mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
To: "Paul E. McKenney" <paulmck@kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Joel Fernandes <joel@joelfernandes.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Neeraj Upadhyay <quic_neeraju@quicinc.com>,
	Davidlohr Bueso <dave@stgolabs.net>
Cc: Qiuxu Zhuo <qiuxu.zhuo@intel.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	rcu@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] rcu/rcuscale: Stop kfree_scale_thread thread(s) after unloading rcuscale
Date: Mon, 13 Mar 2023 16:04:03 +0800	[thread overview]
Message-ID: <20230313080403.89290-1-qiuxu.zhuo@intel.com> (raw)

When running the 'kfree_rcu_test' test case with commands [1] the call
trace [2] was thrown. This was because the kfree_scale_thread thread(s)
still run after unloading rcuscale and torture modules. Fix the call
trace by invoking kfree_scale_cleanup() when removing the rcuscale module.

[1] modprobe torture
    modprobe rcuscale kfree_rcu_test=1
    // After some time
    rmmod rcuscale
    rmmod torture

[2] BUG: unable to handle page fault for address: ffffffffc0601a87
    #PF: supervisor instruction fetch in kernel mode
    #PF: error_code(0x0010) - not-present page
    PGD 11de4f067 P4D 11de4f067 PUD 11de51067 PMD 112f4d067 PTE 0
    Oops: 0010 [#1] PREEMPT SMP NOPTI
    CPU: 1 PID: 1798 Comm: kfree_scale_thr Not tainted 6.3.0-rc1-rcu+ #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
    RIP: 0010:0xffffffffc0601a87
    Code: Unable to access opcode bytes at 0xffffffffc0601a5d.
    RSP: 0018:ffffb25bc2e57e18 EFLAGS: 00010297
    RAX: 0000000000000000 RBX: ffffffffc061f0b6 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: ffffffff962fd0de RDI: ffffffff962fd0de
    RBP: ffffb25bc2e57ea8 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000000
    R13: 0000000000000000 R14: 000000000000000a R15: 00000000001c1dbe
    FS:  0000000000000000(0000) GS:ffff921fa2200000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffffffc0601a5d CR3: 000000011de4c006 CR4: 0000000000370ee0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <TASK>
     ? kvfree_call_rcu+0xf0/0x3a0
     ? kthread+0xf3/0x120
     ? kthread_complete_and_exit+0x20/0x20
     ? ret_from_fork+0x1f/0x30
     </TASK>
    Modules linked in: rfkill sunrpc ... [last unloaded: torture]
    CR2: ffffffffc0601a87
    ---[ end trace 0000000000000000 ]---

Fixes: e6e78b004fa7 ("rcuperf: Add kfree_rcu() performance Tests")
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
---
 kernel/rcu/rcuscale.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/rcu/rcuscale.c b/kernel/rcu/rcuscale.c
index 91fb5905a008..5e580cd08c58 100644
--- a/kernel/rcu/rcuscale.c
+++ b/kernel/rcu/rcuscale.c
@@ -522,6 +522,8 @@ rcu_scale_print_module_parms(struct rcu_scale_ops *cur_ops, const char *tag)
 		 scale_type, tag, nrealreaders, nrealwriters, verbose, shutdown);
 }
 
+static void kfree_scale_cleanup(void);
+
 static void
 rcu_scale_cleanup(void)
 {
@@ -542,6 +544,11 @@ rcu_scale_cleanup(void)
 	if (gp_exp && gp_async)
 		SCALEOUT_ERRSTRING("No expedited async GPs, so went with async!");
 
+	if (kfree_rcu_test) {
+		kfree_scale_cleanup();
+		return;
+	}
+
 	if (torture_cleanup_begin())
 		return;
 	if (!cur_ops) {
-- 
2.17.1


             reply	other threads:[~2023-03-13  8:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13  8:04 Qiuxu Zhuo [this message]
2023-03-14 23:02 ` Paul E. McKenney
2023-03-14 23:29   ` Joel Fernandes
2023-03-15 14:17     ` Zhuo, Qiuxu
2023-03-15 14:07   ` Zhuo, Qiuxu
2023-03-15 14:12     ` Joel Fernandes
2023-03-15 16:59       ` Paul E. McKenney
2023-03-16 13:17         ` Zhuo, Qiuxu
2023-03-16 13:28           ` Joel Fernandes
2023-03-16 13:53             ` Zhuo, Qiuxu
2023-03-16 14:57               ` Joel Fernandes
2023-03-16 17:50                 ` Paul E. McKenney
2023-03-17  5:50                   ` [PATCH v2 " Qiuxu Zhuo
2023-03-20 20:41                     ` Paul E. McKenney
2023-03-21  1:21                       ` Zhuo, Qiuxu
2023-03-21  4:26                         ` Paul E. McKenney
2023-03-21  5:23                           ` [PATCH v3 1/2] rcu/rcuscale: Move rcu_scale_*() after kfree_scale_cleanup() Qiuxu Zhuo
2023-03-21  5:23                             ` [PATCH v3 2/2] rcu/rcuscale: Stop kfree_scale_thread thread(s) after unloading rcuscale Qiuxu Zhuo
2023-03-21 15:47                               ` Davidlohr Bueso
2023-03-21 19:23                                 ` Paul E. McKenney
2023-03-21 21:28                                   ` Joel Fernandes
2023-03-22  1:26                                   ` Zhuo, Qiuxu
2023-03-22  2:18                                     ` Joel Fernandes
2023-03-22 11:42                                   ` [PATCH v4 0/2] " Qiuxu Zhuo
2023-03-22 11:42                                     ` [PATCH v4 1/2] rcu/rcuscale: Move rcu_scale_*() after kfree_scale_cleanup() Qiuxu Zhuo
2023-03-22 11:42                                     ` [PATCH v4 2/2] rcu/rcuscale: Stop kfree_scale_thread thread(s) after unloading rcuscale Qiuxu Zhuo
2023-03-22 18:24                                       ` Paul E. McKenney
2023-03-17  3:29                 ` [PATCH 1/1] " Zhuo, Qiuxu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230313080403.89290-1-qiuxu.zhuo@intel.com \
    --to=qiuxu.zhuo@intel.com \
    --cc=dave@stgolabs.net \
    --cc=frederic@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=quic_neeraju@quicinc.com \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®