From: Hui Su <sh_def@163.com>
To: peterz@infradead.org
Cc: mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
shuah@kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, Hui Su <sh_def@163.com>
Subject: [PATCH v2 0/2] sched/core: Handle unavailable pointer hash in PR_SCHED_CORE_GET
Date: Sun, 13 Sep 2026 23:10:38 +0900 [thread overview]
Message-ID: <20260913141040.2338964-1-sh_def@163.com> (raw)
PR_SCHED_CORE_GET converts the internal core scheduling cookie to an
opaque userspace value with ptr_to_hashval().
When the pointer hash key is not initialized yet, ptr_to_hashval()
returns -EBUSY without storing a hash. PR_SCHED_CORE_GET currently
ignores this error and returns the zero-initialized id instead. Since
cookie 0 denotes the default core scheduling cookie, this reports
incorrect state to userspace.
Propagate the hashing error and make the scheduler selftest retry the
transient EBUSY. Do not wait for RNG initialization in
PR_SCHED_CORE_GET; ptr_to_hashval() already reports an unavailable
pointer hash key as -EBUSY, so propagate that condition through the
prctl interface.
Testing on x86_64:
- An entropy-starved early-boot QEMU reproducer observed on the
unfixed kernel:
CREATE ret=0 errno=0 (Success)
GET ret=0 errno=0 (Success) cookie=0x0000000000000000
With patch 1, the same probe returned:
GET ret=-1 errno=16 (Device or resource busy)
- The selftest built successfully with:
make -C tools/testing/selftests/sched -j12
- With PR_SCHED_CORE_GET fault-injected to return EBUSY, the v1
selftest continued evaluating cookie assertions using the error
sentinel and finished with 5 failures. The v2 selftest instead
aborted without evaluating cookie assertions after the failed GET.
- The v2 selftest passed with normal random initialization:
SUCCESS !!!
Changes since v1:
- Patch 1 is unchanged.
- Keep the PR_SCHED_CORE_GET status separate from the returned cookie.
- Abort after an unrecoverable or timed-out GET instead of comparing an
error sentinel as a valid cookie.
- Return cookie values directly from the fatal error helper to keep the
selftest comparisons compact.
- Avoid sleeping after the final retry.
- Rebased onto 2f0c1cf72f46.
v1: https://lore.kernel.org/all/20260913063439.1513107-1-sh_def@163.com/
Hui Su (2):
sched/core: Propagate pointer hash errors from PR_SCHED_CORE_GET
selftests/sched: Retry PR_SCHED_CORE_GET on EBUSY
kernel/sched/core_sched.c | 5 +-
tools/testing/selftests/sched/cs_prctl_test.c | 93 +++++++++++++------
2 files changed, 66 insertions(+), 32 deletions(-)
base-commit: 2f0c1cf72f4682178506f513bbf015e591b1aa4a
--
2.55.0
next reply other threads:[~2026-09-13 14:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 14:10 Hui Su [this message]
2026-09-13 14:10 ` [PATCH v2 1/2] sched/core: Propagate pointer hash errors from PR_SCHED_CORE_GET Hui Su
2026-09-13 14:10 ` [PATCH v2 2/2] selftests/sched: Retry PR_SCHED_CORE_GET on EBUSY Hui Su
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=20260913141040.2338964-1-sh_def@163.com \
--to=sh_def@163.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=shuah@kernel.org \
--cc=vincent.guittot@linaro.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®