Skip to content

riscv: misaligned: fix interruptible context and add tests

Clément Léger linux-doc linux-kselftest linux-riscv lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 4 repliesIn review 2 of 5 applied
  2. v15 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Use an array of struct to simplify misaligned load/store selection
- Revert use of irqentry_enter()/exit() to irqentry_nmi_enter() for kernel space.

Patches in v2 2 of 5 applied

#Subject and filesSizeRepliesApplied
1/5riscv: misaligned: factorize trap handlingarch/riscv/kernel/traps.c+36 -301 reply
2/5riscv: misaligned: enable IRQs while handling misaligned accessesarch/riscv/kernel/traps.c+8 -41 replyApplied
3/5riscv: misaligned: use get_user() instead of __get_user()arch/riscv/kernel/traps_misaligned.c+1 -10 repliesApplied
4/5Documentation/sysctl: add riscv to unaligned-trap supported archsDocumentation/admin-guide/sysctl/kernel.rst+2 -20 replies
5/5selftests: riscv: add misaligned access testingtools/testing/selftests/riscv/misaligned/.gitignore tools/testing/selftests/riscv/misaligned/Makefile tools/testing/selftests/riscv/misaligned/common.S +3 more+583 -02 replies

Reviews trailers per patch

4 of 5 patches have a Reviewed-by or Acked-by.

PatchAlexandre Ghiti
1/5R-b
2/5R-b
3/5R-b
4/5R-b
5/5

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

Read the v2 thread

Cover letter [PATCH v2 0/5] riscv: misaligned: fix interruptible context and add tests

This series fixes misaligned access handling when in non interruptible context by reenabling interrupts when possible. A previous commit changed raw_copy_from_user() with copy_from_user() which enables page faulting and thus can sleep. While correct, a warning is now triggered due to being called in an invalid context (sleeping in non-interruptible). This series fixes that problem by factorizing misaligned load/store entry in a single function than reenables interrupt if the interrupted context had interrupts enabled. In order for misaligned handling problems to be caught sooner, add a kselftest for all the currently supported instructions .

Note: these commits were actually part of another larger series for misaligned request delegation but was split since it isn't directly required.

V2:
- Use an array of struct to simplify misaligned load/store selection
- Revert use of irqentry_enter()/exit() to irqentry_nmi_enter() for kernel space.

Clément Léger (5):
riscv: misaligned: factorize trap handling
riscv: misaligned: enable IRQs while handling misaligned accesses
riscv: misaligned: use get_user() instead of __get_user() Documentation/sysctl: add riscv to unaligned-trap supported archs
selftests: riscv: add misaligned access testing

 Documentation/admin-guide/sysctl/kernel.rst   |   4 +-
 arch/riscv/kernel/traps.c                     |  64 +++--
 arch/riscv/kernel/traps_misaligned.c          |   2 +-
 .../selftests/riscv/misaligned/.gitignore     |   1 +
 .../selftests/riscv/misaligned/Makefile       |  12 +
 .../selftests/riscv/misaligned/common.S       |  33 +++
 .../testing/selftests/riscv/misaligned/fpu.S  | 180 +++++++++++++
 tools/testing/selftests/riscv/misaligned/gp.S | 103 +++++++
 .../selftests/riscv/misaligned/misaligned.c   | 254 ++++++++++++++++++
 9 files changed, 623 insertions(+), 30 deletions(-)
 create mode 100644 tools/testing/selftests/riscv/misaligned/.gitignore
 create mode 100644 tools/testing/selftests/riscv/misaligned/Makefile
 create mode 100644 tools/testing/selftests/riscv/misaligned/common.S
 create mode 100644 tools/testing/selftests/riscv/misaligned/fpu.S
 create mode 100644 tools/testing/selftests/riscv/misaligned/gp.S
 create mode 100644 tools/testing/selftests/riscv/misaligned/misaligned.c
Signature · 1 line
2.49.0