openvswitch-dpdk starting with DPDK_OPTS parameter

Bug #1547463 reported by Janghoon-Paul Sim
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
openvswitch-dpdk (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

To start OpenvSwitch in DPDK mode,
Users can use parameter DPDK_OPTS in /etc/default/openvswitch-switch.
However, OpenvSwitch-dpdk doesn't start although DPDK_OPTS parameter is uncomment.
For example,
# DPDK options - see /usr/share/doc/openvswitch-common/INSTALL.DPDK.md.gz
DPDK_OPTS='--dpdk -c 0x1 -n 4'

What I did was,

#install openvswitch-dpdk package
$sudo apt-get install openvswitch-switch-dpdk

#enable hugepage
on /etc/default/grub
GRUB_CMDLINE_LINUX="transparent_hugepage=never hugepagesz=1G hugepages=4 default_hugepagesz=1G"
$sudo update-grub
$sudo reboot

#mount hugepage
$sudo mount -t hugetlbfs -o pagesize=1G none /dev/hugepages

# DPDK setup
$sudo modprobe uio_pci_generic
$sudo dpdk_nic_bind --bind=uio_pci_generic p1p1

#uncomment DPDK_OPTS on /etc/default/openvswitch-switch
DPDK_OPTS='--dpdk -c 0x1 -n 4'

# update alternatives ovs-vswitchd and start openvswitch
$sudo update-alternatives --set ovs-vswitchd /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
$sudo start openvswitch-switch

# check if openvswitch-dpdk enabled
ps -ef doesn't show ovs-vswitchd process running with --dpdk option.
Also, /var/log/openvswitch/ovs-ctl.log doesn't show any DPDK relevant message.

Package version :
ubuntu@ubuntu:~$ dpkg -l | grep openvswitch
ii openvswitch-common 2.4.0-0ubuntu4~cloud0 amd64 Open vSwitch common components
ii openvswitch-switch 2.4.0-0ubuntu4~cloud0 amd64 Open vSwitch switch implementations
ii openvswitch-switch-dpdk 2.4.0-0ubuntu1~cloud0 amd64 DPDK enabled Open vSwitch switch implementation

Revision history for this message
Janghoon-Paul Sim (janghoon) wrote :

This issue happens since DPDK_OPTS parameter is not forwarded to ovs-ctl.

To make it working,
/etc/init/openvswitch-switch.conf should be modified like the following so that DPDK_OPTS parameter can be forwarded to ovs-ctl

if test X"$FORCE_COREFILES" != X; then
set "$@" --force-corefiles="$FORCE_COREFILES"
fi
set "$@" $OVS_CTL_OPTS

# To enable openvswitch-dpdk
if test X"$DPDK_OPTS" != X; then
set "$@" --dpdk-opts="$DPDK_OPTS"
fi

This patch works fine on my machine.

Revision history for this message
Hua Zhang (zhhuabj) wrote :

Hi Paul,

Above workaround can't work for me, do you know why ?

hua@node1:~$ cat /etc/default/openvswitch-switch |grep DPDK_OPTS
DPDK_OPTS='--dpdk -c 0x1 -n 4'

hua@node1:~$ cat /etc/init/openvswitch-switch.conf |grep -B 1 -A 2 DPDK
  set "$@" $OVS_CTL_OPTS
  if test X"$DPDK_OPTS" != X; then
    #set "$@" DPDK_OPTS="$DPDK_OPTS"
    set "$@" --dpdk-opts="$DPDK_OPTS"
  fi
  "$@"

hua@node1:~$ cat /usr/share/openvswitch/scripts/ovs-ctl |grep -A 2 DPDK
  if test X"$DPDK_OPTS" != X; then
      set "$@" $DPDK_OPTS --
  fi
  set "$@" unix:"$DB_SOCK"

hua@node1:~$ sudo restart openvswitch-switch
openvswitch-switch start/running

hua@node1:~$ ps -ef |grep ovs-vswitchd
root 22896 1 0 11:38 ? 00:00:00 ovs-vswitchd: monitoring pid 22897 (healthy)
root 22897 22896 5 11:38 ? 00:00:00 ovs-vswitchd unix:/var/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --no-chdir --log-file=/var/log/openvswitch/ovs-vswitchd.log --pidfile=/var/run/openvswitch/ovs-vswitchd.pid --detach --monitor
hua 23000 4470 0 11:38 pts/12 00:00:00 grep --color=auto ovs-vswitchd

hua@node1:~$ dpkg -l |grep openvswitch
ii openvswitch-common 2.4.0-0ubuntu4~cloud0 amd64 Open vSwitch common components
ii openvswitch-switch 2.4.0-0ubuntu4~cloud0 amd64 Open vSwitch switch implementations
ii openvswitch-switch-dpdk 2.4.0-0ubuntu1~cloud0 amd64 DPDK enabled Open vSwitch switch implementation

Revision history for this message
Hua Zhang (zhhuabj) wrote :

Finally I use the following workaround, it works for me.

sudo restart openvswitch-switch
sudo killall ovs-vswitchd
sudo ovs-vswitchd --dpdk -c 0x1 -n 2 -- unix:/var/run/openvswitch/db.sock --pidfile --detach

hua@node1:~$ ps -ef |grep ovs-vswitchd |grep dpdk
root 24124 3720 99 11:47 ? 00:01:59 ovs-vswitchd --dpdk -c 0x1 -n 2 -- unix:/var/run/openvswitch/db.sock --pidfile --detach

But I hit another following problem after executing the command 'sudo ovs-vsctl add-port ovsbr0 dpdk0 -- set Interface dpdk0 type=dpdk':

2016-04-12T03:44:32.151Z|00014|netdev|WARN|could not create netdev dpdk0 of unknown type dpdk
2016-04-12T03:44:32.151Z|00015|bridge|WARN|could not open network device dpdk0 (Address family not supported by protocol)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openvswitch-dpdk (Ubuntu):
status: New → Confirmed
Revision history for this message
Alexandre Derumier (aderumier-odiso) wrote :

Hi,

It's work for me if I add

test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch

at the begin of
/usr/share/openvswitch/scripts/ovs-ctl

Revision history for this message
Ethan Lynn (ethanlynn) wrote :

Will this be fixed in 16.04.1? I have this problem in 16.04.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi,
I beg your pardon as I didn't see that bug before.
Lacked to subscribe for this particular package :-/

It was reported on a similar bug that this works if you use systemd calls like (thnaks Thiago for that):
$ service openvswitch-switch stop
$ service openvswitch-switch start

In general dpdk and even more so openvswitch-dpdk was very experimental back then.
So before looking deeper at what was with dpdk-2.2+OVS-2.5.2 It want to encourage you to upgrade.
If you are bound to Xenial as a base release take a look if [1] is an option for you.

[1]: https://wiki.ubuntu.com/OpenStack/CloudArchive

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Note: in latter versions the options are actual real database properties of ovsdb and can be configured much like anything else in OVS.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

For the issue of zhhuabi in comment #3 - that seems to be missing the update-alternatives call to actually switch to the OVS compiled with dpdk.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I can confirm it worked back then and still works for me with systemd controls.
That is also what the tests were based on which were good in that regard.

I retested today just to the extend of seeing the options where they should be:
# Xenial guest to test on
$ uvt-kvm create --password=ubuntu --memory 3096 xenial-dpdk-test release=xenial arch=amd64 label=daily
# further commands in the guest
$ sudo apt install openvswitch-switch-dpdk
# Of course this won't work, but we want to test args passed
$ echo "DPDK_OPTS='--dpdk -c test -n 4 -m bugno 1547463'" | sudo tee -a /etc/default/openvswitch-switch
# set the dpdk enabled version
$ update-alternatives --set ovs-vswitchd /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
$ sudo systemctl restart openvswitch-switch
# This triggers the other components and in openvswitch-nonetwork.service the env file is read and all works.
# Of course this give me an "invalid core mask" as test isn't good.
# Switching to the suggested defaults of "--dpdk -c 0x1 -n 4" gets me further

So TL;DR it works for me, maybe the sysV call is broken but honestly I don't mind - far more important is to no more use the old experimental version.

Thereby I set the remaining bug to incomplete and would ask (if still import and and not able or willing to follow to a newer version) how you restart the service - is it the sysV style call that doesn't work for you or something else?

Changed in openvswitch-dpdk (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for openvswitch-dpdk (Ubuntu) because there has been no activity for 60 days.]

Changed in openvswitch-dpdk (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.