public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Ming Lei <[email protected]>
Cc: [email protected]
Subject: Re: [RFC 2/3] io_uring/bpf: allow to register and run BPF programs
Date: Wed, 13 Nov 2024 13:09:39 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <ZzRhnDXxkahNB0rx@fedora>

On 11/13/24 08:21, Ming Lei wrote:
> On Mon, Nov 11, 2024 at 01:50:45AM +0000, Pavel Begunkov wrote:
>> Let the user to register a BPF_PROG_TYPE_IOURING BPF program to a ring.
>> The progrma will be run in the waiting loop every time something
>> happens, i.e. the task was woken up by a task_work / signal / etc.
>>
>> Signed-off-by: Pavel Begunkov <[email protected]>
>> ---
...
>>   	do {
>>   		unsigned long check_cq;
>> @@ -2879,6 +2886,13 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, u32 flags,
>>   		if (ret < 0)
>>   			break;
>>   
>> +		if (io_bpf_enabled(ctx)) {
>> +			ret = io_run_bpf(ctx);
>> +			if (ret == IOU_BPF_RET_STOP)
>> +				break;
>> +			continue;
>> +		}
> 
> I believe 'struct_ops' is much simpler to run the prog and return the result.
> Then you needn't any bpf core change and the bpf register code.

Right, that's one of the things I need to look into, I have it in my
todo list, but I'm not sure at all I'd want to get rid of the register
opcode. It's a good idea to have stronger registration locking, i.e.
under ->ring_lock, but again I need to check it out.

-- 
Pavel Begunkov

  reply	other threads:[~2024-11-13 13:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-11  1:50 [RFC 0/3] Add BPF for io_uring Pavel Begunkov
2024-11-11  1:50 ` [RFC 1/3] bpf/io_uring: add io_uring program type Pavel Begunkov
2024-11-11  1:50 ` [RFC 2/3] io_uring/bpf: allow to register and run BPF programs Pavel Begunkov
2024-11-13  8:21   ` Ming Lei
2024-11-13 13:09     ` Pavel Begunkov [this message]
2024-11-11  1:50 ` [RFC 3/3] io_uring/bpf: add kfuncs for " Pavel Begunkov
2024-11-13  8:13 ` [RFC 0/3] Add BPF for io_uring Ming Lei
2024-11-13 13:09   ` Pavel Begunkov

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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