On Mon, 2026-05-18 at 11:43 +0530, Shrikanth Hegde wrote:
>
>
> On 5/18/26 10:38 AM, Aboorva Devarajan wrote:
> > fsl_emb_pmu_del() unconditionally calls put_cpu_var(cpu_hw_events)
> > at
> > the 'out:' label, but only calls the matching get_cpu_var() after
> > the
> > 'i < 0' early-return check. When event->hw.idx is negative the
> > function jumps to 'out:' without having taken get_cpu_var(), and
> > the
> > trailing put_cpu_var() then issues an unmatched preempt_enable(),
> > underflowing preempt_count.
> >
> > On a CONFIG_PREEMPT=y kernel preempt_count would underflow and
> > eventually present as a 'scheduling while atomic' BUG.
> >
> > Move put_cpu_var() to pair with get_cpu_var() so the percpu access
> > is
> > correctly bracketed and the 'out:' label only handles
> > perf_pmu_enable.
> >
> > Fixes: a11106544f33c ("powerpc/perf: e500 support")
> > Signed-off-by: Aboorva Devarajan <[email protected]>
> > ---
> > arch/powerpc/perf/core-fsl-emb.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/perf/core-fsl-emb.c
> > b/arch/powerpc/perf/core-fsl-emb.c
> > index 7120ab20cbfec..02b5dd74c187a 100644
> > --- a/arch/powerpc/perf/core-fsl-emb.c
> > +++ b/arch/powerpc/perf/core-fsl-emb.c
> > @@ -366,9 +366,10 @@ static void fsl_emb_pmu_del(struct perf_event
> > *event, int flags)
> >
> > cpuhw->n_events--;
> >
> > + put_cpu_var(cpu_hw_events);
> > +
> > out:
> > perf_pmu_enable(event->pmu);
> > - put_cpu_var(cpu_hw_events);
> > }
> >
> > static void fsl_emb_pmu_start(struct perf_event *event, int
> > ef_flags)
>
> Thanks for fixing this. Looks good to me.
>
> Reviewed-by: Shrikanth Hegde <[email protected]>
Hi Shrikanth,
Thanks for the review.
Regards,
Aboorva