Messages in this thread | | | Subject | Re: [PATCH 0/4]: Respin local_irq_*_nmi() stuff. | From | Peter Zijlstra <> | Date | Tue, 13 Apr 2010 10:37:14 +0200 |
| |
On Tue, 2010-04-13 at 00:56 -0700, David Miller wrote:
> If we are in an NMI then doing a plain raw_local_irq_disable() will > write PIL_NORMAL_MAX into %pil, which is lower than PIL_NMI, and thus > we'll re-enable NMIs and recurse. > > Doing a simple: > > %pil = %pil | PIL_NORMAL_MAX > > does what we want, if we're already at PIL_NMI (15) we leave it at > that setting, else we set it to PIL_NORMAL_MAX (14).
Ah indeed, and without a conditional, very nice!
It does rely on the exact values of the PIL_levels, it might make sense to note that in the comment, something like:
* Assumes: PIL_NMI | PIL_NORMAL_MAX == PIL_NMI.
Hmm, it also assumes %pil is never anything other than 0, PIL_NORMAL_MAX, PIL_NMI, because if:
(%pil & 1) && (%pil != PIL_NMI)
then you'll end up disabling NMIs. Could something like that ever happen?
| |