From nobody Fri Dec 19 14:36:11 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A3AB34CFD2; Wed, 5 Nov 2025 20:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; cv=none; b=pTSOBcLVydBVyZ6DGcfD/M/chq3gObImuGWN32VojWqbaqVHlPnA6ViLEtGoKTvm3TcqQR7otx4Q+PyPOKT6GqojadAuU/SFE1qmgAqtKUDqzDIpmJivZNycZwBR4VaLmT097qFJN1noy/m3fjM8Qmjx3X3j0UrnjTeRNSH0YCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; c=relaxed/simple; bh=nTHX1YfCh7X8t+gy7/mwsMUuWMwgp6cK39S8CemYIGw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BF96o+IltziKw+TjCDrM41p5ztKvY4Ws7M7pw7lgvEnUmc1JjKmCnJDoezAN+Lejc/5nmR8VjEx3Si0t5U5kKY/rJrZ5BFlwyPHgIzEhpxw5POIm097/Grm5VyZQ+UGv9prVGd8PYfux4M49IlQJGbKkCK83Ht4hOAORedZDn5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rneu7ILz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rneu7ILz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A1BAC4CEF5; Wed, 5 Nov 2025 20:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762374003; bh=nTHX1YfCh7X8t+gy7/mwsMUuWMwgp6cK39S8CemYIGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rneu7ILzxQDORkplKIJfKvcj8v60TRP81/uyvwte9HSLfL7ka7KYQJUSzyNqeMovd TvUbLw+MwO3mA8HfJD3dcgIU0rwKDlIekpd13ZiYRb1mi42eZ16KbxseqA9BT70FUh vWztC0dPOfLhyUNqtuR1cowriYxY0mbSgBzoORqC9HZpZVYcevkRVi//BZsVnDc00U 2dhQkE2KM4ZIEvSVpJor2LSlwzYbtx+Rrlf775JjapiChYOz3d223OiZ22hPcXx1ge 7uNdszXznlWAylcVYJal5dWVdNVFt8j/XrJJN5yJEyTJysvKrxHPpKNZlKzGKNWyH4 Mp8YkuDvOLnmg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 96B75CE0B94; Wed, 5 Nov 2025 12:20:02 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Wang Liang , Zhang Changzhong , "Paul E . McKenney" Subject: [PATCH v2 1/5] locktorture: Fix memory leak in param_set_cpumask() Date: Wed, 5 Nov 2025 12:19:56 -0800 Message-Id: <20251105202000.2700370-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Wang Liang With CONFIG_CPUMASK_OFFSTACK=3Dy, the 'bind_writers' buffer is allocated via alloc_cpumask_var() in param_set_cpumask(). But it is not freed, when setting the module parameter multiple times by sysfs interface or removing module. Below kmemleak trace is seen for this issue: unreferenced object 0xffff888100aabff8 (size 8): comm "bash", pid 323, jiffies 4295059233 hex dump (first 8 bytes): 07 00 00 00 00 00 00 00 ........ backtrace (crc ac50919): __kmalloc_node_noprof+0x2e5/0x420 alloc_cpumask_var_node+0x1f/0x30 param_set_cpumask+0x26/0xb0 [locktorture] param_attr_store+0x93/0x100 module_attr_store+0x1b/0x30 kernfs_fop_write_iter+0x114/0x1b0 vfs_write+0x300/0x410 ksys_write+0x60/0xd0 do_syscall_64+0xa4/0x260 entry_SYSCALL_64_after_hwframe+0x77/0x7f This issue can be reproduced by: insmod locktorture.ko bind_writers=3D1 rmmod locktorture or: insmod locktorture.ko bind_writers=3D1 echo 2 > /sys/module/locktorture/parameters/bind_writers Considering that setting the module parameter 'bind_writers' or 'bind_readers' by sysfs interface has no real effect, set the parameter permissions to 0444. To fix the memory leak when removing module, free 'bind_writers' and 'bind_readers' memory in lock_torture_cleanup(). Fixes: 73e341242483 ("locktorture: Add readers_bind and writers_bind module= parameters") Suggested-by: Zhang Changzhong Signed-off-by: Wang Liang Signed-off-by: Paul E. McKenney --- kernel/locking/locktorture.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c index ce0362f0a871..6567e5eeacc0 100644 --- a/kernel/locking/locktorture.c +++ b/kernel/locking/locktorture.c @@ -103,8 +103,8 @@ static const struct kernel_param_ops lt_bind_ops =3D { .get =3D param_get_cpumask, }; =20 -module_param_cb(bind_readers, <_bind_ops, &bind_readers, 0644); -module_param_cb(bind_writers, <_bind_ops, &bind_writers, 0644); +module_param_cb(bind_readers, <_bind_ops, &bind_readers, 0444); +module_param_cb(bind_writers, <_bind_ops, &bind_writers, 0444); =20 long torture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask, b= ool dowarn); =20 @@ -1211,6 +1211,10 @@ static void lock_torture_cleanup(void) cxt.cur_ops->exit(); cxt.init_called =3D false; } + + free_cpumask_var(bind_readers); + free_cpumask_var(bind_writers); + torture_cleanup_end(); } =20 --=20 2.40.1 From nobody Fri Dec 19 14:36:11 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A44534CFD4; Wed, 5 Nov 2025 20:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; cv=none; b=JknIzZqTWdMEnKbDV1zYVr9X+oV2sovToE9g34iXeHPGfTLhnxw8K1i1zXlucPayu74lafwte6IQ5h0QhrIZJMbtFjPt4OsMG1GMW33UnbZN2nMA+xYdbLnMUl3FEo0S7jAxlU5HbJPYDAQJgeKGMdQRnl6D/q0KaP3aFfS2DQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; c=relaxed/simple; bh=4KUUrYSVLSgf7AtIDUdA8yD1hmE5D2On1prenhy0yxs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DO1Bnq3UyQfDP4jJvv/MmlUEU0+lZkZZj26sihlEFXOdRcLa/F7jk81NNp2SUbpWWAExQmaZphZYWCLYPTQ8FZDOkO4ENRm7/sAc/nnWuUrxHXWLeoJ0hBtWgkTOT4enoRqmCzlaqwHbL2E29+Nh5s3jP1C+FPAccfOVT47BYfk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M65M4Swq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M65M4Swq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2F17C116C6; Wed, 5 Nov 2025 20:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762374003; bh=4KUUrYSVLSgf7AtIDUdA8yD1hmE5D2On1prenhy0yxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M65M4Swq8ZtLapk8i60TThkhyGsAAgXBjsSTw7fCwbBms7pGTOybte3tEvbXOq+5T H1CImQ2jpJelQWOspeMkYz+eBeILI81Wz8XTD0CNDBlE06Kp1rDpd5lUOG4UeShbUc ssBExd/HhSjmOjBfjEclFem6+kidJ46qGCm/hx4JWWxZRpW57gX8EkTOl1TFObRmp9 rNYpZqSHnTK3RAIasVHqs2ZPHsJsQZhZDcEQlMpxUSbFojt8aUsHKi38CNKpKl5TFR Wz5IQOh1i3Bnea5thHQdHc+MXQG3UcbtkmHHzWTpLt7lvFeXK2KzZRA0CrUppg5Y5z CCiTN66T7h7aA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 99CD6CE0BA5; Wed, 5 Nov 2025 12:20:02 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Xuanqiang Luo , "Paul E . McKenney" Subject: [PATCH v2 2/5] rcu: use WRITE_ONCE() for ->next and ->pprev of hlist_nulls Date: Wed, 5 Nov 2025 12:19:57 -0800 Message-Id: <20251105202000.2700370-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Xuanqiang Luo In rculist_nulls.h we can still see ordinary assignments to ->pprev and ->next of hlist_nulls. As noted in the two patches below: commit efd04f8a8b45 ("rcu: Use WRITE_ONCE() for assignments to ->next for rculist_nulls") commit 860c8802ace1 ("rcu: Use WRITE_ONCE() for assignments to ->pprev for hlist_nulls") We should use WRITE_ONCE(). Signed-off-by: Xuanqiang Luo Signed-off-by: Paul E. McKenney --- include/linux/rculist_nulls.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h index 89186c499dd4..d5a656cc4c6a 100644 --- a/include/linux/rculist_nulls.h +++ b/include/linux/rculist_nulls.h @@ -138,7 +138,7 @@ static inline void hlist_nulls_add_tail_rcu(struct hlis= t_nulls_node *n, =20 if (last) { WRITE_ONCE(n->next, last->next); - n->pprev =3D &last->next; + WRITE_ONCE(n->pprev, &last->next); rcu_assign_pointer(hlist_nulls_next_rcu(last), n); } else { hlist_nulls_add_head_rcu(n, h); @@ -148,8 +148,8 @@ static inline void hlist_nulls_add_tail_rcu(struct hlis= t_nulls_node *n, /* after that hlist_nulls_del will work */ static inline void hlist_nulls_add_fake(struct hlist_nulls_node *n) { - n->pprev =3D &n->next; - n->next =3D (struct hlist_nulls_node *)NULLS_MARKER(NULL); + WRITE_ONCE(n->pprev, &n->next); + WRITE_ONCE(n->next, (struct hlist_nulls_node *)NULLS_MARKER(NULL)); } =20 /** --=20 2.40.1 From nobody Fri Dec 19 14:36:11 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71CE434D4C9; Wed, 5 Nov 2025 20:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; cv=none; b=ibAKkkjdvEf5uSN19ywfoP0xWtaRqxL4RraM/tsG4xK3zgPs8NNJ4CpNqvYiQFWbViZu25X3j/yplCexWsls5bfdFu3N+Ie4d/N45c5QS5nZbzrf/kFcc+Y1KOdbAZAZ7vz7nRFzBLDtCf6Wd5SfDLThXi7SWnbmrNANuVtGHBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; c=relaxed/simple; bh=kfsztBfcKFsvKvbfLAh7TIlp4bddlBjidIMtrTwFxeg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FXlWdI3f3weYT8AMXsL2/WvoVDXjyC7BsTYyFUI40r89ohsBS1EtS9entb22GvOpqSFrZ+IoQmoW1k8GXoJKfJgvumXwvHqPQC+6uaSQlC2zFn1h/DYghSJJguIU1LjWYAR2O5BvP+WFZp9Z/NWp428fiU4R4oG66IPygjjh+rg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rlfkDqB0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rlfkDqB0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0254C19423; Wed, 5 Nov 2025 20:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762374003; bh=kfsztBfcKFsvKvbfLAh7TIlp4bddlBjidIMtrTwFxeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rlfkDqB0dlbtCOGwCXrccwa/5Q1tFyZGAN5WGx2gDKE2Y/xaJQfo8zQ+Mh3EulK2e ztSEtQNkscIjX1j8g+Q7jts+ZrDzAqr/4CksxxoBxM8rMFy6og3caQJsl7hgtfbOql IDBrjgKBQF3n29TtkN9CRI9j8ktx6me9GhDnKpKcn8ZClK0d7gx7wie7debrsA+j4H qQPBimRQT0os0XpmT4QDtCTfAKfe9zNrB3gqNxfEVi2xirzQpuyjz9Yf5cpdjFfm7r vyycT8Bcn8mvWWf7RVI1RLucUeCb8sTPcbVIDeGO6HzpwhnARNJlqyCjMQhMBdvFPK 6ElmklujOC/cQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 9C4C5CE0CA7; Wed, 5 Nov 2025 12:20:02 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 3/5] torture: Add kvm-series.sh to test commit/scenario combination Date: Wed, 5 Nov 2025 12:19:58 -0800 Message-Id: <20251105202000.2700370-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit adds a kvm-series.sh script that takes a list of scenarios and a list of commits, and then runs each scenario on all of the commits. A given scenario is run on all the commits before advancing to the next scenario to minimize build times. The successes and failures are summarized at the end of the run. Signed-off-by: Paul E. McKenney --- .../selftests/rcutorture/bin/kvm-series.sh | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100755 tools/testing/selftests/rcutorture/bin/kvm-series.sh diff --git a/tools/testing/selftests/rcutorture/bin/kvm-series.sh b/tools/t= esting/selftests/rcutorture/bin/kvm-series.sh new file mode 100755 index 000000000000..2ff905a1853b --- /dev/null +++ b/tools/testing/selftests/rcutorture/bin/kvm-series.sh @@ -0,0 +1,116 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# +# Usage: kvm-series.sh config-list commit-id-list [ kvm.sh parameters ] +# +# Tests the specified list of unadorned configs ("TREE01 SRCU-P" but not +# "CFLIST" or "3*TRACE01") and an indication of a set of commits to test, +# then runs each commit through the specified list of commits using kvm.sh. +# The runs are grouped into a -series/config/commit directory tree. +# Each run defaults to a duration of one minute. +# +# Run in top-level Linux source directory. Please note that this is in +# no way a replacement for "git bisect"!!! +# +# This script is intended to replace kvm-check-branches.sh by providing +# ease of use and faster execution. + +T=3D"`mktemp -d ${TMPDIR-/tmp}/kvm-series.sh.XXXXXX`" +trap 'rm -rf $T' 0 + +scriptname=3D$0 +args=3D"$*" + +config_list=3D"${1}" +if test -z "${config_list}" +then + echo "$0: Need a quoted list of --config arguments for first argument." + exit 1 +fi +if test -z "${config_list}" || echo "${config_list}" | grep -q '\*' +then + echo "$0: Repetition ('*') not allowed in config list." + exit 1 +fi + +commit_list=3D"${2}" +if test -z "${commit_list}" +then + echo "$0: Need a list of commits (e.g., HEAD^^^..) for second argument." + exit 2 +fi +git log --pretty=3Dformat:"%h" "${commit_list}" > $T/commits +ret=3D$? +if test "${ret}" -ne 0 +then + echo "$0: Invalid commit list ('${commit_list}')." + exit 2 +fi +sha1_list=3D`cat $T/commits` + +shift +shift + +RCUTORTURE=3D"`pwd`/tools/testing/selftests/rcutorture"; export RCUTORTURE +PATH=3D${RCUTORTURE}/bin:$PATH; export PATH +. functions.sh + +ret=3D0 +nfail=3D0 +nsuccess=3D0 +faillist=3D +successlist=3D +cursha1=3D"`git rev-parse --abbrev-ref HEAD`" +ds=3D"`date +%Y.%m.%d-%H.%M.%S`-series" +startdate=3D"`date`" +starttime=3D"`get_starttime`" + +echo " --- " $scriptname $args | tee -a $T/log +echo " --- Results directory: " $ds | tee -a $T/log + +for config in ${config_list} +do + sha_n=3D0 + for sha in ${sha1_list} + do + sha1=3D${sha_n}.${sha} # Enable "sort -k1nr" to list commits in order. + echo Starting ${config}/${sha1} at `date` | tee -a $T/log + git checkout "${sha}" + time tools/testing/selftests/rcutorture/bin/kvm.sh --configs "$config" -= -datestamp "$ds/${config}/${sha1}" --duration 1 "$@" + curret=3D$? + if test "${curret}" -ne 0 + then + nfail=3D$((nfail+1)) + faillist=3D"$faillist ${config}/${sha1}(${curret})" + else + nsuccess=3D$((nsuccess+1)) + successlist=3D"$successlist ${config}/${sha1}" + # Successful run, so remove large files. + rm -f ${RCUTORTURE}/$ds/${config}/${sha1}/{vmlinux,bzImage,System.map,M= odule.symvers} + fi + if test "${ret}" -eq 0 + then + ret=3D${curret} + fi + sha_n=3D$((sha_n+1)) + done +done +git checkout "${cursha1}" + +echo ${nsuccess} SUCCESSES: | tee -a $T/log +echo ${successlist} | fmt | tee -a $T/log +echo | tee -a $T/log +echo ${nfail} FAILURES: | tee -a $T/log +echo ${faillist} | fmt | tee -a $T/log +if test -n "${faillist}" +then + echo | tee -a $T/log + echo Failures across commits: | tee -a $T/log + echo ${faillist} | tr ' ' '\012' | sed -e 's,^[^/]*/,,' -e 's/([0-9]*)//'= | + sort | uniq -c | sort -k2n | tee -a $T/log +fi +echo Started at $startdate, ended at `date`, duration `get_starttime_durat= ion $starttime`. | tee -a $T/log +echo Summary: Successes: ${nsuccess} Failures: ${nfail} | tee -a $T/log +cp $T/log tools/testing/selftests/rcutorture/res/${ds} + +exit "${ret}" --=20 2.40.1 From nobody Fri Dec 19 14:36:11 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6E9134CFC5; Wed, 5 Nov 2025 20:20:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; cv=none; b=FREBE3gKph3+8yF2/jTgdx36AVhTwMmJuzNUnJojlI3hDMdjuLtPxOPNRHQG9SB873GRp8JXCSm5QY+cpMaDnDyZJBJkj+rwnmMdcmNzukQlWGk5ncYcXIC65MkKsh0LhKq/ewxAo1MEUz3XuS3rExkJVuHtNPZVHyMUcmZk52c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; c=relaxed/simple; bh=bdRaLOeGRlaNeOitkkHmPDSe++KDC1F2xKdPiknDIIg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Pvt0ETBtK3y1hkkuZRcNy8+l4QdBdIHcTh3vBGaGXojWdZpg38avMl45kiKHQHfPjqEz9lVPP3j/rehG4A9pxxNyi5zD5JT2s2N+8lnVzYDb4qNYSG11x4ly0xHhUeEH6jdgljCPmUYwF2CXg3RVTAdQHDdGGe0OHibozMYT4Ac= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m61cMLNa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m61cMLNa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8AE8C19422; Wed, 5 Nov 2025 20:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762374003; bh=bdRaLOeGRlaNeOitkkHmPDSe++KDC1F2xKdPiknDIIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m61cMLNaNRBOR7OpXtaa+GnElsOxvM51SYy4reL2KulVYABvzbW0xARnO2WSsLSeY PWhHa9X+MYLfWAHKYxIubiZXWRYutLvH2h8hXM84/Df0HaWO88lMtTQckF31hYGJz6 ll1wnjydgyLcfOq4hXZXZeclLrtrWhfuH1Dgt28f8gjPiCkTu5rTmcv3G+ZZVnQFky Fe10YO1H531j+aVDE8FdL5+lkcHmobdAL5qNJrSh8qUHdVQJeMG7efg+kKpVObUCDZ YkNFpk1GzvTAwyPhFKmEibww+tNWEFf5ljYsfhvLzD8hCnBYleRyPkNzND1ChimCNG tfHS6zFcZibbg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 9F0ACCE0D1C; Wed, 5 Nov 2025 12:20:02 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 4/5] rcutorture: Permit kvm-again.sh to re-use the build directory Date: Wed, 5 Nov 2025 12:19:59 -0800 Message-Id: <20251105202000.2700370-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit adds "inplace" and "inplace-force" values to the kvm-again.sh "--link" argument, which causes the run's output to be placed into the build directory. This could be used to save build time if the machine went down partway into a run, but it can also be used to do a large number of builds, and run the resulting kernels concurrently even if the builds are based on different commits. A later commit will add this latter capability to kvm-series.sh in order to produce large speedups for branch-checking operations. Signed-off-by: Paul E. McKenney --- .../selftests/rcutorture/bin/kvm-again.sh | 56 +++++++++++++------ 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/tools/testing/selftests/rcutorture/bin/kvm-again.sh b/tools/te= sting/selftests/rcutorture/bin/kvm-again.sh index 88ca4e368489..b5239b52cb5d 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-again.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-again.sh @@ -31,7 +31,7 @@ fi if ! cp "$oldrun/scenarios" $T/scenarios.oldrun then # Later on, can reconstitute this from console.log files. - echo Prior run batches file does not exist: $oldrun/batches + echo Prior run scenarios file does not exist: $oldrun/scenarios exit 1 fi =20 @@ -68,7 +68,7 @@ usage () { echo " --datestamp string" echo " --dryrun" echo " --duration minutes | s | h | d" - echo " --link hard|soft|copy" + echo " --link hard|soft|copy|inplace|inplace-force" echo " --remote" echo " --rundir /new/res/path" echo "Command line: $scriptname $args" @@ -121,7 +121,7 @@ do shift ;; --link) - checkarg --link "hard|soft|copy" "$#" "$2" 'hard\|soft\|copy' '^--' + checkarg --link "hard|soft|copy|inplace|inplace-force" "$#" "$2" 'hard\|= soft\|copy\|inplace\|inplace-force' '^--' case "$2" in copy) arg_link=3D"cp -R" @@ -132,6 +132,14 @@ do soft) arg_link=3D"cp -Rs" ;; + inplace) + arg_link=3D"inplace" + rundir=3D"$oldrun" + ;; + inplace-force) + arg_link=3D"inplace-force" + rundir=3D"$oldrun" + ;; esac shift ;; @@ -172,21 +180,37 @@ fi =20 echo ---- Re-run results directory: $rundir =20 -# Copy old run directory tree over and adjust. -mkdir -p "`dirname "$rundir"`" -if ! $arg_link "$oldrun" "$rundir" -then - echo "Cannot copy from $oldrun to $rundir." - usage -fi -rm -f "$rundir"/*/{console.log,console.log.diags,qemu_pid,qemu-pid,qemu-re= tval,Warnings,kvm-test-1-run.sh.out,kvm-test-1-run-qemu.sh.out,vmlinux} "$r= undir"/log -touch "$rundir/log" -echo $scriptname $args | tee -a "$rundir/log" -echo $oldrun > "$rundir/re-run" -if ! test -d "$rundir/../../bin" +if test "$oldrun" !=3D "$rundir" then - $arg_link "$oldrun/../../bin" "$rundir/../.." + # Copy old run directory tree over and adjust. + mkdir -p "`dirname "$rundir"`" + if ! $arg_link "$oldrun" "$rundir" + then + echo "Cannot copy from $oldrun to $rundir." + usage + fi + rm -f "$rundir"/*/{console.log,console.log.diags,qemu_pid,qemu-pid,qemu-r= etval,Warnings,kvm-test-1-run.sh.out,kvm-test-1-run-qemu.sh.out,vmlinux} "$= rundir"/log + touch "$rundir/log" + echo $scriptname $args | tee -a "$rundir/log" + echo $oldrun > "$rundir/re-run" + if ! test -d "$rundir/../../bin" + then + $arg_link "$oldrun/../../bin" "$rundir/../.." + fi +else + # Check for a run having already happened. + find "$rundir" -name console.log -print > $T/oldrun-console.log + if test -s $T/oldrun-console.log + then + echo Run already took place in $rundir + if test "$arg_link" =3D inplace + then + usage + fi + fi fi + +# Find runs to be done based on their qemu-cmd files. for i in $rundir/*/qemu-cmd do cp "$i" $T --=20 2.40.1 From nobody Fri Dec 19 14:36:11 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7F14346FA3; Wed, 5 Nov 2025 20:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; cv=none; b=ZlfIJIR9ylds+pgkdi4Fb9BwgjDlL19WDrIcWoU6X9zmuKSTGOPok6UO0YFzrK+GPr+hI38lckfdSjTppGn6lQr4++B4ozbIKDW4a0Ok4nDGvDl8KjOepwrUlJ6IVGxLS/R6pufdqt2SwruLU+Rz5Ljlzq05vfMR9eSiorNWF2k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762374004; c=relaxed/simple; bh=qOt3gmc4S/dnhc4uiVgFSWjZIhjAb7Cb7CIR0Pi8QmI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b+jtOpBvOl7BqPwstrw3bm1OGzZwCmTEvRhrd2teSDvtoKuZrRvfyQ4tROHKD15XJbh9cK0mWBKVIn6Zvz9Ix0bdXWTXRuxBVuK1gYaD42BnVnIZ2tjwxgh+YCG9zBfjy27G6YA2U+SsH3d6VrOsGa/8KaJQ1LPAb+mHdO8EuC0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qu2hfnyM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qu2hfnyM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23531C19422; Wed, 5 Nov 2025 20:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762374004; bh=qOt3gmc4S/dnhc4uiVgFSWjZIhjAb7Cb7CIR0Pi8QmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qu2hfnyMw1sE1BD8LNBlbmzPvM+AKRQ4csQ+HscFuM9dfNEj5P7L0ZSZXRB51KHwQ VWTc00CS5zZPDWheNa0VWSRCm2Lby8quvxqoSlqixAU0xLlGWv4adf9ZsXaSmt+txz O6UYanC7twNsJmS9uOhWdE+Kuxy0cd0ufVEbtxZwvDNLka56ld4Ql/ywEQiaW5EPpK sFAy8nP8Xyl2fqsXEAKo0XVtorw9mrnoq7YKu9YqD392SeEQAeef5w4FijKjKlVMiN aT1OlbIql1CLbJDBAlSO3oT6XprT4lCowsh4QDQ9j1KoGWX2cpB0Q2a811Rt2ZKeNm pNkTkXV5grFEg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A1756CE0EBB; Wed, 5 Nov 2025 12:20:02 -0800 (PST) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH v2 5/5] rcutorture: Remove redundant rcutorture_one_extend() from rcu_torture_one_read() Date: Wed, 5 Nov 2025 12:20:00 -0800 Message-Id: <20251105202000.2700370-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit removes a harmless but potentially confusing invocation of rcutorture_one_extend() within rcu_torture_one_read(). The immediately preceding call to rcu_torture_one_read_start() already does this cleanup, and the other call to rcu_torture_one_read_start() already relies on this. Signed-off-by: Paul E. McKenney --- kernel/rcu/rcutorture.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 72619e5e8549..318bea62ed3e 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2384,10 +2384,8 @@ static bool rcu_torture_one_read(struct torture_rand= om_state *trsp, long myid) newstate =3D rcutorture_extend_mask(rtors.readstate, trsp); WARN_ON_ONCE(newstate & RCUTORTURE_RDR_UPDOWN); rcutorture_one_extend(&rtors.readstate, newstate, trsp, rtors.rtrsp++); - if (!rcu_torture_one_read_start(&rtors, trsp, myid)) { - rcutorture_one_extend(&rtors.readstate, 0, trsp, rtors.rtrsp); + if (!rcu_torture_one_read_start(&rtors, trsp, myid)) return false; - } rtors.rtrsp =3D rcutorture_loop_extend(&rtors.readstate, trsp, rtors.rtrs= p); rcu_torture_one_read_end(&rtors, trsp); return true; --=20 2.40.1