ARM: vfp: Switch to C API to en/disable softirqs
Subsystems (2)
v3 cover 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 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
Ard Biesheuvel (4):
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: vfp: Reimplement VFP exception entry in C code
arch/arm/include/asm/assembler.h | 13 -- arch/arm/kernel/entry-armv.S | 12 ++ arch/arm/vfp/Makefile | 2 +- arch/arm/vfp/entry.S | 39 ---- arch/arm/vfp/vfp.h | 1 + arch/arm/vfp/vfphw.S | 198 ++------------------ arch/arm/vfp/vfpmodule.c | 125 +++++++++++- 7 files changed, 142 insertions(+), 248 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
PATCH v3 1/4 ARM: vfp: Pass thread_info pointer to vfp_support_entry
Instead of dereferencing thread_info in do_vfp, pass the thread_info pointer to vfp_support_entry via R1. That way, we only use a single caller save register, which makes it easier to convert do_vfp to C code in a subsequent patch.
Note that, unlike the CPU number, which can change due to preemption, passing the thread_info pointer can safely be done with preemption enabled.
--- arch/arm/vfp/entry.S | 5 +---- arch/arm/vfp/vfphw.S | 10 +++++++--- 2 files changed, 8 insertions(+), 7 deletions(-)
arch/arm/vfp/entry.S +1 -4
@@ -22,15 +22,12 @@ @ IRQs enabled. @ ENTRY(do_vfp) - local_bh_disable r10, r4 + mov r1, r10 ldr r4, .LCvfp - ldr r11, [r10, #TI_CPU] @ CPU number - add r10, r10, #TI_VFPSTATE @ r10 = workspace ldr pc, [r4] @ call VFP entry point ENDPROC(do_vfp) ENTRY(vfp_null_entry) - local_bh_enable_ti r10, r4 ret lr ENDPROC(vfp_null_entry)
arch/arm/vfp/vfphw.S +7 -3
@@ -6,9 +6,9 @@ * Written by Deep Blue Solutions Limited. * * This code is called from the kernel's undefined instruction trap. + * r1 holds the thread_info pointer * r9 holds the return address for successful handling. * lr holds the return address for unrecognised instructions. - * r10 points at the start of the private FP workspace in the thread structure * sp points to a struct pt_regs (as defined in include/asm/proc/ptrace.h) */ #include <linux/init.h>
@@ -69,13 +69,17 @@ @ VFP hardware support entry point. @ @ r0 = instruction opcode (32-bit ARM or two 16-bit Thumb) +@ r1 = thread_info pointer @ r2 = PC value to resume execution after successful emulation @ r9 = normal "successful" return address -@ r10 = vfp_state union -@ r11 = CPU number @ lr = unrecognised instruction return address @ IRQs enabled. ENTRY(vfp_support_entry) + local_bh_disable r1, r4 + + ldr r11, [r1, #TI_CPU] @ CPU number + add r10, r1, #TI_VFPSTATE @ r10 = workspace + DBGSTR3 "instr %08x pc %08x state %p", r0, r2, r10 .fpu vfpv2
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v3 2/4 ARM: vfp: Pass successful return address via register R3
In reply to Ard BiesheuvelIn preparation for reimplementing the do_vfp()->vfp_support_entry() handover in C code, switch to using R3 to pass the 'success' return address, rather than R9, as it cannot be used for parameter passing.
--- arch/arm/vfp/entry.S | 1 + arch/arm/vfp/vfphw.S | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-)
arch/arm/vfp/entry.S +1 -0
@@ -23,6 +23,7 @@ @ ENTRY(do_vfp) mov r1, r10 + mov r3, r9 ldr r4, .LCvfp ldr pc, [r4] @ call VFP entry point ENDPROC(do_vfp)
arch/arm/vfp/vfphw.S +7 -7
@@ -7,7 +7,7 @@ * * This code is called from the kernel's undefined instruction trap. * r1 holds the thread_info pointer - * r9 holds the return address for successful handling. + * r3 holds the return address for successful handling. * lr holds the return address for unrecognised instructions. * sp points to a struct pt_regs (as defined in include/asm/proc/ptrace.h) */
@@ -71,7 +71,7 @@ @ r0 = instruction opcode (32-bit ARM or two 16-bit Thumb) @ r1 = thread_info pointer @ r2 = PC value to resume execution after successful emulation -@ r9 = normal "successful" return address +@ r3 = normal "successful" return address @ lr = unrecognised instruction return address @ IRQs enabled. ENTRY(vfp_support_entry)
@@ -89,9 +89,9 @@ ENTRY(vfp_support_entry) bne look_for_VFP_exceptions @ VFP is already enabled DBGSTR1 "enable %x", r10 - ldr r3, vfp_current_hw_state_address + ldr r9, vfp_current_hw_state_address orr r1, r1, #FPEXC_EN @ user FPEXC has the enable bit set - ldr r4, [r3, r11, lsl #2] @ vfp_current_hw_state pointer + ldr r4, [r9, r11, lsl #2] @ vfp_current_hw_state pointer bic r5, r1, #FPEXC_EX @ make sure exceptions are disabled cmp r4, r10 @ this thread owns the hw context? #ifndef CONFIG_SMP
@@ -150,7 +150,7 @@ vfp_reload_hw: #endif DBGSTR1 "load state %p", r10 - str r10, [r3, r11, lsl #2] @ update the vfp_current_hw_state pointer + str r10, [r9, r11, lsl #2] @ update the vfp_current_hw_state pointer @ Load the saved state back into the VFP VFPFLDMIA r10, r5 @ reload the working registers while @ FPEXC is in a safe state
@@ -180,7 +180,7 @@ vfp_hw_state_valid: @ always subtract 4 from the following @ instruction address. local_bh_enable_ti r10, r4 - ret r9 @ we think we have handled things + ret r3 @ we think we have handled things look_for_VFP_exceptions:
@@ -210,7 +210,7 @@ skip: process_exception: DBGSTR "bounce" mov r2, sp @ nothing stacked - regdump is at TOS - mov lr, r9 @ setup for a return to the user code. + mov lr, r3 @ setup for a return to the user code. @ Now call the C code to package up the bounce to the support code @ r0 holds the trigger instruction
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v3 3/4 ARM: vfp: Fix broken softirq handling with instrumentation enabled
In reply to Ard BiesheuvelCommit 62b95a7b44d1 ("ARM: 9282/1: vfp: Manipulate task VFP state with softirqs disabled") replaced the en/disable preemption calls inside the VFP state handling code with en/disabling of soft IRQs, which is necessary to allow kernel use of the VFP/SIMD unit when handling a soft IRQ.
Unfortunately, when lockdep is enabled (or other instrumentation that enables TRACE_IRQFLAGS), the disable path implemented in asm fails to perform the lockdep and RCU related bookkeeping, resulting in spurious warnings and other badness.
Set let's rework the VFP entry code a little bit so we can make the local_bh_disable() call from C, with all the instrumentations that happen to have been configured. Calling local_bh_enable() can be done from asm, as it is a simple wrapper around __local_bh_enable_ip(), which is always a callable function.
--- arch/arm/include/asm/assembler.h | 13 ---------- arch/arm/vfp/entry.S | 11 +------- arch/arm/vfp/vfphw.S | 12 ++++----- arch/arm/vfp/vfpmodule.c | 27 ++++++++++++++++---- 4 files changed, 29 insertions(+), 34 deletions(-)
arch/arm/include/asm/assembler.h +0 -13
@@ -244,19 +244,6 @@ THUMB( fpreg .req r7 ) .endm#endif - .macro local_bh_disable, ti, tmp - ldr \tmp, [\ti, #TI_PREEMPT] - add \tmp, \tmp, #SOFTIRQ_DISABLE_OFFSET - str \tmp, [\ti, #TI_PREEMPT] - .endm - - .macro local_bh_enable_ti, ti, tmp - get_thread_info \ti - ldr \tmp, [\ti, #TI_PREEMPT] - sub \tmp, \tmp, #SOFTIRQ_DISABLE_OFFSET - str \tmp, [\ti, #TI_PREEMPT] - .endm - #define USERL(l, x...) \ 9999: x; \ .pushsection __ex_table,"a"; \
arch/arm/vfp/entry.S +1 -10
@@ -24,14 +24,5 @@ ENTRY(do_vfp) mov r1, r10 mov r3, r9 - ldr r4, .LCvfp - ldr pc, [r4] @ call VFP entry point + b vfp_entry ENDPROC(do_vfp) - -ENTRY(vfp_null_entry) - ret lr -ENDPROC(vfp_null_entry) - - .align 2 -.LCvfp: - .word vfp_vector
arch/arm/vfp/vfphw.S +6 -6
@@ -75,8 +75,6 @@ @ lr = unrecognised instruction return address @ IRQs enabled. ENTRY(vfp_support_entry) - local_bh_disable r1, r4 - ldr r11, [r1, #TI_CPU] @ CPU number add r10, r1, #TI_VFPSTATE @ r10 = workspace
@@ -179,9 +177,12 @@ vfp_hw_state_valid: @ else it's one 32-bit instruction, so @ always subtract 4 from the following @ instruction address. - local_bh_enable_ti r10, r4 - ret r3 @ we think we have handled things + mov lr, r3 @ we think we have handled things +local_bh_enable_and_ret: + adr r0, . + mov r1, #SOFTIRQ_DISABLE_OFFSET + b __local_bh_enable_ip @ tail call look_for_VFP_exceptions: @ Check for synchronous or asynchronous exception
@@ -204,8 +205,7 @@ skip: @ not recognised by VFP DBGSTR "not VFP" - local_bh_enable_ti r10, r4 - ret lr + b local_bh_enable_and_ret process_exception: DBGSTR "bounce"
arch/arm/vfp/vfpmodule.c +22 -5
@@ -32,10 +32,9 @@/* * Our undef handlers (in entry.S) */ -asmlinkage void vfp_support_entry(void); -asmlinkage void vfp_null_entry(void); +asmlinkage void vfp_support_entry(u32, void *, u32, u32); -asmlinkage void (*vfp_vector)(void) = vfp_null_entry; +static bool have_vfp__ro_after_init ;/* * Dual-use variable.
@@ -799,7 +798,6 @@ static int __init vfp_init(void) vfpsid =fmrx (FPSID );barrier ();unregister_undef_hook (&vfp_detect_hook); - vfp_vector = vfp_null_entry;pr_info ("VFP support v0.3: " );if (VFP_arch) {
@@ -884,7 +882,7 @@ static int __init vfp_init(void)"arm/vfp:starting" , vfp_starting_cpu, vfp_dying_cpu); - vfp_vector = vfp_support_entry; + have_vfp = true;thread_register_notifier (&vfp_notifier_block);vfp_pm_init ();
@@ -906,3 +904,22 @@ static int __init vfp_init(void) }core_initcall (vfp_init); + +/* +* Entered with: +* +* r0 = instruction opcode (32-bit ARM or two 16-bit Thumb) +* r1 = thread_info pointer +* r2 = PC value to resume execution after successful emulation +* r3 = normal "successful" return address +* lr = unrecognised instruction return address +*/ +asmlinkage void vfp_entry(u32 trigger, struct thread_info *ti, u32 resume_pc, +u32 resume_return_address) +{ +if (unlikely (!have_vfp)) +return ; + +local_bh_disable (); +vfp_support_entry (opcode, ti, resume_pc, resume_return_address); +}
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v3 4/4 ARM: vfp: Reimplement VFP exception entry in C code
In reply to Ard BiesheuvelEn/disabling softirqs from asm code turned out to be trickier than expected, so vfp_support_entry now returns by tail calling __local_enable_bh_ip() and passing the same arguments that a C call to local_bh_enable() would pass. However, this is slightly hacky, as we don't want to carry our own implementation of local_bh_enable().
So let's bite the bullet, and get rid of the asm logic in vfp_support_entry that reasons about whether or not to save and/or reload the VFP state, and about whether or not an FP exception is pending, and only keep the VFP loading logic as a function that is callable from C.
Replicate the removed logic in vfp_entry(), and use the exact same reasoning as in the asm code. To emphasize the correspondance, retain some of the asm comments in the C version as well.
--- arch/arm/kernel/entry-armv.S | 12 ++ arch/arm/vfp/Makefile | 2 +- arch/arm/vfp/entry.S | 28 --- arch/arm/vfp/vfp.h | 1 + arch/arm/vfp/vfphw.S | 204 ++------------------ arch/arm/vfp/vfpmodule.c | 118 +++++++++-- 6 files changed, 131 insertions(+), 234 deletions(-)
arch/arm/kernel/entry-armv.S +12 -0
@@ -662,6 +662,18 @@ call_fpe: .word 0x00000000 @ opcode #endif +@ VFP entry point. +@ +@ r0 = instruction opcode (32-bit ARM or two 16-bit Thumb) +@ r9 = normal "successful" return address +@ lr = unrecognised instruction return address +do_vfp: + mov r1, sp @ pass struct pt_regs via R1 + bl vfp_entry @ dispatch the VFP exception + cmp r0, #0 @ handled successfully? + reteq r9 @ then use R9 as return address + ret lr + do_fpe: add r10, r10, #TI_FPSTATE @ r10 = workspace ldr_va pc, fp_enter, tmp=r4 @ Call FP module USR entry point
arch/arm/vfp/Makefile +1 -1
@@ -8,4 +8,4 @@ # ccflags-y := -DDEBUG # asflags-y := -DDEBUG -obj-y += vfpmodule.o entry.o vfphw.o vfpsingle.o vfpdouble.o +obj-y += vfpmodule.o vfphw.o vfpsingle.o vfpdouble.o
arch/arm/vfp/entry.S deleted +0 -28
@@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * linux/arch/arm/vfp/entry.S - * - * Copyright (C) 2004 ARM Limited. - * Written by Deep Blue Solutions Limited. - */ -#include <linux/init.h> -#include <linux/linkage.h> -#include <asm/thread_info.h> -#include <asm/vfpmacros.h> -#include <asm/assembler.h> -#include <asm/asm-offsets.h> - -@ VFP entry point. -@ -@ r0 = instruction opcode (32-bit ARM or two 16-bit Thumb) -@ r2 = PC value to resume execution after successful emulation -@ r9 = normal "successful" return address -@ r10 = this threads thread_info structure -@ lr = unrecognised instruction return address -@ IRQs enabled. -@ -ENTRY(do_vfp) - mov r1, r10 - mov r3, r9 - b vfp_entry -ENDPROC(do_vfp)
arch/arm/vfp/vfp.h +1 -0
@@ -375,3 +375,4 @@ struct op { }; asmlinkage void vfp_save_state(void *location, u32 fpexc); +asmlinkage u32 vfp_load_state(const void *location);
arch/arm/vfp/vfphw.S +14 -190
235 lines not on this page · raw message
arch/arm/vfp/vfpmodule.c +103 -15
152 lines not on this page · raw message
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v3 4/4] ARM: vfp: Reimplement VFP exception entry in C code
Quoted 12 lines · Ard Biesheuvel
En/disabling softirqs from asm code turned out to be trickier than expected, so
vfp_support_entrynow returns by tail calling__local_enable_bh_ip()and passing the same arguments that a C call tolocal_bh_enable()would pass. However, this is slightly hacky, as we don't want to carry our own implementation oflocal_bh_enable().So let's bite the bullet, and get rid of the asm logic in
vfp_support_entrythat reasons about whether or not to save and/or reload the VFP state, and about whether or not an FP exception is pending, and only keep the VFP loading logic as a function that is callable from C.
Quoted 5 lines
Replicate the removed logic in
vfp_entry(), and use the exact same reasoning as in the asm code. To emphasize the correspondance, retain some of the asm comments in the C version as well.Signed-off-by Ard Biesheuvel <[email protected]>
I tried to model what the assembly is doing in my head to review if the new code in C does the same thing, but after following some of the semantics (which look correct) I realized it will mostly be down to testing anyway.
It's definately better to have it like this so FWIW:
Apparently a bunch of this code was written by Catalin for VFPv3 support, he may or may not have the memory and time to go back and look at it, but let's page him in anyway :)
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v3 4/4] ARM: vfp: Reimplement VFP exception entry in C code
Quoted 19 lines · Linus Walleij
Quoted 16 lines · Ard Biesheuvel
En/disabling softirqs from asm code turned out to be trickier than expected, so
vfp_support_entrynow returns by tail calling__local_enable_bh_ip()and passing the same arguments that a C call tolocal_bh_enable()would pass. However, this is slightly hacky, as we don't want to carry our own implementation oflocal_bh_enable().So let's bite the bullet, and get rid of the asm logic in
vfp_support_entrythat reasons about whether or not to save and/or reload the VFP state, and about whether or not an FP exception is pending, and only keep the VFP loading logic as a function that is callable from C.Replicate the removed logic in
vfp_entry(), and use the exact same reasoning as in the asm code. To emphasize the correspondance, retain some of the asm comments in the C version as well.
Quoted 7 lines
Quoted 1 line
Signed-off-by Ard Biesheuvel <[email protected]>I tried to model what the assembly is doing in my head to review if the new code in C does the same thing, but after following some of the semantics (which look correct) I realized it will mostly be down to testing anyway.
Indeed. The only hardware I have that actually generates VFP exceptions is Raspberry Pi 1, so I gave it a spin there.
After adding a perf software event like below, and running John Hauser's testfloat tool [0], I get the exact same mix of passes and failures, i.e.,
$ perf_4.9 stat -e emulation-faults ./testfloat -all2 >before 2>&1 $ diff -u before after --- before 2023-03-18 16:51:17.842814747 +0100 +++ after 2023-03-18 16:49:11.783973769 +0100 @@ -399,5 +399,5 @@
259,277 emulation-faults:u
- 5.810963659 seconds time elapsed
+ 5.748333166 seconds time elapsed
So as far as ARM 1176 is concerned, I think we are ok. However, it appears all generated emulation exceptions are synchronous ones, so the async code path is not testable this way.
[0] http://www.jhauser.us/arithmetic/TestFloat.html
arch/arm/vfp/vfpmodule.c +1 -0
@@ -18,6 +18,7 @@#include <linux/uaccess.h> #include <linux/user.h> #include <linux/export.h> +#include <linux/perf_event.h> #include <asm/cp15.h> #include <asm/cputype.h>
@@ -313,6 +314,7 @@ static u32 vfp_emulate_instruction(u32 inst, u32
fpscr, struct pt_regs *regs)
* emulate it.
*/
}
+ perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->ARM_pc);
return exceptions & ~VFP_NAN_FLAG;}
Quoted 3 lines
It's definately better to have it like this so FWIW:
Acked-by Linus Walleij <[email protected]>
Thanks
Quoted 6 lines
Apparently a bunch of this code was written by Catalin for VFPv3 support, he may or may not have the memory and time to go back and look at it, but let's page him in anyway :)
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 45 lines · Ard Biesheuvel
As it turns out, enabling or disabling softirqs from asm code is more tricky than it looks. Simply bumping the associated bit in
preempt_countdoes 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 v2:
- add Rbs and Tbs from Linus and Guenter (thanks!)
- correct reference tolocal_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-rcCc 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 (4):
ARM: vfp: Passthread_infopointer tovfp_support_entry
ARM: vfp: Pass successful return address via register R3
ARM: vfp: Fix broken softirq handling with instrumentation enabled
ARM: vfp: Reimplement VFP exception entry in C codearch/arm/include/asm/assembler.h | 13 -- arch/arm/kernel/entry-armv.S | 12 ++ arch/arm/vfp/Makefile | 2 +- arch/arm/vfp/entry.S | 39 ---- arch/arm/vfp/vfp.h | 1 + arch/arm/vfp/vfphw.S | 198 ++------------------ arch/arm/vfp/vfpmodule.c | 125 +++++++++++- 7 files changed, 142 insertions(+), 248 deletions(-)
Quoted 2 lines
delete mode 100644
arch/arm/vfp/entry.S
After applying this series, imx_v4_v5_defconfig and aspeed_g4_defconfig (and maybe others) fail to build:
arm-linux-gnueabi-ld: arch/arm/kernel/entry-armv.o: in function `do_vfp':
(.entry.text+0x5a4): undefined reference to `vfp_entry' make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 1
make: *** [Makefile:1250: vmlinux] Error 2
Guenter
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 49 lines · Guenter Roeck
Quoted 44 lines · Ard Biesheuvel
As it turns out, enabling or disabling softirqs from asm code is more tricky than it looks. Simply bumping the associated bit in
preempt_countdoes 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 v2:
- add Rbs and Tbs from Linus and Guenter (thanks!)
- correct reference tolocal_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-rcCc 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 (4):
ARM: vfp: Passthread_infopointer tovfp_support_entry
ARM: vfp: Pass successful return address via register R3
ARM: vfp: Fix broken softirq handling with instrumentation enabled
ARM: vfp: Reimplement VFP exception entry in C code
arch/arm/include/asm/assembler.h| 13 -- arch/arm/kernel/entry-armv.S | 12 ++ arch/arm/vfp/Makefile | 2 +- arch/arm/vfp/entry.S | 39 ---- arch/arm/vfp/vfp.h | 1 + arch/arm/vfp/vfphw.S | 198 ++------------------ arch/arm/vfp/vfpmodule.c | 125 +++++++++++-Quoted 3 lines
7 files changed, 142 insertions(+), 248 deletions(-)delete mode 100644
arch/arm/vfp/entry.S
Quoted 8 lines
After applying this series,
imx_v4_v5_defconfigandaspeed_g4_defconfig(and maybe others) fail to build:arm-linux-gnueabi-ld:
arch/arm/kernel/entry-armv.o: in function `do_vfp':
(.entry.text+0x5a4): undefined reference to `vfp_entry' make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 1
make: *** [Makefile:1250: vmlinux] Error 2
... and reverting the last patch of the series fixes the problem.
Guenter
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 54 lines · Guenter Roeck
Quoted 52 lines · Guenter Roeck
Quoted 45 lines · Ard Biesheuvel
As it turns out, enabling or disabling softirqs from asm code is more tricky than it looks. Simply bumping the associated bit in
preempt_countdoes 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 v2:
- add Rbs and Tbs from Linus and Guenter (thanks!)
- correct reference tolocal_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-rcCc 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 (4):
ARM: vfp: Passthread_infopointer tovfp_support_entry
ARM: vfp: Pass successful return address via register R3
ARM: vfp: Fix broken softirq handling with instrumentation enabled
ARM: vfp: Reimplement VFP exception entry in C codearch/arm/include/asm/assembler.h | 13 -- arch/arm/kernel/entry-armv.S | 12 ++ arch/arm/vfp/Makefile | 2 +- arch/arm/vfp/entry.S | 39 ---- arch/arm/vfp/vfp.h | 1 + arch/arm/vfp/vfphw.S | 198 ++------------------ arch/arm/vfp/vfpmodule.c | 125 +++++++++++- 7 files changed, 142 insertions(+), 248 deletions(-)Quoted 2 lines
delete mode 100644
arch/arm/vfp/entry.SAfter applying this series,
imx_v4_v5_defconfigandaspeed_g4_defconfig(and maybe others) fail to build:
Quoted 8 lines
Quoted 5 lines
arm-linux-gnueabi-ld:
arch/arm/kernel/entry-armv.o: in function `do_vfp':
(.entry.text+0x5a4): undefined reference to `vfp_entry' make[1]: *** [scripts/Makefile.vmlinux:35: vmlinux] Error 1
make: *** [Makefile:1250: vmlinux] Error 2... and reverting the last patch of the series fixes the problem.
Thanks Guenter,
It was a missing #ifdef CONFIG_VFP - I'll fix that up before I drop it into the patch system.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel