Linux block layer
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: kaitao.cheng@linux.dev,axboe@kernel.dk,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,martin.lau@linux.dev,eddyz87@gmail.com,memxor@gmail.com,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,john.fastabend@gmail.com
Cc: bpf@vger.kernel.org,linux-block@vger.kernel.org,linux-kernel@vger.kernel.org,chengkaitao@kylinos.cn,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [RFC v2 3/3] tools/ufq_iosched: add BPF example scheduler and build scaffolding
Date: Sun,  3 May 2026 04:44:57 +0000 (UTC)	[thread overview]
Message-ID: <aed2543e93c484d9666ff3087417ee607fceb9cd93bd9646a6f8edda7d65df1d@mail.kernel.org> (raw)
In-Reply-To: <20260503035623.28771-4-kaitao.cheng@linux.dev>

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

> diff --git a/tools/ufq_iosched/ufq_simple.bpf.c b/tools/ufq_iosched/ufq_simple.bpf.c
> new file mode 100644
> index 000000000000..81954e73068a
> --- /dev/null
> +++ b/tools/ufq_iosched/ufq_simple.bpf.c

[ ... ]

> +int BPF_STRUCT_OPS(ufq_simple_insert_req, struct request_queue *q,
> +		   struct request *rq, blk_insert_t flags,
> +		   struct list_head *freeq)
                                              ^^^^^^^

Does this signature match the kernel's ufq_iosched_ops definition?

Looking at block/ufq-iosched.h, the insert_req member is defined with
three parameters:

    int (*insert_req)(struct request_queue *q, struct request *rq,
                     blk_insert_t flags);

The kernel-side callers in block/ufq-iosched.c also pass only three
arguments:

    ret = ops->insert_req(q, rq, flags);
    ops->insert_req(q, target, 0);

The BPF struct_ops verifier (check_struct_ops_btf_id) validates that each
BPF program matches the declared function-pointer signature in the kernel.
A program with four parameters registered against a three-parameter member
will be rejected at load time, so ufq_simple will fail to attach via
UFQ_OPS_LOAD / UFQ_OPS_ATTACH and the example cannot be used.

Even if the verifier accepted the mismatch, the trampoline would not
populate a fourth argument, leaving freeq uninitialized. Should the extra
'struct list_head *freeq' parameter be removed?

> +{
> +	struct ufq_simple_data *ufq_sd;
> +	struct queue_list_node *qnode;
> +	struct sort_tree_node *snode;

[ ... ]

> +UFQ_OPS_DEFINE(ufq_simple_ops,
> +	.init_sched		= (void *)ufq_simple_init_sched,
> +	.exit_sched		= (void *)ufq_simple_exit_sched,
> +	.insert_req		= (void *)ufq_simple_insert_req,
> +	.dispatch_req		= (void *)ufq_simple_dispatch_req,
> +	.has_req		= (void *)ufq_simple_has_req,
> +	.finish_req		= (void *)ufq_simple_finish_req,
> +	.merge_req		= (void *)ufq_simple_merge_req,
> +	.merge_bio		= (void *)ufq_simple_merge_bio,
> +	.name			= "ufq_simple");


---
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/25269522212

      reply	other threads:[~2026-05-03  4:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-03  3:56 [RFC v2 0/3] block: Introduce a BPF-based I/O scheduler Kaitao cheng
2026-05-03  3:56 ` [RFC v2 1/3] bpf: Add KF_SPIN_LOCK flag for kfuncs under bpf_spin_lock Kaitao cheng
2026-05-03  3:56 ` [RFC v2 2/3] block: Introduce the UFQ I/O scheduler Kaitao cheng
2026-05-03  4:45   ` bot+bpf-ci
2026-05-03  3:56 ` [RFC v2 3/3] tools/ufq_iosched: add BPF example scheduler and build scaffolding Kaitao cheng
2026-05-03  4:44   ` bot+bpf-ci [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=aed2543e93c484d9666ff3087417ee607fceb9cd93bd9646a6f8edda7d65df1d@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bpf@vger.kernel.org \
    --cc=chengkaitao@kylinos.cn \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kaitao.cheng@linux.dev \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --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