From: David Miller <davem@davemloft.net>
To: jeff@garzik.org
Cc: akpm@linux-foundation.org, torvalds@linux-foundation.org,
matthew@wil.cx, arnd@arndb.de, ralf@linux-mips.org,
adobriyan@gmail.com, viro@ftp.linux.org.uk,
viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org
Subject: Re: [PATCH 1/2] irq_flags_t: intro and core annotations
Date: Mon, 22 Oct 2007 17:21:23 -0700 (PDT) [thread overview]
Message-ID: <20071022.172123.78710569.davem@davemloft.net> (raw)
In-Reply-To: <471D0C54.7060207@garzik.org>
From: Jeff Garzik <jeff@garzik.org>
Date: Mon, 22 Oct 2007 16:47:16 -0400
> Let me add to the chorus of voices: I continually see two cases where
> real bugs crop up:
>
> 1) hacker uses spin_lock_irq() in incorrect context (where it is not
> safe to do a blind enable/disable)
>
> 2) hacker uses spin_lock_irq() correctly, but the surrounding code
> changes, thus invalidating prior assumptions.
>
> I would even go so far as to support the drastic measure of deleting
> spin_lock_irq().
>
> spin_lock_irqsave() generates fewer bugs, is more future-proof, and by
> virtue of 'flags' permits architectures a bit more flexibility.
Whilst I agree with you fully on the error-prone'ness argument,
reading the processor interrupt level to fill in the 'flags'
can have non-trivial cost. I think it's about 9 cycles and
a full pipeline flush on most sparc64 chips for example.
The write to turn off interrupts costs about the same, so you'd
essentially be doubling the execution cost in every case that
you convert as you propose.
I seem to recall that on modern x86 chips the cost of dorking
around with eflags like this is even higher.
What's the relative cost of pushfl/popl/pushl/popfl vs. cli/sti on
like a core2 duo or a k8?
For 64-bit powerpc's software interrupt disabling scheme it seems
to cost is about equal for both cases.
next prev parent reply other threads:[~2007-10-23 0:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-20 23:55 [PATCH 1/2] irq_flags_t: intro and core annotations Alexey Dobriyan
2007-10-21 0:54 ` Al Viro
2007-10-21 9:30 ` Alexey Dobriyan
2007-10-22 15:29 ` Ralf Baechle
2007-10-22 18:21 ` Andrew Morton
2007-10-22 18:50 ` Geert Uytterhoeven
2007-10-22 19:10 ` Arnd Bergmann
2007-10-22 19:47 ` Matthew Wilcox
2007-10-22 19:56 ` Linus Torvalds
2007-10-22 20:02 ` Andrew Morton
2007-10-22 21:34 ` Arnd Bergmann
2007-10-22 21:46 ` Thomas Gleixner
2007-10-23 1:06 ` Arnd Bergmann
2007-10-23 1:28 ` USB HCD: avoid duplicate local_irq_disable() Arnd Bergmann
2007-10-23 4:01 ` [linux-usb-devel] " Alan Stern
2007-10-25 18:33 ` Greg KH
2007-10-27 19:14 ` Alan Stern
2007-10-22 20:47 ` [PATCH 1/2] irq_flags_t: intro and core annotations Jeff Garzik
2007-10-23 0:21 ` David Miller [this message]
2007-10-23 3:33 ` Herbert Xu
2007-10-24 2:11 ` Jeff Garzik
2007-10-24 8:55 ` Arnd Bergmann
2007-10-27 19:20 ` Roman Zippel
2007-10-27 20:14 ` Alexey Dobriyan
2007-10-27 21:07 ` Peter Zijlstra
2007-10-27 21:22 ` Roman Zippel
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=20071022.172123.78710569.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=jeff@garzik.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=ralf@linux-mips.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ftp.linux.org.uk \
--cc=viro@zeniv.linux.org.uk \
/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).