Re: [PATCH bpf-next v1 1/4] bpf: Add call for selecting kmalloc or kmalloc_nolock at call time
From: David Hildenbrand (Arm)
Date: Thu Nov 26 2026 - 04:46:28 EST
On 11/26/26 10:44, Peter Zijlstra wrote:
> On Thu, Nov 26, 2026 at 01:04:27AM +0000, Alexei Starovoitov wrote:
>> On Wed, Nov 25, 2026 at 06:09 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>>> This is absolute atrocious shite. You cannot attempt a spin_trylock from
>>> NMI context. That thing might be a mutex.
>>
>> cannot spin_trylock from NMI _on PREEMPT_RT_ ... correct.
>> And the patch guard against that.
>>
>> On RT the nolock path doesn't reach zone->lock in NMI or hardirq:
>>
>> __alloc_frozen_pages_noprof() alloc_flags has ALLOC_NOLOCK
>> alloc_nolock_allowed()
>> can_spin_trylock()
>> if (IS_ENABLED(CONFIG_PREEMPT_RT) && (in_nmi() || in_hardirq()))
>> return false;
>>
>> fwiw kmalloc_nolock() has the same check.
>>
>>> This should not work; if it does, that is an accident we need to fix.
>>
>> It's not an accident.
>> In NMI only !RT SMP kernels reach the trylock.
>
> Allowing this on !RT makes people think this is 'OK' and then the RT
> people get to fix endless crap again :-(
>
> Locking constructs should behave identical across the configurations to
> avoid divergence and create problems.
>
> You're actively creating something that doesn't and cannot work on RT.
> That is not cool.
This is all just way too complicated and shaky, sorry to say it.
--
Cheers,
David