public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>
Cc: io-uring@vger.kernel.org,
	Caleb Sander Mateos <csander@purestorage.com>,
	Akilesh Kailash <akailash@google.com>,
	bpf@vger.kernel.org, Xiao Ni <xni@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>
Subject: Re: [PATCH V3 05/12] io_uring: bpf: extend io_uring with bpf struct_ops
Date: Fri, 3 Apr 2026 09:44:03 -0600	[thread overview]
Message-ID: <ba3654fe-5553-4349-8a7e-7d542bc399a6@kernel.dk> (raw)
In-Reply-To: <ac88hCYgrFXBX3-g@fedora>

On 4/2/26 10:05 PM, Ming Lei wrote:
> On Wed, Mar 25, 2026 at 07:49:22PM -0600, Jens Axboe wrote:
>> On 3/24/26 10:37 AM, Ming Lei wrote:
>>> @@ -493,7 +494,16 @@ struct io_ring_ctx {
>>>  	DECLARE_HASHTABLE(napi_ht, 4);
>>>  #endif
>>>  
>>> -	struct io_uring_bpf_ops		*bpf_ops;
>>> +	/*
>>> +	 * bpf_ops and bpf_ext_ops are mutually exclusive: bpf_ops is used
>>> +	 * for io_uring_bpf_ops struct_ops, while bpf_ext_ops provides
>>> +	 * per-opcode BPF extension operations (IORING_SETUP_BPF_EXT).
>>> +	 * The two cannot be active at the same time on the same ring.
>>> +	 */
>>> +	union {
>>> +		struct io_uring_bpf_ops		*bpf_ops;
>>> +		struct uring_bpf_ops_kern	*bpf_ext_ops;
>>> +	};
>>
>> What am I missing here, why is this the case? What makes the use of both
>> at the same time impossible?
> 
> Please see the following code:
> 
> static inline bool io_has_loop_ops(struct io_ring_ctx *ctx)
> {
>         return data_race(ctx->loop_step);
> }
> 
> io_uring_enter():
> 	...
> 	if (io_has_loop_ops(ctx)) {
> 		ret = io_run_loop(ctx);
> 		goto out;
> 	}
> 	...
> 
> So if ->loop_step is assigned from io_install_bpf() called from bpf_ops
> registration, traditional userspace SQE submission and CQE reap are
> bypassed completely, then IORING_OP_BPF and any other OP can't be handled
> at all.

It ends up calling io_submit_sqes() all the same, so not sure I follow the
problem here. Seems to me that the only thing that is making it mutually
exclusive is the fact that you unionized the ops.

-- 
Jens Axboe


  reply	other threads:[~2026-04-03 15:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 16:37 [PATCH v3 0/12] io_uring: add IORING_OP_BPF for extending io_uring Ming Lei
2026-03-24 16:37 ` [PATCH V3 01/12] io_uring: make io_import_fixed() global Ming Lei
2026-03-24 16:37 ` [PATCH V3 02/12] io_uring: refactor io_prep_reg_iovec() for BPF kfunc use Ming Lei
2026-03-24 16:37 ` [PATCH V3 03/12] io_uring: refactor io_import_reg_vec() " Ming Lei
2026-03-24 16:37 ` [PATCH V3 04/12] io_uring: prepare for extending io_uring with bpf Ming Lei
2026-03-24 16:37 ` [PATCH V3 05/12] io_uring: bpf: extend io_uring with bpf struct_ops Ming Lei
2026-03-26  1:49   ` Jens Axboe
2026-04-03  4:05     ` Ming Lei
2026-04-03 15:44       ` Jens Axboe [this message]
2026-04-04  2:53         ` Ming Lei
2026-03-26  2:09   ` Jens Axboe
2026-04-03  4:17     ` Ming Lei
2026-04-03 15:46       ` Jens Axboe
2026-04-04  2:54         ` Ming Lei
2026-03-24 16:37 ` [PATCH V3 06/12] io_uring: bpf: implement struct_ops registration Ming Lei
2026-03-24 16:37 ` [PATCH V3 07/12] io_uring: bpf: add BPF buffer descriptor for IORING_OP_BPF Ming Lei
2026-03-24 16:37 ` [PATCH V3 08/12] io_uring: bpf: add per-buffer iterator kfuncs Ming Lei
2026-03-24 16:37 ` [PATCH V3 09/12] bpf: add bpf_uring_buf_dynptr to special_kfunc_list Ming Lei
2026-03-24 16:37 ` [PATCH V3 10/12] selftests/io_uring: add io_uring_unregister_buffers() Ming Lei
2026-03-24 16:37 ` [PATCH V3 11/12] selftests/io_uring: add BPF struct_ops and kfunc tests Ming Lei
2026-03-24 16:37 ` [PATCH V3 12/12] selftests/io_uring: add buffer iterator selftest with BPF arena Ming Lei

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=ba3654fe-5553-4349-8a7e-7d542bc399a6@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=akailash@google.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=csander@purestorage.com \
    --cc=io-uring@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=xni@redhat.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