From: Michael Ellerman <mpe@ellerman.id.au> Date: 2021-03-20 12:23:00
From: Christophe Leroy <redacted>
call_do_irq() and call_do_softirq() are simple enough to be
worth inlining.
Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. It
also allows GCC to keep the saved ksp_limit in an nonvolatile reg.
This is inspired from S390 arch. Several other arches do more or
less the same. The way sparc arch does seems odd thought.
Signed-off-by: Christophe Leroy <redacted>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
v2: no change.
v3: no change.
v4:
- comment reminding the purpose of the inline asm block.
- added r2 as clobbered reg
v5:
- Limiting the change to PPC32 for now.
- removed r2 from the clobbered regs list (on PPC32 r2 points to current all the time)
- Removed patch 1 and merged ksp_limit handling in here.
v6:
- Rebase on top of merge-test (ca6e327fefb2).
- Remove the ksp_limit stuff as it's doesn't exist anymore.
v7:
mpe:
- Enable for 64-bit too. This all in-kernel code calling in-kernel
code, and must use the kernel TOC.
- Use named parameters for the inline asm.
- Reformat inline asm.
- Mark as always_inline.
- Drop unused ret from call_do_softirq(), add r3 as clobbered.
---
arch/powerpc/include/asm/irq.h | 2 --
arch/powerpc/kernel/irq.c | 41 ++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/misc_32.S | 25 ---------------------
arch/powerpc/kernel/misc_64.S | 22 ------------------
4 files changed, 41 insertions(+), 49 deletions(-)
From: Christophe Leroy <redacted>
call_do_irq() and call_do_softirq() are simple enough to be
worth inlining.
Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. It
also allows GCC to keep the saved ksp_limit in an nonvolatile reg.
We don't have the ksp_limit anymore, I forgot to remove the above text.
This is inspired from S390 arch. Several other arches do more or
less the same. The way sparc arch does seems odd thought.
Signed-off-by: Christophe Leroy <redacted>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
v2: no change.
v3: no change.
v4:
- comment reminding the purpose of the inline asm block.
- added r2 as clobbered reg
v5:
- Limiting the change to PPC32 for now.
- removed r2 from the clobbered regs list (on PPC32 r2 points to current all the time)
- Removed patch 1 and merged ksp_limit handling in here.
v6:
- Rebase on top of merge-test (ca6e327fefb2).
- Remove the ksp_limit stuff as it's doesn't exist anymore.
v7:
mpe:
- Enable for 64-bit too. This all in-kernel code calling in-kernel
code, and must use the kernel TOC.
Great.
- Use named parameters for the inline asm.
Hmm. It is the first time we use named parameters in powerpc assembly, isn't it ?
I saw when investigating userspace access that x86 is using named parameters widely.
Wondering, how would the below look like with named parameters (from __put_user_asm2_goto) ?
stw%X1 %L0, %L1
quoted hunk
- Reformat inline asm.
- Mark as always_inline.
- Drop unused ret from call_do_softirq(), add r3 as clobbered.
---
arch/powerpc/include/asm/irq.h | 2 --
arch/powerpc/kernel/irq.c | 41 ++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/misc_32.S | 25 ---------------------
arch/powerpc/kernel/misc_64.S | 22 ------------------
4 files changed, 41 insertions(+), 49 deletions(-)
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2021-03-24 12:26:41
Christophe Leroy [off-list ref] writes:
Le 20/03/2021 à 13:22, Michael Ellerman a écrit :
quoted
From: Christophe Leroy <redacted>
call_do_irq() and call_do_softirq() are simple enough to be
worth inlining.
Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. It
also allows GCC to keep the saved ksp_limit in an nonvolatile reg.
We don't have the ksp_limit anymore, I forgot to remove the above text.
No worries, I'll edit it when I apply it.
quoted
This is inspired from S390 arch. Several other arches do more or
less the same. The way sparc arch does seems odd thought.
Signed-off-by: Christophe Leroy <redacted>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
v2: no change.
v3: no change.
v4:
- comment reminding the purpose of the inline asm block.
- added r2 as clobbered reg
v5:
- Limiting the change to PPC32 for now.
- removed r2 from the clobbered regs list (on PPC32 r2 points to current all the time)
- Removed patch 1 and merged ksp_limit handling in here.
v6:
- Rebase on top of merge-test (ca6e327fefb2).
- Remove the ksp_limit stuff as it's doesn't exist anymore.
v7:
mpe:
- Enable for 64-bit too. This all in-kernel code calling in-kernel
code, and must use the kernel TOC.
Great.
quoted
- Use named parameters for the inline asm.
Hmm. It is the first time we use named parameters in powerpc assembly, isn't it ?
From: Michael Ellerman <hidden> Date: 2021-03-31 01:20:17
On Sat, 20 Mar 2021 23:22:27 +1100, Michael Ellerman wrote:
call_do_irq() and call_do_softirq() are simple enough to be
worth inlining.
Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. It
also allows GCC to keep the saved ksp_limit in an nonvolatile reg.
This is inspired from S390 arch. Several other arches do more or
less the same. The way sparc arch does seems odd thought.
On Sat, Mar 20, 2021 at 11:22:27PM +1100, Michael Ellerman wrote:
quoted hunk
From: Christophe Leroy <redacted>
call_do_irq() and call_do_softirq() are simple enough to be
worth inlining.
Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. It
also allows GCC to keep the saved ksp_limit in an nonvolatile reg.
This is inspired from S390 arch. Several other arches do more or
less the same. The way sparc arch does seems odd thought.
Signed-off-by: Christophe Leroy <redacted>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
v2: no change.
v3: no change.
v4:
- comment reminding the purpose of the inline asm block.
- added r2 as clobbered reg
v5:
- Limiting the change to PPC32 for now.
- removed r2 from the clobbered regs list (on PPC32 r2 points to current all the time)
- Removed patch 1 and merged ksp_limit handling in here.
v6:
- Rebase on top of merge-test (ca6e327fefb2).
- Remove the ksp_limit stuff as it's doesn't exist anymore.
v7:
mpe:
- Enable for 64-bit too. This all in-kernel code calling in-kernel
code, and must use the kernel TOC.
- Use named parameters for the inline asm.
- Reformat inline asm.
- Mark as always_inline.
- Drop unused ret from call_do_softirq(), add r3 as clobbered.
---
arch/powerpc/include/asm/irq.h | 2 --
arch/powerpc/kernel/irq.c | 41 ++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/misc_32.S | 25 ---------------------
arch/powerpc/kernel/misc_64.S | 22 ------------------
4 files changed, 41 insertions(+), 49 deletions(-)
This change caused our ppc44x_defconfig builds to hang when powering
down in QEMU:
https://github.com/ClangBuiltLinux/continuous-integration2/runs/2304364629?check_suite_focus=true#logs
This is probably something with clang given that GCC 10.3.0 works fine
but due to the nature of the change, I have no idea how to tell what is
going wrong. I tried to do some rudimentary debugging with gdb but that
did not really get me anywhere.
The kernel was built with just 'CC=clang' and it is reproducible with
all versions of clang that the kernel supports.
The QEMU invocation is visible at the link above, it is done with our
boot-qemu.sh in this repo, which also houses the rootfs:
https://github.com/ClangBuiltLinux/boot-utils
Happy to provide any other information or debug/test as directed!
Cheers,
Nathan
Le 26/04/2021 à 20:50, Nathan Chancellor a écrit :
On Sat, Mar 20, 2021 at 11:22:27PM +1100, Michael Ellerman wrote:
quoted
From: Christophe Leroy <redacted>
call_do_irq() and call_do_softirq() are simple enough to be
worth inlining.
Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. It
also allows GCC to keep the saved ksp_limit in an nonvolatile reg.
This is inspired from S390 arch. Several other arches do more or
less the same. The way sparc arch does seems odd thought.
Signed-off-by: Christophe Leroy <redacted>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This change caused our ppc44x_defconfig builds to hang when powering
down in QEMU:
https://github.com/ClangBuiltLinux/continuous-integration2/runs/2304364629?check_suite_focus=true#logs
This is probably something with clang given that GCC 10.3.0 works fine
but due to the nature of the change, I have no idea how to tell what is
going wrong. I tried to do some rudimentary debugging with gdb but that
did not really get me anywhere.
The kernel was built with just 'CC=clang' and it is reproducible with
all versions of clang that the kernel supports.
The QEMU invocation is visible at the link above, it is done with our
boot-qemu.sh in this repo, which also houses the rootfs:
https://github.com/ClangBuiltLinux/boot-utils
Happy to provide any other information or debug/test as directed!
From: Nick Desaulniers <ndesaulniers@google.com> Date: 2021-04-27 20:43:29
On Mon, Apr 26, 2021 at 11:39 PM Christophe Leroy
[off-list ref] wrote:
Le 26/04/2021 à 20:50, Nathan Chancellor a écrit :
quoted
On Sat, Mar 20, 2021 at 11:22:27PM +1100, Michael Ellerman wrote:
quoted
From: Christophe Leroy <redacted>
call_do_irq() and call_do_softirq() are simple enough to be
worth inlining.
Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. It
also allows GCC to keep the saved ksp_limit in an nonvolatile reg.
This is inspired from S390 arch. Several other arches do more or
less the same. The way sparc arch does seems odd thought.
Signed-off-by: Christophe Leroy <redacted>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This change caused our ppc44x_defconfig builds to hang when powering
down in QEMU:
https://github.com/ClangBuiltLinux/continuous-integration2/runs/2304364629?check_suite_focus=true#logs
This is probably something with clang given that GCC 10.3.0 works fine
but due to the nature of the change, I have no idea how to tell what is
going wrong. I tried to do some rudimentary debugging with gdb but that
did not really get me anywhere.
The kernel was built with just 'CC=clang' and it is reproducible with
all versions of clang that the kernel supports.
The QEMU invocation is visible at the link above, it is done with our
boot-qemu.sh in this repo, which also houses the rootfs:
https://github.com/ClangBuiltLinux/boot-utils
Happy to provide any other information or debug/test as directed!
Looks like there's a fix posted for LLVM in: https://reviews.llvm.org/D101657
Though trying to test it in QEMU, I'm hitting some assertion failure
booting a kernel (even without that patch to LLVM):
qemu-system-ppc: ../../hw/pci/pci.c:253: pci_bus_change_irq_level:
Assertion `irq_num >= 0' failed.
That's with
QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-9)
I didn't see anything in https://bugs.launchpad.net/qemu/ about it,
but figured I'd share in case that assertion failure looked familiar
to anyone.
--
Thanks,
~Nick Desaulniers
Looks like there's a fix posted for LLVM in: https://reviews.llvm.org/D101657
Though trying to test it in QEMU, I'm hitting some assertion failure
booting a kernel (even without that patch to LLVM):
qemu-system-ppc: ../../hw/pci/pci.c:253: pci_bus_change_irq_level:
Assertion `irq_num >= 0' failed.
That's with
QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-9)
I didn't see anything in https://bugs.launchpad.net/qemu/ about it,
but figured I'd share in case that assertion failure looked familiar
to anyone.