mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: sched-ext@lists.linux.dev
Cc: David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	David Dai <david.dai@linux.dev>,
	linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH 2/2] sched_ext: scx_qmap: Read SCX_RESCUE_DISABLE through the enum lookup tables
Date: Thu, 22 Oct 2026 14:03:48 -1000	[thread overview]
Message-ID: <20261023000348.2726436-3-tj@kernel.org> (raw)
In-Reply-To: <20261023000348.2726436-1-tj@kernel.org>

788b494fab1c ("sched_ext: scx_qmap: Drop the compat code") left one compat
lookup behind: the -B 0 case reads SCX_RESCUE_DISABLE with
__COMPAT_ENUM_OR_ZERO(). Userspace can read SCX_RESCUE_DISABLE only from BTF
as it is in the kernel-internal enum scx_consts. The enum lookup tables
already read their entries from BTF for every scheduler at open time.

Add SCX_RESCUE_DISABLE to the lookup tables and read it from the skeleton's
rodata. No behavior change.

Suggested-by: Andrea Righi <arighi@nvidia.com>
Link: https://lore.kernel.org/all/ataTuzRFTRm_pax6@gpd4/
Signed-off-by: Tejun Heo <tj@kernel.org>
---
 tools/sched_ext/include/scx/enums.autogen.bpf.h | 3 +++
 tools/sched_ext/include/scx/enums.autogen.h     | 1 +
 tools/sched_ext/scx_qmap.c                      | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/sched_ext/include/scx/enums.autogen.bpf.h b/tools/sched_ext/include/scx/enums.autogen.bpf.h
index 405a3e6b8f33..d0c37018659e 100644
--- a/tools/sched_ext/include/scx/enums.autogen.bpf.h
+++ b/tools/sched_ext/include/scx/enums.autogen.bpf.h
@@ -13,6 +13,9 @@ const volatile u64 __SCX_SLICE_DFL __weak;
 const volatile u64 __SCX_SLICE_INF __weak;
 #define SCX_SLICE_INF __SCX_SLICE_INF
 
+const volatile u64 __SCX_RESCUE_DISABLE __weak;
+#define SCX_RESCUE_DISABLE __SCX_RESCUE_DISABLE
+
 const volatile u64 __SCX_RQ_ONLINE __weak;
 #define SCX_RQ_ONLINE __SCX_RQ_ONLINE
 
diff --git a/tools/sched_ext/include/scx/enums.autogen.h b/tools/sched_ext/include/scx/enums.autogen.h
index 7ec2e5e41cb2..c4a7260f0983 100644
--- a/tools/sched_ext/include/scx/enums.autogen.h
+++ b/tools/sched_ext/include/scx/enums.autogen.h
@@ -9,6 +9,7 @@
 	SCX_ENUM_SET(skel, scx_public_consts, SCX_OPS_NAME_LEN); \
 	SCX_ENUM_SET(skel, scx_public_consts, SCX_SLICE_DFL); \
 	SCX_ENUM_SET(skel, scx_public_consts, SCX_SLICE_INF); \
+	SCX_ENUM_SET(skel, scx_consts, SCX_RESCUE_DISABLE); \
 	SCX_ENUM_SET(skel, scx_rq_flags, SCX_RQ_ONLINE); \
 	SCX_ENUM_SET(skel, scx_rq_flags, SCX_RQ_CAN_STOP_TICK); \
 	SCX_ENUM_SET(skel, scx_rq_flags, SCX_RQ_BAL_PENDING); \
diff --git a/tools/sched_ext/scx_qmap.c b/tools/sched_ext/scx_qmap.c
index 9b1cbe187ebd..fe2f206f5c8a 100644
--- a/tools/sched_ext/scx_qmap.c
+++ b/tools/sched_ext/scx_qmap.c
@@ -427,7 +427,7 @@ int main(int argc, char **argv)
 			u32 ppt = strtoul(optarg, NULL, 0);
 
 			if (!ppt)
-				ppt = __COMPAT_ENUM_OR_ZERO("scx_consts", "SCX_RESCUE_DISABLE");
+				ppt = skel->rodata->__SCX_RESCUE_DISABLE;
 			skel->struct_ops.qmap_ops->rescue_bandwidth_ppt = ppt;
 			break;
 		}
-- 
2.56.0


      parent reply	other threads:[~2026-10-23  0:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23  0:03 [PATCHSET sched_ext/for-7.5] sched_ext: Regenerate the enum tables and drop scx_qmap's last compat lookup Tejun Heo
2026-10-23  0:03 ` [PATCH 1/2] sched_ext: Regenerate tools autogen enum headers Tejun Heo
2026-10-23  0:03 ` Tejun Heo [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=20261023000348.2726436-3-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=david.dai@linux.dev \
    --cc=emil@etsalapatis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=void@manifault.com \
    /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®