[PATCH v3 0/8] Generic IRQ entry/exit support for powerpc

Mukesh Kumar Chaurasiya posted 8 patches 1 month, 1 week ago
There is a newer version of this series
arch/powerpc/Kconfig                    |   2 +
arch/powerpc/include/asm/entry-common.h | 533 ++++++++++++++++++++++++
arch/powerpc/include/asm/hw_irq.h       |   4 +-
arch/powerpc/include/asm/interrupt.h    | 386 +++--------------
arch/powerpc/include/asm/ptrace.h       |   6 +-
arch/powerpc/include/asm/signal.h       |   1 -
arch/powerpc/include/asm/stacktrace.h   |   6 +
arch/powerpc/include/asm/syscall.h      |   5 +
arch/powerpc/include/asm/thread_info.h  |   1 +
arch/powerpc/include/uapi/asm/ptrace.h  |  14 +-
arch/powerpc/kernel/interrupt.c         | 255 ++----------
arch/powerpc/kernel/ptrace/ptrace.c     | 142 +------
arch/powerpc/kernel/signal.c            |  25 +-
arch/powerpc/kernel/syscall.c           | 119 +-----
arch/powerpc/kernel/traps.c             |   2 +-
arch/powerpc/kernel/watchdog.c          |   2 +-
arch/powerpc/perf/core-book3s.c         |   2 +-
17 files changed, 681 insertions(+), 824 deletions(-)
create mode 100644 arch/powerpc/include/asm/entry-common.h
[PATCH v3 0/8] Generic IRQ entry/exit support for powerpc
Posted by Mukesh Kumar Chaurasiya 1 month, 1 week ago
Adding support for the generic irq entry/exit handling for PowerPC. The
goal is to bring PowerPC in line with other architectures that already
use the common irq entry infrastructure, reducing duplicated code and
making it easier to share future changes in entry/exit paths.

This is slightly tested of ppc64le and ppc32.

The performance benchmarks are below:

perf bench syscall usec/op

| Syscall | Base       | New        | change % |
| ------- | ---------- | ---------- | -------- |
| basic   | 0.173212   | 0.133294   | -23.05   |
| execve  | 363.176190 | 357.148150 | -1.66    |
| fork    | 853.657880 | 840.268800 | -1.57    |
| getpgid | 0.174832   | 0.135372   | -22.57   |

perf bench syscall ops/sec

| Syscall | Base    | New     | change % |
| ------- | ------- | ------- | -------- |
| basic   | 6006021 | 7502236 | +24.91   |
| execve  | 2753    | 2800    | +1.71    |
| fork    | 1171    | 1190    | +1.62    |
| getpgid | 5942117 | 7387040 | +24.32   |

IPI latency benchmark

| Metric         | Base (ns)     | Test (ns)     | change % |
| -------------- | ------------- | ------------- | -------- |
| Dry-run        | 206652.45     | 209317.37     | +1.29    |
| Self-IPI       | 3567895.23    | 3590444.77    | +0.63    |
| Normal IPI     | 148570416.17  | 148564173.40  | -0.00    |
| Broadcast IPI  | 4033489673.38 | 4007319512.62 | -0.65    |
| Broadcast lock | 4011023005.48 | 4010267885.93 | -0.02    |


Thats very close to performance earlier with arch specific handling.

Tests done:
 - Build and boot on ppc64le pseries.
 - Build and boot on ppc64le powernv8 powernv9 powernv10.
 - Build and boot on ppc32.
 - Performance benchmark done with perf syscall basic on pseries.

Changelog:

V2 -> V3
 - #ifdef CONFIG_GENERIC_IRQ_ENTRY removed from unnecessary places
 - Some functions made __always_inline
 - pt_regs padding changed to match 16byte interrupt stack alignment
 - And some cosmetic changes from reviews from earlier patch
V2: https://lore.kernel.org/all/20251214130245.43664-1-mkchauras@linux.ibm.com/

V1 -> V2
 - Fix an issue where context tracking was showing warnings for
   incorrect context
V1: https://lore.kernel.org/all/20251102115358.1744304-1-mkchauras@linux.ibm.com/

RFC -> PATCH V1
 - Fix for ppc32 spitting out kuap lock warnings.
 - ppc64le powernv8 crash fix.
 - Review comments incorporated from previous RFC.
RFC https://lore.kernel.org/all/20250908210235.137300-2-mchauras@linux.ibm.com/

Mukesh Kumar Chaurasiya (8):
  powerpc: rename arch_irq_disabled_regs
  powerpc: Prepare to build with generic entry/exit framework
  powerpc: introduce arch_enter_from_user_mode
  powerpc: Introduce syscall exit arch functions
  powerpc: add exit_flags field in pt_regs
  powerpc: Prepare for IRQ entry exit
  powerpc: Enable IRQ generic entry/exit path.
  powerpc: Enable Generic Entry/Exit for syscalls.

 arch/powerpc/Kconfig                    |   2 +
 arch/powerpc/include/asm/entry-common.h | 533 ++++++++++++++++++++++++
 arch/powerpc/include/asm/hw_irq.h       |   4 +-
 arch/powerpc/include/asm/interrupt.h    | 386 +++--------------
 arch/powerpc/include/asm/ptrace.h       |   6 +-
 arch/powerpc/include/asm/signal.h       |   1 -
 arch/powerpc/include/asm/stacktrace.h   |   6 +
 arch/powerpc/include/asm/syscall.h      |   5 +
 arch/powerpc/include/asm/thread_info.h  |   1 +
 arch/powerpc/include/uapi/asm/ptrace.h  |  14 +-
 arch/powerpc/kernel/interrupt.c         | 255 ++----------
 arch/powerpc/kernel/ptrace/ptrace.c     | 142 +------
 arch/powerpc/kernel/signal.c            |  25 +-
 arch/powerpc/kernel/syscall.c           | 119 +-----
 arch/powerpc/kernel/traps.c             |   2 +-
 arch/powerpc/kernel/watchdog.c          |   2 +-
 arch/powerpc/perf/core-book3s.c         |   2 +-
 17 files changed, 681 insertions(+), 824 deletions(-)
 create mode 100644 arch/powerpc/include/asm/entry-common.h

-- 
2.52.0
Re: [PATCH v3 0/8] Generic IRQ entry/exit support for powerpc
Posted by Shrikanth Hegde 1 month, 1 week ago

On 12/29/25 10:24 AM, Mukesh Kumar Chaurasiya wrote:
> Adding support for the generic irq entry/exit handling for PowerPC. The
> goal is to bring PowerPC in line with other architectures that already
> use the common irq entry infrastructure, reducing duplicated code and
> making it easier to share future changes in entry/exit paths.
> 
> This is slightly tested of ppc64le and ppc32.
> 
> The performance benchmarks are below:
> 
> perf bench syscall usec/op
> 
> | Syscall | Base       | New        | change % |
> | ------- | ---------- | ---------- | -------- |
> | basic   | 0.173212   | 0.133294   | -23.05   |
> | execve  | 363.176190 | 357.148150 | -1.66    |
> | fork    | 853.657880 | 840.268800 | -1.57    |
> | getpgid | 0.174832   | 0.135372   | -22.57   |
> 

Could you please add a description for whether its an improvement
or regression.

Looking at it, it seems time taken for operation to complete. So it is
an improvement. Seeing negative numbers one might think its a regression.

Also, are these average numbers?
Could you get the numbers with preempt=lazy and with context tracking on?

> perf bench syscall ops/sec
> 
> | Syscall | Base    | New     | change % |
> | ------- | ------- | ------- | -------- |
> | basic   | 6006021 | 7502236 | +24.91   |
> | execve  | 2753    | 2800    | +1.71    |
> | fork    | 1171    | 1190    | +1.62    |
> | getpgid | 5942117 | 7387040 | +24.32   |
> 
> IPI latency benchmark
> 
> | Metric         | Base (ns)     | Test (ns)     | change % |
> | -------------- | ------------- | ------------- | -------- |
> | Dry-run        | 206652.45     | 209317.37     | +1.29    |
> | Self-IPI       | 3567895.23    | 3590444.77    | +0.63    |
> | Normal IPI     | 148570416.17  | 148564173.40  | -0.00    |
> | Broadcast IPI  | 4033489673.38 | 4007319512.62 | -0.65    |
> | Broadcast lock | 4011023005.48 | 4010267885.93 | -0.02    |
> 
>
Re: [PATCH v3 0/8] Generic IRQ entry/exit support for powerpc
Posted by Mukesh Kumar Chaurasiya 1 month ago
On Thu, Jan 01, 2026 at 02:37:41PM +0530, Shrikanth Hegde wrote:
> 
> 
> On 12/29/25 10:24 AM, Mukesh Kumar Chaurasiya wrote:
> > Adding support for the generic irq entry/exit handling for PowerPC. The
> > goal is to bring PowerPC in line with other architectures that already
> > use the common irq entry infrastructure, reducing duplicated code and
> > making it easier to share future changes in entry/exit paths.
> > 
> > This is slightly tested of ppc64le and ppc32.
> > 
> > The performance benchmarks are below:
> > 
> > perf bench syscall usec/op
> > 
> > | Syscall | Base       | New        | change % |
> > | ------- | ---------- | ---------- | -------- |
> > | basic   | 0.173212   | 0.133294   | -23.05   |
> > | execve  | 363.176190 | 357.148150 | -1.66    |
> > | fork    | 853.657880 | 840.268800 | -1.57    |
> > | getpgid | 0.174832   | 0.135372   | -22.57   |
> > 
> 
> Could you please add a description for whether its an improvement
> or regression.
> 
> Looking at it, it seems time taken for operation to complete. So it is
> an improvement. Seeing negative numbers one might think its a regression.
> 
Sure will add an explanation.
> Also, are these average numbers?
Yes, as there was very high run to run variation i took an avg of
100 runs.
> Could you get the numbers with preempt=lazy and with context tracking on?
Sure will do those too.

Regards,
Mukesh

> 
> > perf bench syscall ops/sec
> > 
> > | Syscall | Base    | New     | change % |
> > | ------- | ------- | ------- | -------- |
> > | basic   | 6006021 | 7502236 | +24.91   |
> > | execve  | 2753    | 2800    | +1.71    |
> > | fork    | 1171    | 1190    | +1.62    |
> > | getpgid | 5942117 | 7387040 | +24.32   |
> > 
> > IPI latency benchmark
> > 
> > | Metric         | Base (ns)     | Test (ns)     | change % |
> > | -------------- | ------------- | ------------- | -------- |
> > | Dry-run        | 206652.45     | 209317.37     | +1.29    |
> > | Self-IPI       | 3567895.23    | 3590444.77    | +0.63    |
> > | Normal IPI     | 148570416.17  | 148564173.40  | -0.00    |
> > | Broadcast IPI  | 4033489673.38 | 4007319512.62 | -0.65    |
> > | Broadcast lock | 4011023005.48 | 4010267885.93 | -0.02    |
> > 
> > 
>
Re: [PATCH v3 0/8] Generic IRQ entry/exit support for powerpc
Posted by Venkat 1 month ago
With this patch set, build fails.

Failure logs:

ld: warning: discarding dynamic section .glink
ld: warning: discarding dynamic section .plt
ld: linkage table error against `memset'
ld: stubs don't match calculated size
ld: can not build stubs: bad value
ld: init/main.o: in function `do_one_initcall':
/root/linux/init/main.c:1384: undefined reference to `memcpy'
ld: arch/powerpc/kernel/process.o: in function `arch_dup_task_struct':
/root/linux/arch/powerpc/kernel/process.c:1724: undefined reference to `memcpy'
ld: arch/powerpc/kernel/process.o: in function `copy_thread':
/root/linux/arch/powerpc/kernel/process.c:1812: undefined reference to `memcpy'
ld: arch/powerpc/kernel/signal.o: in function `do_signal':
/root/linux/arch/powerpc/kernel/signal.c:247: undefined reference to `memset'
ld: arch/powerpc/kernel/sysfs.o: in function `show_smt_snooze_delay':
/root/linux/arch/powerpc/kernel/sysfs.c:66: undefined reference to `memcpy'
ld: /root/linux/arch/powerpc/kernel/sysfs.c:66: undefined reference to `memcpy'
ld: arch/powerpc/kernel/time.o: in function `register_decrementer_clockevent':
/root/linux/arch/powerpc/kernel/time.c:834: undefined reference to `memcpy'
ld: arch/powerpc/kernel/time.o: in function `platform_device_register_resndata':
/root/linux/./include/linux/platform_device.h:160: undefined reference to `memset'
ld: arch/powerpc/kernel/ptrace/ptrace-noadv.o: in function `ptrace_set_debugreg':
/root/linux/arch/powerpc/kernel/ptrace/ptrace-noadv.c:130: undefined reference to `memcpy'
ld: arch/powerpc/kernel/paca.o: in function `init_lppaca':
/root/linux/arch/powerpc/kernel/paca.c:112: undefined reference to `memset'
ld: arch/powerpc/kernel/hw_breakpoint.o: in function `ptrace_triggered':
/root/linux/arch/powerpc/kernel/hw_breakpoint.c:607: undefined reference to `memcpy'
ld: arch/powerpc/kernel/mce.o: in function `get_mce_event':
/root/linux/arch/powerpc/kernel/mce.c:206: undefined reference to `memcpy'
ld: /root/linux/arch/powerpc/kernel/mce.c:206: undefined reference to `memcpy'
ld: arch/powerpc/kernel/mce_power.o: in function `mce_find_instr_ea_and_phys':
/root/linux/arch/powerpc/kernel/mce_power.c:461: undefined reference to `memcpy'
ld: arch/powerpc/kernel/security.o: in function `cpu_show_meltdown':
/root/linux/arch/powerpc/kernel/security.c:172: undefined reference to `memcpy'
ld: arch/powerpc/kernel/security.o:/root/linux/arch/powerpc/kernel/security.c:166: more undefined references to `memcpy' follow
ld: arch/powerpc/mm/mem.o: in function `execmem_arch_setup':
/root/linux/arch/powerpc/mm/mem.c:423: undefined reference to `memset'
ld: arch/powerpc/mm/book3s64/subpage_prot.o: in function `subpage_mark_vma_nohuge':
/root/linux/arch/powerpc/mm/book3s64/subpage_prot.c:155: undefined reference to `memset'
ld: arch/powerpc/mm/numa.o: in function `vphn_get_nid':
/root/linux/arch/powerpc/mm/numa.c:676: undefined reference to `memset'
ld: arch/powerpc/mm/numa.o: in function `find_and_update_cpu_nid':
/root/linux/arch/powerpc/mm/numa.c:1416: undefined reference to `memset'
ld: arch/powerpc/mm/numa.o: in function `cpu_to_coregroup_id':
/root/linux/arch/powerpc/mm/numa.c:1438: undefined reference to `memset'
ld: arch/powerpc/mm/ptdump/ptdump.o:/root/linux/arch/powerpc/mm/ptdump/ptdump.c:370: more undefined references to `memset' follow
ld: arch/powerpc/lib/mem_64.o: in function `__memmove':
/root/linux/arch/powerpc/lib/mem_64.S:103: undefined reference to `memcpy'
/root/linux/arch/powerpc/lib/mem_64.S:103:(.text+0x10c): call to `memcpy' lacks nop, can't restore toc; (plt call stub)
ld: final link failed: bad value
make[2]: *** [scripts/Makefile.vmlinux:72: vmlinux.unstripped] Error 1
make[1]: *** [/root/linux/Makefile:1276: vmlinux] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:248: __sub-make] Error 2

Regards,
Venkat.

> On 29 Dec 2025, at 10:24 AM, Mukesh Kumar Chaurasiya <mkchauras@linux.ibm.com> wrote:
> 
> Adding support for the generic irq entry/exit handling for PowerPC. The
> goal is to bring PowerPC in line with other architectures that already
> use the common irq entry infrastructure, reducing duplicated code and
> making it easier to share future changes in entry/exit paths.
> 
> This is slightly tested of ppc64le and ppc32.
> 
> The performance benchmarks are below:
> 
> perf bench syscall usec/op
> 
> | Syscall | Base       | New        | change % |
> | ------- | ---------- | ---------- | -------- |
> | basic   | 0.173212   | 0.133294   | -23.05   |
> | execve  | 363.176190 | 357.148150 | -1.66    |
> | fork    | 853.657880 | 840.268800 | -1.57    |
> | getpgid | 0.174832   | 0.135372   | -22.57   |
> 
> perf bench syscall ops/sec
> 
> | Syscall | Base    | New     | change % |
> | ------- | ------- | ------- | -------- |
> | basic   | 6006021 | 7502236 | +24.91   |
> | execve  | 2753    | 2800    | +1.71    |
> | fork    | 1171    | 1190    | +1.62    |
> | getpgid | 5942117 | 7387040 | +24.32   |
> 
> IPI latency benchmark
> 
> | Metric         | Base (ns)     | Test (ns)     | change % |
> | -------------- | ------------- | ------------- | -------- |
> | Dry-run        | 206652.45     | 209317.37     | +1.29    |
> | Self-IPI       | 3567895.23    | 3590444.77    | +0.63    |
> | Normal IPI     | 148570416.17  | 148564173.40  | -0.00    |
> | Broadcast IPI  | 4033489673.38 | 4007319512.62 | -0.65    |
> | Broadcast lock | 4011023005.48 | 4010267885.93 | -0.02    |
> 
> 
> Thats very close to performance earlier with arch specific handling.
> 
> Tests done:
> - Build and boot on ppc64le pseries.
> - Build and boot on ppc64le powernv8 powernv9 powernv10.
> - Build and boot on ppc32.
> - Performance benchmark done with perf syscall basic on pseries.
> 
> Changelog:
> 
> V2 -> V3
> - #ifdef CONFIG_GENERIC_IRQ_ENTRY removed from unnecessary places
> - Some functions made __always_inline
> - pt_regs padding changed to match 16byte interrupt stack alignment
> - And some cosmetic changes from reviews from earlier patch
> V2: https://lore.kernel.org/all/20251214130245.43664-1-mkchauras@linux.ibm.com/
> 
> V1 -> V2
> - Fix an issue where context tracking was showing warnings for
>   incorrect context
> V1: https://lore.kernel.org/all/20251102115358.1744304-1-mkchauras@linux.ibm.com/
> 
> RFC -> PATCH V1
> - Fix for ppc32 spitting out kuap lock warnings.
> - ppc64le powernv8 crash fix.
> - Review comments incorporated from previous RFC.
> RFC https://lore.kernel.org/all/20250908210235.137300-2-mchauras@linux.ibm.com/
> 
> Mukesh Kumar Chaurasiya (8):
>  powerpc: rename arch_irq_disabled_regs
>  powerpc: Prepare to build with generic entry/exit framework
>  powerpc: introduce arch_enter_from_user_mode
>  powerpc: Introduce syscall exit arch functions
>  powerpc: add exit_flags field in pt_regs
>  powerpc: Prepare for IRQ entry exit
>  powerpc: Enable IRQ generic entry/exit path.
>  powerpc: Enable Generic Entry/Exit for syscalls.
> 
> arch/powerpc/Kconfig                    |   2 +
> arch/powerpc/include/asm/entry-common.h | 533 ++++++++++++++++++++++++
> arch/powerpc/include/asm/hw_irq.h       |   4 +-
> arch/powerpc/include/asm/interrupt.h    | 386 +++--------------
> arch/powerpc/include/asm/ptrace.h       |   6 +-
> arch/powerpc/include/asm/signal.h       |   1 -
> arch/powerpc/include/asm/stacktrace.h   |   6 +
> arch/powerpc/include/asm/syscall.h      |   5 +
> arch/powerpc/include/asm/thread_info.h  |   1 +
> arch/powerpc/include/uapi/asm/ptrace.h  |  14 +-
> arch/powerpc/kernel/interrupt.c         | 255 ++----------
> arch/powerpc/kernel/ptrace/ptrace.c     | 142 +------
> arch/powerpc/kernel/signal.c            |  25 +-
> arch/powerpc/kernel/syscall.c           | 119 +-----
> arch/powerpc/kernel/traps.c             |   2 +-
> arch/powerpc/kernel/watchdog.c          |   2 +-
> arch/powerpc/perf/core-book3s.c         |   2 +-
> 17 files changed, 681 insertions(+), 824 deletions(-)
> create mode 100644 arch/powerpc/include/asm/entry-common.h
> 
> -- 
> 2.52.0
> 
Re: [PATCH v3 0/8] Generic IRQ entry/exit support for powerpc
Posted by Christophe Leroy (CS GROUP) 1 month ago
Hi,

Le 08/01/2026 à 06:16, Venkat a écrit :
> With this patch set, build fails.
> 
> Failure logs:
> 
> ld: init/main.o: in function `do_one_initcall':
> /root/linux/init/main.c:1384: undefined reference to `memcpy'

I guess you have KASAN enabled ?

See 
https://lore.kernel.org/all/0947502d-96e3-4179-ae48-603de74dc7b3@kernel.org/

This is because of commit 69d4c0d32186 ("entry, kasan, x86: Disallow 
overriding mem*() functions") which changed the core behaviour in 2023 
without taking care of other architectures than x86 who was the only one 
with CONFIG_GENERIC_ENTRY ?

For powerpc the expected behaviour introduced in 2019 by commit 
26deb04342e3 ("powerpc: prepare string/mem functions for KASAN") needs 
to be modified the same way to fit with the core change.

Christophe
Re: [PATCH v3 0/8] Generic IRQ entry/exit support for powerpc
Posted by Mukesh Kumar Chaurasiya 1 month ago
On Thu, Jan 08, 2026 at 07:05:42AM +0100, Christophe Leroy (CS GROUP) wrote:
> Hi,
> 
> Le 08/01/2026 à 06:16, Venkat a écrit :
> > With this patch set, build fails.
> > 
> > Failure logs:
> > 
> > ld: init/main.o: in function `do_one_initcall':
> > /root/linux/init/main.c:1384: undefined reference to `memcpy'
> 
> I guess you have KASAN enabled ?
> 
> See
> https://lore.kernel.org/all/0947502d-96e3-4179-ae48-603de74dc7b3@kernel.org/
> 
> This is because of commit 69d4c0d32186 ("entry, kasan, x86: Disallow
> overriding mem*() functions") which changed the core behaviour in 2023
> without taking care of other architectures than x86 who was the only one
> with CONFIG_GENERIC_ENTRY ?
> 
> For powerpc the expected behaviour introduced in 2019 by commit 26deb04342e3
> ("powerpc: prepare string/mem functions for KASAN") needs to be modified the
> same way to fit with the core change.
> 
> Christophe
Hey Christophe, Venkat

I am working on this. I'll send out a new revision soon.

Regards,
Mukesh