public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Ed Swierk <eswierk@aristanetworks.com>,
	rml@tech9.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix BUG: using smp_processor_id() in preemptible code in print_fatal_signal()
Date: Tue, 27 Jan 2009 13:46:18 +0100	[thread overview]
Message-ID: <20090127124618.GA23121@elte.hu> (raw)
In-Reply-To: <20090127030237.GA14108@redhat.com>


* Oleg Nesterov <oleg@redhat.com> wrote:

> On 01/26, Ed Swierk wrote:
> >
> > On Tue, 2009-01-27 at 01:41 +0100, Oleg Nesterov wrote:
> > > Ed, Ingo, but isn't it better to just use raw_smp_processor_id() in
> > > __show_regs() ? This is only debug info, the printed CPU doesn't
> > > have the "exact" meaning.
> >
> > I guess it doesn't really matter which CPU the signal handling thread 
> > happened to be running on, but are there other situations where 
> > show_regs() is always expected to print the correct CPU (and if not, 
> > why bother printing the CPU at all)?  Disabling preemption here seems 
> > the safest approach and doesn't add much overhead.
> 
> OK.
> 
> > > And, without the comment, it is not easy to see why print_fatal_signal()
> > > disables preeemption before show_regs().
> >
> > Agreed; here's an updated patch.
> 
> Actually, now I think show_regs() has other reasons to run with the 
> preemption disabled, __show_regs() does read_crX()/etc, I guess it is 
> better to stay on the same CPU throughout.
> 
> So, Ed, I am sorry for noise.

another reason why it's good to run it with preemption disabled is that 
whatever context does show_regs() ought to be non-preemptible as it deals 
with CPU local details.

In the fatal-signals case we indeed have a "it does not really matter" 
boundary case, but in most of the other uses we want to be non-preemptible 
in debug contexts, and want a constant reminder in terms of 
smp_processor_id() warnings if that expectation is not met.

	Ingo

      reply	other threads:[~2009-01-27 12:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-26 23:00 [PATCH] Fix BUG: using smp_processor_id() in preemptible code in print_fatal_signal() Ed Swierk
2009-01-26 23:15 ` Ingo Molnar
2009-01-26 23:33   ` Ed Swierk
2009-01-26 23:37     ` Ingo Molnar
2009-01-27  0:41       ` Oleg Nesterov
2009-01-27  1:34         ` Ed Swierk
2009-01-27  3:02           ` Oleg Nesterov
2009-01-27 12:46             ` Ingo Molnar [this message]

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=20090127124618.GA23121@elte.hu \
    --to=mingo@elte.hu \
    --cc=eswierk@aristanetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=rml@tech9.net \
    /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