linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Roman Zippel <zippel@linux-m68k.org>,
	torvalds@osdl.org, akpm@osdl.org, 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: Sat, 27 Oct 2007 23:07:13 +0200	[thread overview]
Message-ID: <1193519234.27652.21.camel@twins> (raw)
In-Reply-To: <20071027201429.GE9816@martell.zuzino.mipt.ru>

On Sun, 2007-10-28 at 00:14 +0400, Alexey Dobriyan wrote:
> On Sat, Oct 27, 2007 at 09:20:43PM +0200, Roman Zippel wrote:
> > On Sun, 21 Oct 2007, Alexey Dobriyan wrote:
> > 
> > > So far remedies were:
> > > a) grep(1) -- obviously fragile. I tried at some point grepping for
> > >    spin_lock_irqsave(), found quite a few, but it became booooring quickly.
> > > b) BUILD_BUG_ON(sizeof(flags) != sizeof(unsigned long)) -- was tried,
> > >    brutally broke some arches, survived one commit before revert :^)
> > >    Doesn't work on i386 where sizeof(unsigned int) == sizeof(unsigned long).
> > > 
> > > So it would be nice to have something more robust.
> > 
> > If it's just about the type checking, something like below should pretty 
> > much do the same.
> 
> It won't catch, the following if both variables are unsigned long:
> 
> 	spin_lock_irqsave(&lock, flags);
> 		[stuff]
> 	spin_unlock_irqrestore(&lock, foo->flags);
> 
> It won't catch "static unsigned long flags;". With sparse, we can
> eventually mark type as "on-stack only".

> > +static __always_inline void __irq_flags_check(unsigned long *flags)
> > +{
+	BUILD_BUG_ON(!__builtin_stack_addr(flags));
> > +}
> > +

obviously gcc doesn't (yet) support that __builtin function, but you
could make it work for sparse and define a dummy for gcc.


  reply	other threads:[~2007-10-27 21:07 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
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 [this message]
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=1193519234.27652.21.camel@twins \
    --to=peterz@infradead.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zippel@linux-m68k.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;
as well as URLs for NNTP newsgroup(s).