From: "H. Peter Anvin" <hpa@zytor.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christoph Lameter <cl@linux-foundation.org>,
Matthew Wilcox <matthew@wil.cx>, Yinghai Lu <yinghai@kernel.org>,
Rabin Vincent <rabin@rab.in>, lkml <linux-kernel@vger.kernel.org>,
penberg@cs.helsinki.fi, linux-arch@vger.kernel.org
Subject: Re: start_kernel(): bug: interrupts were enabled early
Date: Thu, 01 Apr 2010 09:15:51 -0700 [thread overview]
Message-ID: <4BB4C6B7.40302@zytor.com> (raw)
In-Reply-To: <1270104536.7101.114.camel@pasglop>
On 03/31/2010 11:48 PM, Benjamin Herrenschmidt wrote:
> On Wed, 2010-03-31 at 23:33 -0400, Andrew Morton wrote:
>> Just a few instructions, I guess. But we can do it with zero.
>>
>> And from a design POV, pretending that down_read()/down_write() can be
>> called with interrupts disabled is daft - they cannot! Why muck up
>> the
>> usual code paths with this startup-specific hack?
>
> Because we the problem of when interrupts are enabled for the first time
> is a nasty one, and having entire layer of things not usable at the
> right level of init because somewhere something might do an irq enable
> due to calling generic code that down's a semaphore is a PITA.
>
> Seriously, Andrew, I don't see a clean solution... Something -somewhere-
> will have to be ugly.
>
> Allocation is a pretty basic service that a lot of stuff expect
> especially when booting.
>
> We went through that discussion before when we moved the SLAB init
> earlier during boot, because it makes no sense to have tons of code to
> have to figure out what allocator to call depending on what phase of the
> moon it's called from (especially when said code can also be called
> later during boot, say for hotplug reasons).
>
> So we moved sl*b init earlier, thus we ought to be able to also
> kmem_cache_alloc() earlier. We -fixed- that problem already afaik.
I would like to point out that initialization is a particular subcase of
a more general rule:
- It is safe to call a semaphore/rwlock down with IRQ disabled *if and
only if* the caller can guarantee non-contention.
Initialization is an obvious subcase, but there might be others.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
next prev parent reply other threads:[~2010-04-01 16:15 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-25 19:41 start_kernel(): bug: interrupts were enabled early Rabin Vincent
2010-03-31 20:40 ` Andrew Morton
2010-03-31 20:47 ` Yinghai Lu
2010-03-31 20:52 ` Andrew Morton
2010-03-31 21:12 ` H. Peter Anvin
2010-03-31 21:28 ` Andrew Morton
2010-03-31 22:35 ` Benjamin Herrenschmidt
2010-04-01 16:13 ` Linus Torvalds
2010-04-01 14:27 ` Andrew Morton
2010-04-01 20:12 ` Linus Torvalds
2010-04-02 14:46 ` David Howells
2010-04-02 14:54 ` Linus Torvalds
2010-04-07 19:09 ` Kevin Hilman
2010-04-07 19:09 ` Kevin Hilman
2010-04-08 15:55 ` Américo Wang
2010-04-08 15:55 ` Américo Wang
2010-03-31 21:01 ` Matthew Wilcox
2010-03-31 21:05 ` H. Peter Anvin
2010-03-31 21:17 ` Matthew Wilcox
2010-03-31 21:42 ` Christoph Lameter
2010-03-31 21:54 ` Russell King
2010-03-31 21:57 ` H. Peter Anvin
2010-03-31 21:57 ` H. Peter Anvin
2010-03-31 22:30 ` Russell King
2010-03-31 22:37 ` Benjamin Herrenschmidt
2010-03-31 22:49 ` Andrew Morton
2010-04-01 1:17 ` Benjamin Herrenschmidt
2010-03-31 22:26 ` Andrew Morton
2010-04-01 6:26 ` H. Peter Anvin
2010-04-01 3:33 ` Andrew Morton
2010-04-01 6:48 ` Benjamin Herrenschmidt
2010-04-01 11:06 ` David Howells
2010-04-01 15:55 ` Christoph Lameter
2010-04-01 23:00 ` Benjamin Herrenschmidt
2010-04-01 16:15 ` H. Peter Anvin [this message]
2010-04-01 6:50 ` Benjamin Herrenschmidt
2010-03-31 22:36 ` Benjamin Herrenschmidt
2010-04-01 15:57 ` Christoph Lameter
2010-03-31 21:05 ` Russell King
2010-03-31 21:08 ` H. Peter Anvin
2010-03-31 21:08 ` H. Peter Anvin
2010-03-31 22:58 ` David Howells
2010-04-01 9:41 ` Jamie Lokier
2010-04-01 10:50 ` David Howells
2010-04-01 11:23 ` Matthew Wilcox
2010-03-31 22:31 ` Benjamin Herrenschmidt
2010-03-31 22:36 ` H. Peter Anvin
-- strict thread matches above, loose matches on Subject: below --
2006-10-18 15:50 Martin Michlmayr
2006-10-18 16:51 ` mlachwani
2006-10-18 18:14 ` Ralf Baechle
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=4BB4C6B7.40302@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=cl@linux-foundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=penberg@cs.helsinki.fi \
--cc=rabin@rab.in \
--cc=yinghai@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.