linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: David Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	sparclinux@vger.kernel.org
Subject: Re: [PATCH 0/4]: Respin local_irq_*_nmi() stuff.
Date: Tue, 13 Apr 2010 10:37:14 +0200	[thread overview]
Message-ID: <1271147834.4807.980.camel@twins> (raw)
In-Reply-To: <20100413.005640.48990319.davem@davemloft.net>

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?



  reply	other threads:[~2010-04-13  8:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-09 23:01 [PATCH 0/4]: Respin local_irq_*_nmi() stuff David Miller
2010-04-09 23:01 ` David Miller
2010-04-13  5:08 ` David Miller
2010-04-13  7:48   ` Peter Zijlstra
2010-04-13  7:56     ` David Miller
2010-04-13  8:37       ` Peter Zijlstra [this message]
2010-04-13  8:37         ` Peter Zijlstra
2010-04-13  8:46         ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271147834.4807.980.camel@twins \
    --to=peterz@infradead.org \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).