mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: ihor.solodrai@linux.dev,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,eddyz87@gmail.com,memxor@gmail.com
Cc: alan.maguire@oracle.com,emil@etsalapatis.com,jolsa@kernel.org,song@kernel.org,tj@kernel.org,yonghong.song@linux.dev,bpf@vger.kernel.org,linux-kernel@vger.kernel.org,sched-ext@lists.linux.dev,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v2 2/6] sched_ext: Prefer ___v2 kfunc names in compat.bpf.h
Date: Sat, 21 Nov 2026 01:13:57 +0000 (UTC)	[thread overview]
Message-ID: <d76bfe6573fc2c9e4aca4d36766a3c616070ae7067065a38def07e8430803d7a@mail.kernel.org> (raw)
In-Reply-To: <20261121003403.2928928-3-ihor.solodrai@linux.dev>

[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]

> sched_ext: Prefer ___v2 kfunc names in compat.bpf.h

TL;DR: __COMPAT_scx_bpf_reenqueue_local_from_anywhere() in compat.bpf.h still
checks only the ___v2___compat name, so with the new libbpf it may return
false on v6.19+ kernels, silently disabling scx_qmap's sched_switch reenqueue.

> diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/include/scx/compat.bpf.h
> --- a/tools/sched_ext/include/scx/compat.bpf.h
> +++ b/tools/sched_ext/include/scx/compat.bpf.h

[ ... ]

>  u32 scx_bpf_reenqueue_local___v1(void) __ksym __weak;
> +void scx_bpf_reenqueue_local___v2(void) __ksym __weak;
>  void scx_bpf_reenqueue_local___v2___compat(void) __ksym __weak;
>
>  static inline bool __COMPAT_scx_bpf_reenqueue_local_from_anywhere(void)
>  {
>  	return bpf_ksym_exists(scx_bpf_reenqueue_local___v2___compat);
>  }

After the libbpf change described in the commit message, the
___v2___compat names resolve nothing.  This predicate still tests only
scx_bpf_reenqueue_local___v2___compat, so with that libbpf it would
return false even on v6.19+ kernels where
scx_bpf_reenqueue_local___v2() can be called from anywhere.

The in-tree wrappers scx_bpf_reenqueue_local() and
scx_bpf_reenqueue_local_from_anywhere() check
bpf_ksym_exists(scx_bpf_reenqueue_local___v2) before calling it, but
__COMPAT_scx_bpf_reenqueue_local_from_anywhere() is exported from this
header and schedulers use it directly.  For example, scx_qmap does:

  qmap_sched_switch():
      if (!__COMPAT_scx_bpf_reenqueue_local_from_anywhere())
          return 0;
  qmap_cpu_release():
      if (!__COMPAT_scx_bpf_reenqueue_local_from_anywhere())
          scx_bpf_reenqueue_local();

A scheduler built this way would silently turn off its sched_switch based
reenqueue and fall back to ops.cpu_release().

Should this predicate also check scx_bpf_reenqueue_local___v2, so that it
still returns true on v6.19+ kernels with the new libbpf?  Note that the
two ksym checks probably need to be in separate branches rather than an
||, since the comment in scx_bpf_reenqueue_local_from_anywhere() says
clang can fold that into a bitwise OR of the ksym addresses.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/44845964556

  reply	other threads:[~2026-11-21  1:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21  0:33 [PATCH bpf-next v2 0/6] libbpf: Support kernel-side kfunc variants Ihor Solodrai
2026-11-21  0:33 ` [PATCH bpf-next v2 1/6] libbpf: Separate interfaces shared with in-tree tools Ihor Solodrai
2026-11-21  0:33 ` [PATCH bpf-next v2 2/6] sched_ext: Prefer ___v2 kfunc names in compat.bpf.h Ihor Solodrai
2026-11-21  1:13   ` bot+bpf-ci [this message]
2026-11-21  0:34 ` [PATCH bpf-next v2 3/6] libbpf: Resolve kfunc variants by prototype Ihor Solodrai
2026-11-21  1:14   ` bot+bpf-ci
2026-11-21  0:34 ` [PATCH bpf-next v2 4/6] selftests/bpf: Test kfunc variant selection " Ihor Solodrai
2026-11-21  0:34 ` [PATCH bpf-next v2 5/6] resolve_btfids: Reject ambiguous kfunc variants Ihor Solodrai
2026-11-21  0:34 ` [PATCH bpf-next v2 6/6] docs/bpf: Describe how to change a kfunc's prototype Ihor Solodrai
2026-11-21  0:58   ` bot+bpf-ci

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=d76bfe6573fc2c9e4aca4d36766a3c616070ae7067065a38def07e8430803d7a@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --cc=sched-ext@lists.linux.dev \
    --cc=song@kernel.org \
    --cc=tj@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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®