| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 9 |
|
| 10 |
#include <linux/module.h> |
| 11 |
#include <linux/kernel.h> |
| 12 |
#include <linux/smp.h> |
| 13 |
#include <asm-generic/delay.h> |
| 14 |
|
| 15 |
static int ipidest; |
| 16 |
module_param(ipidest, int, S_IRUGO); |
| 17 |
|
| 18 |
|
| 19 |
static int nripis; |
| 20 |
module_param(nripis, int, S_IRUGO); |
| 21 |
|
| 22 |
|
| 23 |
static int interval; |
| 24 |
module_param(interval, int, S_IRUGO); |
| 25 |
|
| 26 |
|
| 27 |
static int delay; |
| 28 |
module_param(delay, int, S_IRUGO); |
| 29 |
|
| 30 |
static void ipi_handler(void *info) |
| 31 |
{ |
| 32 |
udelay(interval); |
| 33 |
} |
| 34 |
|
| 35 |
static int targeted_ipi_init(void) |
| 36 |
{ |
| 37 |
int ret, i; |
| 38 |
|
| 39 |
for (i=0; i < nripis; i++) |
| 40 |
{ |
| 41 |
ret = smp_call_function_single(ipidest, ipi_handler, NULL, 1); |
| 42 |
if (ret) { |
| 43 |
printk(KERN_ERR "i=%d smp_call_function_single ret=%d\n", i, ret); |
| 44 |
return 0; |
| 45 |
} |
| 46 |
udelay(interval); |
| 47 |
} |
| 48 |
|
| 49 |
return 0; |
| 50 |
} |
| 51 |
|
| 52 |
static void targeted_ipi_exit(void) |
| 53 |
{ |
| 54 |
} |
| 55 |
|
| 56 |
module_init(targeted_ipi_init); |
| 57 |
module_exit(targeted_ipi_exit); |
| 58 |
MODULE_LICENSE("GPL"); |