[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6b1dfe9b-90b4-2782-9444-b6afd2b8791b@arm.com>
Date: Thu, 20 Jun 2019 10:44:22 +0100
From: Julien Thierry <julien.thierry@....com>
To: Lecopzer Chen <lecopzer.chen@...iatek.com>,
linux-kernel@...r.kernel.org
Cc: linux-arm-kernel@...ts.infradead.org,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Marc Zyngier <marc.zyngier@....com>,
YJ Chiang <yj.chiang@...iatek.com>
Subject: Re: [PATCH] genirq: Remove warning on preemptible in
prepare_percpu_nmi()
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
Powered by blists - more mailing lists