All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-kernel@vger.kernel.org
Cc: Josh Triplett <josh@freedesktop.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	linux-wireless@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: [RFC 1/3] add macros for new sparse features
Date: Thu, 10 Apr 2008 15:48:11 +0200	[thread overview]
Message-ID: <20080410134827.771251000@sipsolutions.net> (raw)
In-Reply-To: 20080410134810.629048000@sipsolutions.net

[-- Attachment #1: 011-kernel-add-new-sparse-stuff.patch --]
[-- Type: text/plain, Size: 1577 bytes --]

This patch adds kernel macros for a few new sparse features, namely
 * checking try_lock functions and
 * making a function or macro require a certain lock.

Still waiting to see what the sparse folks say to my patches.

Not-yet-signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 include/linux/compiler.h |    6 ++++++
 1 file changed, 6 insertions(+)

--- everything.orig/include/linux/compiler.h	2008-04-10 15:36:18.000000000 +0200
+++ everything/include/linux/compiler.h	2008-04-10 15:36:40.000000000 +0200
@@ -11,9 +11,12 @@
 # define __nocast	__attribute__((nocast))
 # define __iomem	__attribute__((noderef, address_space(2)))
 # define __acquires(x)	__attribute__((context(x,0,1)))
+# define __try_acquires(x,t,f)	__attribute__((conditional_context(x,0,t,f)))
 # define __releases(x)	__attribute__((context(x,1,0)))
 # define __acquire(x)	__context__(x,1)
 # define __release(x)	__context__(x,-1)
+# define __requires(x)	__attribute__((context(x,1,1)))
+# define __macro_requires(x)	__context__(x,0,1)
 # define __cond_lock(x,c)	((c) ? ({ __acquire(x); 1; }) : 0)
 extern void __chk_user_ptr(const volatile void __user *);
 extern void __chk_io_ptr(const volatile void __iomem *);
@@ -28,9 +31,12 @@ extern void __chk_io_ptr(const volatile 
 # define __chk_io_ptr(x) (void)0
 # define __builtin_warning(x, y...) (1)
 # define __acquires(x)
+# define __try_acquires(x,t,f)
 # define __releases(x)
 # define __acquire(x) (void)0
 # define __release(x) (void)0
+# define __requires(x)
+# define __macro_requires(x)
 # define __cond_lock(x,c) (c)
 #endif
 

-- 


WARNING: multiple messages have this Message-ID (diff)
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-kernel@vger.kernel.org
Cc: Josh Triplett <josh@freedesktop.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	linux-wireless@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: [RFC 1/3] add macros for new sparse features
Date: Thu, 10 Apr 2008 15:48:11 +0200	[thread overview]
Message-ID: <20080410134827.771251000@sipsolutions.net> (raw)
In-Reply-To: 20080410134810.629048000@sipsolutions.net

This patch adds kernel macros for a few new sparse features, namely
 * checking try_lock functions and
 * making a function or macro require a certain lock.

Still waiting to see what the sparse folks say to my patches.

Not-yet-signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 include/linux/compiler.h |    6 ++++++
 1 file changed, 6 insertions(+)

--- everything.orig/include/linux/compiler.h	2008-04-10 15:36:18.000000000 +0200
+++ everything/include/linux/compiler.h	2008-04-10 15:36:40.000000000 +0200
@@ -11,9 +11,12 @@
 # define __nocast	__attribute__((nocast))
 # define __iomem	__attribute__((noderef, address_space(2)))
 # define __acquires(x)	__attribute__((context(x,0,1)))
+# define __try_acquires(x,t,f)	__attribute__((conditional_context(x,0,t,f)))
 # define __releases(x)	__attribute__((context(x,1,0)))
 # define __acquire(x)	__context__(x,1)
 # define __release(x)	__context__(x,-1)
+# define __requires(x)	__attribute__((context(x,1,1)))
+# define __macro_requires(x)	__context__(x,0,1)
 # define __cond_lock(x,c)	((c) ? ({ __acquire(x); 1; }) : 0)
 extern void __chk_user_ptr(const volatile void __user *);
 extern void __chk_io_ptr(const volatile void __iomem *);
@@ -28,9 +31,12 @@ extern void __chk_io_ptr(const volatile 
 # define __chk_io_ptr(x) (void)0
 # define __builtin_warning(x, y...) (1)
 # define __acquires(x)
+# define __try_acquires(x,t,f)
 # define __releases(x)
 # define __acquire(x) (void)0
 # define __release(x) (void)0
+# define __requires(x)
+# define __macro_requires(x)
 # define __cond_lock(x,c) (c)
 #endif
 

-- 


  reply	other threads:[~2008-04-10 14:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10 13:48 [RFC 0/3] Examples for the new sparse context tracking functionality Johannes Berg
2008-04-10 13:48 ` Johannes Berg [this message]
2008-04-10 13:48   ` [RFC 1/3] add macros for new sparse features Johannes Berg
2008-04-10 16:37   ` Stefan Richter
2008-04-11 12:20     ` Johannes Berg
2008-04-10 13:48 ` [RFC 2/3] rcu: allow functions to declare they need RCU locking Johannes Berg
2008-04-10 13:48   ` Johannes Berg
2008-04-10 13:48 ` [RFC 3/3] mac80211: annotate with __requires_rcu Johannes Berg
2008-04-10 13:48   ` Johannes Berg
     [not found]   ` <20080410134829.412424000-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2008-04-12  8:50     ` Geert Uytterhoeven
2008-04-12  8:50       ` Geert Uytterhoeven
2008-04-12  8:56       ` Johannes Berg
2008-04-12 13:38       ` [RFC 1/2] mac80211: Patch to prevent mac80211 to clobber injected sequence numbers Jory A. Pratt
2008-04-12 13:56         ` Michael Buesch
     [not found] ` <20080410134810.629048000-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
2008-04-10 15:22   ` [RFC 0/3] Examples for the new sparse context tracking functionality Johannes Berg
2008-04-10 15:22     ` Johannes Berg
2008-04-19 23:33   ` Paul E. McKenney
2008-04-19 23:33     ` Paul E. McKenney
2008-04-21  8:25     ` Johannes Berg
     [not found]       ` <1208766355.26186.37.camel-YfaajirXv214zXjbi5bjpg@public.gmane.org>
2008-04-21 14:55         ` Paul E. McKenney
2008-04-21 14:55           ` Paul E. McKenney
     [not found]           ` <20080421145525.GB9153-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2008-04-21 15:05             ` Johannes Berg
2008-04-21 15:05               ` Johannes Berg

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=20080410134827.771251000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=josh@freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    /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.