[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200424223630.224895-1-joel@joelfernandes.org>
Date: Fri, 24 Apr 2020 18:36:30 -0400
From: "Joel Fernandes (Google)" <joel@...lfernandes.org>
To: linux-kernel@...r.kernel.org
Cc: "Joel Fernandes (Google)" <joel@...lfernandes.org>,
Steven Rostedt <rostedt@...dmis.org>,
Xiao Yang <yangx.jy@...fujitsu.com>,
Ingo Molnar <mingo@...hat.com>
Subject: [PATCH] kernel/trace: Stop and wait for kthread on preempt irq module unload
Kthread running the test needs to be stopped or it can continue
executing code unloaded by module causing a crash.
Suggested-by: Steven Rostedt <rostedt@...dmis.org>
Reported-by: Xiao Yang <yangx.jy@...fujitsu.com>
Link: http://lore.kernel.org/r/5EA2B0C8.2080706@cn.fujitsu.com
Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org>
---
kernel/trace/preemptirq_delay_test.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/preemptirq_delay_test.c b/kernel/trace/preemptirq_delay_test.c
index 31c0fad4cb9e1..1c28ca20e30b6 100644
--- a/kernel/trace/preemptirq_delay_test.c
+++ b/kernel/trace/preemptirq_delay_test.c
@@ -145,10 +145,10 @@ static struct attribute_group attr_group = {
};
static struct kobject *preemptirq_delay_kobj;
+static struct task_struct *test_task;
static int __init preemptirq_delay_init(void)
{
- struct task_struct *test_task;
int retval;
test_task = preemptirq_start_test();
@@ -171,6 +171,9 @@ static int __init preemptirq_delay_init(void)
static void __exit preemptirq_delay_exit(void)
{
kobject_put(preemptirq_delay_kobj);
+
+ if (test_task)
+ kthread_stop(test_task);
}
module_init(preemptirq_delay_init)
--
2.26.2.303.gf8c07b1a785-goog
Powered by blists - more mailing lists