Commit b2b18660 authored by Paul E. McKenney's avatar Paul E. McKenney Committed by Linus Torvalds

[PATCH] RCU: clean up a few remaining synchronize_kernel() calls

2.6.12-rc6-mm1 has a few remaining synchronize_kernel()s, some (but not
all) in comments.  This patch changes these synchronize_kernel() calls (and
comments) to synchronize_rcu() or synchronize_sched() as follows:

- arch/x86_64/kernel/mce.c mce_read(): change to synchronize_sched() to
  handle races with machine-check exceptions (synchronize_rcu() would not cut
  it given RCU implementations intended for hardcore realtime use.

- drivers/input/serio/i8042.c i8042_stop(): change to synchronize_sched() to
  handle races with i8042_interrupt() interrupt handler.  Again,
  synchronize_rcu() would not cut it given RCU implementations intended for
  hardcore realtime use.

- include/*/kdebug.h comments: change to synchronize_sched() to handle races
  with NMIs.  As before, synchronize_rcu() would not cut it...

- include/linux/list.h comment: change to synchronize_rcu(), since this
  comment is for list_del_rcu().

- security/keys/key.c unregister_key_type(): change to synchronize_rcu(),
  since this is interacting with RCU read side.

- security/keys/process_keys.c install_session_keyring(): change to
  synchronize_rcu(), since this is interacting with RCU read side.
Signed-off-by: default avatar"Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ae67cd64
...@@ -411,7 +411,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff ...@@ -411,7 +411,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, loff
memset(mcelog.entry, 0, next * sizeof(struct mce)); memset(mcelog.entry, 0, next * sizeof(struct mce));
mcelog.next = 0; mcelog.next = 0;
synchronize_kernel(); synchronize_sched();
/* Collect entries that were still getting written before the synchronize. */ /* Collect entries that were still getting written before the synchronize. */
......
...@@ -396,7 +396,7 @@ static void i8042_stop(struct serio *serio) ...@@ -396,7 +396,7 @@ static void i8042_stop(struct serio *serio)
struct i8042_port *port = serio->port_data; struct i8042_port *port = serio->port_data;
port->exists = 0; port->exists = 0;
synchronize_kernel(); synchronize_sched();
port->serio = NULL; port->serio = NULL;
} }
......
...@@ -18,7 +18,7 @@ struct die_args { ...@@ -18,7 +18,7 @@ struct die_args {
}; };
/* Note - you should never unregister because that can race with NMIs. /* Note - you should never unregister because that can race with NMIs.
If you really want to do it first unregister - then synchronize_kernel - then free. If you really want to do it first unregister - then synchronize_sched - then free.
*/ */
int register_die_notifier(struct notifier_block *nb); int register_die_notifier(struct notifier_block *nb);
extern struct notifier_block *i386die_chain; extern struct notifier_block *i386die_chain;
......
...@@ -17,7 +17,7 @@ struct die_args { ...@@ -17,7 +17,7 @@ struct die_args {
/* /*
Note - you should never unregister because that can race with NMIs. Note - you should never unregister because that can race with NMIs.
If you really want to do it first unregister - then synchronize_kernel - If you really want to do it first unregister - then synchronize_sched -
then free. then free.
*/ */
int register_die_notifier(struct notifier_block *nb); int register_die_notifier(struct notifier_block *nb);
......
...@@ -16,7 +16,7 @@ struct die_args { ...@@ -16,7 +16,7 @@ struct die_args {
}; };
/* Note - you should never unregister because that can race with NMIs. /* Note - you should never unregister because that can race with NMIs.
* If you really want to do it first unregister - then synchronize_kernel * If you really want to do it first unregister - then synchronize_sched
* - then free. * - then free.
*/ */
int register_die_notifier(struct notifier_block *nb); int register_die_notifier(struct notifier_block *nb);
......
...@@ -14,7 +14,7 @@ struct die_args { ...@@ -14,7 +14,7 @@ struct die_args {
}; };
/* Note - you should never unregister because that can race with NMIs. /* Note - you should never unregister because that can race with NMIs.
If you really want to do it first unregister - then synchronize_kernel - then free. If you really want to do it first unregister - then synchronize_sched - then free.
*/ */
int register_die_notifier(struct notifier_block *nb); int register_die_notifier(struct notifier_block *nb);
extern struct notifier_block *die_chain; extern struct notifier_block *die_chain;
......
...@@ -185,7 +185,7 @@ static inline void list_del(struct list_head *entry) ...@@ -185,7 +185,7 @@ static inline void list_del(struct list_head *entry)
* list_for_each_entry_rcu(). * list_for_each_entry_rcu().
* *
* Note that the caller is not permitted to immediately free * Note that the caller is not permitted to immediately free
* the newly deleted entry. Instead, either synchronize_kernel() * the newly deleted entry. Instead, either synchronize_rcu()
* or call_rcu() must be used to defer freeing until an RCU * or call_rcu() must be used to defer freeing until an RCU
* grace period has elapsed. * grace period has elapsed.
*/ */
......
...@@ -980,7 +980,7 @@ void unregister_key_type(struct key_type *ktype) ...@@ -980,7 +980,7 @@ void unregister_key_type(struct key_type *ktype)
spin_unlock(&key_serial_lock); spin_unlock(&key_serial_lock);
/* make sure everyone revalidates their keys */ /* make sure everyone revalidates their keys */
synchronize_kernel(); synchronize_rcu();
/* we should now be able to destroy the payloads of all the keys of /* we should now be able to destroy the payloads of all the keys of
* this type with impunity */ * this type with impunity */
......
...@@ -234,7 +234,7 @@ static int install_session_keyring(struct task_struct *tsk, ...@@ -234,7 +234,7 @@ static int install_session_keyring(struct task_struct *tsk,
ret = 0; ret = 0;
/* we're using RCU on the pointer */ /* we're using RCU on the pointer */
synchronize_kernel(); synchronize_rcu();
key_put(old); key_put(old);
error: error:
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment