forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use stop_machine_run in the Intel RNG driver
Replace call_smp_function with stop_machine_run in the Intel RNG driver. CPU A has done read_lock(&lock) CPU B has done write_lock_irq(&lock) and is waiting for A to release the lock. A third CPU calls call_smp_function and issues the IPI. CPU A takes CPU C's IPI. CPU B is waiting with interrupts disabled and does not see the IPI. CPU C is stuck waiting for CPU B to respond to the IPI. Deadlock. The solution is to use stop_machine_run instead of call_smp_function (call_smp_function should not be called in situations where the CPUs may be suspended). [[email protected]: fix a typo in mod_init()] [[email protected]: fix memory leak] Signed-off-by: Prarit Bhargava <[email protected]> Cc: Jan Beulich <[email protected]> Cc: "Tomita, Haruo" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
Showing
2 changed files
with
127 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
/* Copyright 2005 Rusty Russell [email protected] IBM Corporation. | ||
* GPL v2 and any later version. | ||
*/ | ||
#include <linux/stop_machine.h> | ||
#include <linux/kthread.h> | ||
#include <linux/sched.h> | ||
#include <linux/cpu.h> | ||
#include <linux/err.h> | ||
#include <linux/kthread.h> | ||
#include <linux/module.h> | ||
#include <linux/sched.h> | ||
#include <linux/stop_machine.h> | ||
#include <linux/syscalls.h> | ||
#include <asm/atomic.h> | ||
#include <asm/semaphore.h> | ||
|
@@ -208,3 +209,4 @@ int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) | |
|
||
return ret; | ||
} | ||
EXPORT_SYMBOL_GPL(stop_machine_run); |