public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Andrew Morton <akpm@osdl.org>
Cc: David Howells <dhowells@redhat.com>,
	torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Provide better printk() support for SMP machines
Date: Fri, 08 Jul 2005 13:29:52 +0100	[thread overview]
Message-ID: <31528.1120825792@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <20050705142958.4075c5a7.akpm@osdl.org>

Andrew Morton <akpm@osdl.org> wrote:

> hm, I guess it adds a theoretical deadlock if some other CPU is in the
> middle of printk and is trying to take some_lock and this CPU takes an oops
> while holding some_lock.  Probably that's an acceptable tradeoff though.

What it perhaps needs is a maximum number of spins or something like that.

> Does this guy really need to be volatile?

atomic_t is volatile, so that makes no difference.

Actually, I shouldn't use an atomic_t or a signed int as the CPU ID is
unsigned:-/

I'm using -1 / UINT_MAX as a "not in use" thing, but I'm not sure that's
strictly viable.

> Coud we use atomic_t and lose that wmb()?

I talked it over with David Woodhouse, and he's convinced me that we don't
need the barrier: the only thing we care about is getting a printk within a
printk on the CPU because of an oops. THEN we have to break the lock. And in
that case we're looking for the CPU number being set to that of our CPU, and
only our CPU will ever set that.

> Methinks this should be raw_smp_processor_id().

Not only that, but the whole function needs wrapping in preemption
disablement, lest the processor ID change under us.

David

  reply	other threads:[~2005-07-08 12:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-05 20:10 [PATCH] Provide better printk() support for SMP machines David Howells
2005-07-05 21:29 ` Andrew Morton
2005-07-08 12:29   ` David Howells [this message]
2005-07-08 12:36 ` [PATCH] Provide better printk() support for SMP machines [try #2] David Howells
2005-07-08 13:12   ` Lars Marowsky-Bree

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=31528.1120825792@warthog.cambridge.redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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