public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF
@ 2026-02-19  5:38 Xiao Ni
  2026-02-20 14:13 ` Ming Lei
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Xiao Ni @ 2026-02-19  5:38 UTC (permalink / raw)
  To: lsf-pc, linux-block, bpf; +Cc: Ming Lei

Hi all

I'm doing some work on user-space RAID recently. I'd like to propose a
topic for LSF/MM 2026 regarding the implementation of RAID5 in user
space using ublk and io_uring bpf[1], particularly focusing on the
challenges encountered and potential kernel improvements needed.

Ublk raid5 uses the ublk framework (tools/testing/selftests/ublk/),
with the goal of leveraging io_uring's zero-copy capabilities and
BPF[1] for performance optimization. The implementation includes:
* RAID5 stripe handling with configurable chunk sizes
* Multi-queue support via io_uring
* Degraded mode for single disk failure tolerance
* Integration with io_uring BPF struct_ops framework

During the implementation, I encountered several technical challenges.
The primary challenge is performing XOR parity calculations in a true
zero-copy manner:

1. Bpf program support
Raid5 needs to calculate parity with data. Now io_uring already
supports zero copy. For targets such as raid0/raid1, it's enough. But
for targets such as raid5, it still needs to copy data to userspace
and calculate the parity. Bpf program is a nice solution[1] to resolve
this issue. Besides the patch set[1], it still needs another bpf kfunc
uring_bpf_xor() support.

2. Register buffer per io
Raid5 needs to calculate parity with data. So it still needs to
pre-alloc buffer and register it for each io. The total memory is
controlled by queue number and queue depth. With the pre-alloc memory
and bpf program support, target such as raid5 can support true
zero-copy manner.

Question for discussion:
* Should the kernel provide XOR operation kfuncs for io_uring BPF?
* What would be the appropriate API design?
* Are there security or verification concerns with BPF performing XOR
on registered buffers?

Current Status:
* Basic RAID5 functionality: implemented
* BPF struct_ops framework: successfully integrated
* Performance testing: in progress
* Main blocker: zero-copy XOR implementation waiting for kernel
support I've written a patch for testing based on [1]

Why this matters
User-space block devices (ublk) offer several advantages:
* Faster development and iteration
* Easier debugging
*  Ability to leverage user-space libraries
* No kernel panic risks during development
* Easy to evaluate/compare performance between kernel raid and ublk
based userspace raid.

Desired Outcome
* If proposal in [1] would be acceptable
* Get feedback on whether `uring_bpf_xor()` kfunc would be acceptable
* Discuss API design for BPF-based computation on io_uring buffers
* Understand the roadmap for io_uring + BPF capabilities
* Learn best practices from the community for similar implementations

I'll finish the ublk raid5(tools/testing/selftests/ublk/) and submit
patches later. Also, I'll try to prepare a patch for uring_bpf_xor.
Next, I'll try to impement it based on rublk[2].

[1] https://lore.kernel.org/io-uring/20260106101126.4064990-1-ming.lei@redhat.com/
[2] https://github.com/ublk-org/libublk-rs

Best Regards
Xiao


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF
  2026-02-19  5:38 [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF Xiao Ni
@ 2026-02-20 14:13 ` Ming Lei
  2026-02-21  9:11   ` Xiao Ni
  2026-02-23 15:54 ` Pavel Begunkov
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Ming Lei @ 2026-02-20 14:13 UTC (permalink / raw)
  To: Xiao Ni; +Cc: lsf-pc, linux-block, bpf, Caleb Sander Mateos

Hi Xiao,

On Thu, Feb 19, 2026 at 01:38:46PM +0800, Xiao Ni wrote:
> Hi all
> 
> I'm doing some work on user-space RAID recently. I'd like to propose a
> topic for LSF/MM 2026 regarding the implementation of RAID5 in user
> space using ublk and io_uring bpf[1], particularly focusing on the
> challenges encountered and potential kernel improvements needed.
> 
> Ublk raid5 uses the ublk framework (tools/testing/selftests/ublk/),
> with the goal of leveraging io_uring's zero-copy capabilities and
> BPF[1] for performance optimization. The implementation includes:
> * RAID5 stripe handling with configurable chunk sizes
> * Multi-queue support via io_uring
> * Degraded mode for single disk failure tolerance
> * Integration with io_uring BPF struct_ops framework
> 
> During the implementation, I encountered several technical challenges.
> The primary challenge is performing XOR parity calculations in a true
> zero-copy manner:
> 
> 1. Bpf program support
> Raid5 needs to calculate parity with data. Now io_uring already
> supports zero copy. For targets such as raid0/raid1, it's enough. But
> for targets such as raid5, it still needs to copy data to userspace
> and calculate the parity. Bpf program is a nice solution[1] to resolve
> this issue. Besides the patch set[1], it still needs another bpf kfunc
> uring_bpf_xor() support.
> 
> 2. Register buffer per io
> Raid5 needs to calculate parity with data. So it still needs to
> pre-alloc buffer and register it for each io. The total memory is
> controlled by queue number and queue depth. With the pre-alloc memory
> and bpf program support, target such as raid5 can support true
> zero-copy manner.
> 
> Question for discussion:
> * Should the kernel provide XOR operation kfuncs for io_uring BPF?
> * What would be the appropriate API design?
> * Are there security or verification concerns with BPF performing XOR
> on registered buffers?
> 
> Current Status:
> * Basic RAID5 functionality: implemented
> * BPF struct_ops framework: successfully integrated
> * Performance testing: in progress
> * Main blocker: zero-copy XOR implementation waiting for kernel
> support I've written a patch for testing based on [1]
> 
> Why this matters
> User-space block devices (ublk) offer several advantages:
> * Faster development and iteration
> * Easier debugging
> *  Ability to leverage user-space libraries
> * No kernel panic risks during development
> * Easy to evaluate/compare performance between kernel raid and ublk
> based userspace raid.
> 
> Desired Outcome
> * If proposal in [1] would be acceptable
> * Get feedback on whether `uring_bpf_xor()` kfunc would be acceptable
> * Discuss API design for BPF-based computation on io_uring buffers
> * Understand the roadmap for io_uring + BPF capabilities
> * Learn best practices from the community for similar implementations

I am interested in this topic, and looks Caleb Sander Mateos has similar
requirement too.


Thanks,
Ming


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF
  2026-02-20 14:13 ` Ming Lei
@ 2026-02-21  9:11   ` Xiao Ni
  0 siblings, 0 replies; 7+ messages in thread
From: Xiao Ni @ 2026-02-21  9:11 UTC (permalink / raw)
  To: Ming Lei; +Cc: lsf-pc, linux-block, bpf, Caleb Sander Mateos

On Fri, Feb 20, 2026 at 10:14 PM Ming Lei <ming.lei@redhat.com> wrote:
>
> Hi Xiao,
>
> On Thu, Feb 19, 2026 at 01:38:46PM +0800, Xiao Ni wrote:
> > Hi all
> >
> > I'm doing some work on user-space RAID recently. I'd like to propose a
> > topic for LSF/MM 2026 regarding the implementation of RAID5 in user
> > space using ublk and io_uring bpf[1], particularly focusing on the
> > challenges encountered and potential kernel improvements needed.
> >
> > Ublk raid5 uses the ublk framework (tools/testing/selftests/ublk/),
> > with the goal of leveraging io_uring's zero-copy capabilities and
> > BPF[1] for performance optimization. The implementation includes:
> > * RAID5 stripe handling with configurable chunk sizes
> > * Multi-queue support via io_uring
> > * Degraded mode for single disk failure tolerance
> > * Integration with io_uring BPF struct_ops framework
> >
> > During the implementation, I encountered several technical challenges.
> > The primary challenge is performing XOR parity calculations in a true
> > zero-copy manner:
> >
> > 1. Bpf program support
> > Raid5 needs to calculate parity with data. Now io_uring already
> > supports zero copy. For targets such as raid0/raid1, it's enough. But
> > for targets such as raid5, it still needs to copy data to userspace
> > and calculate the parity. Bpf program is a nice solution[1] to resolve
> > this issue. Besides the patch set[1], it still needs another bpf kfunc
> > uring_bpf_xor() support.
> >
> > 2. Register buffer per io
> > Raid5 needs to calculate parity with data. So it still needs to
> > pre-alloc buffer and register it for each io. The total memory is
> > controlled by queue number and queue depth. With the pre-alloc memory
> > and bpf program support, target such as raid5 can support true
> > zero-copy manner.
> >
> > Question for discussion:
> > * Should the kernel provide XOR operation kfuncs for io_uring BPF?
> > * What would be the appropriate API design?
> > * Are there security or verification concerns with BPF performing XOR
> > on registered buffers?
> >
> > Current Status:
> > * Basic RAID5 functionality: implemented
> > * BPF struct_ops framework: successfully integrated
> > * Performance testing: in progress
> > * Main blocker: zero-copy XOR implementation waiting for kernel
> > support I've written a patch for testing based on [1]
> >
> > Why this matters
> > User-space block devices (ublk) offer several advantages:
> > * Faster development and iteration
> > * Easier debugging
> > *  Ability to leverage user-space libraries
> > * No kernel panic risks during development
> > * Easy to evaluate/compare performance between kernel raid and ublk
> > based userspace raid.
> >
> > Desired Outcome
> > * If proposal in [1] would be acceptable
> > * Get feedback on whether `uring_bpf_xor()` kfunc would be acceptable
> > * Discuss API design for BPF-based computation on io_uring buffers
> > * Understand the roadmap for io_uring + BPF capabilities
> > * Learn best practices from the community for similar implementations
>
> I am interested in this topic, and looks Caleb Sander Mateos has similar
> requirement too.

Hi Ming

Thanks and any suggestion is welcome :)

Best Regards
Xiao
>
>
> Thanks,
> Ming
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF
  2026-02-19  5:38 [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF Xiao Ni
  2026-02-20 14:13 ` Ming Lei
@ 2026-02-23 15:54 ` Pavel Begunkov
  2026-02-23 16:40   ` Hannes Reinecke
  2026-02-24 16:24 ` Keith Busch
  2026-03-01  2:32 ` Cong Wang
  3 siblings, 1 reply; 7+ messages in thread
From: Pavel Begunkov @ 2026-02-23 15:54 UTC (permalink / raw)
  To: Xiao Ni, lsf-pc, linux-block, bpf; +Cc: Ming Lei

On 2/19/26 05:38, Xiao Ni wrote:
> Hi all
> 
> I'm doing some work on user-space RAID recently. I'd like to propose a
> topic for LSF/MM 2026 regarding the implementation of RAID5 in user
> space using ublk and io_uring bpf[1], particularly focusing on the
> challenges encountered and potential kernel improvements needed.
> 
> Ublk raid5 uses the ublk framework (tools/testing/selftests/ublk/),
> with the goal of leveraging io_uring's zero-copy capabilities and
> BPF[1] for performance optimization. The implementation includes:
> * RAID5 stripe handling with configurable chunk sizes
> * Multi-queue support via io_uring
> * Degraded mode for single disk failure tolerance
> * Integration with io_uring BPF struct_ops framework
> 
> During the implementation, I encountered several technical challenges.
> The primary challenge is performing XOR parity calculations in a true
> zero-copy manner:

I aim at similar use cases, i.e. interacting with registered buffers
from BPF, but based on a different BPF-io_uring implementation. I'd be
interesting to discuss how the kfunc API should look like.

-- 
Pavel Begunkov


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF
  2026-02-23 15:54 ` Pavel Begunkov
@ 2026-02-23 16:40   ` Hannes Reinecke
  0 siblings, 0 replies; 7+ messages in thread
From: Hannes Reinecke @ 2026-02-23 16:40 UTC (permalink / raw)
  To: Pavel Begunkov, Xiao Ni, lsf-pc, linux-block, bpf; +Cc: Ming Lei

On 2/23/26 16:54, Pavel Begunkov wrote:
> On 2/19/26 05:38, Xiao Ni wrote:
>> Hi all
>>
>> I'm doing some work on user-space RAID recently. I'd like to propose a
>> topic for LSF/MM 2026 regarding the implementation of RAID5 in user
>> space using ublk and io_uring bpf[1], particularly focusing on the
>> challenges encountered and potential kernel improvements needed.
>>
>> Ublk raid5 uses the ublk framework (tools/testing/selftests/ublk/),
>> with the goal of leveraging io_uring's zero-copy capabilities and
>> BPF[1] for performance optimization. The implementation includes:
>> * RAID5 stripe handling with configurable chunk sizes
>> * Multi-queue support via io_uring
>> * Degraded mode for single disk failure tolerance
>> * Integration with io_uring BPF struct_ops framework
>>
>> During the implementation, I encountered several technical challenges.
>> The primary challenge is performing XOR parity calculations in a true
>> zero-copy manner:
> 
> I aim at similar use cases, i.e. interacting with registered buffers
> from BPF, but based on a different BPF-io_uring implementation. I'd be
> interesting to discuss how the kfunc API should look like.
> 
I'd be interested in that, too.
I'm working on BPF support for nvme / nvmet, so some ideas how others
handle it won't go amiss.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF
  2026-02-19  5:38 [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF Xiao Ni
  2026-02-20 14:13 ` Ming Lei
  2026-02-23 15:54 ` Pavel Begunkov
@ 2026-02-24 16:24 ` Keith Busch
  2026-03-01  2:32 ` Cong Wang
  3 siblings, 0 replies; 7+ messages in thread
From: Keith Busch @ 2026-02-24 16:24 UTC (permalink / raw)
  To: Xiao Ni; +Cc: lsf-pc, linux-block, bpf, Ming Lei

On Thu, Feb 19, 2026 at 01:38:46PM +0800, Xiao Ni wrote:
> Hi all
> 
> I'm doing some work on user-space RAID recently. I'd like to propose a
> topic for LSF/MM 2026 regarding the implementation of RAID5 in user
> space using ublk and io_uring bpf[1], particularly focusing on the
> challenges encountered and potential kernel improvements needed.
> 
> Ublk raid5 uses the ublk framework (tools/testing/selftests/ublk/),
> with the goal of leveraging io_uring's zero-copy capabilities and
> BPF[1] for performance optimization. The implementation includes:
> * RAID5 stripe handling with configurable chunk sizes
> * Multi-queue support via io_uring
> * Degraded mode for single disk failure tolerance
> * Integration with io_uring BPF struct_ops framework
> 
> During the implementation, I encountered several technical challenges.
> The primary challenge is performing XOR parity calculations in a true
> zero-copy manner:

Great use case. The indirect reference to memory from user space is a
bit of a blocker for various zero-copy plans, so being able to leverage
the kernel to perform parity and crypto transforms would be awesome. I
think there's potential for fuse as well as ublk.

Anyway, I'm interested in the topic.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF
  2026-02-19  5:38 [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF Xiao Ni
                   ` (2 preceding siblings ...)
  2026-02-24 16:24 ` Keith Busch
@ 2026-03-01  2:32 ` Cong Wang
  3 siblings, 0 replies; 7+ messages in thread
From: Cong Wang @ 2026-03-01  2:32 UTC (permalink / raw)
  To: Xiao Ni; +Cc: lsf-pc, linux-block, bpf, Ming Lei

On Thu, Feb 19, 2026 at 01:38:46PM +0800, Xiao Ni wrote:
> Hi all
> 
> I'm doing some work on user-space RAID recently. I'd like to propose a
> topic for LSF/MM 2026 regarding the implementation of RAID5 in user
> space using ublk and io_uring bpf[1], particularly focusing on the
> challenges encountered and potential kernel improvements needed.
> 
> Ublk raid5 uses the ublk framework (tools/testing/selftests/ublk/),
> with the goal of leveraging io_uring's zero-copy capabilities and
> BPF[1] for performance optimization. The implementation includes:
> * RAID5 stripe handling with configurable chunk sizes
> * Multi-queue support via io_uring
> * Degraded mode for single disk failure tolerance
> * Integration with io_uring BPF struct_ops framework


This is very interesting.

Although technically different with RAID, how about user-space LVM?

I need it for the multikernel use case:
https://lpc.events/event/19/contributions/2074/attachments/1776/3957/Multikernel-LPC2025.pdf
(slide #19)

Relying on the in-kernel LVM is not ideal for provisioning since ublk is
already there.

Also, it does not need to be a complete replacement of existing LVM,
a simple ublk-defined storage isolation is sufficient.

Regards,
Cong Wang

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-01  2:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19  5:38 [LSF/MM/BPF TOPIC] User space RAID5 with ublk and io_uring BPF Xiao Ni
2026-02-20 14:13 ` Ming Lei
2026-02-21  9:11   ` Xiao Ni
2026-02-23 15:54 ` Pavel Begunkov
2026-02-23 16:40   ` Hannes Reinecke
2026-02-24 16:24 ` Keith Busch
2026-03-01  2:32 ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox