* [PATCH] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard @ 2026-09-07 7:00 Venkat Rao Bagalkote 2026-09-07 7:18 ` Mukesh Kumar Chaurasiya 2026-09-07 8:34 ` Michal Suchánek 0 siblings, 2 replies; 6+ messages in thread From: Venkat Rao Bagalkote @ 2026-09-07 7:00 UTC (permalink / raw) To: linuxppc-dev Cc: maddy, mpe, npiggin, chleroy, mkchauras, mkchauras, sshegde, ruanjinjie, ritesh.list, riteshh, venkat88, linux-kernel radix_enabled() uses a jump label which is only valid after mmu_feature_keys_init() is called. Before that point, on a pSeries hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in cur_cpu_spec->mmu_features but the jump label has not yet been patched, so radix_enabled() incorrectly returns true. Replace radix_enabled() with early_radix_enabled() which does a plain bitmask check against cur_cpu_spec->mmu_features and is correct at all times, including before jump label initialization. Add the missing #include <asm/mmu.h> since early_radix_enabled() is declared there. Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> --- arch/powerpc/include/asm/interrupt.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h index 1b45a49e9bed..36a654e780f7 100644 --- a/arch/powerpc/include/asm/interrupt.h +++ b/arch/powerpc/include/asm/interrupt.h @@ -71,6 +71,7 @@ #include <asm/kprobes.h> #include <asm/runlatch.h> +#include <asm/mmu.h> #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG /* @@ -290,7 +291,7 @@ interrupt_handler long func(struct pt_regs *regs) \ state = irqentry_nmi_enter(regs); \ } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ firmware_has_feature(FW_FEATURE_LPAR) && \ - !radix_enabled()) { \ + !early_radix_enabled()) { \ /* no nmi_entry for a pseries hash guest \ * taking a real mode exception */ \ } else if (IS_ENABLED(CONFIG_KASAN)) { \ @@ -307,7 +308,7 @@ interrupt_handler long func(struct pt_regs *regs) \ irqentry_nmi_exit(regs, state); \ } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ firmware_has_feature(FW_FEATURE_LPAR) && \ - !radix_enabled()) { \ + !early_radix_enabled()) { \ /* no nmi_exit for a pseries hash guest \ * taking a real mode exception */ \ } else if (IS_ENABLED(CONFIG_KASAN)) { \ -- 2.45.2 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard 2026-09-07 7:00 [PATCH] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard Venkat Rao Bagalkote @ 2026-09-07 7:18 ` Mukesh Kumar Chaurasiya 2026-09-07 8:34 ` Michal Suchánek 1 sibling, 0 replies; 6+ messages in thread From: Mukesh Kumar Chaurasiya @ 2026-09-07 7:18 UTC (permalink / raw) To: Venkat Rao Bagalkote Cc: linuxppc-dev, maddy, mpe, npiggin, chleroy, mkchauras, sshegde, ruanjinjie, ritesh.list, riteshh, linux-kernel On Mon, Sep 07, 2026 at 12:30:58PM +0530, Venkat Rao Bagalkote wrote: > radix_enabled() uses a jump label which is only valid after > mmu_feature_keys_init() is called. Before that point, on a pSeries > hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in > cur_cpu_spec->mmu_features but the jump label has not yet been patched, > so radix_enabled() incorrectly returns true. > > Replace radix_enabled() with early_radix_enabled() which does a plain > bitmask check against cur_cpu_spec->mmu_features and is correct at all > times, including before jump label initialization. > > Add the missing #include <asm/mmu.h> since early_radix_enabled() is > declared there. > > Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> > --- > arch/powerpc/include/asm/interrupt.h | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h > index 1b45a49e9bed..36a654e780f7 100644 > --- a/arch/powerpc/include/asm/interrupt.h > +++ b/arch/powerpc/include/asm/interrupt.h > @@ -71,6 +71,7 @@ > > #include <asm/kprobes.h> > #include <asm/runlatch.h> > +#include <asm/mmu.h> I would prefer this to be in alphabetical order. > > #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG > /* > @@ -290,7 +291,7 @@ interrupt_handler long func(struct pt_regs *regs) \ > state = irqentry_nmi_enter(regs); \ > } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ > firmware_has_feature(FW_FEATURE_LPAR) && \ > - !radix_enabled()) { \ > + !early_radix_enabled()) { \ > /* no nmi_entry for a pseries hash guest \ > * taking a real mode exception */ \ > } else if (IS_ENABLED(CONFIG_KASAN)) { \ > @@ -307,7 +308,7 @@ interrupt_handler long func(struct pt_regs *regs) \ > irqentry_nmi_exit(regs, state); \ > } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ > firmware_has_feature(FW_FEATURE_LPAR) && \ > - !radix_enabled()) { \ > + !early_radix_enabled()) { \ > /* no nmi_exit for a pseries hash guest \ > * taking a real mode exception */ \ > } else if (IS_ENABLED(CONFIG_KASAN)) { \ > -- > 2.45.2 > Rest all looks good. Reviewed-by: Mukesh Kumar Chaurasiya (IBM) <mkchauras@gmail.com> Regards, Mukesh ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard 2026-09-07 7:00 [PATCH] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard Venkat Rao Bagalkote 2026-09-07 7:18 ` Mukesh Kumar Chaurasiya @ 2026-09-07 8:34 ` Michal Suchánek 2026-09-07 8:54 ` Venkat Rao Bagalkote 1 sibling, 1 reply; 6+ messages in thread From: Michal Suchánek @ 2026-09-07 8:34 UTC (permalink / raw) To: Venkat Rao Bagalkote Cc: linuxppc-dev, maddy, mpe, npiggin, chleroy, mkchauras, mkchauras, sshegde, ruanjinjie, ritesh.list, riteshh, linux-kernel Hello, On Mon, Sep 07, 2026 at 12:30:58PM +0530, Venkat Rao Bagalkote wrote: > radix_enabled() uses a jump label which is only valid after > mmu_feature_keys_init() is called. Before that point, on a pSeries > hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in > cur_cpu_spec->mmu_features but the jump label has not yet been patched, > so radix_enabled() incorrectly returns true. > > Replace radix_enabled() with early_radix_enabled() which does a plain > bitmask check against cur_cpu_spec->mmu_features and is correct at all > times, including before jump label initialization. Any Fixes: here? Thanks Michal > > Add the missing #include <asm/mmu.h> since early_radix_enabled() is > declared there. > > Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> > --- > arch/powerpc/include/asm/interrupt.h | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h > index 1b45a49e9bed..36a654e780f7 100644 > --- a/arch/powerpc/include/asm/interrupt.h > +++ b/arch/powerpc/include/asm/interrupt.h > @@ -71,6 +71,7 @@ > > #include <asm/kprobes.h> > #include <asm/runlatch.h> > +#include <asm/mmu.h> > > #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG > /* > @@ -290,7 +291,7 @@ interrupt_handler long func(struct pt_regs *regs) \ > state = irqentry_nmi_enter(regs); \ > } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ > firmware_has_feature(FW_FEATURE_LPAR) && \ > - !radix_enabled()) { \ > + !early_radix_enabled()) { \ > /* no nmi_entry for a pseries hash guest \ > * taking a real mode exception */ \ > } else if (IS_ENABLED(CONFIG_KASAN)) { \ > @@ -307,7 +308,7 @@ interrupt_handler long func(struct pt_regs *regs) \ > irqentry_nmi_exit(regs, state); \ > } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ > firmware_has_feature(FW_FEATURE_LPAR) && \ > - !radix_enabled()) { \ > + !early_radix_enabled()) { \ > /* no nmi_exit for a pseries hash guest \ > * taking a real mode exception */ \ > } else if (IS_ENABLED(CONFIG_KASAN)) { \ > -- > 2.45.2 > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard 2026-09-07 8:34 ` Michal Suchánek @ 2026-09-07 8:54 ` Venkat Rao Bagalkote 2026-09-07 17:27 ` Shrikanth Hegde 0 siblings, 1 reply; 6+ messages in thread From: Venkat Rao Bagalkote @ 2026-09-07 8:54 UTC (permalink / raw) To: Michal Suchánek Cc: linuxppc-dev, maddy, mpe, npiggin, chleroy, mkchauras, mkchauras, sshegde, ruanjinjie, ritesh.list, riteshh, linux-kernel On 07/09/26 2:04 pm, Michal Suchánek wrote: > Hello, > > On Mon, Sep 07, 2026 at 12:30:58PM +0530, Venkat Rao Bagalkote wrote: >> radix_enabled() uses a jump label which is only valid after >> mmu_feature_keys_init() is called. Before that point, on a pSeries >> hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in >> cur_cpu_spec->mmu_features but the jump label has not yet been patched, >> so radix_enabled() incorrectly returns true. >> >> Replace radix_enabled() with early_radix_enabled() which does a plain >> bitmask check against cur_cpu_spec->mmu_features and is correct at all >> times, including before jump label initialization. > Any Fixes: here? Hello Michal, Yes, this can have. Fixes: 118178e62e2e ("powerpc: move NMI entry/exit code into wrapper") As commit 118178e62e2e originally introduced !radxi_enabled() check in NMI wrapper path. Regards, Venkat. > > Thanks > > Michal > >> Add the missing #include <asm/mmu.h> since early_radix_enabled() is >> declared there. >> >> Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> >> --- >> arch/powerpc/include/asm/interrupt.h | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h >> index 1b45a49e9bed..36a654e780f7 100644 >> --- a/arch/powerpc/include/asm/interrupt.h >> +++ b/arch/powerpc/include/asm/interrupt.h >> @@ -71,6 +71,7 @@ >> >> #include <asm/kprobes.h> >> #include <asm/runlatch.h> >> +#include <asm/mmu.h> >> >> #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG >> /* >> @@ -290,7 +291,7 @@ interrupt_handler long func(struct pt_regs *regs) \ >> state = irqentry_nmi_enter(regs); \ >> } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ >> firmware_has_feature(FW_FEATURE_LPAR) && \ >> - !radix_enabled()) { \ >> + !early_radix_enabled()) { \ >> /* no nmi_entry for a pseries hash guest \ >> * taking a real mode exception */ \ >> } else if (IS_ENABLED(CONFIG_KASAN)) { \ >> @@ -307,7 +308,7 @@ interrupt_handler long func(struct pt_regs *regs) \ >> irqentry_nmi_exit(regs, state); \ >> } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ >> firmware_has_feature(FW_FEATURE_LPAR) && \ >> - !radix_enabled()) { \ >> + !early_radix_enabled()) { \ >> /* no nmi_exit for a pseries hash guest \ >> * taking a real mode exception */ \ >> } else if (IS_ENABLED(CONFIG_KASAN)) { \ >> -- >> 2.45.2 >> >> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard 2026-09-07 8:54 ` Venkat Rao Bagalkote @ 2026-09-07 17:27 ` Shrikanth Hegde 2026-09-08 3:52 ` Venkat Rao Bagalkote 0 siblings, 1 reply; 6+ messages in thread From: Shrikanth Hegde @ 2026-09-07 17:27 UTC (permalink / raw) To: Venkat Rao Bagalkote, Michal Suchánek Cc: linuxppc-dev, maddy, mpe, npiggin, chleroy, mkchauras, mkchauras, ruanjinjie, ritesh.list, riteshh, linux-kernel On 9/7/26 2:24 PM, Venkat Rao Bagalkote wrote: > > On 07/09/26 2:04 pm, Michal Suchánek wrote: >> Hello, >> >> On Mon, Sep 07, 2026 at 12:30:58PM +0530, Venkat Rao Bagalkote wrote: >>> radix_enabled() uses a jump label which is only valid after >>> mmu_feature_keys_init() is called. Before that point, on a pSeries >>> hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in >>> cur_cpu_spec->mmu_features but the jump label has not yet been patched, >>> so radix_enabled() incorrectly returns true. >>> >>> Replace radix_enabled() with early_radix_enabled() which does a plain >>> bitmask check against cur_cpu_spec->mmu_features and is correct at all >>> times, including before jump label initialization. >> Any Fixes: here? > > > Hello Michal, > > Yes, this can have. > > Fixes: 118178e62e2e ("powerpc: move NMI entry/exit code into wrapper") > > As commit 118178e62e2e originally introduced !radxi_enabled() check in NMI wrapper path. > > looks like it did movement of code, rather than introducing. > Regards, > > Venkat. > >> >> Thanks >> >> Michal >> >>> Add the missing #include <asm/mmu.h> since early_radix_enabled() is >>> declared there. >>> >>> Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> >>> --- >>> arch/powerpc/include/asm/interrupt.h | 5 +++-- >>> 1 file changed, 3 insertions(+), 2 deletions(-) >>> >>> diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h >>> index 1b45a49e9bed..36a654e780f7 100644 >>> --- a/arch/powerpc/include/asm/interrupt.h >>> +++ b/arch/powerpc/include/asm/interrupt.h >>> @@ -71,6 +71,7 @@ >>> #include <asm/kprobes.h> >>> #include <asm/runlatch.h> >>> +#include <asm/mmu.h> >>> #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG >>> /* >>> @@ -290,7 +291,7 @@ interrupt_handler long func(struct pt_regs *regs) \ >>> state = irqentry_nmi_enter(regs); \ >>> } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ >>> firmware_has_feature(FW_FEATURE_LPAR) && \ >>> - !radix_enabled()) { \ >>> + !early_radix_enabled()) { \ >>> /* no nmi_entry for a pseries hash guest \ >>> * taking a real mode exception */ \ >>> } else if (IS_ENABLED(CONFIG_KASAN)) { \ >>> @@ -307,7 +308,7 @@ interrupt_handler long func(struct pt_regs *regs) \ >>> irqentry_nmi_exit(regs, state); \ >>> } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ >>> firmware_has_feature(FW_FEATURE_LPAR) && \ >>> - !radix_enabled()) { \ >>> + !early_radix_enabled()) { \ >>> /* no nmi_exit for a pseries hash guest \ >>> * taking a real mode exception */ \ >>> } else if (IS_ENABLED(CONFIG_KASAN)) { \ >>> -- >>> 2.45.2 >>> >>> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard 2026-09-07 17:27 ` Shrikanth Hegde @ 2026-09-08 3:52 ` Venkat Rao Bagalkote 0 siblings, 0 replies; 6+ messages in thread From: Venkat Rao Bagalkote @ 2026-09-08 3:52 UTC (permalink / raw) To: Shrikanth Hegde, Michal Suchánek Cc: linuxppc-dev, maddy, mpe, npiggin, chleroy, mkchauras, mkchauras, ruanjinjie, ritesh.list, riteshh, linux-kernel On 07/09/26 10:57 pm, Shrikanth Hegde wrote: > > > On 9/7/26 2:24 PM, Venkat Rao Bagalkote wrote: >> >> On 07/09/26 2:04 pm, Michal Suchánek wrote: >>> Hello, >>> >>> On Mon, Sep 07, 2026 at 12:30:58PM +0530, Venkat Rao Bagalkote wrote: >>>> radix_enabled() uses a jump label which is only valid after >>>> mmu_feature_keys_init() is called. Before that point, on a pSeries >>>> hash guest, early_check_vec5() clears MMU_FTR_TYPE_RADIX in >>>> cur_cpu_spec->mmu_features but the jump label has not yet been >>>> patched, >>>> so radix_enabled() incorrectly returns true. >>>> >>>> Replace radix_enabled() with early_radix_enabled() which does a plain >>>> bitmask check against cur_cpu_spec->mmu_features and is correct at all >>>> times, including before jump label initialization. >>> Any Fixes: here? >> >> >> Hello Michal, >> >> Yes, this can have. >> >> Fixes: 118178e62e2e ("powerpc: move NMI entry/exit code into wrapper") >> >> As commit originally introduced !radxi_enabled() check in NMI >> wrapper path. >> >> > > looks like it did movement of code, rather than introducing. > Hello Shrikanth, Yes, you are right. commit 118178e62e2e, just consolidated NMI wrapper logic from arch/powerpc/kernel/mce.c into interrupt.h. Tracing it further back, radix_enabled() check for pseries hash guest in real-mode NMI was originally introduced in commit: 8d0e21012743 ("powerpc/mce: Avoid nmi_enter/exit in real mode on pseries hash") I can add Fixes: 8d0e21012743, and send V2, if that works. Regards, Venkat. >> Regards, >> >> Venkat. >> >>> >>> Thanks >>> >>> Michal >>> >>>> Add the missing #include <asm/mmu.h> since early_radix_enabled() is >>>> declared there. >>>> >>>> Signed-off-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> >>>> --- >>>> arch/powerpc/include/asm/interrupt.h | 5 +++-- >>>> 1 file changed, 3 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/arch/powerpc/include/asm/interrupt.h >>>> b/arch/powerpc/include/asm/interrupt.h >>>> index 1b45a49e9bed..36a654e780f7 100644 >>>> --- a/arch/powerpc/include/asm/interrupt.h >>>> +++ b/arch/powerpc/include/asm/interrupt.h >>>> @@ -71,6 +71,7 @@ >>>> #include <asm/kprobes.h> >>>> #include <asm/runlatch.h> >>>> +#include <asm/mmu.h> >>>> #ifdef CONFIG_PPC_IRQ_SOFT_MASK_DEBUG >>>> /* >>>> @@ -290,7 +291,7 @@ interrupt_handler long func(struct pt_regs >>>> *regs) \ >>>> state = irqentry_nmi_enter(regs); \ >>>> } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ >>>> firmware_has_feature(FW_FEATURE_LPAR) && \ >>>> - !radix_enabled()) { \ >>>> + !early_radix_enabled()) { \ >>>> /* no nmi_entry for a pseries hash guest \ >>>> * taking a real mode exception */ \ >>>> } else if (IS_ENABLED(CONFIG_KASAN)) { \ >>>> @@ -307,7 +308,7 @@ interrupt_handler long func(struct pt_regs >>>> *regs) \ >>>> irqentry_nmi_exit(regs, state); \ >>>> } else if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && \ >>>> firmware_has_feature(FW_FEATURE_LPAR) && \ >>>> - !radix_enabled()) { \ >>>> + !early_radix_enabled()) { \ >>>> /* no nmi_exit for a pseries hash guest \ >>>> * taking a real mode exception */ \ >>>> } else if (IS_ENABLED(CONFIG_KASAN)) { \ >>>> -- >>>> 2.45.2 >>>> >>>> > > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-08 3:53 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-09-07 7:00 [PATCH] powerpc/interrupt: Use early_radix_enabled() in NMI real-mode guard Venkat Rao Bagalkote 2026-09-07 7:18 ` Mukesh Kumar Chaurasiya 2026-09-07 8:34 ` Michal Suchánek 2026-09-07 8:54 ` Venkat Rao Bagalkote 2026-09-07 17:27 ` Shrikanth Hegde 2026-09-08 3:52 ` Venkat Rao Bagalkote
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®