[dpdk][kernel][driver] 如何让DPDK的UIO开机自动加载到正确的网卡上
0. 前言
开了虚拟机,开始dpdk之前,我每天都干这几件事:
[root@dpdk potatos]# modprobe uio
[root@dpdk potatos]# insmod /root/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
[root@dpdk potatos]# /root/dpdk/tools/dpdk-devbind.py -b igb_uio ::04.0
作为一个有理想的人,很明显,这件事需要让机器自己干 --! 做了上百次之后,我终于开窍了。。。
1. linux启动过程
BOIS/UEFI --> MBR --> grub2 -> linux kernel --> initrd --> root_fs --> sys init / systemd / busybox --> shell --> logind/display manager --> X
可参考另一篇:https://i.cnblogs.com/PostDone.aspx?postid=6652739&actiontip=%E5%8F%91%E5%B8%83%E6%88%90%E5%8A%9F
涉及到驱动的地方:
A:linux kernel,有一部分驱动是直接编译到内核里边去的 /boot/vmlinuz-linux ,另一部分是动态加载的,在/usr/lib/modules/4.10.6-1-ARCH/kernel/ 下面。还有一部分是没有的。
我们在编译内核之前,可以修改内核编译选项,有三个选项 Y / M / N 一一对应。
B:initrd: 但是我们是两阶段启动,所以,initrd中也被集成了一部分驱动,他们的目的只是为了strap起 rootfs。可以在/etc/mkinitcpio.conf中指定。
C:rootfs,也就是/usr/lib/modules/4.10.6-1-ARCH/kernel/ 下面的驱动。
2. 我们讨论 rootfs中的内容。
A:我们可以手动加载卸载他们,用modprobe。了解modprobe的大概用法,配置。
# man modprobe
# man modprobe.d
B:udev, 设备插拔之类的,udev会根据事件,自动的加载卸载驱动。
https://wiki.archlinux.org/index.php/udev
http://www.reactivated.net/writing_udev_rules.html
https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html
看完两篇文档,我依然对udev了解不深。
所以,我应该把dpdk的uio放进udev么? 还是加入启动脚本里,在里边调用 modprobe?
了解一下sys init 和 systemd 的流程,应该会找到正确的方式。
3. sys init / systemd 流程
略。好像没啥关系
4. 来个别人总结的番外篇:(为了防止这位博友把原文删掉,我已经另存本地了。)
http://www.cnblogs.com/image-eye/archive/2011/08/19/2145858.html
5. 按照番外片里的说法,所有设备在被内核发现的时候,内核就会发内核事件出来,而外面正在监听的udev就会捕获到,然后根据modprobe.alias 和 modprobe.dep中的内容,加载一系列的模块了。
所以,我应该去改modprobe的配置,blacklist掉相应的网卡,使之使用dpdk的驱动。
6. https://wiki.archlinux.org/index.php/Kernel_modules#Blacklisting
CentOS 7 里边的方法:红色为关键操作。
[root@dpdk ~]# cd /lib/modules/3.10.-514.6..el7.x86_64/extra/
[root@dpdk extra]# mkdir dpdk
[root@dpdk extra]# cp /root/dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko dpdk/
[root@dpdk etc]# cd modules-load.d/
[root@dpdk modules-load.d]# touch dpdk.conf
[root@dpdk modules-load.d]# vim dpdk.conf
[root@dpdk ~]# cat /etc/modules-load.d/dpdk.conf
igb_uio
[root@dpdk ~]# depmod
[root@dpdk ~]# modprobe igb_uio
[root@dpdk ~]# reboot
[root@dpdk ~]# lsmod |grep igb
igb_uio
uio igb_uio
[root@dpdk ~]#
http://stackoverflow.com/questions/34800731/module-not-found-when-i-do-a-modprobe
至此,UIO已经开机自动加载了,接下来的问题是,让UIO自动驱动网卡。
截至到目前,只能自动加载。却不知道如何让指定的网卡默认加载UIO,毕竟我不能blacklist intel的驱动。而
且从udev里卸载一个驱动去加载另一个是否常规呢?这些疑问都需要深入的理解了udev之后才能回答。
算了,放弃了。。。。 不然人家dpdk为啥要提供个脚本。。。
当然,实现功能是没问题的,只需要自启动一个脚本,调用这个驱动。
如果,有幸有人读到此处并愿意分享的话,欢迎留言。
-------- update@20170412 --------
driver_override: 可能有点关系吧,还没有时间细研究。
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-platform
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci
----------- update@20170918 -------------
自动加载hugepage.
1. 增加内核参数: hugepages=1024
http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html#use-of-hugepages-in-the-linux-environment
2. 修改fstab自动挂载. 增加行
nodev /mnt/huge hugetlbfs defaults
------------ update@20170918 -----------------------
清除igb_uio自动加载的逆过程.
1. 删除
/etc/modules-load.d/dpdk.conf
2. 删除
/usr/lib/modules/3.10.-693.2..el7.x86_64/weak_updates/dpdk/
3. depmod
与安装时不同的是, 还有后两个步骤
4. 卸载uio
rmmod igb_uio
modprobe -r uio
5. 重新生成initramfs
mkinitrd /boot/initramfs-3.10.-693.2..el7.x86_64.img.new 3.10.-693.2..el7.x86_64
6. reboot
-------------- update @ 2018-07-25 ------------------------------------
[administrator][driver] driverctl 是如何在udev上层管理设备驱动的
igb_uio 自动加载问题.
偶然发现的,可以用 driverctl 做.
driverctl 设置了udev的rules, 同时留下了pci的ID在配置里:
[root@D129 copyright]# rpm -ql driverctl
/etc/driverctl.d
/usr/lib/udev/rules.d/-driverctl.rules
/usr/lib/udev/rules.d/-vfio-uio.rules
/usr/lib/udev/vfio_name
... ...
[root@D129 copyright]# cat /etc/driverctl.d/pci-\:\:04.0
igb_uio
[root@D129 copyright]#
[dpdk][kernel][driver] 如何让DPDK的UIO开机自动加载到正确的网卡上的更多相关文章
- 浅析 GRUB 如何加载 linux kernel
前言 对于 GRUB 的加载流程,网上绝大部分都是写对 menu.lst, grub.cfg 这些 GRUB 配置文件的编写流程,就像是写脚本语言一样,用些关键字就能让 PC机能正确启动桌面 Linu ...
- [driver]linux内核动态加载模块
问题: 1. 把编译好的模块放到板子/lib/modules对应文件夹下,并且执行了depmod -a, 比如pl2303.ko, 那么下一次插入pl2303的串口线,是否可以识别,也就是自动加载pl ...
- selenium学习笔记11——driver.get(url) 页面加载时间太长
在执行自动化测试用例过程中,发现因为网络慢或其他原因导致driver.get(url) 时,页面一直在加载,页面没有加载完成就不会去继续执行下面的动作,但是实际上需要操作的元素已经加载出来了. 解决方 ...
- selenium学习笔记——driver.get(url) 页面加载时间太长
# 两个同时设置才行 # 实现效果:加载状态停止,进行代码下一步操作 driver.set_page_load_timeout(10) driver.set_script_timeout(10) # ...
- [dpdk] dpdk编译成动态库使用 -- PCI port自动发现与pmd动态加载
1. 修改配置文件 .conf, 设置如下变量的值. [root@D129 x86_64-native-linuxapp-gcc]# cat dpdk/x86_64-native-linuxapp- ...
- CentOS VirtualBox启动虚拟及报错:VirtualBox error: Kernel driver not installed (rc=1908)
VirtualBox error: Kernel driver not installed (rc=1908) Hi all, Let me first say that this is my fin ...
- Ubuntu 升级VisualBox后无法启动 Kernel driver not installed (rc=-1908)
VisualBox之所以在Linux上比传统的VMware快得多,关键一点就是它和Linux内核的结合比较紧密,这也是开源的优点. 不过Linux内核更新很频繁,每次更新内核后启动VirtualBox ...
- virtualbox cannot access the kernel driver的解决办法
一位网友windows xp sp3下安装virtualbox 4.1.20版本,安装好了重启过后,可以打开virtualbox,但是等到创建好虚拟电脑后按启动按钮,就出现了错误提示:"Ca ...
- Fedora安装VirtualBox时出现错误Kernel driver not installed (rc=-1908)的解决办法
新建虚拟机后启动时出现如下错误: Kernel driver not installed (rc=-1908) The VirtualBox Linux kernel driver (vboxdrv) ...
随机推荐
- linux source code search
https://elixir.bootlin.com/linux/latest/source/fs/eventpoll.c#L1120
- 灯箱效果插件Magnific Popup详解
Magnific Popup 是一个非常优秀的弹出对话框或者灯箱效果插件.它基于jQuery(zepto)开发,使用非常简单,特点就是:非常好用. 官网地址: http://dimsemenov.co ...
- java Filter过滤器例外URL设置
在web.xml声明的一个filter中: <!– session过滤filter –> <filter> <filter-name>SessionFilter&l ...
- Spring Session Redis
http://www.infoq.com/cn/articles/Next-Generation-Session-Management-with-Spring-Session
- mysql 核心知识要点
整体知识介绍:mysql基本操作和使用,mysql优化(索引,分表等),mysql部署(读写分离,负载均衡等) 数据库基本介绍:数据库概念,常用数据库,web应用三大软件分工,PHP动态语言特点(处理 ...
- React Native 进的第一个坑
Bundling index.ios.js [development, non-minified, hmr disabled] 0.0% (0/1), failed. error: bundling ...
- 关于枚举,enum、Enum、EnumSet、RegularEnumSet、JumboEnumSet
Apache Commons Lang. 在版本3中,enum相关的工具就留下EnumUtils. 首先, 所有enum,都默认实现了抽象类 java.lang.Enum .所以,所有enum都具备E ...
- last
last reboot 显示系统最后重启的历史记录 last -w 显示自系统启动以来,所有登录的用户(全名)
- 【QT】error: 'SIGNAL' was not declared in this scope
error: 'SIGNAL' was not declared in this scope 未在此范围内声明. connect(ui->Btnshowhello,SIGNAL(clicked ...
- bootstrap-select 多选下拉框使用教程
http://silviomoreto.github.io/bootstrap-select/ 一.使用bootstrap-select组件时,先引用下列文件 最后一个文件 defaults-zh_C ...