From: Tejun Heo <tj@kernel.org>
To: Changwoo Min <changwoo@igalia.com>
Cc: void@manifault.com, arighi@nvidia.com, kernel-dev@igalia.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] tools/sched_ext: Compatible testing of SCX_ENQ_CPU_SELECTED
Date: Sat, 8 Feb 2025 20:44:34 -1000 [thread overview]
Message-ID: <Z6hO0toLJPN9PL-w@slm.duckdns.org> (raw)
In-Reply-To: <20250209015353.11172-1-changwoo@igalia.com>
On Sun, Feb 09, 2025 at 10:53:53AM +0900, Changwoo Min wrote:
> This provides compatible testing of SCX_ENQ_CPU_SELECTED.
> More specifically, it handles two cases:
>
> 1. a BPF scheduler is compiled against vmlinux.h where
> SCX_ENQ_CPU_SELECTED is defined, but it runs on a kernel that does not
> have SCX_ENQ_CPU_SELECTED. In this case, the test result of
> 'enq_flags & SCX_ENQ_CPU_SELECTED' will always be false. That test result
> is semantically incorrect because the kernel before SCX_ENQ_CPU_SELECTED
> has never skipped select_task_rq_scx(), so the result should be true.
>
> 2. a BPF scheduler is compiling against vmlinux.h where
> SCX_ENQ_CPU_SELECTED is not defined. In this case, directly using
> SCX_ENQ_CPU_SELECTED causes compilation errors.
>
> To hide such complexity, introduce __COMPAT_is_enq_cpu_selected(),
> which checks if SCX_ENQ_CPU_SELECTED exists in runtime using BPF CO-RE.
> This consists of three parts:
>
> 1. Add enum_defs.autogen.h, which has macros (HAVE_{enum name}) denoting
> whether SCX enums are defined in the vmlinux.h or not.
>
> 2. Implement __COMPAT_is_enq_cpu_selected(), which provide the test of
> SCX_ENQ_CPU_SELECTED in a compatible way.
>
> 3. Use __COMPAT_is_enq_cpu_selected() in scx_qmap.
>
> Note that this is a sync of the relevant PR [1] in the scx repo.
>
> [1] https://github.com/sched-ext/scx/pull/1314
>
> Signed-off-by: Changwoo Min <changwoo@igalia.com>
Applied to sched_ext/for-6.15 with a very minor edit:
> diff --git a/tools/sched_ext/include/scx/enum_defs.autogen.h b/tools/sched_ext/include/scx/enum_defs.autogen.h
> new file mode 100644
> index 000000000000..a32e534a4012
> --- /dev/null
> +++ b/tools/sched_ext/include/scx/enum_defs.autogen.h
...
> +#endif /* __ENUM_DEFS_AUTOGEN_H__ */
> +
The extra newline triggers git warning on commit. I dropped the extra
newline. Maybe adjust the script too? Also, if we aren't including the
script in the kernel tree, maybe a good idea for the generated file to point
to where the script is?
Thanks.
--
tejun
prev parent reply other threads:[~2025-02-09 6:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-09 1:53 Changwoo Min
2025-02-09 6:44 ` 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=Z6hO0toLJPN9PL-w@slm.duckdns.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--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®