Haifeng
1. Get the latest dpdk master branch code, apply huawei's patchset of
vhost-user. The first patch is http://dpdk.org/dev/patchwork/patch/2796/,
totally 12patches, date is 1/30/2015.
2. Update the config/common_linuxapp and build the samples, see my script for
reference. If
cd ./dpdk
export RTE_SDK=$PWD
export RTE_TARGET=x86_64-native-linuxapp-gcc
sed -i 's/CONFIG_RTE_LIBRTE_VHOST=.*$/CONFIG_RTE_LIBRTE_VHOST=y/'
./config/commo
n_linuxapp
make install -j38 T=x86_64-native-linuxapp-gcc
cd $RTE_SDK/lib/librte_vhost
make
cd ./eventfd_link
make
cd $RTE_SDK/examples/vhost
make
3. Launch the vhost-user sample, then you will see there is a vhost-net under
you dpdk folder for socket use. If you meet error as can't setup mempool, you
can update one line in examples/vhost/main.c, '#define MAX_QUEUES 512'--->'
#define MAX_QUEUE 128'.
#!/bin/sh
modprobe kvm
modprobe kvm_intel
awk '/Hugepagesize/ {print $2}' /proc/meminfo
awk '/HugePages_Total/ { print $2 }' /proc/meminfo
umount `awk '/hugetlbfs/ { print $2 }' /proc/mounts`
mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge -o pagesize=1G #1G or 2M page, both ok.
rm -f /dev/vhost-net
rmmod vhost-net
modprobe fuse
modprobe cuse
rmmod eventfd_link
rmmod igb_uio
cd ./dpdk
pwd
insmod lib/librte_vhost/eventfd_link/eventfd_link.ko
modprobe uio
rmmod rte_kni
rmmod igb_uio
insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
./tools/dpdk_nic_bind.py --bind=igb_uio 0000:08:00.1
taskset -c 1-3 examples/vhost/build/vhost-switch -c 0xf -n 4 --huge-dir
/mnt/huge --socket-mem 1024,1024 -- -p 1 --mergeable 0 --zero-copy 0 --vm2vm 2
#Make sure the vm2vm is 1 or 2 to make vm to vm communication work. Mergeable
can be 1(to enable jumbo frame) or 0(disable jumbo frame).
4. Launch the VM1 and VM2 with virtio device, note: you need use qemu
version>2.1 to enable the vhost-user server's feature. Old qemu such as 1.5,1.6
didn't support it.
Below is my VM1 startup command, for your reference, similar for VM2.
/home/qemu-2.2.0/x86_64-softmmu/qemu-system-x86_64 -name us-vhost-vm1 -cpu host
-enable-kvm -m 2048 -object
memory-backend-file,id=mem,size=2048M,mem-path=/mnt/huge,share=on -numa
node,memdev=mem -mem-prealloc -smp 2 -drive file=/home/img/dpdk1-vm1.img
-chardev socket,id=char0,path=/home/dpdk-vhost/vhost-net -netdev
type=vhost-user,id=mynet1,chardev=char0,vhostforce -device
virtio-net-pci,mac=00:00:00:00:00:01, -nographic
5. Then in the VM, you can have the same operations as before, send packet from
virtio1 to virtio2.
Pls let me know if any questions, issues.
-----Original Message-----
From: Linhaifeng [mailto:[email protected]]
Sent: Tuesday, February 03, 2015 5:19 PM
To: Xu, Qian Q; Xie, Huawei
Cc: lilijun; liuyongan at huawei.com
Subject: Re: [dpdk-dev] [PATCH] vhost: notify guest to fill buffer when there
is no buffer
Yes,the lasted codes will not happen.
On 2015/2/3 16:53, Xu, Qian Q wrote:
> If you'd like to use DPDK plus vhost-user's patch, I can send you my steps
> for setup, do u need it?
of course! pls!
I'd like to use it.Thank you very much!
--
Regards,
Haifeng