• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
杏子的成长日记
博客园    首页    新随笔    联系   管理    订阅  订阅
ublk

资源整理

ebpf+ublk内核代码:https://lore.kernel.org/all/20230222132534.114574-1-xiaoguang.wang@linux.alibaba.com/
需要学习:

  • Linux内核源码:drivers/block/ublk_drv.c 链接:https://github.com/ming1/ubdsrv(内核驱动,只关注2023.2.22之前的版本)
  • 用户态代码:https://github.com/ming1/ubdsrv (2023.2.22之前的版本)

ebpf程序:https://lore.kernel.org/all/20230222132534.114574-1-xiaoguang.wang@linux.alibaba.com/

验收目标:安装好ublk内核模块,启动ublksrv daemon,会出现ublk设备。然后用fio读写这个ublk设备就行

ebpf+ublk内核代码

u64 bpf_ublk_queue_sqe(struct ublk_io_bpf_ctx *bpf_ctx, struct io_uring_sqe *sqe, u32 sqe_len, u32, fd)会使用io_uring 提交io请求
ideas来源:Pavel's patchset [2]

git clone https://github.com/ming1/ubdsrv
  cd ubdsrv
  git am -3 0001-Add-ebpf-support.patch
  # replace "/root/ublk/" with your own linux build directory
  cd bpf; make; cd ..;
  ./build_with_liburing_src
  ./ublk add -t loop -q 1 -d 128 -f loop.file

Linux内核安装

Linux内核版本:5.10
打补丁:https://lore.kernel.org/all/20230222132534.114574-1-xiaoguang.wang@linux.alibaba.com/#r

编译Linux内核,需要打三个补丁:
https://lore.kernel.org/all/20230222132534.114574-2-xiaoguang.wang@linux.alibaba.com/
https://lore.kernel.org/all/20230222132534.114574-3-xiaoguang.wang@linux.alibaba.com/
https://lore.kernel.org/all/20230222132534.114574-4-xiaoguang.wang@linux.alibaba.com/

编译ublk:
https://lore.kernel.org/all/20230222132534.114574-1-xiaoguang.wang@linux.alibaba.com/
需要打补丁:https://lore.kernel.org/all/20230222132744.117182-1-xiaoguang.wang@linux.alibaba.com/

posted on 2023-07-15 22:48  杏子的成长日记  阅读(267)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3