From: Waiman Long <longman@redhat.com>
To: Rui Qi <qirui.001@bytedance.com>,
linux-cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: tj@kernel.org, lizefan.x@bytedance.com, shuah@kernel.org
Subject: Re: [PATCH v2] selftests/cgroup: Preserve CPU hotplug write errors
Date: Thu, 13 Aug 2026 13:37:37 -0400 [thread overview]
Message-ID: <df882b76-1ad7-4a4d-8f1d-5b08d097e384@redhat.com> (raw)
In-Reply-To: <20260813132807.1160861-1-qirui.001@bytedance.com>
On 8/13/26 9:28 AM, Rui Qi wrote:
> The cpuset partition root state selftest checks several CPU hotplug
> transitions. If writing to a CPU online file fails, the helper still
> runs pause afterwards and returns the status of pause instead of the
> failed write.
>
> This hides the real hotplug failure and can make later checks run
> against expectations for a transition that never happened. Move the
> write before the bookkeeping and return when it fails, so callers can
> observe the hotplug error and the test does not record a CPU as offline
> unless the offline operation actually succeeded.
>
> Also change the O* command handler in set_ctrl_state() to use
> "eval $COMM $REDIRECT" like all other handlers. The previous version
> set COMM but still called write_cpu_online directly, bypassing the
> redirect that captures stderr for error reporting.
>
> Changes since v1:
> - Use eval $COMM $REDIRECT in the O* handler instead of calling
> write_cpu_online directly (Waiman Long)
>
> Fixes: a8c52eba880a ("kselftest/cgroup: Add cpuset v2 partition root state test")
> Signed-off-by: Rui Qi <qirui.001@bytedance.com>
> ---
> tools/testing/selftests/cgroup/test_cpuset_prs.sh | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> index 8380fd9d76bd..da8f7b920178 100755
> --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh
> @@ -526,6 +526,7 @@ write_cpu_online()
> CPU=${1%=*}
> VAL=${1#*=}
> CPUFILE=//sys/devices/system/cpu/cpu${CPU}/online
> + echo $VAL > $CPUFILE || return 1
> if [[ $VAL -eq 0 ]]
> then
> OFFLINE_CPUS="$OFFLINE_CPUS $CPU"
> @@ -535,7 +536,6 @@ write_cpu_online()
> sort | uniq -u)
> }
> fi
> - echo $VAL > $CPUFILE
> pause 0.05
> }
>
> @@ -603,7 +603,8 @@ set_ctrl_state()
> eval $COMM $REDIRECT
> ;;
> O*) VAL=${CMD#?}
> - write_cpu_online $VAL
> + COMM="write_cpu_online $VAL"
> + eval $COMM $REDIRECT
> ;;
> T*) COMM="echo 0 > $TFILE"
> eval $COMM $REDIRECT
Reviewed-by: Waiman Long <longman@redhat.com>
prev parent reply other threads:[~2026-08-13 17:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-09 8:21 [PATCH 0/2] selftests/cgroup: Fix cpuset test portability and hotplug error handling Rui Qi
2026-08-09 8:21 ` [PATCH 1/2] selftests/cgroup: Avoid awk -e in cpuset tests Rui Qi
2026-08-10 3:07 ` Ridong Chen
2026-08-10 14:49 ` Waiman Long
2026-08-10 19:36 ` Tejun Heo
2026-08-09 8:21 ` [PATCH 2/2] selftests/cgroup: Preserve CPU hotplug write errors Rui Qi
2026-08-10 3:22 ` Ridong Chen
2026-08-10 14:53 ` Waiman Long
2026-08-11 3:25 ` Rui Qi
2026-08-13 17:39 ` Waiman Long
2026-08-13 13:28 ` [PATCH v2] " Rui Qi
2026-08-13 17:10 ` Tejun Heo
2026-08-13 17:37 ` Waiman Long [this message]
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=df882b76-1ad7-4a4d-8f1d-5b08d097e384@redhat.com \
--to=longman@redhat.com \
--cc=linux-cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=qirui.001@bytedance.com \
--cc=shuah@kernel.org \
--cc=tj@kernel.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®