From: Arjan van de Ven <arjan@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
Nick Piggin <nickpiggin@yahoo.com.au>
Subject: Re: [kerneloops] regression in 2.6.27 wrt "lock_page" and the "hwclock" program
Date: Sun, 5 Oct 2008 10:38:26 -0700 [thread overview]
Message-ID: <20081005103826.6771540a@infradead.org> (raw)
In-Reply-To: <20081005102742.de8353b4.akpm@linux-foundation.org>
On Sun, 5 Oct 2008 10:27:42 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:
> > static unsigned long
> > atomic(const char *name, unsigned long (*op)(unsigned long),
> > unsigned long arg)
> > {
> > unsigned long v;
> > __asm__ volatile ("cli");
> > v = (*op)(arg);
> > __asm__ volatile ("sti");
> > return v;
> > }
> >
> > looks like it (but only on 32 bit x86, not on 64 bit x86)
>
> I suspect this is new in hwclock? We do a might_sleep() in
> lock_page() in 2.6.25 and in 2.6.26.
this quote was from the F9 hwclock.. which shipped with 2.6.25.
Hum.
> > > Really, it's a bit stupid doing _any_ system calls (and a
> > > pagefault is a syscall in disguise) with interrupts disabled.
> > > The kernel makes no guarantees that we'll honour it. We could
> > > just enable interrupts on pagefault entry - that'll teach 'em.
> >
> > or save - enable - <run handlers> - restore sequence
>
> hwclock is buggy either way -
not arguing with that ;-)
All code doing cli/sti in userland is buggy period. No excuses possible.
> it's trying to disable interrupts but
> it's calling into the kernel, which will reenable interrupts, thus
> losing any protection which hwclock was trying to attain.
>
> Plus there's this little thing called "smp". I bet it doesn't disable
> interrupts on all CPUs.
I get the impression from the code that it really wants a "don't
schedule me out" rather than "this is a lock".
it can do better.
On Alpha it implements a seq-lock kind of thing instead.
(and on x86-64 .. it implements NOTHING)
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
next prev parent reply other threads:[~2008-10-05 17:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-05 0:44 [kerneloops] regression in 2.6.27 wrt "lock_page" and the "hwclock" program Arjan van de Ven
2008-10-05 4:52 ` Andrew Morton
2008-10-05 15:11 ` Arjan van de Ven
2008-10-05 17:27 ` Andrew Morton
2008-10-05 17:38 ` Arjan van de Ven [this message]
2008-10-12 20:00 ` Karel Zak
2008-10-12 20:16 ` Linus Torvalds
2008-10-13 14:55 ` Arjan van de Ven
2008-10-14 21:04 ` Karel Zak
2008-10-13 15:26 ` Ingo Molnar
2008-10-13 15:40 ` Alan Cox
2008-10-13 15:44 ` Linus Torvalds
2008-10-13 16:02 ` Ingo Molnar
2008-10-13 16:08 ` Linus Torvalds
2008-10-13 16:21 ` Ingo Molnar
2008-10-12 19:46 ` Karel Zak
2008-10-05 18:18 ` Linus Torvalds
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=20081005103826.6771540a@infradead.org \
--to=arjan@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=torvalds@linux-foundation.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