-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlkb_defer_softirq.patch
73 lines (65 loc) · 2.18 KB
/
lkb_defer_softirq.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From 8c0d436eee113426bdfdfc028b057133e5162e90 Mon Sep 17 00:00:00 2001
From: Savio Machado <[email protected]>
Date: Tue, 25 Sep 2018 02:20:00 -0300
Subject: [PATCH] kernel/softirq.c: add new dummie softirq
will print a message whenever a module is successfully loaded.
---
include/linux/interrupt.h | 1 +
kernel/module.c | 2 ++
kernel/softirq.c | 7 +++++++
3 files changed, 10 insertions(+)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index eeceac3376fc..4a6ef4cb03e2 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -468,6 +468,7 @@ enum
NET_RX_SOFTIRQ,
BLOCK_SOFTIRQ,
IRQ_POLL_SOFTIRQ,
+ LKB_SOFTIRQ,
TASKLET_SOFTIRQ,
SCHED_SOFTIRQ,
HRTIMER_SOFTIRQ, /* Unused, but kept as tools rely on the
diff --git a/kernel/module.c b/kernel/module.c
index 6746c85511fe..bd27526156e8 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -40,6 +40,7 @@
#include <linux/moduleparam.h>
#include <linux/errno.h>
#include <linux/err.h>
+#include <linux/interrupt.h>
#include <linux/vermagic.h>
#include <linux/notifier.h>
#include <linux/sched.h>
@@ -3509,6 +3510,7 @@ static noinline int do_init_module(struct module *mod)
call_rcu_sched(&freeinit->rcu, do_free_init);
mutex_unlock(&module_mutex);
wake_up_all(&module_wq);
+ raise_softirq(LKB_SOFTIRQ);
return 0;
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 6f584861d329..a792a091cad6 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -545,6 +545,12 @@ static __latent_entropy void tasklet_hi_action(struct softirq_action *a)
tasklet_action_common(a, this_cpu_ptr(&tasklet_hi_vec), HI_SOFTIRQ);
}
+static __latent_entropy void lkb_softirq_action(struct softirq_action *a)
+{
+ /* runs with interrupt enabled, can't sleep */
+ printk(KERN_DEBUG "%s: module loaded\n", __FUNCTION__);
+}
+
void tasklet_init(struct tasklet_struct *t,
void (*func)(unsigned long), unsigned long data)
{
@@ -635,6 +641,7 @@ void __init softirq_init(void)
open_softirq(TASKLET_SOFTIRQ, tasklet_action);
open_softirq(HI_SOFTIRQ, tasklet_hi_action);
+ open_softirq(LKB_SOFTIRQ, lkb_softirq_action);
}
static int ksoftirqd_should_run(unsigned int cpu)
--
2.17.1