Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232025
b: refs/heads/master
c: 225c8e0
h: refs/heads/master
i:
  232023: 4432e23
v: v3
  • Loading branch information
Milton Miller authored and Linus Torvalds committed Jan 21, 2011
1 parent 98449d6 commit 94e8669
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 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: 6dc19899958e420a931274b94019e267e2396d3e
refs/heads/master: 225c8e010f2d17a62aef131e24c6e7c111f36f9b
29 changes: 19 additions & 10 deletions trunk/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ void generic_smp_call_function_interrupt(void)
*/
list_for_each_entry_rcu(data, &call_function.queue, csd.list) {
int refs;
void (*func) (void *info);

/*
* Since we walk the list without any locks, we might
Expand All @@ -213,24 +214,32 @@ void generic_smp_call_function_interrupt(void)
if (atomic_read(&data->refs) == 0)
continue;

if (!cpumask_test_and_clear_cpu(cpu, data->cpumask))
continue;

func = data->csd.func; /* for later warn */
data->csd.func(data->csd.info);

/*
* If the cpu mask is not still set then it enabled interrupts,
* we took another smp interrupt, and executed the function
* twice on this cpu. In theory that copy decremented refs.
*/
if (!cpumask_test_and_clear_cpu(cpu, data->cpumask)) {
WARN(1, "%pS enabled interrupts and double executed\n",
func);
continue;
}

refs = atomic_dec_return(&data->refs);
WARN_ON(refs < 0);
if (!refs) {
WARN_ON(!cpumask_empty(data->cpumask));

raw_spin_lock(&call_function.lock);
list_del_rcu(&data->csd.list);
raw_spin_unlock(&call_function.lock);
}

if (refs)
continue;

WARN_ON(!cpumask_empty(data->cpumask));

raw_spin_lock(&call_function.lock);
list_del_rcu(&data->csd.list);
raw_spin_unlock(&call_function.lock);

csd_unlock(&data->csd);
}

Expand Down

0 comments on commit 94e8669

Please sign in to comment.