lkml.org 
[lkml]   [2019]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] genirq: Remove warning on preemptible in prepare_percpu_nmi()
From
Date
Hi Lecopzer,

On 20/06/2019 10:12, Lecopzer Chen wrote:
> prepare_percpu_nmi() acquires lock first by irq_get_desc_lock(),
> no matter whether preempt enabled or not, acquiring lock forces preempt off.
>
> This simplifies the usage of prepare_percpu_nmi() and we don't need to
> acquire extra lock or explicitly call preempt_[disable,enable]().
>

This allows wrong usage of prepare_percpu_nmi(). If you are not calling
it from a preemptible context, you could start the call on a CPU, get
preempted and setup the NMI on a completely different CPU than the one
you started on.

This check is for sanity checking, and if you end up calling
prepare_percpu_nmi() from non-preemptible context then your intentions
are unclear, unless you are fine with the possibility of "preparing an
NMI on a random CPU". Also you would have no way to know that that CPU
(since you could run on a random CPU) doesn't already have that IRQ line
set for NMI delivery.

So, I don't think removing those simplifies much, it just silences calls
to it that could go wrong.

Cheers,

--
Julien Thierry

\
 
 \ /
  Last update: 2019-06-20 11:44    [W:0.053 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site