[RFT PATCH] ARM: vfp: Fix broken softirq handling with instrumentation enabled

Ard Biesheuvel ardb at kernel.org
Tue Mar 14 06:58:40 PDT 2023


On Tue, 14 Mar 2023 at 14:12, Frederic Weisbecker <frederic at kernel.org> wrote:
>
> Le Tue, Mar 14, 2023 at 01:57:43PM +0100, Ard Biesheuvel a écrit :
> > diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
> > index 9a89264cdcc0b46e..9555c0a1c46fd47b 100644
> > --- a/arch/arm/vfp/entry.S
> > +++ b/arch/arm/vfp/entry.S
> > @@ -22,7 +22,23 @@
> >  @  IRQs enabled.
> >  @
> >  ENTRY(do_vfp)
> > -     local_bh_disable r10, r4
> > +#if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_TRACE_IRQFLAGS)
> > +     mov     r4, r0                  @ stash r0, r2, lr
> > +     mov     r5, r2
> > +     mov     r6, lr
> > +
> > +     adr     r0, .
> > +     mov     r1, #SOFTIRQ_DISABLE_OFFSET
> > +     bl      __local_bh_disable_ip
> > +
> > +     mov     r0, r4                  @ restore r0, r2, lr
> > +     mov     r2, r5
> > +     mov     lr, r6
> > +#else
> > +     ldr     r4, [r10, #TI_PREEMPT]
> > +     add     r4, r4, #SOFTIRQ_DISABLE_OFFSET
> > +     str     r4, [r10, #TI_PREEMPT]
> > +#endi
>
> I suggest you avoid taking any risk and unconditionally call
> __local_bh_disable_ip(). You never know what will be added to softirq
> APIs in the future.
>

That is not possible - __local_bh_disable_ip() is only a callable
function under the #ifdef condition, and a static inline otherwise.

> For example you're missing the CONFIG_DEBUG_PREEMPT part.
>

Yeah, so I'd have to call preempt_count_add() directly from asm
instead - that should work, although it becomes a bit of a kludge now.
I'll try to find a solution that is a bit cleaner.

Thanks,
Ard.



More information about the linux-arm-kernel mailing list