DPDK Running As Non Privileged User - linux

I have an issue running DPDK helloworld application as non privileged user.
[#dredd examples]$ ./dpdk-helloworld
EAL: Detected CPU lcores: 4
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /run/user/1000/dpdk/rte/mp_socket
EAL: rte_mem_virt2phy(): cannot open /proc/self/pagemap: Permission denied
EAL: FATAL: Cannot use IOVA as 'PA' since physical addresses are not available
EAL: Cannot use IOVA as 'PA' since physical addresses are not available
PANIC in main():
Cannot init EAL
5: [./dpdk-helloworld(_start+0x2e) [0x58ce4e]]
4: [/lib64/libc.so.6(__libc_start_main+0xf3) [0x7f93977edcf3]]
3: [./dpdk-helloworld(main+0x42) [0x58cf87]]
2: [./dpdk-helloworld(__rte_panic+0xdb) [0xa01c59]]
1: [./dpdk-helloworld(rte_dump_stack+0x27) [0xa2fcac]]
Clearly this issue is described in DPDK guide and it advises adding the capability to the executable which I did but it didn't work.
[XXX#dredd examples]$ sudo setcap cap_ipc_lock,cap_sys_admin+ep ./dpdk-helloworld
[sudo] password for XXX:
[XXX#dredd examples]$ getcap ./dpdk-helloworld
./dpdk-helloworld = cap_ipc_lock,cap_sys_admin+ep
[XXX#dredd examples]$
On other hand I have seen some pages that claim that running user itself must have the SYS_ADMIN capability. So does it mean that DPDK guide is not updated, and what why file permission may not be sufficient???
Any advises on how to overcome the permission issue for the DPDK application will be highly appreciated.
Running with sudo it seams to be working:-
[#dredd examples]$ sudo ./dpdk-helloworld
[sudo] password for XXX:
EAL: Detected CPU lcores: 4
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: VFIO support initialized
EAL: Using IOMMU type 8 (No-IOMMU)
EAL: Ignore mapping IO port bar(2)
EAL: Probe PCI driver: net_e1000_em (8086:100e) device: 0000:00:08.0 (socket 0)
The environment is VirtualBox AlmaLinux
[XXX#dredd examples]$ uname -a
Linux dredd 4.18.0-348.el8.x86_64 #1 SMP Tue Nov 9 06:28:28 EST 2021 x86_64 x86_64 x86_64 GNU/Linux
I have bound two pci devices to vfio-pci driver with disabled iommu support

sudo setcap all+ep ./dpdk-helloworld
But it is far from intended granularity of the solution

Related

qemu: installating ubuntu through ISO gets stuck, shows "SVM" CPU bit warning

I am trying to install ubuntu in one of the qcow2 images I have created, using the below command
sudo qemu-system-x86_64 -enable-kvm -nographic -smp 8 -m 8G -cpu qemu64 -cdrom ubuntu-19.10-live-server-amd64.iso -boot d ubuntu-19.10-live-server-amd64.qcow2
First it spits out a warning, and then just hangs
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.80000001H:ECX.svm [bit 2]
SeaBIOS (version 1.13.0-1ubuntu1)
iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+BFF8C9F0+BFECC9F0 CA00
Booting from DVD/CD...
ISOLINUX 6.04 20190226 ETCD Copyright (C) 1994-2015 H. Peter Anvin et al
Loading bootlogo...
Initializing gfx code...
I have searched a lot and got a number of solutions and possible problems but none worked.
1) Have tried with Ubuntu 20 also, but same error.
2) VT-x not enabled.
It is enabled, lscpu shows
Virtualization: VT-x
Hypervisor vendor: KVM
Flags: .. vmx ..
3) Try with -cpu qemu64. Did not work
4) use qemu-system-i386 instead of qemu-system-x86_64. But that fails with a different error
This kernel requires an x86-64 CPU, but only detected an i686 CPU.
Unable to boot - please use a kernel appropriate for your CPU.
5) I did find out that the "SVM" CPU bit corresponds to "AMD Secure Virtual Machine", which confused me since my CPU is Haswell.
Help!
I found what the issue was.
While using nested virtualization, the option -cpu host works. This advises qemu to use the same cpu format as the host, which in our case is also a VM, and which mostly will be using the host CPU format too..
The above setting works,
unless; you are using nested virtualization over a virtualbox, and trying to run qemu on the VM. Then, to make this work, we have to skip enable-kvm and the -cpu option altogether. It does make the qemu VM run slow, but it works.

intel SPDK ioat example fail to run

I am new in the intel SPDK and meet some problem when I run the example code.
I setup the BIOS as this page said.
Intel® Hyper-Threading Technology off
Intel SpeedStep® technology enabled
Intel® Turbo Boost Technology disabled
then I git clone from this page and run all the command. The test command ./test/unit/unittest.sh return All unit tests passed.
But when I run the example examples/ioat/verify/verify , it return
EAL: 24 hugepages of size 1073741824 reserved, but no mounted hugetlbfs found for that size
Starting SPDK v18.10-pre / DPDK 18.05.0 initialization...
[ DPDK EAL parameters: verify --no-shconf -c 0x1 --legacy-mem --file-prefix=spdk_pid3170 ]
EAL: Detected 16 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/spdk_pid3170/mp_socket
EAL: 24 hugepages of size 1073741824 reserved, but no mounted hugetlbfs found
for that size
EAL: Probing VFIO support...
User configuration:
Run time: 10 seconds
Core mask: 0x1
Queue depth: 32
Not enough ioat channels found. Check that ioat channels are bound
to uio_pci_generic or vfio-pci. scripts/setup.sh can help with this.
and scripts/setup.sh status shows
Hugepages
node hugesize free / total
node0 1048576kB 24 / 24
node0 2048kB 0 / 800
node1 1048576kB 0 / 0
node1 2048kB 0 / 224
NVMe devices
BDF Numa Node Driver name Device name
I/OAT DMA
BDF Numa Node Driver Name
virtio
BDF Numa Node Driver Name Device Name
My hardware is:
linux kernel version 4.15.7
with ioatdma compile as module
CPU intel Xeon E5-2695
chipset C612
It would be great help if somebody could give me some advises or send me some website about SPDK!
Thank you!
Run ./scripts/setup.sh (with no parameters). If there will be no ioat devices under I/OAT DMA section you can't run this app. Also there is no hugetlbfs mount points.

DPDK test application cannot found on redhat

I met a issue with error shows(when deploy dpdk on redhat) :
sudo: x86_64-native-linuxapp-gcc/app/test: command not found
I am not sure what is the matter.
Now I cannot test dpdk, could you someone help me if you met this before.
There are some detailed information about my system below.
FYI.
Kernel version
3.10.0-693.11.1.el7.x86_64
[root#cnhzdhcp16557 usertools]# ./dpdk-setup.sh
Build x86_64-native-linuxapp-gcc
...
== Build app/test-crypto-perf
== Build app/test-eventdev
Build complete [x86_64-native-linuxapp-gcc]
Installation cannot run with T defined and DESTDIR undefined
Insert IGB UIO module
Unloading any existing DPDK UIO module
Loading DPDK UIO module
Insert VFIO module
Unloading any existing VFIO module
Loading VFIO module
chmod /dev/vfio
OK
Insert KNI module
Unloading any existing DPDK KNI module
Loading DPDK KNI module
Press enter to continue ...
Network devices using kernel driver
0000:00:19.0 'Ethernet Connection I217-V 153b' if=enp0s25 drv=e1000e unused=igb_uio Active
0000:02:00.0 'Centrino Advanced-N 6235 088e' if=wlo1 drv=iwlwifi unused=igb_uio
Huge page information
AnonHugePages: 98304 kB
HugePages_Total: 128
HugePages_Free: 128
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Run test application ($RTE_TARGET/app/test)
Enter hex bitmask of cores to execute test app on
Example: to execute app on cores 0 to 7, enter 0xff
bitmask: f
Launching app
sudo: x86_64-native-linuxapp-gcc/app/test: command not found
Run testpmd application in interactive mode ($RTE_TARGET/app/testpmd)
Enter hex bitmask of cores to execute test app on
Example: to execute app on cores 0 to 7, enter 0xff
bitmask: f
Launching app
EAL: Detected 4 lcore(s)
EAL: No free hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
EAL: PCI device 0000:00:19.0 on NUMA socket -1
EAL: Invalid NUMA socket, default to 0
EAL: probe driver: 8086:153b net_e1000_em
EAL: No probed ethernet devices
Interactive-mode selected
USER1: create a new mbuf pool : n=171456, size=2176,
socket=0
EAL: Error - exiting with code: 1
Cause: Creation of mbuf pool for socket 0 failed: Cannot allocate memory
The test application should be build manually with make test... command. What you really want is the testpmd application to work. There are two issues:
EAL: No probed ethernet devices log means there are no NICs available for testpmd. You need to bind your NIC to igb_uio in order to use in with DPDK application.
Cause: Creation of mbuf pool for socket 0 failed: Cannot allocate memory log means there are no enough huge pages to allocate mempool. Indeed:
HugePages_Free: 128
Hugepagesize: 2048 kB
There are 128 pages 2M each, which makes 256M of available memory. While testpmd tries to allocate create a new mbuf pool : n=171456, size=2176 which makes 171456 * 2176 = 373M, so it fails.
The solution would be to either allocate more huge pages or to run testpmd with --total-num-mbufs command line option.

how to enable PMU in KVM guest

I am running KVM/QEMU in my Lenovo X1 laptop.
The guest OS is Ubuntu 15.04 x86_64.
Now, I want to run 'perf' command in guest OS, but I found followings in guest OS in dmesg.
...
[ 0.055442] smpboot: CPU0: Intel Xeon E3-12xx v2 (Ivy Bridge) (fam: 06, model: 3a, stepping: 09)
[ 0.056000] Performance Events: unsupported p6 CPU model 58 no PMU driver, software events only.
[ 0.057602] x86: Booting SMP configuration:
[ 0.058686] .... node #0, CPUs: #1
[ 0.008000] kvm-clock: cpu 1, msr 0:1ffd6041, secondary cpu clock
...
So, the perf command could NOT work hardware PMU event in guest OS.
How could I enable hardware PMU from my host to the Ubuntu guest?
Thanks,
-Tao
Page https://github.com/mozilla/rr/wiki/Building-And-Installing gives some hints how to enable guest PMU:
Qemu: On QEMU command line use
-cpu host
Libvirt/KVM: Specify CPU passthrough in domain XML definition:
<cpu mode='host-passthrough'/>
Same advice in https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_tuning_and_optimization_guide/sect-virtualization_tuning_optimization_guide-monitoring_tools-vpmu
I edit <cpu mode='host-passthrough'/> line into /etc/libvirt/qemu/my_vm_name.xml file instead of <cpu>...</cpu> block.
(In virt-manager use "host-passthrough" as CPU "Model:" field - http://blog.wikichoon.com/2016/01/using-cpu-host-passthrough-with-virt.html)
Now PMU works, tested with perf stat echo inside the VM, there are "arch_perfmon" in /proc/cpuinfo and PMUs are enabled in dmesg|grep PMU.
-cpu host option of Qemu was used according to /var/log/libvirt/qemu/vm_name.log:
/usr/bin/kvm-spice ... -machine ...,accel=kvm,... -cpu host ...

Error running qemu-system-riscv using root.bin and vmlinux

I am following riscv.org guides for toolchain building. When emulate using qemu running local built rootfilesystem (with busybox) and Linux Kernel, encounter the error below:
Running Qemu using local-built root.bin and kernel image
danny#danny:~/test/riscv/work$ qemu-system-riscv -hda root-local.bin -kernel vmlinux-local -nographic
unassigned address was called?
with addr: 102000735F80006E
not implemented for riscv
Running Qemu using riscv.org stocked root.bin and kernel image
danny#danny:~/test/riscv/work$ qemu-system-riscv -hda root.bin -kernel vmlinux -nographic
[ 0.150000] io scheduler cfq registered (default)
[ 0.160000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 0.160000] serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 0.160000] TCP: cubic registered
[ 0.160000] htifbd: detected disk with ID 1
[ 0.160000] htifbd: adding htifbd0
[ 0.160000] VFS: Mounted root (ext2 filesystem) readonly on device 254:0.
[ 0.160000] devtmpfs: mounted
[ 0.160000] Freeing unused kernel memory: 64K (ffffffff80002000 - ffffffff80012000)
[ 0.200000] EXT2-fs (htifbd0): warning: mounting unchecked fs, running e2fsck is recommended
#uname -a
Linux ucbvax 3.14.15-g4073e84-dirty #4 Sun Jan 11 07:17:06 PST 2015 riscv GNU/Linux
If qemu testing using the downloaded root.bin and vmlinux from riscv.org, seem ok but cant see the busybox starting message and the terminal cant Halt :
Have tested qemu using various combination and result as below:
**root.bin vmlinux RESULT**
local-built local-built Unassigned address was called ....
Downloaded Downloaded Seem OK but without busybox starting bar
local-built Downloaded Kernelpanic-not syncing:No working init found
Downloaded local-built Unassigned address was called ....
We are starting a project to build and fabricate a RISCV silicon chip for Makers around the world and testing the toolchain now in order to port Ubuntu Core & Android to RISCV. Any idea what might probably went wrong ?
Thanks.
QEMU hasn't been fully updated to support the new RISC-V privileged spec (github issue). The update is currently underway.
For an ISA simulator, spike is a good alternative. It may not have all of the platform features of QEMU, but it could serve as a starting point while the QEMU update completes.

Resources