dawr-power9.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. =====================
  2. DAWR issues on POWER9
  3. =====================
  4. On older POWER9 processors, the Data Address Watchpoint Register (DAWR) can
  5. cause a checkstop if it points to cache inhibited (CI) memory. Currently Linux
  6. has no way to distinguish CI memory when configuring the DAWR, so on affected
  7. systems, the DAWR is disabled.
  8. Affected processor revisions
  9. ============================
  10. This issue is only present on processors prior to v2.3. The revision can be
  11. found in /proc/cpuinfo::
  12. processor : 0
  13. cpu : POWER9, altivec supported
  14. clock : 3800.000000MHz
  15. revision : 2.3 (pvr 004e 1203)
  16. On a system with the issue, the DAWR is disabled as detailed below.
  17. Technical Details:
  18. ==================
  19. DAWR has 6 different ways of being set.
  20. 1) ptrace
  21. 2) h_set_mode(DAWR)
  22. 3) h_set_dabr()
  23. 4) kvmppc_set_one_reg()
  24. 5) xmon
  25. For ptrace, we now advertise zero breakpoints on POWER9 via the
  26. PPC_PTRACE_GETHWDBGINFO call. This results in GDB falling back to
  27. software emulation of the watchpoint (which is slow).
  28. h_set_mode(DAWR) and h_set_dabr() will now return an error to the
  29. guest on a POWER9 host. Current Linux guests ignore this error, so
  30. they will silently not get the DAWR.
  31. kvmppc_set_one_reg() will store the value in the vcpu but won't
  32. actually set it on POWER9 hardware. This is done so we don't break
  33. migration from POWER8 to POWER9, at the cost of silently losing the
  34. DAWR on the migration.
  35. For xmon, the 'bd' command will return an error on P9.
  36. Consequences for users
  37. ======================
  38. For GDB watchpoints (ie 'watch' command) on POWER9 bare metal , GDB
  39. will accept the command. Unfortunately since there is no hardware
  40. support for the watchpoint, GDB will software emulate the watchpoint
  41. making it run very slowly.
  42. The same will also be true for any guests started on a POWER9
  43. host. The watchpoint will fail and GDB will fall back to software
  44. emulation.
  45. If a guest is started on a POWER8 host, GDB will accept the watchpoint
  46. and configure the hardware to use the DAWR. This will run at full
  47. speed since it can use the hardware emulation. Unfortunately if this
  48. guest is migrated to a POWER9 host, the watchpoint will be lost on the
  49. POWER9. Loads and stores to the watchpoint locations will not be
  50. trapped in GDB. The watchpoint is remembered, so if the guest is
  51. migrated back to the POWER8 host, it will start working again.
  52. Force enabling the DAWR
  53. =======================
  54. Kernels (since ~v5.2) have an option to force enable the DAWR via::
  55. echo Y > /sys/kernel/debug/powerpc/dawr_enable_dangerous
  56. This enables the DAWR even on POWER9.
  57. This is a dangerous setting, USE AT YOUR OWN RISK.
  58. Some users may not care about a bad user crashing their box
  59. (ie. single user/desktop systems) and really want the DAWR. This
  60. allows them to force enable DAWR.
  61. This flag can also be used to disable DAWR access. Once this is
  62. cleared, all DAWR access should be cleared immediately and your
  63. machine once again safe from crashing.
  64. Userspace may get confused by toggling this. If DAWR is force
  65. enabled/disabled between getting the number of breakpoints (via
  66. PTRACE_GETHWDBGINFO) and setting the breakpoint, userspace will get an
  67. inconsistent view of what's available. Similarly for guests.
  68. For the DAWR to be enabled in a KVM guest, the DAWR needs to be force
  69. enabled in the host AND the guest. For this reason, this won't work on
  70. POWERVM as it doesn't allow the HCALL to work. Writes of 'Y' to the
  71. dawr_enable_dangerous file will fail if the hypervisor doesn't support
  72. writing the DAWR.
  73. To double check the DAWR is working, run this kernel selftest:
  74. tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c
  75. Any errors/failures/skips mean something is wrong.