Skip to content

ARM: vfp: Switch to C API to en/disable softirqs

Ard Biesheuvel linux-arm-kernel regressions stable 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest12 patches 19 repliesIn review
  2. v34 patches 5 repliesSuperseded
  3. v23 patches 7 repliesSuperseded

Changes since v2 from the cover letter

- add Rbs and Tbs from Linus and Guenter (thanks!)
- correct reference to local_bh_enable() vs __local_bh_enable_ip() in commit log of patch #3
- add patch that reworks the asm VFP exception handling entirely so the bulk of it is implemented in C. This could be taken into v6.4, while the preceding patches are fixes for v6.3-rc

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12ARM: vfp: Pass thread_info pointer to vfp_support_entryarch/arm/vfp/entry.S arch/arm/vfp/vfphw.S+8 -70 replies
2/12ARM: vfp: Pass successful return address via register R3arch/arm/vfp/entry.S arch/arm/vfp/vfphw.S+8 -70 replies
3/12ARM: vfp: Fix broken softirq handling with instrumentation enabledarch/arm/include/asm/assembler.h arch/arm/vfp/entry.S arch/arm/vfp/vfphw.S +1 more+29 -342 replies
4/12ARM: entry: Fix iWMMXT TIF flag handlingarch/arm/kernel/entry-armv.S+5 -43 replies
5/12ARM: vfp: Record VFP bounces as perf emulation faultsarch/arm/vfp/vfpmodule.c+2 -01 reply
6/12ARM: vfp: Remove workaround for Feroceon CPUsarch/arm/mm/proc-feroceon.S arch/arm/vfp/vfphw.S arch/arm/vfp/vfpmodule.c+9 -75 replies
7/12ARM: vfp: Reimplement VFP exception entry in C codearch/arm/vfp/entry.S arch/arm/vfp/vfp.h arch/arm/vfp/vfphw.S +1 more+124 -2110 replies
8/12ARM: kernel: Get rid of thread_info::used_cp[] arrayarch/arm/include/asm/thread_info.h arch/arm/kernel/asm-offsets.c arch/arm/kernel/entry-armv.S +2 more+0 -111 reply
9/12ARM: vfp: Use undef hook for handling VFP exceptionsarch/arm/kernel/entry-armv.S arch/arm/vfp/Makefile arch/arm/vfp/entry.S +1 more+32 -1192 replies
10/12ARM: entry: Disregard Thumb undef exception in coproc dispatcharch/arm/kernel/entry-armv.S+17 -471 reply
11/12ARM: iwmmxt: Use undef hook to enable coprocessor for taskarch/arm/include/asm/thread_info.h arch/arm/kernel/iwmmxt.S arch/arm/kernel/pj4-cp0.c +1 more+27 -01 reply
12/12ARM: entry: Make asm coproc dispatch code NWFPE onlyarch/arm/kernel/entry-armv.S+5 -51 reply

Reviews trailers per patch

All 12 patches have a Reviewed-by or Acked-by.

PatchLinus WalleijGuenter RoeckNicolas Pitre
1/12R-b T-b
2/12R-b T-b
3/12R-b T-b
4/12R-b
5/12R-b
6/12R-b A-b
7/12A-b
8/12R-b
9/12R-b
10/12A-b
11/12R-b
12/12R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/12] ARM: vfp: Switch to C API to en/disable softirqs

As it turns out, enabling or disabling softirqs from asm code is more tricky than it looks. Simply bumping the associated bit in preempt_count does the trick for uninstrumented kernels, but with lockdep or preempt debug enabled, we really need to call the C versions, as replicating their behavior in asm fully is intractible.

So let's rework the existing code a little bit so we can interpose a little C helper 'vfp_entry()' that disables softirqs before calling the existing vfpstate handling code in asm. Re-enabling softirqs from asm code is more straight-forward, as we can simply perform a tail call via a C routine that is guaranteed to be callable as a function.

However, since calling these APIs from asm code is still not ideal, let's reimplement the whole thing in C (patch #4)

Changes since v3:

I got a bit carried away, as I noticed that the NEON opcode matching implemented in asm in entry-armv.S basically duplicates how undef hooks work, and so I have added a patch that drops the associated asm code and moves it into C code, reusing the existing VFP undef hook we have for kernel mode exceptions. (patch #9)

With that removed, no Thumb mode undef exceptions remain that are dispatched by the coprocessor undef handling, so that can be simplified as well (patch #10)

iWMMXT undef exceptions can be handled using an undef hook as well, (patch #11), which allows us to compile out the coprocessor dispatch entirely unless we have FPE enabled, which is only the case on OABI or OABI compat. This removes the non-standard calling convention which returns via register R9 on success, which can only be implemented in asm. (patch #12)

Patch #4 is a fix for an issue that I spotted while working on this, patch #5 is an enhancement that makes it easier to keep track of how many VFP traps were taken for emulation purposes.

The first four patches are fixes, the remaining ones might go into v6.4.

This also fixes the !CONFIG_VFP build error spotted by Guenter.

Changes since v2:
- add Rbs and Tbs from Linus and Guenter (thanks!)
- correct reference to local_bh_enable() vs __local_bh_enable_ip() in commit log of patch #3
- add patch that reworks the asm VFP exception handling entirely so the bulk of it is implemented in C. This could be taken into v6.4, while the preceding patches are fixes for v6.3-rc

Cc Frederic Weisbecker <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>

Ard Biesheuvel (12):
ARM: vfp: Pass thread_info pointer to vfp_support_entry
ARM: vfp: Pass successful return address via register R3
ARM: vfp: Fix broken softirq handling with instrumentation enabled
ARM: entry: Fix iWMMXT TIF flag handling
ARM: vfp: Record VFP bounces as perf emulation faults
ARM: vfp: Remove workaround for Feroceon CPUs
ARM: vfp: Reimplement VFP exception entry in C code
ARM: kernel: Get rid of thread_info::used_cp[] array
ARM: vfp: Use undef hook for handling VFP exceptions
ARM: entry: Disregard Thumb undef exception in coproc dispatch
ARM: iwmmxt: Use undef hook to enable coprocessor for task
ARM: entry: Make asm coproc dispatch code NWFPE only

 arch/arm/include/asm/assembler.h   |  13 --
 arch/arm/include/asm/thread_info.h |  17 +-
 arch/arm/kernel/asm-offsets.c      |   1 -
 arch/arm/kernel/entry-armv.S       | 138 +++-----------
 arch/arm/kernel/iwmmxt.S           |   9 +
 arch/arm/kernel/pj4-cp0.c          |   1 +
 arch/arm/kernel/process.c          |   1 -
 arch/arm/kernel/ptrace.c           |   2 -
 arch/arm/kernel/xscale-cp0.c       |   1 +
 arch/arm/mm/proc-feroceon.S        |   4 +
 arch/arm/vfp/Makefile              |   2 +-
 arch/arm/vfp/entry.S               |  39 ----
 arch/arm/vfp/vfp.h                 |   1 +
 arch/arm/vfp/vfphw.S               | 200 ++------------------
 arch/arm/vfp/vfpmodule.c           | 195 ++++++++++++++-----
 15 files changed, 219 insertions(+), 405 deletions(-)
 delete mode 100644 arch/arm/vfp/entry.S
Signature · 7 lines
2.39.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel