* Re: [patch 04/18] loongarch/syscall: Use syscall_enter_from_user_mode_randomize_stack()
From: Philippe Mathieu-Daudé @ 2026-07-09 11:15 UTC (permalink / raw)
To: Thomas Gleixner, LKML
Cc: Peter Zijlstra, Huacai Chen, loongarch, Michael Ellerman,
Shrikanth Hegde, linuxppc-dev, Kees Cook, Paul Walmsley,
Palmer Dabbelt, linux-riscv, Sven Schnelle, linux-s390, x86,
Mark Rutland, Jinjie Ruan, Andy Lutomirski, Oleg Nesterov,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Michal Suchánek,
Jonathan Corbet, linux-doc
In-Reply-To: <20260707190253.865955911@kernel.org>
On 7/7/26 21:06, Thomas Gleixner wrote:
> syscall_enter_from_user_mode_randomize_stack() replaces
> syscall_enter_from_user_mode() and the subsequent invocation of
> add_random_kstack_offset().
>
> The advantage is that it applies the stack randomization right after
> enter_from_user_mode() and thereby avoids the overhead of get/put_cpu_var()
> as that code is invoked with interrupts disabled.
>
> No functional change.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: loongarch@lists.linux.dev
> ---
> arch/loongarch/kernel/syscall.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply
* Re: [patch 05/18] powerpc/syscall: Use syscall_enter_from_user_mode_randomize_stack()
From: Philippe Mathieu-Daudé @ 2026-07-09 11:16 UTC (permalink / raw)
To: Thomas Gleixner, LKML
Cc: Peter Zijlstra, Michael Ellerman, Shrikanth Hegde, linuxppc-dev,
Kees Cook, Huacai Chen, loongarch, Paul Walmsley, Palmer Dabbelt,
linux-riscv, Sven Schnelle, linux-s390, x86, Mark Rutland,
Jinjie Ruan, Andy Lutomirski, Oleg Nesterov, Richard Henderson,
Russell King, Catalin Marinas, Guo Ren, Geert Uytterhoeven,
Thomas Bogendoerfer, Helge Deller, Yoshinori Sato,
Richard Weinberger, Chris Zankel, linux-arm-kernel, linux-alpha,
linux-csky, linux-m68k, linux-mips, linux-parisc, linux-sh,
linux-um, Arnd Bergmann, Vineet Gupta, Will Deacon, Brian Cain,
Michal Simek, Dinh Nguyen, David S. Miller, Andreas Larsson,
linux-snps-arc, linux-hexagon, linux-openrisc, sparclinux,
linux-arch, Michal Suchánek, Jonathan Corbet, linux-doc
In-Reply-To: <20260707190253.918861529@kernel.org>
On 7/7/26 21:06, Thomas Gleixner wrote:
> syscall_enter_from_user_mode_randomize_stack() replaces
> syscall_enter_from_user_mode() and the subsequent invocation of
> add_random_kstack_offset().
>
> The advantage is that it applies the stack randomization right after
> enter_from_user_mode() and thereby avoids the overhead of get/put_cpu_var()
> as that code is invoked with interrupts disabled.
>
> No functional change.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/kernel/syscall.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply
* Re: [patch 06/18] riscv/syscall: Use syscall_enter_from_user_mode_randomize_stack()
From: Philippe Mathieu-Daudé @ 2026-07-09 11:16 UTC (permalink / raw)
To: Thomas Gleixner, LKML
Cc: Peter Zijlstra, Paul Walmsley, Palmer Dabbelt, linux-riscv,
Michael Ellerman, Shrikanth Hegde, linuxppc-dev, Kees Cook,
Huacai Chen, loongarch, Sven Schnelle, linux-s390, x86,
Mark Rutland, Jinjie Ruan, Andy Lutomirski, Oleg Nesterov,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Michal Suchánek,
Jonathan Corbet, linux-doc
In-Reply-To: <20260707190253.974626922@kernel.org>
On 7/7/26 21:06, Thomas Gleixner wrote:
> syscall_enter_from_user_mode_randomize_stack() replaces
> syscall_enter_from_user_mode() and the subsequent invocation of
> add_random_kstack_offset().
>
> The advantage is that it applies the stack randomization right after
> enter_from_user_mode() and thereby avoids the overhead of get/put_cpu_var()
> as that code is invoked with interrupts disabled.
>
> No functional change.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Paul Walmsley <pjw@kernel.org>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: linux-riscv@lists.infradead.org
> ---
> arch/riscv/kernel/traps.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply
* Re: [patch 07/18] s390/syscall: Use enter_from_user_mode_randomize_stack()
From: Philippe Mathieu-Daudé @ 2026-07-09 11:17 UTC (permalink / raw)
To: Jinjie Ruan, Thomas Gleixner, LKML
Cc: Peter Zijlstra, Sven Schnelle, linux-s390, Michael Ellerman,
Shrikanth Hegde, linuxppc-dev, Kees Cook, Huacai Chen, loongarch,
Paul Walmsley, Palmer Dabbelt, linux-riscv, x86, Mark Rutland,
Andy Lutomirski, Oleg Nesterov, Richard Henderson, Russell King,
Catalin Marinas, Guo Ren, Geert Uytterhoeven, Thomas Bogendoerfer,
Helge Deller, Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Michal Suchánek,
Jonathan Corbet, linux-doc
In-Reply-To: <499eca86-8def-4044-8b69-8f290528e10f@huawei.com>
On 9/7/26 04:46, Jinjie Ruan wrote:
>
>
> On 7/8/2026 3:06 AM, Thomas Gleixner wrote:
>> enter_from_user_mode_randomize_stack() replaces enter_from_user_mode() and
>> the subsequent invocation of add_random_kstack_offset_irqsoff().
>>
>> As a bonus this avoids the overhead of get/put_cpu_var() in
>> add_random_kstack_offset().
>>
>> No functional change.
>>
>> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
>> Cc: Sven Schnelle <svens@linux.ibm.com>
>> Cc: linux-s390@vger.kernel.org
>> ---
>> arch/s390/kernel/syscall.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> --- a/arch/s390/kernel/syscall.c
>> +++ b/arch/s390/kernel/syscall.c
>> @@ -97,8 +97,8 @@ void noinstr __do_syscall(struct pt_regs
>> {
>> unsigned long nr;
>>
>> - enter_from_user_mode(regs);
>> - add_random_kstack_offset();
>> + enter_from_user_mode_randomize_stack(regs);
>
> The #include <linux/randomize_kstack.h> can be removed.
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply
* Re: [patch 08/18] x86/syscall: Use [syscall_]enter_from_user_mode_randomize_stack()
From: Philippe Mathieu-Daudé @ 2026-07-09 11:18 UTC (permalink / raw)
To: Thomas Gleixner, LKML
Cc: Peter Zijlstra, x86, Michael Ellerman, Shrikanth Hegde,
linuxppc-dev, Kees Cook, Huacai Chen, loongarch, Paul Walmsley,
Palmer Dabbelt, linux-riscv, Sven Schnelle, linux-s390,
Mark Rutland, Jinjie Ruan, Andy Lutomirski, Oleg Nesterov,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Michal Suchánek,
Jonathan Corbet, linux-doc
In-Reply-To: <20260707190254.079478122@kernel.org>
On 7/7/26 21:06, Thomas Gleixner wrote:
> These functions integrate the stack randomization.
>
> syscall_enter_from_user_mode_randomize_stack() has the advantage that the
> randomization happens early right after enter_from_user_mode().
>
> In both cases also the overhead of get/put_cpu_var() in
> add_random_kstack_offset() is avoided.
>
> No functional change.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: x86@kernel.org
> ---
> arch/x86/entry/syscall_32.c | 19 +++++--------------
> arch/x86/entry/syscall_64.c | 3 +--
> arch/x86/include/asm/entry-common.h | 1 -
> 3 files changed, 6 insertions(+), 17 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply
* Re: [patch 10/18] entry: Use syscall number instead of rereading it
From: Philippe Mathieu-Daudé @ 2026-07-09 11:20 UTC (permalink / raw)
To: Thomas Gleixner, LKML
Cc: Peter Zijlstra, Michael Ellerman, Shrikanth Hegde, linuxppc-dev,
Kees Cook, Huacai Chen, loongarch, Paul Walmsley, Palmer Dabbelt,
linux-riscv, Sven Schnelle, linux-s390, x86, Mark Rutland,
Jinjie Ruan, Andy Lutomirski, Oleg Nesterov, Richard Henderson,
Russell King, Catalin Marinas, Guo Ren, Geert Uytterhoeven,
Thomas Bogendoerfer, Helge Deller, Yoshinori Sato,
Richard Weinberger, Chris Zankel, linux-arm-kernel, linux-alpha,
linux-csky, linux-m68k, linux-mips, linux-parisc, linux-sh,
linux-um, Arnd Bergmann, Vineet Gupta, Will Deacon, Brian Cain,
Michal Simek, Dinh Nguyen, David S. Miller, Andreas Larsson,
linux-snps-arc, linux-hexagon, linux-openrisc, sparclinux,
linux-arch, Michal Suchánek, Jonathan Corbet, linux-doc
In-Reply-To: <20260707190254.181086755@kernel.org>
On 7/7/26 21:06, Thomas Gleixner wrote:
> rseq_syscall_enter_work() is invoked before the syscall number can be
> modified. So there is no point in rereading it from pt_regs.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> ---
> include/linux/entry-common.h | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
^ permalink raw reply
* Re: [patch 10/18] entry: Use syscall number instead of rereading it
From: Philippe Mathieu-Daudé @ 2026-07-09 11:22 UTC (permalink / raw)
To: Thomas Gleixner, LKML
Cc: Peter Zijlstra, Michael Ellerman, Shrikanth Hegde, linuxppc-dev,
Kees Cook, Huacai Chen, loongarch, Paul Walmsley, Palmer Dabbelt,
linux-riscv, Sven Schnelle, linux-s390, x86, Mark Rutland,
Jinjie Ruan, Andy Lutomirski, Oleg Nesterov, Richard Henderson,
Russell King, Catalin Marinas, Guo Ren, Geert Uytterhoeven,
Thomas Bogendoerfer, Helge Deller, Yoshinori Sato,
Richard Weinberger, Chris Zankel, linux-arm-kernel, linux-alpha,
linux-csky, linux-m68k, linux-mips, linux-parisc, linux-sh,
linux-um, Arnd Bergmann, Vineet Gupta, Will Deacon, Brian Cain,
Michal Simek, Dinh Nguyen, David S. Miller, Andreas Larsson,
linux-snps-arc, linux-hexagon, linux-openrisc, sparclinux,
linux-arch, Michal Suchánek, Jonathan Corbet, linux-doc
In-Reply-To: <73b82749-2df3-4c12-bc2a-ff7628dc8292@oss.qualcomm.com>
On 9/7/26 13:20, Philippe Mathieu-Daudé wrote:
> On 7/7/26 21:06, Thomas Gleixner wrote:
>> rseq_syscall_enter_work() is invoked before the syscall number can be
>> modified. So there is no point in rereading it from pt_regs.
>>
>> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
>> ---
>> include/linux/entry-common.h | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
^ permalink raw reply
* [PATCH] bitmap: Properly initialise destination bitmap for scatter & gather test
From: Christophe Leroy (CS GROUP) @ 2026-07-09 11:40 UTC (permalink / raw)
To: Andrew Morton, Yury Norov, Rasmus Villemoes, Andy Shevchenko
Cc: Christophe Leroy (CS GROUP), linux-kernel, linuxppc-dev,
Erhard Furtner
Erhard reports failure of bitmap tests on powerpc:
test_bitmap: loaded.
test_bitmap: [lib/test_bitmap.c:397] bitmaps contents differ: expected "1,3-4,9", got "1,3-4,9,65-71,73-79,81-87,89-95,97-99"
test_bitmap: parselist('0-2047:128/256'): 912
test_bitmap: scnprintf("%*pbl", '0-32767'): 5977
test_bitmap: test_bitmap_read_perf: 1191082
test_bitmap: test_bitmap_write_perf: 1270153
test_bitmap: failed 1 out of 208655 tests
The happens mainly when CONFIG_INIT_STACK_ALL_PATTERN is set.
Commit 6b5a4b687367 ("bitmap: Add test for out-of-boundary
modifications for scatter & gather") extended the test to
out-of-boundary bits, but those bits where left uninitialised.
Properly initialise the entire result bitmap before the test.
Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Closes: https://lore.kernel.org/all/ca3547ae-8b79-43a2-a758-23ec980bfd9a@mailbox.org
Fixes: 6b5a4b687367 ("bitmap: Add test for out-of-boundary modifications for scatter & gather")
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
---
lib/test_bitmap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index 69813c10e6c0..448c3eb48a4a 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -392,6 +392,7 @@ static void __init test_bitmap_sg(void)
/* Scatter/gather relationship */
bitmap_zero(bmap_tmp, 100);
+ bitmap_zero(bmap_res, 100);
bitmap_gather(bmap_tmp, bmap_scatter, sg_mask, nbits);
bitmap_scatter(bmap_res, bmap_tmp, sg_mask, nbits);
expect_eq_bitmap(bmap_scatter, bmap_res, 100);
--
2.54.0
^ permalink raw reply related
* Re: [PATCH] bitmap: Properly initialise destination bitmap for scatter & gather test
From: Andy Shevchenko @ 2026-07-09 11:53 UTC (permalink / raw)
To: Christophe Leroy (CS GROUP)
Cc: Andrew Morton, Yury Norov, Rasmus Villemoes, linux-kernel,
linuxppc-dev, Erhard Furtner
In-Reply-To: <67d1838732b85b1f715cc3ada5bb38dcfcf9db55.1783593992.git.chleroy@kernel.org>
On Thu, Jul 09, 2026 at 01:40:06PM +0200, Christophe Leroy (CS GROUP) wrote:
> Erhard reports failure of bitmap tests on powerpc:
>
> test_bitmap: loaded.
> test_bitmap: [lib/test_bitmap.c:397] bitmaps contents differ: expected "1,3-4,9", got "1,3-4,9,65-71,73-79,81-87,89-95,97-99"
> test_bitmap: parselist('0-2047:128/256'): 912
> test_bitmap: scnprintf("%*pbl", '0-32767'): 5977
> test_bitmap: test_bitmap_read_perf: 1191082
> test_bitmap: test_bitmap_write_perf: 1270153
> test_bitmap: failed 1 out of 208655 tests
>
> The happens mainly when CONFIG_INIT_STACK_ALL_PATTERN is set.
>
> Commit 6b5a4b687367 ("bitmap: Add test for out-of-boundary
> modifications for scatter & gather") extended the test to
> out-of-boundary bits, but those bits where left uninitialised.
>
> Properly initialise the entire result bitmap before the test.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Thanks!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [kvm-unit-tests PATCH 4/6] powerpc: gitlab CI update
From: Harsh Prateek Bora @ 2026-07-09 14:32 UTC (permalink / raw)
To: Thomas Huth, Chinmay Rath
Cc: npiggin, lvivier, linuxppc-dev, kvm, andrew.jones, sbhat,
Misbah Anjum N, Anushree Mathur, Venkat Rao Bagalkote,
Madhavan Srinivasan
In-Reply-To: <bd10e435-de06-4b67-962c-b520a43a8280@redhat.com>
+ folks who might be interested.
Hi Thomas,
On 09/07/26 12:16 pm, Thomas Huth wrote:
>> +++ b/powerpc/unittests.cfg
>> @@ -24,6 +24,14 @@ file = selftest-migration.elf
>> machine = pseries
>> groups = selftest migration
>> +# make a kvm-only version for CI for now
>> +# TCG accel support with Qemu and distro release used in gitlab CI
>> needs to checked.
>> +[selftest-migration-ci]
>> +file = selftest-migration.elf
>> +machine = pseries
>> +groups = nodefault selftest migration
>> +accel = kvm
>
> This does not make sense (or I don't understand it) - gitlab-CI
> currently only runs with TCG for the ppc64 jobs, so adding a separate
> test for this with "accel = kvm" just adds a job there that will always
> be skipped. What should this be good for?
I understand it may get skipped in gitlab CI for kvm-unit-tests,
but it might be helpful to those who can run it on their Power HW.
If the job can safely skip on non-ppc HW, I hope it's fine?
We would like to get it integrated in IBM's internal CI with Power HW.
Chinmay,
Could you please share logs of running these tests with kvm accel on
Power HW? Thanks!
regards,
Harsh
^ permalink raw reply
* Re: [kvm-unit-tests PATCH 4/6] powerpc: gitlab CI update
From: Thomas Huth @ 2026-07-09 15:16 UTC (permalink / raw)
To: Harsh Prateek Bora, Chinmay Rath
Cc: npiggin, lvivier, linuxppc-dev, kvm, andrew.jones, sbhat,
Misbah Anjum N, Anushree Mathur, Venkat Rao Bagalkote,
Madhavan Srinivasan
In-Reply-To: <8c9b739c-8a9b-4e9a-8e43-7b1a6e1aa330@linux.ibm.com>
On 09/07/2026 16.32, Harsh Prateek Bora wrote:
> + folks who might be interested.
>
> Hi Thomas,
>
> On 09/07/26 12:16 pm, Thomas Huth wrote:
>>> +++ b/powerpc/unittests.cfg
>>> @@ -24,6 +24,14 @@ file = selftest-migration.elf
>>> machine = pseries
>>> groups = selftest migration
>>> +# make a kvm-only version for CI for now
>>> +# TCG accel support with Qemu and distro release used in gitlab CI needs
>>> to checked.
>>> +[selftest-migration-ci]
>>> +file = selftest-migration.elf
>>> +machine = pseries
>>> +groups = nodefault selftest migration
>>> +accel = kvm
>>
>> This does not make sense (or I don't understand it) - gitlab-CI currently
>> only runs with TCG for the ppc64 jobs, so adding a separate test for this
>> with "accel = kvm" just adds a job there that will always be skipped. What
>> should this be good for?
>
> I understand it may get skipped in gitlab CI for kvm-unit-tests,
> but it might be helpful to those who can run it on their Power HW.
> If the job can safely skip on non-ppc HW, I hope it's fine?
> We would like to get it integrated in IBM's internal CI with Power HW.
You mean you also use a gitlab instance internally within IBM? ... otherwise
it does not make sense to add this to the .gitlab-ci.yml file (which you did
earlier in this patch).
Thomas
^ permalink raw reply
* Re: [RFC PATCH 0/6] selftests/vfio: Add sPAPR TCE v2 coverage
From: David Matlack @ 2026-07-09 15:51 UTC (permalink / raw)
To: Narayana Murty N
Cc: alex, shuah, amastro, rananta, kvm, linux-kselftest, linux-kernel,
vaibhav, sbhat, harshpb, linuxppc-dev
In-Reply-To: <afb9bf4d-2258-4731-a28e-7f4eaa01ee0b@linux.ibm.com>
On Thu, Jul 9, 2026 at 1:49 AM Narayana Murty N <nnmlinux@linux.ibm.com> wrote:
> >> Feedback is requested from the VFIO and PowerPC communities on:
> >> 1. whether the sPAPR TCE v2 helpers should remain in the common VFIO
> >> selftest library or move into a sPAPR-specific test helper?
> > Responded in the patch. Let's move to their own file.
> Will do. v2 will have:
>
> lib/iommu_spapr.c — all sPAPR logic, compiled only on powerpc
> lib/iommu_spapr_stub.c — empty stubs returning -EOPNOTSUPP,
> compiled on all other architectures
> lib/include/libvfio/iommu_spapr.h — declarations
Just one small thing here: You can put all the stubs in iommu_spapr.h
as static inlines, then you don't need the extra C file. e.g.
#ifdef __powerpc__
... prototypes ...
#else
... static inline stubs ...
#endif
^ permalink raw reply
* Re: [PATCH] powerpc/prom: Remove redundant early_init_dt_scan_root() call
From: Ritesh Harjani @ 2026-07-09 15:54 UTC (permalink / raw)
To: Sourabh Jain, linuxppc-dev
Cc: Sourabh Jain, Aditya Gupta, Christophe Leroy (CS GROUP),
Hari Bathini, Madhavan Srinivasan, Mahesh Salgaonkar,
Michael Ellerman, Nicholas Piggin, Shivang Upadhyay,
Venkat Rao Bagalkote, linux-kernel
In-Reply-To: <20260418091250.134111-1-sourabhjain@linux.ibm.com>
Sourabh Jain <sourabhjain@linux.ibm.com> writes:
> Commit 554b66233623 ("of/fdt: Scan the root node properties earlier")
> moved the invocation of early_init_dt_scan_root() into
> early_init_dt_verify().
>
> early_init_devtree() already calls early_init_dt_verify(), so the root
> node properties are parsed before reaching the explicit call in this
> function.
>
> Keeping the call here results in scanning the root node twice. Remove
> the redundant call and rely on the invocation from
> early_init_dt_verify().
>
> This change keeps the behavior the same and removes an unnecessary
> duplicate call.
>
yup. Nice catch! LGTM. Feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
^ permalink raw reply
* Re: [kvm-unit-tests PATCH 4/6] powerpc: gitlab CI update
From: Harsh Prateek Bora @ 2026-07-09 16:08 UTC (permalink / raw)
To: Thomas Huth, Chinmay Rath
Cc: npiggin, lvivier, linuxppc-dev, kvm, andrew.jones, sbhat,
Misbah Anjum N, Anushree Mathur, Venkat Rao Bagalkote,
Madhavan Srinivasan
In-Reply-To: <73573868-2fb9-445d-b5c6-02166a0feb25@redhat.com>
On 09/07/26 8:46 pm, Thomas Huth wrote:
> On 09/07/2026 16.32, Harsh Prateek Bora wrote:
>> + folks who might be interested.
>>
>> Hi Thomas,
>>
>> On 09/07/26 12:16 pm, Thomas Huth wrote:
>>>> +++ b/powerpc/unittests.cfg
>>>> @@ -24,6 +24,14 @@ file = selftest-migration.elf
>>>> machine = pseries
>>>> groups = selftest migration
>>>> +# make a kvm-only version for CI for now
>>>> +# TCG accel support with Qemu and distro release used in gitlab CI
>>>> needs to checked.
>>>> +[selftest-migration-ci]
>>>> +file = selftest-migration.elf
>>>> +machine = pseries
>>>> +groups = nodefault selftest migration
>>>> +accel = kvm
>>>
>>> This does not make sense (or I don't understand it) - gitlab-CI
>>> currently only runs with TCG for the ppc64 jobs, so adding a separate
>>> test for this with "accel = kvm" just adds a job there that will
>>> always be skipped. What should this be good for?
>>
>> I understand it may get skipped in gitlab CI for kvm-unit-tests,
>> but it might be helpful to those who can run it on their Power HW.
>> If the job can safely skip on non-ppc HW, I hope it's fine?
>> We would like to get it integrated in IBM's internal CI with Power HW.
> You mean you also use a gitlab instance internally within IBM? ...
> otherwise it does not make sense to add this to the .gitlab-ci.yml file
> (which you did earlier in this patch).
I do not think we currently use a gitlab runner as of now, but that's a
future possibility.
Chinmay,
My understanding is that we wanted to use kvm accel also when executed
manually using scripts, as we wanted it to be integrated in IBM's
internal CI that runs on Power HW. Do we need additional changes for that?
regards,
Harsh
>
> Thomas
>
^ permalink raw reply
* Re: [patch 11/18] seccomp, treewide: Rename and convert __secure_computing() to return boolean
From: Kees Cook @ 2026-07-09 16:22 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Mark Rutland, Jinjie Ruan, Andy Lutomirski,
Oleg Nesterov, Richard Henderson, Russell King, Catalin Marinas,
Guo Ren, Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Michael Ellerman,
Shrikanth Hegde, linuxppc-dev, Huacai Chen, loongarch,
Paul Walmsley, Palmer Dabbelt, linux-riscv, Sven Schnelle,
linux-s390, x86, Arnd Bergmann, Vineet Gupta, Will Deacon,
Brian Cain, Michal Simek, Dinh Nguyen, David S. Miller,
Andreas Larsson, linux-snps-arc, linux-hexagon, linux-openrisc,
sparclinux, linux-arch, Michal Suchánek, Jonathan Corbet,
linux-doc
In-Reply-To: <20260707190254.230735780@kernel.org>
On Tue, Jul 07, 2026 at 09:06:40PM +0200, Thomas Gleixner wrote:
> From: Jinjie Ruan <ruanjinjie@huawei.com>
>
> The return value of __secure_computing() currently uses 0 to indicate
> that a system call should be allowed, and -1 to indicate that it should
> be blocked/killed. This 0/-1 pattern is non-intuitive for a security
> check function and makes the control flow at the call sites less readable.
Conceptually, I'm good with this. Just make sure that the
tools/testing/selftests/seccomp/seccomp_bpf tests still passes. :)
--
Kees Cook
^ permalink raw reply
* Re: [patch 02/18] randomize_kstack: Provide add_random_kstack_offset_irqsoff()
From: Kees Cook @ 2026-07-09 16:23 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Michael Ellerman, Shrikanth Hegde,
linuxppc-dev, Huacai Chen, loongarch, Paul Walmsley,
Palmer Dabbelt, linux-riscv, Sven Schnelle, linux-s390, x86,
Mark Rutland, Jinjie Ruan, Andy Lutomirski, Oleg Nesterov,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Michal Suchánek,
Jonathan Corbet, linux-doc
In-Reply-To: <20260707190253.768842729@kernel.org>
On Tue, Jul 07, 2026 at 09:06:02PM +0200, Thomas Gleixner wrote:
> add_random_kstack_offset() uses get/put_cpu_var() which is pointless
> overhead when it is invoked from low level entry code with interrupts
> disabled.
>
> Provide a irqsoff() variant, which avoids that.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Seems good. I don't think macro'izing the interior is worth it since
both cases are very short, with only the lockdep and raw bits changed.
Reviewed-by: Kees Cook <kees@kernel.org>
-Kees
--
Kees Cook
^ permalink raw reply
* Re: [patch 13/18] entry: Make trace_syscall_enter() return type bool
From: David Laight @ 2026-07-09 16:26 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Michal Suchánek, LKML, Peter Zijlstra, Michael Ellerman,
Shrikanth Hegde, linuxppc-dev, Kees Cook, Huacai Chen, loongarch,
Paul Walmsley, Palmer Dabbelt, linux-riscv, Sven Schnelle,
linux-s390, x86, Mark Rutland, Jinjie Ruan, Andy Lutomirski,
Oleg Nesterov, Richard Henderson, Russell King, Catalin Marinas,
Guo Ren, Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Jonathan Corbet,
linux-doc
In-Reply-To: <87ik6pqdkf.ffs@fw13>
On Thu, 09 Jul 2026 01:14:24 +0200
Thomas Gleixner <tglx@kernel.org> wrote:
> On Wed, Jul 08 2026 at 22:34, Thomas Gleixner wrote:
> > On Wed, Jul 08 2026 at 17:52, Michal Suchánek wrote:
> > Q: Is it perfect?
> > A: No
> >
> > Q: Can it be made perfect?
> > A: No, because you can't change history and established practice.
> >
> > Just for illustration. Changing the logic in trace_syscall_enter() to:
> >
> > --- a/kernel/entry/syscall-common.c
> > +++ b/kernel/entry/syscall-common.c
> > @@ -9,13 +9,15 @@
> >
> > bool trace_syscall_enter(struct pt_regs *regs, long *syscall)
> > {
> > + long orig_syscall = *syscall;
> > +
> > trace_sys_enter(regs, *syscall);
> > /*
> > * Probes or BPF hooks in the tracepoint may have changed the
> > * system call number. Reread it.
> > */
> > *syscall = syscall_get_nr(current, regs);
> > - return *syscall != -1L;
> > + return *syscall == orig_syscall || *syscall != -1L;
> > }
> >
> > void trace_syscall_exit(struct pt_regs *regs, long ret)
> >
> > does not make #2 magically go away. It's still the same problem whether
> > you like it or not.
>
> And just to be entirely clear, the syscall() interface has to be correct
> in the first place, but then it's all about performance.
>
> So the sequence of:
>
> pt_regs = PUSH_REGS();
> syscall = pt_regs->syscall_reg;
> pt_regs->result = -ENOSYS;
>
> arch_syscall(pt_regs, syscall) {
> if (likely(syscall_enter_from_user_mode(pt_regs, &syscall) {
I guess most architectures inline that to avoid the &syscall.
Otherwise you'd want:
syscall = syscall_enter_from_user_mode(pt_regs, syscall);
with the 'error' return being selected to fail the test below
(which -1L converted to ~0UL will do nicely).
David
> if (syscall < SYSCALL_max)
> pt_regs->result = invoke_syscall(pt_regs, syscall);
> }
> ,,,,
> }
> pt_regs->($RETURN_VALUE) = pt_regs->result;
> POP_REGS();
> return;
>
> is the correct and obviuosly most efficient way idependent of the -1L
> return value overload in the original implementation, which this series
> gets rid of for clarity.
>
> If an architecture decide[sd] to do otherwise and makes up it's own rules
> which only cover parts of the problem then it _is_ an architecture
> problem and not something which has to be solved by claiming that every
> architecture has to implement the same nonsense as you falsely claimed
> in your RFC^WPOC^Whack thread:
>
> "However, the API should be specified in a way that does not require
> everyone implementing such flag."
>
> There is _ZERO_ requirement for any architecture to implement that
> flag. Just because S390 decided it's a brilliant idea to do so does not
> make it a requirement for everyone.
>
> No. Every other architecture got it right because they looked at the
> historical patterns despite having correct documentation at hand.
>
> Feel free to prove me wrong with actual facts.
>
> Thanks,
>
> tglx
>
^ permalink raw reply
* Re: [kvm-unit-tests PATCH 4/6] powerpc: gitlab CI update
From: Thomas Huth @ 2026-07-09 16:33 UTC (permalink / raw)
To: Harsh Prateek Bora, Chinmay Rath
Cc: npiggin, lvivier, linuxppc-dev, kvm, andrew.jones, sbhat,
Misbah Anjum N, Anushree Mathur, Venkat Rao Bagalkote,
Madhavan Srinivasan
In-Reply-To: <4dd23a35-8dcc-422c-8ffa-2387abf92558@linux.ibm.com>
On 09/07/2026 18.08, Harsh Prateek Bora wrote:
>
>
> On 09/07/26 8:46 pm, Thomas Huth wrote:
>> On 09/07/2026 16.32, Harsh Prateek Bora wrote:
>>> + folks who might be interested.
>>>
>>> Hi Thomas,
>>>
>>> On 09/07/26 12:16 pm, Thomas Huth wrote:
>>>>> +++ b/powerpc/unittests.cfg
>>>>> @@ -24,6 +24,14 @@ file = selftest-migration.elf
>>>>> machine = pseries
>>>>> groups = selftest migration
>>>>> +# make a kvm-only version for CI for now
>>>>> +# TCG accel support with Qemu and distro release used in gitlab CI
>>>>> needs to checked.
>>>>> +[selftest-migration-ci]
>>>>> +file = selftest-migration.elf
>>>>> +machine = pseries
>>>>> +groups = nodefault selftest migration
>>>>> +accel = kvm
>>>>
>>>> This does not make sense (or I don't understand it) - gitlab-CI
>>>> currently only runs with TCG for the ppc64 jobs, so adding a separate
>>>> test for this with "accel = kvm" just adds a job there that will always
>>>> be skipped. What should this be good for?
>>>
>>> I understand it may get skipped in gitlab CI for kvm-unit-tests,
>>> but it might be helpful to those who can run it on their Power HW.
>>> If the job can safely skip on non-ppc HW, I hope it's fine?
>>> We would like to get it integrated in IBM's internal CI with Power HW.
>> You mean you also use a gitlab instance internally within IBM? ...
>> otherwise it does not make sense to add this to the .gitlab-ci.yml file
>> (which you did earlier in this patch).
>
> I do not think we currently use a gitlab runner as of now, but that's a
> future possibility.
Ok, then please remove the related entries from .gitlab-ci.yml again.
> Chinmay,
> My understanding is that we wanted to use kvm accel also when executed
> manually using scripts, as we wanted it to be integrated in IBM's
> internal CI that runs on Power HW. Do we need additional changes for that?
KVM unit tests run by default with KVM, so you don't need an extra entry for
this in the unittest.cfg file, I think.
Thomas
^ permalink raw reply
* Re: [PATCH v2 00/10] soc: fsl: qe: QE PIC improvement and add support of IRQs to QUICC ENGINE GPIOs
From: Christophe Leroy (CS GROUP) @ 2026-07-09 16:47 UTC (permalink / raw)
To: Paul Louvel, Qiang Zhao, Thomas Gleixner, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Linus Walleij,
Bartosz Golaszewski, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin
Cc: linuxppc-dev, linux-arm-kernel, linux-kernel, devicetree,
linux-gpio, Herve Codina, stable, Krzysztof Kozlowski
In-Reply-To: <20260708-qe-pic-gpios-v2-0-1972044cfbd1@bootlin.com>
Le 08/07/2026 à 12:15, Paul Louvel a écrit :
> This series modernizes the QUICC Engine Port Interrupt Controller (QE
> PIC) driver and adds the ability for QE GPIO pins to generate interrupts
> through the QE PIC, completing Christophe Leroy's prior work [1].
>
> Christophe's series was partially merged; patches 4, 6 and 7 did not
> make it to mainline.
>
> The series is organized in three parts:
>
> 1) Add missing chained_irq_{enter,exit}() calls
>
> - In a chained handler, the parent controller need to mask and ack
> the interrupt source.
>
> 2) DT binding updates
>
> - Update #interrupt-cells from 1 to 2 in the QE PIC binding so
> consumers can encode the interrupt type (falling-edge or
> both-edges).
>
> - Convert the QE GPIO binding from freeform text to DT schema.
>
> - Extend the QE GPIO binding with an interrupt-map (nexus node) that
> maps GPIO lines to parent QE PIC interrupts. This approach was
> suggested by Rob Herring [2] as an alternative to using compatible
> strings and driver data to specify which pins support interrupts in
> a given bank.
>
> 3) QE PIC driver refactoring
>
> - The QE PIC is a perfect fit to use the generic irq framework
> instead. Perform the necessary changes to the driver to convert it.
>
> - Minor cleanups.
>
> 4) QE GPIO interrupt support
>
> - Add a to_irq() method to the QE GPIO driver that perform the
> mapping of the GPIO pin to the parent interrupt domain, allowing
> GPIO pins to be used as interrupt sources through the QE PIC via
> gpio_to_irq().
>
> [1] https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2Fcover.1758212309.git.christophe.leroy%40csgroup.eu%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C1e59449bc6904ae4c2a808dedcd9e3e4%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639191025561275310%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=SgmsHETiol22Fip%2FU04XAAKihuQ4UtGfIqUU8t%2FMTpI%3D&reserved=0
> [2] https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2F20250919152414.GB852815-robh%40kernel.org%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C1e59449bc6904ae4c2a808dedcd9e3e4%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639191025561303589%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=t%2B83hXaaY147CW1fvLA7ATUHJXDkfq6jLv5OWRr9ABI%3D&reserved=0
>
> Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
>
> ---
> Changes in v2:
> - Applied Christophe two patches before this series [3] [4].
> - Fix a miscalculation in patch 6 when iterating over bits set in
> CEPIER. Old ffs() is 1-indexed, but for_each_set_bit() is 0-indexed.
> - Add in patch 3 commit message more info about the changes introduced
> by the conversion to DT schema.
> - In patch 4, keep the existing example without any IRQ supports, and
> add only one new example. Also fix the DTS coding style that was wrong.
> - Add raw spinlock guard to mask and unmasking hook since multiple CPUs
> can modify different IRQs concurrently. Also add it to set_type hook.
> - Drop usage of register offset in irq_chip_type. It requires additional
> load instruction with no real benefit since irq_gc_* functions are not
> used.
> - A race condition can occurs if an interrupt fires immediately after
> the domain is initialised, because gc is NULL.
> Instead, do not carry gc in the struct qepic_data. Add the domain in
> the handler data, and retrieve gc with irq_data_get_irq_chip_data() in
> hook functions.
> Because of this modification, patch 10 and 11 are dropped.
> - Link to v1: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch.msgid.link%2F20260703-qe-pic-gpios-v1-0-6c3e706e27dc%40bootlin.com&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C1e59449bc6904ae4c2a808dedcd9e3e4%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639191025561327333%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=fSy9tyhbYvMFKNFQsqGikR3llkOgaLXFMv6sGt4UPXg%3D&reserved=0
>
> [3] https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2Fb08f76c1d8ff864774246f1e2c2158c223c001be.1783435914.git.chleroy%40kernel.org%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C1e59449bc6904ae4c2a808dedcd9e3e4%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639191025561348477%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=JDjk7SvhF1cJGAI8xnVtECrKn1m6ZhmHeNO860rQhwo%3D&reserved=0
> [4] https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fall%2Fcd46aec4b325745d38ac7992e4d3d5b4f4c4e95f.1783435914.git.chleroy%40kernel.org%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C1e59449bc6904ae4c2a808dedcd9e3e4%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639191025561367590%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=sYCT9QzjBWVowv%2BEgbvSiYe0qVdWGZV4vGwgIGAwQhg%3D&reserved=0
>
> ---
> Christophe Leroy (1):
> dt-bindings: soc: fsl: qe: Convert QE GPIO to DT schema
>
> Paul Louvel (9):
> soc: fsl: qe: Add chained_irq_{enter,exit}() calls in cascade handler
> dt-bindings: soc: fsl: qe: Set #interrupt-cells to 2 to support interrupt type encoding
> dt-bindings: soc: fsl: qe: Add support of IRQ in QE GPIO
> soc: fsl: qe: Use generic_handle_domain_irq()
> soc: fsl: qe: Iterate over all pending interrupts in cascade handler
> soc: fsl: qe: Handle spurious interrupts
> soc: fsl: qe: Convert to generic IRQ chip
> soc: fsl: qe: Rename irq variable to parent_irq
> soc: fsl: qe: Add support of IRQs in QE GPIO
>
> .../bindings/gpio/fsl,mpc8323-qe-pario-bank.yaml | 84 ++++++++++++
> .../interrupt-controller/fsl,qe-ports-ic.yaml | 4 +-
> .../bindings/soc/fsl/cpm_qe/qe/par_io.txt | 26 +---
> drivers/soc/fsl/qe/Kconfig | 1 +
> drivers/soc/fsl/qe/gpio.c | 28 +++-
> drivers/soc/fsl/qe/qe_ports_ic.c | 145 +++++++++++++--------
> 6 files changed, 208 insertions(+), 80 deletions(-)
> ---
> base-commit: c34b47a17bc566c7113679e6ae095d5510b4f1c6
> change-id: 20260513-qe-pic-gpios-073e284615a3
>
> Best regards,
> --
> Paul Louvel, Bootlin
> Embedded Linux and Kernel engineering
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbootlin.com%2F&data=05%7C02%7Cchristophe.leroy%40csgroup.eu%7C1e59449bc6904ae4c2a808dedcd9e3e4%7C8b87af7d86474dc78df45f69a2011bb5%7C0%7C0%7C639191025561386837%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=EMKgQXFWGtGS8OwHXgqIB7IH3cWQVA0ZJA%2B2emFlI1E%3D&reserved=0
>
^ permalink raw reply
* Re: [PATCH 1/1] powerpc/crash: stop watchdogs before booting kdump kernel
From: Ritesh Harjani @ 2026-07-09 16:31 UTC (permalink / raw)
To: Sourabh Jain, linuxppc-dev, maddy, mpe
Cc: npiggin, chleroy, shivangu, hbathini, mahesh, adityag, venkat88,
sourabhjain, stable, Mahesh Kumar G
In-Reply-To: <20260603070217.483696-2-sourabhjain@linux.ibm.com>
Sourabh Jain <sourabhjain@linux.ibm.com> writes:
> On pseries LPAR systems, watchdog timers configured from userspace
> can remain active after a kernel panic. During panic triggered crash
> dump capture, the crashing kernel jumps directly to the kdump kernel
> without shutting down userspace services. As a result, active
> watchdogs are not stopped before entering the kdump kernel.
>
> If dump capture takes longer than the watchdog timeout, PHYP resets
> the LPAR before dump collection completes, resulting in dump capture
> failure.
>
> Fix this by issuing the H_WATCHDOG hcall on the crash shutdown path
> to stop all active watchdogs before booting the kdump kernel.
>
Nice catch!
> Fixes: 69472ffa6575 ("watchdog/pseries-wdt: initial support for H_WATCHDOG-based watchdog timers")
> Reported-by: Mahesh Kumar G <mahe657@linux.ibm.com>
> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
> ---
> arch/powerpc/kexec/crash.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c
> index e6539f213b3d..5651523e3a70 100644
> --- a/arch/powerpc/kexec/crash.c
> +++ b/arch/powerpc/kexec/crash.c
> @@ -28,6 +28,7 @@
> #include <asm/interrupt.h>
> #include <asm/kexec_ranges.h>
> #include <asm/crashdump-ppc64.h>
> +#include <asm/hvcall.h>
>
would be nice, if we could avoid papr specific header into common crash.c
> /*
> * The primary CPU waits a while for all secondary CPUs to enter. This is to
> @@ -352,6 +353,28 @@ int crash_shutdown_unregister(crash_shutdown_t handler)
> }
> EXPORT_SYMBOL(crash_shutdown_unregister);
>
> +/**
> + * stop_watchdogs - Stop active watchdogs before entering kdump kernel
> + * On pseries LPAR systems, watchdogs configured from userspace remain
> + * active after a kernel panic because userspace services are not shut
> + * down on the kdump crash path. If a watchdog expires while the kdump
> + * kernel is collecting the dump, PHYP resets the LPAR and dump capture
> + * fails
> + *
> + * 0x200UL : watchdog stop operation
> + * -1 : watchdog number, disable all watchdogs
> + */
> +static void stop_watchdogs(void)
> +{
> + if (firmware_has_feature(FW_FEATURE_LPAR)) {
> + int rc;
ditto.
Also I guess this could be FW_FEATURE_WATCHDOG
> +
> + rc = plpar_hcall_norets_notrace(H_WATCHDOG, 0x200UL, -1);
- 0x200 is hardcoded.
- -1 is hardcoded.
- I think it's return value is long.
> + if (rc != H_SUCCESS && rc != H_NOOP)
> + pr_warn("crash: failed to stop watchdogs\n");
Let's print rc as well.
> + }
> +}
> +
Looking at the code, we already have a mechanism to register a crash
shutdown handler which anyways is getting called from
default_machine_crash_shutdown(). So, I think we could use this generic
crash handler register mechanism and keep the wdt specific calls within
pseries/setup.c file...
...How about something like this?
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 50b26ed8432d..4e557694d724 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -59,6 +59,7 @@
#include <asm/xics.h>
#include <asm/xive.h>
#include <asm/papr-sysparm.h>
+#include <asm/papr-watchdog.h>
#include <asm/ppc-pci.h>
#include <asm/i8259.h>
#include <asm/udbg.h>
@@ -185,14 +186,42 @@ static void __init fwnmi_init(void)
#endif
}
<...>
+static void pseries_crash_stop_watchdogs(void)
+{
+ long rc;
+
+ rc = plpar_hcall_norets_notrace(H_WATCHDOG, PSERIES_WDTF_OP_STOP,
+ PSERIES_WDT_NUM_ALL);
+ if (rc != H_SUCCESS && rc != H_NOOP)
+ pr_warn("Could not stop watchdogs before kdump rc=%ld\n", rc);
+}
+
/*
* Affix a device for the first timer to the platform bus if
* we have firmware support for the H_WATCHDOG hypercall.
*/
static __init int pseries_wdt_init(void)
{
- if (firmware_has_feature(FW_FEATURE_WATCHDOG))
- platform_device_register_simple("pseries-wdt", 0, NULL, 0);
+ if (!firmware_has_feature(FW_FEATURE_WATCHDOG))
+ return 0;
+
+ platform_device_register_simple("pseries-wdt", 0, NULL, 0);
+
+ if (crash_shutdown_register(pseries_crash_stop_watchdogs))
+ pr_warn("Could not register watchdog crash shutdown handler\n");
+
return 0;
}
machine_subsys_initcall(pseries, pseries_wdt_init);
Note that I added papr-watchdog.h header file in above. I am guessing we
can move some definitions from drivers/watchdog/pseries-wdt.c to
arch/powerpc/include/asm/papr-watchdog.h in a separate patch before this
change.
I think you get the idea. Can you try this way and let me know if this works?
-ritesh
> void default_machine_crash_shutdown(struct pt_regs *regs)
> {
> volatile unsigned int i;
> @@ -360,6 +383,8 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
> if (TRAP(regs) == INTERRUPT_SYSTEM_RESET)
> is_via_system_reset = 1;
>
> + stop_watchdogs();
> +
> if (IS_ENABLED(CONFIG_SMP))
> crash_smp_send_stop();
> else
> --
> 2.52.0
^ permalink raw reply related
* Re: [patch 12/18] ptrace, treewide: Rename ptrace_report_syscall_entry() to ptrace_report_syscall_permit_entry()
From: Radu Rendec @ 2026-07-09 17:03 UTC (permalink / raw)
To: Thomas Gleixner, LKML
Cc: Peter Zijlstra, Arnd Bergmann, Oleg Nesterov, Richard Henderson,
Vineet Gupta, Russell King, Catalin Marinas, Will Deacon, Guo Ren,
Brian Cain, Geert Uytterhoeven, Michal Simek, Thomas Bogendoerfer,
Dinh Nguyen, Helge Deller, Yoshinori Sato, David S. Miller,
Andreas Larsson, Chris Zankel, linux-alpha, linux-snps-arc,
linux-arm-kernel, linux-csky, linux-hexagon, linux-m68k,
linux-mips, linux-openrisc, linux-parisc, linux-sh, sparclinux,
linux-um, linux-arch, Michael Ellerman, Shrikanth Hegde,
linuxppc-dev, Kees Cook, Huacai Chen, loongarch, Paul Walmsley,
Palmer Dabbelt, linux-riscv, Sven Schnelle, linux-s390, x86,
Mark Rutland, Jinjie Ruan, Andy Lutomirski, Richard Weinberger,
Michal Suchánek, Jonathan Corbet, linux-doc
In-Reply-To: <20260707190254.280015701@kernel.org>
On Tue, 2026-07-07 at 21:06 +0200, Thomas Gleixner wrote:
> The return value of that function is boolean and tells the caller whether
> to permit the syscall processing or not.
>
> Rename the function so the purpose is clear and make the return type bool.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Vineet Gupta <vgupta@kernel.org>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Guo Ren <guoren@kernel.org>
> Cc: Brian Cain <bcain@kernel.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Dinh Nguyen <dinguyen@kernel.org>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Andreas Larsson <andreas@gaisler.com>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: linux-alpha@vger.kernel.org
> Cc: linux-snps-arc@lists.infradead.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-csky@vger.kernel.org
> Cc: linux-hexagon@vger.kernel.org
> Cc: linux-m68k@lists.linux-m68k.org
> Cc: linux-mips@vger.kernel.org
> Cc: linux-openrisc@vger.kernel.org
> Cc: linux-parisc@vger.kernel.org
> Cc: linux-sh@vger.kernel.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-um@lists.infradead.org
> Cc: linux-arch@vger.kernel.org
> ---
> arch/alpha/kernel/ptrace.c | 2 +-
> arch/arc/kernel/ptrace.c | 2 +-
> arch/arm/kernel/ptrace.c | 2 +-
> arch/arm64/kernel/ptrace.c | 2 +-
> arch/csky/kernel/ptrace.c | 2 +-
> arch/hexagon/kernel/traps.c | 2 +-
> arch/m68k/kernel/ptrace.c | 2 +-
> arch/microblaze/kernel/ptrace.c | 2 +-
> arch/mips/kernel/ptrace.c | 2 +-
> arch/nios2/kernel/ptrace.c | 2 +-
> arch/openrisc/kernel/ptrace.c | 2 +-
> arch/parisc/kernel/ptrace.c | 10 ++++------
> arch/sh/kernel/ptrace_32.c | 2 +-
> arch/sparc/kernel/ptrace_32.c | 2 +-
> arch/sparc/kernel/ptrace_64.c | 2 +-
> arch/um/kernel/ptrace.c | 2 +-
> arch/xtensa/kernel/ptrace.c | 2 +-
> include/asm-generic/syscall.h | 4 ++--
> include/linux/entry-common.h | 25 ++++++++++++-------------
> include/linux/ptrace.h | 13 ++++++-------
> 20 files changed, 40 insertions(+), 44 deletions(-)
>
> --- a/arch/alpha/kernel/ptrace.c
> +++ b/arch/alpha/kernel/ptrace.c
> @@ -375,7 +375,7 @@ asmlinkage unsigned long syscall_trace_e
> struct pt_regs *regs = current_pt_regs();
>
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs)) {
> + !ptrace_report_syscall_permit_entry(regs)) {
> syscall_set_nr(current, regs, -1);
> if (regs->r19 == 0 && regs->r0 == (unsigned long)-1)
> syscall_set_return_value(current, regs, -ENOSYS, 0);
> --- a/arch/arc/kernel/ptrace.c
> +++ b/arch/arc/kernel/ptrace.c
> @@ -342,7 +342,7 @@ long arch_ptrace(struct task_struct *chi
> asmlinkage int syscall_trace_enter(struct pt_regs *regs)
> {
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - if (ptrace_report_syscall_entry(regs))
> + if (!ptrace_report_syscall_permit_entry(regs))
> return ULONG_MAX;
>
> #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
> --- a/arch/arm/kernel/ptrace.c
> +++ b/arch/arm/kernel/ptrace.c
> @@ -840,7 +840,7 @@ static void report_syscall(struct pt_reg
>
> if (dir == PTRACE_SYSCALL_EXIT)
> ptrace_report_syscall_exit(regs, 0);
> - else if (ptrace_report_syscall_entry(regs))
> + else if (!ptrace_report_syscall_permit_entry(regs))
> current_thread_info()->abi_syscall = -1;
>
> regs->ARM_ip = ip;
> --- a/arch/arm64/kernel/ptrace.c
> +++ b/arch/arm64/kernel/ptrace.c
> @@ -2379,7 +2379,7 @@ static int report_syscall_entry(struct p
> int regno, ret;
>
> saved_reg = ptrace_save_reg(regs, PTRACE_SYSCALL_ENTER, ®no);
> - ret = ptrace_report_syscall_entry(regs);
> + ret = !ptrace_report_syscall_permit_entry(regs);
> if (ret)
> forget_syscall(regs);
> regs->regs[regno] = saved_reg;
> --- a/arch/csky/kernel/ptrace.c
> +++ b/arch/csky/kernel/ptrace.c
> @@ -320,7 +320,7 @@ long arch_ptrace(struct task_struct *chi
> asmlinkage int syscall_trace_enter(struct pt_regs *regs)
> {
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - if (ptrace_report_syscall_entry(regs))
> + if (!ptrace_report_syscall_permit_entry(regs))
> return -1;
>
> if (!seccomp_permit_syscall())
> --- a/arch/hexagon/kernel/traps.c
> +++ b/arch/hexagon/kernel/traps.c
> @@ -345,7 +345,7 @@ void do_trap0(struct pt_regs *regs)
>
> /* allow strace to catch syscall args */
> if (unlikely(test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs)))
> + !ptrace_report_syscall_permit_entry(regs)))
> return; /* return -ENOSYS somewhere? */
>
> /* Interrupts should be re-enabled for syscall processing */
> --- a/arch/m68k/kernel/ptrace.c
> +++ b/arch/m68k/kernel/ptrace.c
> @@ -279,7 +279,7 @@ asmlinkage int syscall_trace_enter(void)
> int ret = 0;
>
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - ret = ptrace_report_syscall_entry(task_pt_regs(current));
> + ret = !ptrace_report_syscall_permit_entry(task_pt_regs(current));
>
> if (!seccomp_permit_syscall())
> return -1;
> --- a/arch/microblaze/kernel/ptrace.c
> +++ b/arch/microblaze/kernel/ptrace.c
> @@ -139,7 +139,7 @@ asmlinkage unsigned long do_syscall_trac
> secure_computing_strict(regs->r12);
>
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs))
> + !ptrace_report_syscall_permit_entry(regs))
> /*
> * Tracing decided this syscall should not happen.
> * We'll return a bogus call number to get an ENOSYS
> --- a/arch/mips/kernel/ptrace.c
> +++ b/arch/mips/kernel/ptrace.c
> @@ -1324,7 +1324,7 @@ asmlinkage long syscall_trace_enter(stru
> user_exit();
>
> if (test_thread_flag(TIF_SYSCALL_TRACE)) {
> - if (ptrace_report_syscall_entry(regs))
> + if (!ptrace_report_syscall_permit_entry(regs))
> return -1;
> }
>
> --- a/arch/nios2/kernel/ptrace.c
> +++ b/arch/nios2/kernel/ptrace.c
> @@ -133,7 +133,7 @@ asmlinkage int do_syscall_trace_enter(vo
> int ret = 0;
>
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - ret = ptrace_report_syscall_entry(task_pt_regs(current));
> + ret = !ptrace_report_syscall_permit_entry(task_pt_regs(current));
>
> return ret;
> }
> --- a/arch/openrisc/kernel/ptrace.c
> +++ b/arch/openrisc/kernel/ptrace.c
> @@ -293,7 +293,7 @@ asmlinkage long do_syscall_trace_enter(s
> long ret = 0;
>
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs))
> + !ptrace_report_syscall_permit_entry(regs))
> /*
> * Tracing decided this syscall should not happen.
> * We'll return a bogus call number to get an ENOSYS
> --- a/arch/parisc/kernel/ptrace.c
> +++ b/arch/parisc/kernel/ptrace.c
> @@ -326,7 +326,7 @@ long compat_arch_ptrace(struct task_stru
> long do_syscall_trace_enter(struct pt_regs *regs)
> {
> if (test_thread_flag(TIF_SYSCALL_TRACE)) {
> - int rc = ptrace_report_syscall_entry(regs);
> + bool permit = ptrace_report_syscall_permit_entry(regs);
>
> /*
> * As tracesys_next does not set %r28 to -ENOSYS
> @@ -334,12 +334,10 @@ long do_syscall_trace_enter(struct pt_re
> */
> regs->gr[28] = -ENOSYS;
>
> - if (rc) {
> + if (!permit) {
> /*
> - * A nonzero return code from
> - * ptrace_report_syscall_entry() tells us
> - * to prevent the syscall execution. Skip
> - * the syscall call and the syscall restart handling.
> + * Skip the syscall call and the syscall restart
> + * handling.
> *
> * Note that the tracer may also just change
> * regs->gr[20] to an invalid syscall number,
> --- a/arch/sh/kernel/ptrace_32.c
> +++ b/arch/sh/kernel/ptrace_32.c
> @@ -455,7 +455,7 @@ long arch_ptrace(struct task_struct *chi
> asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
> {
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs)) {
> + !ptrace_report_syscall_permit_entry(regs)) {
> regs->regs[0] = -ENOSYS;
> return -1;
> }
> --- a/arch/sparc/kernel/ptrace_32.c
> +++ b/arch/sparc/kernel/ptrace_32.c
> @@ -441,7 +441,7 @@ asmlinkage int syscall_trace(struct pt_r
> if (syscall_exit_p)
> ptrace_report_syscall_exit(regs, 0);
> else
> - ret = ptrace_report_syscall_entry(regs);
> + ret = !ptrace_report_syscall_permit_entry(regs);
> }
>
> return ret;
> --- a/arch/sparc/kernel/ptrace_64.c
> +++ b/arch/sparc/kernel/ptrace_64.c
> @@ -1093,7 +1093,7 @@ asmlinkage int syscall_trace_enter(struc
> user_exit();
>
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> - ret = ptrace_report_syscall_entry(regs);
> + ret = !ptrace_report_syscall_permit_entry(regs);
>
> if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
> trace_sys_enter(regs, regs->u_regs[UREG_G1]);
> --- a/arch/um/kernel/ptrace.c
> +++ b/arch/um/kernel/ptrace.c
> @@ -135,7 +135,7 @@ int syscall_trace_enter(struct pt_regs *
> if (!test_thread_flag(TIF_SYSCALL_TRACE))
> return 0;
>
> - return ptrace_report_syscall_entry(regs);
> + return !ptrace_report_syscall_permit_entry(regs);
> }
>
> void syscall_trace_leave(struct pt_regs *regs)
> --- a/arch/xtensa/kernel/ptrace.c
> +++ b/arch/xtensa/kernel/ptrace.c
> @@ -547,7 +547,7 @@ int do_syscall_trace_enter(struct pt_reg
> regs->areg[2] = -ENOSYS;
>
> if (test_thread_flag(TIF_SYSCALL_TRACE) &&
> - ptrace_report_syscall_entry(regs)) {
> + !ptrace_report_syscall_permit_entry(regs)) {
> regs->areg[2] = -ENOSYS;
> regs->syscall = NO_SYSCALL;
> return 0;
> --- a/include/asm-generic/syscall.h
> +++ b/include/asm-generic/syscall.h
> @@ -58,8 +58,8 @@ void syscall_set_nr(struct task_struct *
> *
> * It's only valid to call this when @task is stopped for system
> * call exit tracing (due to %SYSCALL_WORK_SYSCALL_TRACE or
> - * %SYSCALL_WORK_SYSCALL_AUDIT), after ptrace_report_syscall_entry()
> - * returned nonzero to prevent the system call from taking place.
> + * %SYSCALL_WORK_SYSCALL_AUDIT), after ptrace_report_syscall_permit_entry()
> + * returned False to prevent the system call from taking place.
> *
> * This rolls back the register state in @regs so it's as if the
> * system call instruction was a no-op. The registers containing
> --- a/include/linux/entry-common.h
> +++ b/include/linux/entry-common.h
> @@ -38,21 +38,22 @@
> SYSCALL_WORK_SYSCALL_EXIT_TRAP)
>
> /**
> - * arch_ptrace_report_syscall_entry - Architecture specific ptrace_report_syscall_entry() wrapper
> + * arch_ptrace_report_syscall_permit_entry - Architecture specific wrapper for
> + * ptrace_report_syscall_permit_entry()
> * @regs: Pointer to the register state at syscall entry
> *
> - * Invoked from syscall_trace_enter() to wrap ptrace_report_syscall_entry().
> + * Invoked from syscall_trace_enter() to wrap ptrace_report_syscall_permit_entry().
> *
> - * This allows architecture specific ptrace_report_syscall_entry()
> + * This allows architecture specific ptrace_report_syscall_permit_entry()
> * implementations. If not defined by the architecture this falls back to
> - * to ptrace_report_syscall_entry().
> + * to ptrace_report_syscall_permit_entry().
> */
> -static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs);
> +static __always_inline bool arch_ptrace_report_syscall_permit_entry(struct pt_regs *regs);
>
> -#ifndef arch_ptrace_report_syscall_entry
> -static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs)
> +#ifndef arch_ptrace_report_syscall_permit_entry
> +static __always_inline bool arch_ptrace_report_syscall_permit_entry(struct pt_regs *regs)
> {
> - return ptrace_report_syscall_entry(regs);
> + return ptrace_report_syscall_permit_entry(regs);
> }
> #endif
>
> @@ -73,8 +74,6 @@ static inline void syscall_enter_audit(s
> static __always_inline long syscall_trace_enter(struct pt_regs *regs, unsigned long work,
> long syscall)
> {
> - long ret = 0;
> -
> /*
> * Handle Syscall User Dispatch. This must comes first, since
> * the ABI here can be something that doesn't make sense for
> @@ -95,8 +94,8 @@ static __always_inline long syscall_trac
>
> /* Handle ptrace */
> if (work & (SYSCALL_WORK_SYSCALL_TRACE | SYSCALL_WORK_SYSCALL_EMU)) {
> - ret = arch_ptrace_report_syscall_entry(regs);
> - if (ret || (work & SYSCALL_WORK_SYSCALL_EMU))
> + if (!arch_ptrace_report_syscall_permit_entry(regs) ||
> + (work & SYSCALL_WORK_SYSCALL_EMU))
> return -1L;
> }
>
> @@ -137,7 +136,7 @@ static __always_inline long syscall_trac
> * It handles the following work items:
> *
> * 1) syscall_work flag dependent invocations of
> - * ptrace_report_syscall_entry(), __seccomp_permit_syscall(), trace_sys_enter()
> + * ptrace_report_syscall_permit_entry(), __seccomp_permit_syscall(), trace_sys_enter()
> * 2) Invocation of audit_syscall_entry()
> */
> static __always_inline long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall)
> --- a/include/linux/ptrace.h
> +++ b/include/linux/ptrace.h
> @@ -405,13 +405,13 @@ extern void sigaction_compat_abi(struct
> /*
> * ptrace report for syscall entry and exit looks identical.
> */
> -static inline int ptrace_report_syscall(unsigned long message)
> +static inline bool ptrace_report_syscall(unsigned long message)
> {
> int ptrace = current->ptrace;
> int signr;
>
> if (!(ptrace & PT_PTRACED))
> - return 0;
> + return true;
>
> signr = ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0),
> message);
> @@ -424,11 +424,11 @@ static inline int ptrace_report_syscall(
> if (signr)
> send_sig(signr, current, 1);
>
> - return fatal_signal_pending(current);
> + return !fatal_signal_pending(current);
> }
>
> /**
> - * ptrace_report_syscall_entry - task is about to attempt a system call
> + * ptrace_report_syscall_permit_entry - task is about to attempt a system call
> * @regs: user register state of current task
> *
> * This will be called if %SYSCALL_WORK_SYSCALL_TRACE or
> @@ -438,7 +438,7 @@ static inline int ptrace_report_syscall(
> * call number and arguments to be tried. It is safe to block here,
> * preventing the system call from beginning.
> *
> - * Returns zero normally, or nonzero if the calling arch code should abort
> + * Returns True normally, or False if the calling architecture code should abort
> * the system call. That must prevent normal entry so no system call is
> * made. If @task ever returns to user mode after this, its register state
> * is unspecified, but should be something harmless like an %ENOSYS error
> @@ -447,8 +447,7 @@ static inline int ptrace_report_syscall(
> *
> * Called without locks, just after entering kernel mode.
> */
> -static inline __must_check int ptrace_report_syscall_entry(
> - struct pt_regs *regs)
> +static inline __must_check bool ptrace_report_syscall_permit_entry(struct pt_regs *regs)
> {
> return ptrace_report_syscall(PTRACE_EVENTMSG_SYSCALL_ENTRY);
> }
Reviewed-by: Radu Rendec <radu@rendec.net>
^ permalink raw reply
* Re: [PATCH] bitmap: Properly initialise destination bitmap for scatter & gather test
From: Yury Norov @ 2026-07-09 17:31 UTC (permalink / raw)
To: Christophe Leroy (CS GROUP)
Cc: Andrew Morton, Yury Norov, Rasmus Villemoes, Andy Shevchenko,
linux-kernel, linuxppc-dev, Erhard Furtner
In-Reply-To: <67d1838732b85b1f715cc3ada5bb38dcfcf9db55.1783593992.git.chleroy@kernel.org>
On Thu, Jul 09, 2026 at 01:40:06PM +0200, Christophe Leroy (CS GROUP) wrote:
> Erhard reports failure of bitmap tests on powerpc:
>
> test_bitmap: loaded.
> test_bitmap: [lib/test_bitmap.c:397] bitmaps contents differ: expected "1,3-4,9", got "1,3-4,9,65-71,73-79,81-87,89-95,97-99"
> test_bitmap: parselist('0-2047:128/256'): 912
> test_bitmap: scnprintf("%*pbl", '0-32767'): 5977
> test_bitmap: test_bitmap_read_perf: 1191082
> test_bitmap: test_bitmap_write_perf: 1270153
> test_bitmap: failed 1 out of 208655 tests
>
> The happens mainly when CONFIG_INIT_STACK_ALL_PATTERN is set.
>
> Commit 6b5a4b687367 ("bitmap: Add test for out-of-boundary
> modifications for scatter & gather") extended the test to
> out-of-boundary bits, but those bits where left uninitialised.
>
> Properly initialise the entire result bitmap before the test.
>
> Reported-by: Erhard Furtner <erhard_f@mailbox.org>
> Closes: https://lore.kernel.org/all/ca3547ae-8b79-43a2-a758-23ec980bfd9a@mailbox.org
> Fixes: 6b5a4b687367 ("bitmap: Add test for out-of-boundary modifications for scatter & gather")
> Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Applied, thanks!
> ---
> lib/test_bitmap.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
> index 69813c10e6c0..448c3eb48a4a 100644
> --- a/lib/test_bitmap.c
> +++ b/lib/test_bitmap.c
> @@ -392,6 +392,7 @@ static void __init test_bitmap_sg(void)
>
> /* Scatter/gather relationship */
> bitmap_zero(bmap_tmp, 100);
> + bitmap_zero(bmap_res, 100);
> bitmap_gather(bmap_tmp, bmap_scatter, sg_mask, nbits);
> bitmap_scatter(bmap_res, bmap_tmp, sg_mask, nbits);
> expect_eq_bitmap(bmap_scatter, bmap_res, 100);
> --
> 2.54.0
^ permalink raw reply
* Re: [PATCH v7 16/22] dma-direct: make dma_direct_map_phys() honor DMA_ATTR_CC_SHARED
From: Jason Gunthorpe @ 2026-07-09 18:13 UTC (permalink / raw)
To: Catalin Marinas
Cc: Aneesh Kumar K.V, iommu, linux-arm-kernel, linux-kernel,
linux-coco, Robin Murphy, Marek Szyprowski, Will Deacon,
Marc Zyngier, Steven Price, Suzuki K Poulose, Jiri Pirko,
Mostafa Saleh, Petr Tesarik, Alexey Kardashevskiy, Dan Williams,
Xu Yilun, linuxppc-dev, linux-s390, Madhavan Srinivasan,
Michael Ellerman, Nicholas Piggin, Christophe Leroy (CS GROUP),
Alexander Gordeev, Gerald Schaefer, Heiko Carstens, Vasily Gorbik,
Christian Borntraeger, Sven Schnelle, x86, Jiri Pirko,
Michael Kelley
In-Reply-To: <ak-CT3oanlDfgTy4@arm.com>
On Thu, Jul 09, 2026 at 12:13:19PM +0100, Catalin Marinas wrote:
> > > For AMD/SME, on host with memory encryption we now end up setting the C
> > > bit for DMA_ATTR_MMIO. This is fine for RAM but not sure whether
> > > some other MMIO bus understands this attribute. Maybe we should stick to
> > > something like __phys_to_dma() for the !CC_SHARED && MMIO path. Or,
> > > since this is not universally defined, just use the old dma_addr = phys
> > > if MMIO and ignore any unlikely DMA offsets.
> > >
> >
> > Considering for AMD/SME system an unencrypted dma addr is one without C
> > bit, will this be good?
> >
> > /*
> > * For host memory encryption and device requiring unencrypted DMA,
> > * MMIO memory is treated as shared by default.
> > */
> > if (attrs & DMA_ATTR_MMIO) {
> > if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) || force_dma_unencrypted(dev))
> > attrs |= DMA_ATTR_CC_SHARED;
> > }
>
> Yes, I think it does the trick, preserves the current semantics for AMD.
> I guess you could use a single 'if' for all checks (up to you).
Please don't change it, MMIO P2P is broken on CC systems today and it
should stay broken. Passing DMA_ATTR_MMIO with DMA_ATTR_CC_SHARED is
an error that we need to correct in the drivers not make work in the
core code.
Jason
^ permalink raw reply
* Re: [patch 01/18] powerpc: Move stack randomization after syscall_enter_from_user_mode()
From: Mukesh Kumar Chaurasiya @ 2026-07-09 18:32 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Michael Ellerman, Shrikanth Hegde,
linuxppc-dev, Kees Cook, Huacai Chen, loongarch, Paul Walmsley,
Palmer Dabbelt, linux-riscv, Sven Schnelle, linux-s390, x86,
Mark Rutland, Jinjie Ruan, Andy Lutomirski, Oleg Nesterov,
Richard Henderson, Russell King, Catalin Marinas, Guo Ren,
Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Michal Suchánek,
Jonathan Corbet, linux-doc
In-Reply-To: <20260707190253.718191130@kernel.org>
On Tue, Jul 07, 2026 at 09:05:58PM +0200, Thomas Gleixner wrote:
> add_random_kstack_offset() is invoked before syscall_enter_from_user_mode()
> establishes state. That's wrong because add_random_kstack_offset() calls
> into instrumentable code.
>
> Move it after syscall_enter_from_user_mode() to ensure that state is
> correctly established.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Shrikanth Hegde <sshegde@linux.ibm.com>
> Cc: linuxppc-dev@lists.ozlabs.org
Thanks for fixing this.
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
[...]
^ permalink raw reply
* Re: [patch 02/18] randomize_kstack: Provide add_random_kstack_offset_irqsoff()
From: Mukesh Kumar Chaurasiya @ 2026-07-09 18:34 UTC (permalink / raw)
To: Thomas Gleixner
Cc: LKML, Peter Zijlstra, Kees Cook, Michael Ellerman,
Shrikanth Hegde, linuxppc-dev, Huacai Chen, loongarch,
Paul Walmsley, Palmer Dabbelt, linux-riscv, Sven Schnelle,
linux-s390, x86, Mark Rutland, Jinjie Ruan, Andy Lutomirski,
Oleg Nesterov, Richard Henderson, Russell King, Catalin Marinas,
Guo Ren, Geert Uytterhoeven, Thomas Bogendoerfer, Helge Deller,
Yoshinori Sato, Richard Weinberger, Chris Zankel,
linux-arm-kernel, linux-alpha, linux-csky, linux-m68k, linux-mips,
linux-parisc, linux-sh, linux-um, Arnd Bergmann, Vineet Gupta,
Will Deacon, Brian Cain, Michal Simek, Dinh Nguyen,
David S. Miller, Andreas Larsson, linux-snps-arc, linux-hexagon,
linux-openrisc, sparclinux, linux-arch, Michal Suchánek,
Jonathan Corbet, linux-doc
In-Reply-To: <20260707190253.768842729@kernel.org>
On Tue, Jul 07, 2026 at 09:06:02PM +0200, Thomas Gleixner wrote:
> add_random_kstack_offset() uses get/put_cpu_var() which is pointless
> overhead when it is invoked from low level entry code with interrupts
> disabled.
>
> Provide a irqsoff() variant, which avoids that.
>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Kees Cook <kees@kernel.org>
> ---
> include/linux/randomize_kstack.h | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> --- a/include/linux/randomize_kstack.h
> +++ b/include/linux/randomize_kstack.h
> @@ -77,8 +77,27 @@ static __always_inline u32 get_kstack_of
> } \
> } while (0)
>
> +/**
> + * add_random_kstack_offset_irqsoff - Increase stack utilization by a random offset.
> + *
> + * This should be used in the syscall entry path after user registers have been
> + * stored to the stack. Interrupts must be still disabled.
> + */
> +#define add_random_kstack_offset_irqsoff() \
> +do { \
> + lockdep_assert_irqs_disabled(); \
> + if (static_branch_maybe(CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT, \
> + &randomize_kstack_offset)) { \
> + u32 offset = prandom_u32_state(raw_cpu_ptr(&kstack_rnd_state)); \
> + u8 *ptr = __kstack_alloca(KSTACK_OFFSET_MAX(offset)); \
> + /* Keep allocation even after "ptr" loses scope. */ \
> + asm volatile("" :: "r"(ptr) : "memory"); \
> + } \
> +} while (0)
> +
> #else /* CONFIG_RANDOMIZE_KSTACK_OFFSET */
> #define add_random_kstack_offset() do { } while (0)
> +#define add_random_kstack_offset_irqsoff() do { } while (0)
> #endif /* CONFIG_RANDOMIZE_KSTACK_OFFSET */
>
> #endif
>
LGTM.
Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com>
>
> _______________________________________________
> linux-snps-arc mailing list
> linux-snps-arc@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox