The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] sched_ext: Make scx_bpf_kick_cid() return s32
Date: Wed, 3 Jun 2026 20:38:43 +0200	[thread overview]
Message-ID: <aiB0s-UPTAaaIIdA@gpd4> (raw)
In-Reply-To: <20260603172153.3081861-4-tj@kernel.org>

Hi Tejun,

On Wed, Jun 03, 2026 at 07:21:53AM -1000, Tejun Heo wrote:
> Switch scx_bpf_kick_cid() from void to s32 so future cap enforcement can
> surface failures. cid interface is introduced in this cycle and has no
> external users, so the ABI change is safe. Subsequent patches will add
> -EPERM returns when the calling sub-sched lacks the required cap on the
> target cid.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> ---
>  kernel/sched/ext.c                       | 13 ++++++++-----
>  tools/sched_ext/include/scx/common.bpf.h |  2 +-
>  2 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 32ebbc351564..fedd501de67e 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -9405,9 +9405,10 @@ __bpf_kfunc void scx_bpf_kick_cpu(s32 cpu, u64 flags, const struct bpf_prog_aux
>   * @flags: %SCX_KICK_* flags
>   * @aux: implicit BPF argument to access bpf_prog_aux hidden from BPF progs
>   *
> - * cid-addressed equivalent of scx_bpf_kick_cpu().
> + * cid-addressed equivalent of scx_bpf_kick_cpu(). Return 0 on success,
> + * -errno otherwise.
>   */
> -__bpf_kfunc void scx_bpf_kick_cid(s32 cid, u64 flags, const struct bpf_prog_aux *aux)
> +__bpf_kfunc s32 scx_bpf_kick_cid(s32 cid, u64 flags, const struct bpf_prog_aux *aux)
>  {
>  	struct scx_sched *sch;
>  	s32 cpu;
> @@ -9415,10 +9416,12 @@ __bpf_kfunc void scx_bpf_kick_cid(s32 cid, u64 flags, const struct bpf_prog_aux
>  	guard(rcu)();
>  	sch = scx_prog_sched(aux);
>  	if (unlikely(!sch))
> -		return;
> +		return -ENODEV;
>  	cpu = scx_cid_to_cpu(sch, cid);
> -	if (cpu >= 0)
> -		scx_kick_cpu(sch, cpu, flags);
> +	if (cpu < 0)
> +		return -EINVAL;

Right now scx_cid_to_cpu() can only return -EINVAL, but should we propagate the
error to the caller and return cpu here (in case we add more errors in the
future)?

Thanks,
-Andrea

  reply	other threads:[~2026-06-03 18:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 17:21 [PATCHSET sched_ext/for-7.2] sched_ext: cid/cmask interface prep Tejun Heo
2026-06-03 17:21 ` [PATCH 1/3] sched_ext: Order single-cid cmask helpers as (cid, mask) Tejun Heo
2026-06-03 17:21 ` [PATCH 2/3] sched_ext: Add scx_cmask_test() and scx_cmask_for_each_cid() Tejun Heo
2026-06-03 17:21 ` [PATCH 3/3] sched_ext: Make scx_bpf_kick_cid() return s32 Tejun Heo
2026-06-03 18:38   ` Andrea Righi [this message]
2026-06-03 18:41 ` [PATCHSET sched_ext/for-7.2] sched_ext: cid/cmask interface prep Andrea Righi

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=aiB0s-UPTAaaIIdA@gpd4 \
    --to=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=emil@etsalapatis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tj@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