mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hui Su <sh_def@163.com>
To: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: Yonghong Song <yonghong.song@linux.dev>,
	Quentin Monnet <qmo@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hui Su <sh_def@163.com>
Subject: [PATCH bpf-next v2 0/3] bpf: expose cgroup preorder attachment state to userspace
Date: Sat, 19 Sep 2026 18:43:57 +0900	[thread overview]
Message-ID: <20260919094400.600585-1-sh_def@163.com> (raw)

Commit 4b82b181a26c ("bpf: Allow pre-ordering for bpf cgroup progs")
introduced BPF_F_PREORDER to request top-down (ancestor to descendant)
execution ordering across the cgroup hierarchy. While this flag is stored
in struct bpf_prog_list::flags and affects the effective program ordering,
direct BPF_PROG_QUERY currently reports only the cgroup-wide flags and
omits BPF_F_PREORDER from prog_attach_flags[].

This series extends direct cgroup program queries to expose the per-program
BPF_F_PREORDER state, adds selftests to validate the reported flags, and
updates bpftool to support inspection, attachment, documentation, and bash
completion.

Structure of the series:
- Patch 1 extends __cgroup_bpf_query() so that prog_attach_flags[] includes
  BPF_F_PREORDER for direct queries.
- Patch 2 adds query verification to cgroup_mprog_opts selftests for both
  direct program and bpf_link attachments.
- Patch 3 updates bpftool with bitmask attach flag formatting, preorder
  attachment CLI support, bash completion for valid flag combinations,
  and documentation.

Testing:
- Verified that baseline kernel reports 0x2 for PREORDER multi-attachments
  through BPF_PROG_QUERY.
- Verified that the patched kernel reports 0x42 (BPF_F_ALLOW_MULTI |
  BPF_F_PREORDER).
- Selftests cgroup_mprog_opts (all subtests) and cgroup_preorder pass in an
  x86_64 QEMU/KVM guest.
- bpftool and its documentation build cleanly without warnings or errors.
- Bash completion verified for standalone and composite flag combinations.
- checkpatch.pl reports 0 errors and 0 warnings across all patches.

Changes in v2:
- Rebase onto bpf-next and drop the Fixes tag, as requested by
  Alexei Starovoitov.
- Document the userspace-visible BPF_PROG_QUERY flag extension.
- Factor the duplicated PREORDER query checks and fix comment style.
- Clarify PREORDER ordering and single/multi attachment semantics.
- Fix bash completion for valid PREORDER flag combinations.

Hui Su (3):
  bpf: Report BPF_F_PREORDER in cgroup program queries
  selftests/bpf: Test querying BPF_F_PREORDER cgroup attachments
  bpftool: Add support for BPF_F_PREORDER cgroup attach flag

 kernel/bpf/cgroup.c                           | 16 ++---
 .../bpftool/Documentation/bpftool-cgroup.rst  | 25 ++++---
 tools/bpf/bpftool/bash-completion/bpftool     |  4 +-
 tools/bpf/bpftool/cgroup.c                    | 55 +++++++++-----
 .../bpf/prog_tests/cgroup_mprog_opts.c        | 72 ++++++++++++++++++-
 5 files changed, 134 insertions(+), 38 deletions(-)

-- 
2.55.0


             reply	other threads:[~2026-09-19  9:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19  9:43 Hui Su [this message]
2026-09-19  9:43 ` [PATCH bpf-next v2 1/3] bpf: Report BPF_F_PREORDER in cgroup program queries Hui Su
2026-09-19 10:57   ` bot+bpf-ci
2026-09-19  9:43 ` [PATCH bpf-next v2 2/3] selftests/bpf: Test querying BPF_F_PREORDER cgroup attachments Hui Su
2026-09-19 10:43   ` bot+bpf-ci
2026-09-19  9:44 ` [PATCH bpf-next v2 3/3] bpftool: Add support for BPF_F_PREORDER cgroup attach flag Hui Su
2026-09-19 10:58   ` bot+bpf-ci
2026-09-21 13:42   ` Quentin Monnet

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=20260919094400.600585-1-sh_def@163.com \
    --to=sh_def@163.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=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=qmo@kernel.org \
    --cc=shuah@kernel.org \
    --cc=song@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®