Skip to content

ARM64: disable irq between breakpoint and step exception

Pratyush Anand linux-arm-kernel lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 9 repliesIn review
  2. v24 patches 8 repliesSuperseded
  3. v12 patches 0 repliesSuperseded

Changes in v3 from the cover letter

- Moved step_needed from uapi structure to kernel only structure
- Re-enable interrupt if stepped instruction faults
- Modified register_wide_hw_breakpoint() to accept step_needed arg v2 was here: http://marc.info/?l=linux-arm-kernel&m=149942910730496&w=2

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5hw_breakpoint: Add step_needed event attributeinclude/linux/hw_breakpoint.h include/linux/perf_event.h kernel/events/core.c+14 -01 reply
2/5arm64: use hw_breakpoint_needs_single_step() to decide if step is neededarch/arm64/kernel/hw_breakpoint.c+3 -30 replies
3/5register_wide_hw_breakpoint(): modify to accept step_needed argarch/x86/kernel/kgdb.c include/linux/hw_breakpoint.h kernel/events/hw_breakpoint.c +1 more+8 -50 replies
4/5arm64: disable irq between breakpoint and step exceptionarch/arm64/kernel/debug-monitors.c arch/arm64/kernel/hw_breakpoint.c arch/arm64/mm/fault.c+23 -60 replies
5/5arm64: fault: re-enable irq if it was disabled for single steppingarch/arm64/mm/fault.c+8 -20 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by.

PatchJames Morse
SeriesT-b
1/5
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/5] ARM64: disable irq between breakpoint and step exception

v2 -> v3
- Moved step_needed from uapi structure to kernel only structure
- Re-enable interrupt if stepped instruction faults
- Modified register_wide_hw_breakpoint() to accept step_needed arg v2 was here: http://marc.info/?l=linux-arm-kernel&m=149942910730496&w=2

v1 -> v2:
- patch 1 of v1 has been modified to patch 1-3 of v2.
- Introduced a new event attribute step_needed and implemented hw_breakpoint_needs_single_step() (patch 1)
- Replaced usage of is_default_overflow_handler() with hw_breakpoint_needs_single_step(). (patch 2)
- Modified sample test to set set step_needed bit field (patch 3) v1 was here: http://marc.info/?l=linux-arm-kernel&m=149910958418708&w=2

samples/hw_breakpoint/data_breakpoint.c passes with x86_64 but fails with ARM64. Even though it has been NAKed previously on upstream [1, 2], I have tried to come up with patches which can resolve it for ARM64 as well.

I noticed that even perf step exception can go into an infinite loop if CPU receives an interrupt while executing breakpoint/watchpoint handler. So, event though we are not concerned about above test, we will have to find a solution for the perf issue.

This patchset attempts to resolve both the issue. Please review. Since, it also takes care of SW breakpoint, so I hope kgdb should also be fine. However, I have not tested that.
@Takahiro: Will it be possible to test these patches for kgdb.

[1] http://marc.info/?l=linux-arm-kernel&m=149580777524910&w=2
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2016-April/425266.html

Pratyush Anand (5):
hw_breakpoint: Add step_needed event attribute
arm64: use hw_breakpoint_needs_single_step() to decide if step is
needed
register_wide_hw_breakpoint(): modify to accept step_needed arg
arm64: disable irq between breakpoint and step exception
arm64: fault: re-enable irq if it was disabled for single stepping

 arch/arm64/kernel/debug-monitors.c      |  3 +++
 arch/arm64/kernel/hw_breakpoint.c       | 10 +++++-----
 arch/arm64/mm/fault.c                   | 28 ++++++++++++++++++++++++----
 arch/x86/kernel/kgdb.c                  |  2 +-
 include/linux/hw_breakpoint.h           | 10 ++++++++--
 include/linux/perf_event.h              |  6 ++++++
 kernel/events/core.c                    |  2 ++
 kernel/events/hw_breakpoint.c           |  4 +++-
 samples/hw_breakpoint/data_breakpoint.c |  3 ++-
 9 files changed, 54 insertions(+), 14 deletions(-)
Signature · 1 line
2.9.4