powerpc/64: interrupt return in C
Nicholas Piggin
reviewerPATCH 1/1 powerpc/64: interrupt return in C
This is a work in progress that goes on top of the syscalls in C patch. It's not quite complete, 64e low level exit is not taken care of, and the new return is hacked into the existing interrupt handlers pretty quickly (e.g., full gprs handling is still ugly and could be cleaned), but that code touches exception-64s.S which is under heavy modification in parallel so I will rebase on top of that before polishing it properly. I will also try to convert to more IS_ENABLED() for Christophe.
I guess syscall_64.c will change to interrupt_64.c with this.
Hopefully there is no fundamental problem with it, it replaces some fairly horrific asm code with stack frame bouncing and reusing for replay, and almost imcomprehensible maze of exit points and labels.
This is just a quick preview because it's booting, if anyone can spot major issue with the approach would be good.
Thanks,
Nick
--- .../powerpc/include/asm/book3s/64/kup-radix.h | 6 + arch/powerpc/kernel/entry_64.S | 475 ++++-------------- arch/powerpc/kernel/exceptions-64s.S | 55 +- arch/powerpc/kernel/syscall_64.c | 147 +++++- arch/powerpc/kernel/vector.S | 2 +- 5 files changed, 288 insertions(+), 397 deletions(-)
arch/powerpc/include/asm/book3s/64/kup-radix.h +6 -0
@@ -60,6 +60,12 @@#include <asm/mmu.h> #include <asm/ptrace.h> +static inline void kuap_restore_amr (struct pt_regs *regs) +{ +if (mmu_has_feature (MMU_FTR_RADIX_KUAP )) +mtspr (SPRN_AMR , regs->kuap); +} +static inline void kuap_check_amr (void ) {#ifdef CONFIG_PPC_KUAP_DEBUG
arch/powerpc/kernel/entry_64.S +107 -368
537 lines not on this page · raw message
arch/powerpc/kernel/exceptions-64s.S +28 -27
211 lines not on this page · raw message
arch/powerpc/kernel/syscall_64.c +146 -1
162 lines not on this page · raw message
arch/powerpc/kernel/vector.S +1 -1
@@ -131,7 +131,7 @@ _GLOBAL(load_up_vsx) /* enable use of VSX after return */ oris r12,r12,MSR_VSX@h std r12,_MSR(r1) - b fast_exception_return + b fast_interrupt_return #endif /* CONFIG_VSX */
Signature · 1 line
2.22.0
Le 28/08/2019 à 11:06, Nicholas Piggin a écrit :
Quoted 7 lines
This is a work in progress that goes on top of the syscalls in C patch. It's not quite complete, 64e low level exit is not taken care of, and the new return is hacked into the existing interrupt handlers pretty quickly (e.g., full gprs handling is still ugly and could be cleaned), but that code touches
exception-64s.Swhich is under heavy modification in parallel so I will rebase on top of that before polishing it properly. I will also try to convert to moreIS_ENABLED()for Christophe.
I am flattered.
I guess at the end you are not doing it for me but because it is on purpose in your code improvement process.
See https://www.kernel.org/doc/html/latest/process/coding-style.html#conditional-compilation
Christophe
Nicholas Piggin
reviewerChristophe Leroy's on August 28, 2019 7:28 pm:
Quoted 11 lines
Le 28/08/2019 à 11:06, Nicholas Piggin a écrit :
Quoted 7 lines
This is a work in progress that goes on top of the syscalls in C patch. It's not quite complete, 64e low level exit is not taken care of, and the new return is hacked into the existing interrupt handlers pretty quickly (e.g., full gprs handling is still ugly and could be cleaned), but that code touches
exception-64s.Swhich is under heavy modification in parallel so I will rebase on top of that before polishing it properly. I will also try to convert to moreIS_ENABLED()for Christophe.
Quoted 4 lines
I am flattered.
I guess at the end you are not doing it for me but because it is on purpose in your code improvement process.
Heh :) Yeah I agree it's almost always nicer code. Sometimes I just forget about it so I appreciate you pointing out improvements.
Thanks,
Nick
Nicholas Piggin
reviewerNicholas Piggin's on August 28, 2019 7:06 pm:
Quoted 4 lines
This is a work in progress that goes on top of the syscalls in C patch. It's not quite complete, 64e low level exit is not taken care of, and the new return is hacked into the existing interrupt handlers pretty quickly (e.g., full gprs handling is still ugly and could be cleaned),
In performance testing on a POWER9, page fault latency is about 1.1% faster with interrupt returns in C which always saves NVGPRs. So I think the plan will be to rip out all the NVGPR save optimisation from the 64-bit code.
Thanks,
Nick