From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CA2838E5FB for ; Wed, 25 Feb 2026 12:59:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772024371; cv=none; b=mJwKXt4WHdKJ2p58GzLFcSniqkrss47MbtmzgkfrEkvmXsOA7BMq0TRUvc7F5aNJU+89USwVYBoSEQxEKlQ5nxy/dv2fv1mcc4AZdpG/onQ4H/XM6YnXfyfDgvOOgYFQmawO6/weCzxl3DUo5XFWO3ShpHs2yQlOMezIWBql8Bg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772024371; c=relaxed/simple; bh=TPtQecFLt3bKgAlUJv6uA3jD+8ENnPfJf8K8C1mKZj0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cgAcmnTU+Sd0ruf0arixepExOPKzwqUc6ur4EeaciBeBbbscpHFQz9eACjlqwq5xvYarDEwy/+su0YHhUTXYemG7Rgmry1NTltrxLxpd2tAu+U5LAn12FL0/yaEH+vz2n+x5FAfMM+6vqmlhwJYup8hMhTyN19jJlWQA2/k2Eac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nqYQ6DDi; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nqYQ6DDi" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-389e4330e32so5499781fa.0 for ; Wed, 25 Feb 2026 04:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772024369; x=1772629169; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=tXh8nJgWerBQSiJBvjtEBHO2Vkt5cQS3cW38XI+++O8=; b=nqYQ6DDiWVc67vqdI61Zj2cHS+dB1g38yS6o1FNobtwqz9VaHtyv10HkSVjum4l+a/ 546iFR9sQyzU+S/r5NUMQJMCeVTE+VZDhnrtvBurHFs4+UGi9lJeh87oe5oyjd1yZbOA QGl8a0OuccWN2/Tu6RaEcaO4t6qFTq+JBh9UvVg4LX2FJ++qU8uLOaBvitfkkdpxgzyf kGFRhL8glJ3zHIYy4PvdzDBGNQqYfhVTbaUiL7UQ+X1Z5ESLPKdJo/CRokGBuxxctMFa ZqzOdZf3+QAQdTCWira8tIkgJtu8ns0zIpLGwFRMPPMSptee6uFDfmCTQzIlnRLKpfci z4GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772024369; x=1772629169; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tXh8nJgWerBQSiJBvjtEBHO2Vkt5cQS3cW38XI+++O8=; b=NW1u03WCx8lz+FZUm41iG9brgfYjNwa6I8TqCvqbPrEyw2ZC3WaDV9Sab+Qd8jsLrp 8ECXpDtealHnHqolslr1RO4d88IcObJCH4aKV15HC4UJwQlVq8GjsjLcqM44E/BZZ5CX BDu9L93MsKgQQyvFPT2DLaNzB6irdw/as1F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r898192366b.22.1772017948488; Wed, 25 Feb 2026 03:12:28 -0800 (PST) Received: from [10.112.148.141] (82-132-214-161.dab.02.net. [82.132.214.161]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b9084ee4d63sm508858366b.62.2026.02.25.03.12.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Feb 2026 03:12:27 -0800 (PST) Message-ID: <22073d2a-31ea-46c2-bb4a-b771b2fcf8ee@gmail.com> Date: Wed, 25 Feb 2026 11:12:24 +0000 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 5/5] selftests/io_uring: add a bpf io_uring selftest To: Ming Lei Cc: Ming Lei , Alexei Starovoitov , io-uring , bpf , Jens Axboe , Xiao Ni , Caleb Sander Mateos References: <7cc147a959ac068c55dae4f540e38e9e4ab121e0.1771327059.git.asml.silence@gmail.com> <84e2f3ad-28f0-4e9a-804f-2647cba9b30f@gmail.com> <591a7f0e-7b78-42f1-9486-163249f5e306@gmail.com> Content-Language: en-US From: Pavel Begunkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/25/26 08:41, Ming Lei wrote: > On Tue, Feb 24, 2026 at 12:30 AM Pavel Begunkov wrote: >> >> On 2/23/26 15:23, Ming Lei wrote: >>> On Sat, Feb 21, 2026 at 6:35 AM Pavel Begunkov wrote: >>>> >>>> On 2/20/26 17:45, Alexei Starovoitov wrote: >>>>> On Fri, Feb 20, 2026 at 3:41 AM Pavel Begunkov wrote: >>>>>> >>>>>> I had such examples, but selftests is not the best place for that. >>>>>> It can use abstractions, and I want to make them reusable instead >>>>>> of people copy-pasting from selftests. >>>>> >>>>> Sure, but please still post them as extra patches so it's easier >>>>> to see what's the end result. >>>>> >>>>> Also please reply to that thread: >>>>> https://lore.kernel.org/bpf/CALTww28QMg=YXqKWpWLZrLO+xiqOe3LGyput8dx68-dnQsxg=g@mail.gmail.com/ >>>>> >>>>> It's not clear to me whether your io_uring+bpf setup will work >>>>> for Xiao's use case. >>>>> I don't think we need 2 ways of doing it. >>>> >>>> We discussed this with Ming on the list before, that's one of the use >>>> cases I target as well, there is no reason why it shouldn't work. The >>>> difference is that this approach gives a flexible framework for >>>> extensibility and covers a good bunch of other needs, which is exactly >>>> the reason I moved from a BPF opcode approach, while Ming's proposal is >>>> more specific but argued to be a way easier to plug into ublk servers. >>>> If you ask me, we need a solution that covers a broader spectrum of >>>> use cases, but I guess it all can be argued in either way. >>> >>> One big drawback of Pavel's approach is that it needs a totally >>> different userspace >>> implementation for using BPF, which is just hard to use in existing >>> io_uring applications. >> >> Not really, it depends on how you write it. If you need to rewrite CQ > > I meant SQE has to be allocated & built in bpf prog, then it is inevitable > to move application logic into bpf prog. But that's what I'm saying, you don't need building sqes in bpf to augment it with BPF checksumming / etc. I can elaborate when I get some time, but to give a short example: # bpf-prog.c: unsigned csum_jobs; unsigned regbuf_idx_to_csum; loop() { if (csum_jobs) { kfunc_regbuf_do_csum(regbuf_idx_to_csum); csum_jobs = 0; ... } // proceed to the default submit / lopp implementation // you'd expect from normal io_uring_submit_and_wait() } # user-prog.c ring = create_ring(); load_my_bpf(); sqe = get_and_prep_sqe(); // normal submit+wait io_uring_submit_and_wait(); cqe = get_cqes(); if (cqe->type == ...) { skel->bss->csum_jobs++; skel->bss->regbuf_idx_to_csum = idx_from_cqe(cqe); // use bpf arenas, io_uring regions for the real tning } // queue more sqes if needed // this will do csum'ing and followed by submit+wait io_uring_submit_and_wait(); > If the logic is complicated, it is one big thing. The implementation above would be simple enough. And on top, someone could try to do BPF submissions to cover cases like you had with group request ordering (forgot the actual name). > raid5 is a great example with complicated fast io code path, I'd suggest someone > or Xiao or Caleb, try it. Compare your approach to the bpf opcode and draw > some useful conclusions. Code should be more convincing. > > For bpf opcode approach I believe Xiao has already built an example. It might be entertaining, but I wanted to stress that it's not a blocker for my work. It can handle the use case with registered buffers, but I aim at a more wider range of applications, which wouldn't be covered by the opcode approach. And that's the reason why I moved away from opcodes, it wasn't flexible enough. -- Pavel Begunkov