Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47568
b: refs/heads/master
c: 78ba2fa
h: refs/heads/master
v: v3
  • Loading branch information
Corey Minyard authored and Linus Torvalds committed Feb 11, 2007
1 parent 1746056 commit 3702dd4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3678d62f028689abc8ac5693b254e48f605f94ba
refs/heads/master: 78ba2faf71c63990cba9997f18cf1d610e06e3f2
29 changes: 22 additions & 7 deletions trunk/drivers/char/ipmi/ipmi_msghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,14 @@ static void clean_up_interface_data(ipmi_smi_t intf)
free_smi_msg_list(&intf->waiting_msgs);
free_recv_msg_list(&intf->waiting_events);

/* Wholesale remove all the entries from the list in the
* interface and wait for RCU to know that none are in use. */
/*
* Wholesale remove all the entries from the list in the
* interface and wait for RCU to know that none are in use.
*/
mutex_lock(&intf->cmd_rcvrs_mutex);
list_add_rcu(&list, &intf->cmd_rcvrs);
list_del_rcu(&intf->cmd_rcvrs);
INIT_LIST_HEAD(&list);
list_splice_init_rcu(&intf->cmd_rcvrs, &list, synchronize_rcu);
mutex_unlock(&intf->cmd_rcvrs_mutex);
synchronize_rcu();

list_for_each_entry_safe(rcvr, rcvr2, &list, link)
kfree(rcvr);
Expand Down Expand Up @@ -451,7 +452,7 @@ int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher)
mutex_lock(&ipmi_interfaces_mutex);

/* Build a list of things to deliver. */
list_for_each_entry_rcu(intf, &ipmi_interfaces, link) {
list_for_each_entry(intf, &ipmi_interfaces, link) {
if (intf->intf_num == -1)
continue;
e = kmalloc(sizeof(*e), GFP_KERNEL);
Expand Down Expand Up @@ -2760,9 +2761,15 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
synchronize_rcu();
kref_put(&intf->refcount, intf_free);
} else {
/* After this point the interface is legal to use. */
/*
* Keep memory order straight for RCU readers. Make
* sure everything else is committed to memory before
* setting intf_num to mark the interface valid.
*/
smp_wmb();
intf->intf_num = i;
mutex_unlock(&ipmi_interfaces_mutex);
/* After this point the interface is legal to use. */
call_smi_watchers(i, intf->si_dev);
mutex_unlock(&smi_watchers_mutex);
}
Expand Down Expand Up @@ -3923,6 +3930,14 @@ static void send_panic_events(char *str)
/* Interface was not ready yet. */
continue;

/*
* intf_num is used as an marker to tell if the
* interface is valid. Thus we need a read barrier to
* make sure data fetched before checking intf_num
* won't be used.
*/
smp_rmb();

/* First job here is to figure out where to send the
OEM events. There's no way in IPMI to send OEM
events using an event send command, so we have to
Expand Down

0 comments on commit 3702dd4

Please sign in to comment.