From: Arnd Bergmann <arnd@arndb.de>
To: paulmck@linux.vnet.ibm.com
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org, mingo@elte.hu,
laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, josh@joshtriplett.org,
dvhltc@us.ibm.com, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, rostedt@goodmis.org,
Valdis.Kletnieks@vt.edu, dhowells@redhat.com
Subject: [PATCH 06/10] audit: __rcu annotations
Date: Wed, 24 Feb 2010 21:04:02 +0100 [thread overview]
Message-ID: <1267041846-10469-7-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1267041846-10469-1-git-send-email-arnd@arndb.de>
In-Reply-To: <20100223180127.GF6700@linux.vnet.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
kernel/audit.c | 4 ++--
kernel/audit.h | 6 +++---
kernel/audit_tree.c | 14 +++++++-------
kernel/auditfilter.c | 28 ++++++++++++++--------------
kernel/auditsc.c | 8 ++++----
5 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/kernel/audit.c b/kernel/audit.c
index 5feed23..6115194 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -116,7 +116,7 @@ static atomic_t audit_lost = ATOMIC_INIT(0);
static struct sock *audit_sock;
/* Hash for inode-based rules */
-struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
+struct rcu_list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
/* The audit_freelist is a list of pre-allocated audit buffers (if more
* than AUDIT_MAXFREE are in use, the audit buffer is freed instead of
@@ -985,7 +985,7 @@ static int __init audit_init(void)
audit_log(NULL, GFP_KERNEL, AUDIT_KERNEL, "initialized");
for (i = 0; i < AUDIT_INODE_BUCKETS; i++)
- INIT_LIST_HEAD(&audit_inode_hash[i]);
+ INIT_LIST_HEAD_RCU(&audit_inode_hash[i]);
return 0;
}
diff --git a/kernel/audit.h b/kernel/audit.h
index 208687b..bd4335c 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -58,7 +58,7 @@ struct audit_tree;
struct audit_chunk;
struct audit_entry {
- struct list_head list;
+ struct rcu_list_head list;
struct rcu_head rcu;
struct audit_krule rule;
};
@@ -71,7 +71,7 @@ extern int audit_ever_enabled;
extern int audit_pid;
#define AUDIT_INODE_BUCKETS 32
-extern struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
+extern struct rcu_list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
static inline int audit_hash_ino(u32 ino)
{
@@ -101,7 +101,7 @@ extern int selinux_audit_rule_update(void);
extern struct mutex audit_filter_mutex;
extern void audit_free_rule_rcu(struct rcu_head *);
-extern struct list_head audit_filter_list[];
+extern struct rcu_list_head audit_filter_list[];
/* audit watch functions */
extern unsigned long audit_watch_inode(struct audit_watch *watch);
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index 4b05bd9..dfebdbb 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -20,7 +20,7 @@ struct audit_tree {
};
struct audit_chunk {
- struct list_head hash;
+ struct rcu_list_head hash;
struct inotify_watch watch;
struct list_head trees; /* with root here */
int dead;
@@ -121,7 +121,7 @@ static struct audit_chunk *alloc_chunk(int count)
if (!chunk)
return NULL;
- INIT_LIST_HEAD(&chunk->hash);
+ INIT_LIST_HEAD_RCU(&chunk->hash);
INIT_LIST_HEAD(&chunk->trees);
chunk->count = count;
atomic_long_set(&chunk->refs, 1);
@@ -157,10 +157,10 @@ static void __put_chunk(struct rcu_head *rcu)
}
enum {HASH_SIZE = 128};
-static struct list_head chunk_hash_heads[HASH_SIZE];
+static struct rcu_list_head chunk_hash_heads[HASH_SIZE];
static __cacheline_aligned_in_smp DEFINE_SPINLOCK(hash_lock);
-static inline struct list_head *chunk_hash(const struct inode *inode)
+static inline struct rcu_list_head *chunk_hash(const struct inode *inode)
{
unsigned long n = (unsigned long)inode / L1_CACHE_BYTES;
return chunk_hash_heads + n % HASH_SIZE;
@@ -169,14 +169,14 @@ static inline struct list_head *chunk_hash(const struct inode *inode)
/* hash_lock is held by caller */
static void insert_hash(struct audit_chunk *chunk)
{
- struct list_head *list = chunk_hash(chunk->watch.inode);
+ struct rcu_list_head *list = chunk_hash(chunk->watch.inode);
list_add_rcu(&chunk->hash, list);
}
/* called under rcu_read_lock */
struct audit_chunk *audit_tree_lookup(const struct inode *inode)
{
- struct list_head *list = chunk_hash(inode);
+ struct rcu_list_head *list = chunk_hash(inode);
struct audit_chunk *p;
list_for_each_entry_rcu(p, list, hash) {
@@ -959,7 +959,7 @@ static int __init audit_tree_init(void)
audit_panic("cannot initialize inotify handle for rectree watches");
for (i = 0; i < HASH_SIZE; i++)
- INIT_LIST_HEAD(&chunk_hash_heads[i]);
+ INIT_LIST_HEAD_RCU(&chunk_hash_heads[i]);
return 0;
}
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index a706040..0de3cdb 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -44,13 +44,13 @@
*/
/* Audit filter lists, defined in <linux/audit.h> */
-struct list_head audit_filter_list[AUDIT_NR_FILTERS] = {
- LIST_HEAD_INIT(audit_filter_list[0]),
- LIST_HEAD_INIT(audit_filter_list[1]),
- LIST_HEAD_INIT(audit_filter_list[2]),
- LIST_HEAD_INIT(audit_filter_list[3]),
- LIST_HEAD_INIT(audit_filter_list[4]),
- LIST_HEAD_INIT(audit_filter_list[5]),
+struct rcu_list_head audit_filter_list[AUDIT_NR_FILTERS] = {
+ LIST_HEAD_INIT_RCU(audit_filter_list[0]),
+ LIST_HEAD_INIT_RCU(audit_filter_list[1]),
+ LIST_HEAD_INIT_RCU(audit_filter_list[2]),
+ LIST_HEAD_INIT_RCU(audit_filter_list[3]),
+ LIST_HEAD_INIT_RCU(audit_filter_list[4]),
+ LIST_HEAD_INIT_RCU(audit_filter_list[5]),
#if AUDIT_NR_FILTERS != 6
#error Fix audit_filter_list initialiser
#endif
@@ -821,10 +821,10 @@ struct audit_entry *audit_dupe_rule(struct audit_krule *old,
/* Find an existing audit rule.
* Caller must hold audit_filter_mutex to prevent stale rule data. */
static struct audit_entry *audit_find_rule(struct audit_entry *entry,
- struct list_head **p)
+ struct rcu_list_head **p)
{
struct audit_entry *e, *found = NULL;
- struct list_head *list;
+ struct rcu_list_head *list;
int h;
if (entry->rule.inode_f) {
@@ -834,7 +834,7 @@ static struct audit_entry *audit_find_rule(struct audit_entry *entry,
/* we don't know the inode number, so must walk entire hash */
for (h = 0; h < AUDIT_INODE_BUCKETS; h++) {
list = &audit_inode_hash[h];
- list_for_each_entry(e, list, list)
+ list_for_each_entry_rcu(e, list, list)
if (!audit_compare_rule(&entry->rule, &e->rule)) {
found = e;
goto out;
@@ -845,7 +845,7 @@ static struct audit_entry *audit_find_rule(struct audit_entry *entry,
*p = list = &audit_filter_list[entry->rule.listnr];
}
- list_for_each_entry(e, list, list)
+ list_for_each_entry_rcu(e, list, list)
if (!audit_compare_rule(&entry->rule, &e->rule)) {
found = e;
goto out;
@@ -864,7 +864,7 @@ static inline int audit_add_rule(struct audit_entry *entry)
struct audit_entry *e;
struct audit_watch *watch = entry->rule.watch;
struct audit_tree *tree = entry->rule.tree;
- struct list_head *list;
+ struct rcu_list_head *list;
int h, err;
#ifdef CONFIG_AUDITSYSCALL
int dont_count = 0;
@@ -947,7 +947,7 @@ static inline int audit_del_rule(struct audit_entry *entry)
struct audit_entry *e;
struct audit_watch *watch = entry->rule.watch;
struct audit_tree *tree = entry->rule.tree;
- struct list_head *list;
+ struct rcu_list_head *list;
LIST_HEAD(inotify_list);
int ret = 0;
#ifdef CONFIG_AUDITSYSCALL
@@ -1296,7 +1296,7 @@ int audit_filter_type(int type)
int result = 0;
rcu_read_lock();
- if (list_empty(&audit_filter_list[AUDIT_FILTER_TYPE]))
+ if (list_empty_rcu(&audit_filter_list[AUDIT_FILTER_TYPE]))
goto unlock_and_return;
list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_TYPE],
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index fc0f928..e4fdd74 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -686,7 +686,7 @@ static enum audit_state audit_filter_task(struct task_struct *tsk, char **key)
*/
static enum audit_state audit_filter_syscall(struct task_struct *tsk,
struct audit_context *ctx,
- struct list_head *list)
+ struct rcu_list_head *list)
{
struct audit_entry *e;
enum audit_state state;
@@ -695,7 +695,7 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk,
return AUDIT_DISABLED;
rcu_read_lock();
- if (!list_empty(list)) {
+ if (!list_empty_rcu(list)) {
int word = AUDIT_WORD(ctx->major);
int bit = AUDIT_BIT(ctx->major);
@@ -733,9 +733,9 @@ void audit_filter_inodes(struct task_struct *tsk, struct audit_context *ctx)
int bit = AUDIT_BIT(ctx->major);
struct audit_names *n = &ctx->names[i];
int h = audit_hash_ino((u32)n->ino);
- struct list_head *list = &audit_inode_hash[h];
+ struct rcu_list_head *list = &audit_inode_hash[h];
- if (list_empty(list))
+ if (list_empty_rcu(list))
continue;
list_for_each_entry_rcu(e, list, list) {
--
1.6.3.3
next prev parent reply other threads:[~2010-02-24 20:05 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-23 1:04 [PATCH tip/core/rcu 0/21] v6 add lockdep-based diagnostics to rcu_dereference() Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 01/21] rcu: introduce lockdep-based checking to RCU read-side primitives Paul E. McKenney
2010-02-25 10:09 ` [tip:core/rcu] rcu: Introduce " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 02/21] rcu: add lockdep-enabled variants of rcu_dereference() Paul E. McKenney
2010-02-25 10:09 ` [tip:core/rcu] rcu: Add " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 03/21] rcu: integrate rcu_dereference_check() message into lockdep Paul E. McKenney
2010-02-25 10:09 ` [tip:core/rcu] rcu: Integrate " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 04/21] rcu: disable lockdep checking in RCU list-traversal primitives Paul E. McKenney
2010-02-25 10:10 ` [tip:core/rcu] rcu: Disable " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 05/21] net: add checking to rcu_dereference() primitives Paul E. McKenney
2010-02-25 10:10 ` [tip:core/rcu] net: Add " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 06/21] sched: use lockdep-based checking on rcu_dereference() Paul E. McKenney
2010-02-25 10:11 ` [tip:core/rcu] sched: Use " tip-bot for Paul E. McKenney
2010-02-25 11:06 ` [tip:core/rcu] sched, cgroups: Fix module export tip-bot for Ingo Molnar
2010-02-23 1:04 ` [PATCH tip/core/rcu 07/21] sched: better name for for_each_domain_rd Paul E. McKenney
2010-02-25 10:11 ` [tip:core/rcu] sched: Better " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 08/21] vfs: apply lockdep-based checking to rcu_dereference() uses Paul E. McKenney
2010-02-25 10:11 ` [tip:core/rcu] vfs: Apply " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 09/21] vfs: abstract rcu_dereference_check for files-fdtable use Paul E. McKenney
2010-02-25 10:11 ` [tip:core/rcu] vfs: Abstract " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 10/21] radix-tree: disable RCU lockdep checking in radix tree Paul E. McKenney
2010-02-25 10:12 ` [tip:core/rcu] radix-tree: Disable " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 11/21] idr: apply lockdep-based diagnostics to rcu_dereference() uses Paul E. McKenney
2010-02-25 10:12 ` [tip:core/rcu] idr: Apply " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 12/21] security: apply lockdep-based checking " Paul E. McKenney
2010-02-25 10:12 ` [tip:core/rcu] security: Apply " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 13/21] rcu: documentation update for CONFIG_PROVE_RCU Paul E. McKenney
2010-02-25 10:12 ` [tip:core/rcu] rcu: Documentation " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 14/21] rcu: fix citation of Mathieu's dissertation Paul E. McKenney
2010-02-25 10:13 ` [tip:core/rcu] rcu: Fix " tip-bot for Paul E. McKenney
2010-02-23 1:04 ` [PATCH tip/core/rcu 15/21] rcu: accelerate grace period if last non-dynticked CPU Paul E. McKenney
2010-02-25 10:13 ` [tip:core/rcu] rcu: Accelerate " tip-bot for Paul E. McKenney
2010-02-23 1:05 ` [PATCH tip/core/rcu 16/21] rcu: use canonical URL for Mathieu's dissertation Paul E. McKenney
2010-02-25 10:13 ` [tip:core/rcu] rcu: Use " tip-bot for Paul E. McKenney
2010-02-23 1:05 ` [PATCH tip/core/rcu 17/21] rcu: stop overflowing signed integers Paul E. McKenney
2010-02-25 10:14 ` [tip:core/rcu] rcu: Stop " tip-bot for Paul E. McKenney
2010-02-23 1:05 ` [PATCH tip/core/rcu 18/21] rcu: Convert to raw_spinlocks Paul E. McKenney
2010-02-25 10:14 ` [tip:core/rcu] " tip-bot for Paul E. McKenney
2010-02-23 1:05 ` [PATCH tip/core/rcu 19/21] rcu: fix deadlock in TREE_PREEMPT_RCU CPU stall detection Paul E. McKenney
2010-02-25 10:14 ` [tip:core/rcu] rcu: Fix " tip-bot for Paul E. McKenney
2010-02-23 1:05 ` [PATCH tip/core/rcu 20/21] rcu: fix rcutorture mod_timer argument to delay one jiffy Paul E. McKenney
2010-02-25 10:14 ` [tip:core/rcu] rcu: Fix " tip-bot for Paul E. McKenney
2010-02-23 1:05 ` [PATCH tip/core/rcu 21/21] rcu: add RCU_CPU_STALL_VERBOSE to dump detailed per-task information Paul E. McKenney
2010-02-25 10:15 ` [tip:core/rcu] rcu: Add " tip-bot for Paul E. McKenney
2010-02-23 12:59 ` [PATCH tip/core/rcu 0/21] v6 add lockdep-based diagnostics to rcu_dereference() Arnd Bergmann
2010-02-23 13:15 ` Mathieu Desnoyers
2010-02-23 14:35 ` Paul E. McKenney
2010-02-23 15:54 ` Arnd Bergmann
2010-02-23 16:16 ` Paul E. McKenney
2010-02-23 17:15 ` Arnd Bergmann
2010-02-23 18:01 ` Paul E. McKenney
2010-02-24 20:03 ` [PATCH 00/10] __rcu annotations, first draft Arnd Bergmann
2010-02-24 22:18 ` Paul E. McKenney
2010-02-25 8:37 ` Ingo Molnar
2010-02-24 20:03 ` [PATCH 01/10] rcu: define __rcu address space modifier for sparse Arnd Bergmann
2010-02-24 20:12 ` Mathieu Desnoyers
2010-02-24 20:22 ` Arnd Bergmann
2010-02-24 20:03 ` [PATCH 02/10] rcu: annotated list rcu code Arnd Bergmann
2010-02-24 20:15 ` Mathieu Desnoyers
2010-02-24 20:32 ` Arnd Bergmann
2010-02-24 20:03 ` [PATCH 03/10] cgroups: __rcu annotations Arnd Bergmann
2010-02-24 20:04 ` [PATCH 04/10] credentials: rcu annotation Arnd Bergmann
2010-02-24 20:04 ` [PATCH 05/10] perf_event: __rcu annotations Arnd Bergmann
2010-02-24 20:04 ` Arnd Bergmann [this message]
2010-02-24 20:04 ` [PATCH 07/10] module: " Arnd Bergmann
2010-02-24 20:13 ` Alexey Dobriyan
2010-02-24 20:26 ` Arnd Bergmann
2010-02-24 22:17 ` Paul E. McKenney
2010-02-24 23:07 ` Arnd Bergmann
2010-02-24 23:59 ` Paul E. McKenney
2010-02-25 17:06 ` Paul E. McKenney
2010-02-25 18:10 ` Arnd Bergmann
2010-02-25 20:05 ` Paul E. McKenney
2010-02-26 2:12 ` Paul E. McKenney
2010-02-24 20:04 ` [PATCH 08/10] pid: " Arnd Bergmann
2010-02-24 20:04 ` [PATCH 09/10] notifiers: " Arnd Bergmann
2010-02-24 20:04 ` [PATCH 10/10] scheduler: " Arnd Bergmann
2010-02-23 13:28 ` [PATCH tip/core/rcu 0/21] v6 add lockdep-based diagnostics to rcu_dereference() Paul E. McKenney
2010-02-25 10:00 ` Ingo Molnar
2010-02-25 10:01 ` Ingo Molnar
2010-02-25 12:04 ` Ingo Molnar
2010-02-25 18:18 ` Paul E. McKenney
2010-02-25 21:36 ` Paul E. McKenney
2010-02-25 21:22 ` Ingo Molnar
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=1267041846-10469-7-git-send-email-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=Valdis.Kletnieks@vt.edu \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dvhltc@us.ibm.com \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@elte.hu \
--cc=niv@us.ibm.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®