public inbox for bpf@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

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