[PATCH 1/5] powerpc/kprobes: Remove preempt disable around call to get_kprobe() in arch_prepare_kprobe()

Naveen N. Rao naveen.n.rao at linux.vnet.ibm.com
Tue Nov 8 21:33:22 AEDT 2022


Nicholas Piggin wrote:
> On Fri Oct 21, 2022 at 3:28 AM AEST, Naveen N. Rao wrote:
>> arch_prepare_kprobe() is called from register_kprobe() via
>> prepare_kprobe(), or through register_aggr_kprobe(), both with the
>> kprobe_mutex held. Per the comment for get_kprobe():
>>   /*
>>    * This routine is called either:
>>    *	- under the 'kprobe_mutex' - during kprobe_[un]register().
>>    *				OR
>>    *	- with preemption disabled - from architecture specific code.
>>    */
> 
> That comment should read [un]register_kprobe(), right?

Ugh, yes!

> 
>>
>> As such, there is no need to disable preemption around the call to
>> get_kprobe(). Drop the same.
> 
> And prepare_kprobe() and register_aggr_kprobe() are both called with
> kprobe_mutex held so you rely on the same protection. This seems to
> fix a lost-resched bug with preempt kernels too.
> 
> Reviewed-by: Nicholas Piggin <npiggin at gmail.com>

Thanks,
Naveen



More information about the Linuxppc-dev mailing list