diff mbox series

[ovs-dev,dpdk-latest,v2] dpdk: Migrate to the new pdump API.

Message ID 20191031131532.16376-1-i.maximets@ovn.org
State Superseded
Headers show
Series [ovs-dev,dpdk-latest,v2] dpdk: Migrate to the new pdump API. | expand

Commit Message

Ilya Maximets Oct. 31, 2019, 1:15 p.m. UTC
DPDK commit 660098d61f57 ("pdump: use generic multi-process channel")
switched pdump to use generic DPDK IPC instead of sockets.
Old API was deprecated and removed.  Updating OVS code accordingly.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---

Version 2:
  * Removed unneeded deinitialization on error.
  * Docs updated.

 Documentation/topics/dpdk/pdump.rst |  9 ++-------
 lib/dpdk.c                          | 11 +----------
 2 files changed, 3 insertions(+), 17 deletions(-)

Comments

David Marchand Oct. 31, 2019, 3:35 p.m. UTC | #1
On Thu, Oct 31, 2019 at 2:15 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> DPDK commit 660098d61f57 ("pdump: use generic multi-process channel")
> switched pdump to use generic DPDK IPC instead of sockets.
> Old API was deprecated and removed.  Updating OVS code accordingly.
>
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
>
> Version 2:
>   * Removed unneeded deinitialization on error.
>   * Docs updated.
>
>  Documentation/topics/dpdk/pdump.rst |  9 ++-------
>  lib/dpdk.c                          | 11 +----------
>  2 files changed, 3 insertions(+), 17 deletions(-)
>
> diff --git a/Documentation/topics/dpdk/pdump.rst b/Documentation/topics/dpdk/pdump.rst
> index 7bd1d3e9f..26acff45e 100644
> --- a/Documentation/topics/dpdk/pdump.rst
> +++ b/Documentation/topics/dpdk/pdump.rst
> @@ -41,8 +41,7 @@ To use pdump, simply launch OVS as usual, then navigate to the ``app/pdump``
>  directory in DPDK, ``make`` the application and run like so::
>
>      $ sudo ./build/app/dpdk-pdump -- \
> -        --pdump port=0,queue=0,rx-dev=/tmp/pkts.pcap \
> -        --server-socket-path=/usr/local/var/run/openvswitch
> +        --pdump port=0,queue=0,rx-dev=/tmp/pkts.pcap

You still need to instruct the secondary process where to find the
dpdk configuration and mp_socket.

In my test, ovs running as openvswitch user, I had to:
# sudo -u openvswitch XDG_RUNTIME_DIR=/var/run/openvswitch
./dpdk/v18.11.2/app/dpdk-pdump -- --pdump
'port=0,queue=*,rx-dev=/tmp/pkts.pcap,tx-dev=/tmp/pkts.pcap'
EAL: Detected 28 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket
/var/run/openvswitch/dpdk/rte/mp_socket_85457_497b63ab1c2d10
EAL: Probing VFIO support...
EAL: VFIO support initialized

dpdk won't look at XDG_RUNTIME_DIR when running as uid 0, which I find
a bit odd and something to change.
I did not find another way to set the runtime directory.

Cc: Anatoly (off this week).
David Marchand Oct. 31, 2019, 4:27 p.m. UTC | #2
On Thu, Oct 31, 2019 at 4:35 PM David Marchand
<david.marchand@redhat.com> wrote:
> # sudo -u openvswitch XDG_RUNTIME_DIR=/var/run/openvswitch
> ./dpdk/v18.11.2/app/dpdk-pdump -- --pdump
> 'port=0,queue=*,rx-dev=/tmp/pkts.pcap,tx-dev=/tmp/pkts.pcap'
> EAL: Detected 28 lcore(s)
> EAL: Detected 1 NUMA nodes
> EAL: Multi-process socket
> /var/run/openvswitch/dpdk/rte/mp_socket_85457_497b63ab1c2d10
> EAL: Probing VFIO support...
> EAL: VFIO support initialized

Hum, looks like something is broken in master, when capturing packets:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f03c6d31700 (LWP 98102)]
bucket_dequeue_orphans (n_orphans=251, obj_table=0x14fe83a10,
bd=0x14fe006c0) at
/root/dpdk/drivers/mempool/bucket/rte_mempool_bucket.c:194
194                rc = rte_ring_dequeue(bd->shared_bucket_ring,

I will have to start with a clean environment, just in case I broke
something when switching ovs / dpdk build dirs.
But I don't have the time now, maybe next week.
Ilya Maximets Oct. 31, 2019, 7:03 p.m. UTC | #3
On 31.10.2019 17:27, David Marchand wrote:
> On Thu, Oct 31, 2019 at 4:35 PM David Marchand
> <david.marchand@redhat.com> wrote:
>> # sudo -u openvswitch XDG_RUNTIME_DIR=/var/run/openvswitch
>> ./dpdk/v18.11.2/app/dpdk-pdump -- --pdump

18.11.2 ? Looks suspicious.

>> 'port=0,queue=*,rx-dev=/tmp/pkts.pcap,tx-dev=/tmp/pkts.pcap'
>> EAL: Detected 28 lcore(s)
>> EAL: Detected 1 NUMA nodes
>> EAL: Multi-process socket
>> /var/run/openvswitch/dpdk/rte/mp_socket_85457_497b63ab1c2d10
>> EAL: Probing VFIO support...
>> EAL: VFIO support initialized
> 
> Hum, looks like something is broken in master, when capturing packets:
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7f03c6d31700 (LWP 98102)]
> bucket_dequeue_orphans (n_orphans=251, obj_table=0x14fe83a10,
> bd=0x14fe006c0) at
> /root/dpdk/drivers/mempool/bucket/rte_mempool_bucket.c:194
> 194                rc = rte_ring_dequeue(bd->shared_bucket_ring,
> 
> I will have to start with a clean environment, just in case I broke
> something when switching ovs / dpdk build dirs.
> But I don't have the time now, maybe next week.

You also need to re-check that your threads are not running on the
same cores which is hard, because OVS uses non-eal threads and
non-pmd threads could float over the free system cores.

All this multiprocessing in DPDK is too dangerous to use IHMO.
 From my experience, if you trying to run 2 DPDK applications
on the same memory, one of them will definitely crash. At least
on a first few attempts.

'--in-memory' is the best option. It'll be probably cool to enable
it by default. :)

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/Documentation/topics/dpdk/pdump.rst b/Documentation/topics/dpdk/pdump.rst
index 7bd1d3e9f..26acff45e 100644
--- a/Documentation/topics/dpdk/pdump.rst
+++ b/Documentation/topics/dpdk/pdump.rst
@@ -41,8 +41,7 @@  To use pdump, simply launch OVS as usual, then navigate to the ``app/pdump``
 directory in DPDK, ``make`` the application and run like so::
 
     $ sudo ./build/app/dpdk-pdump -- \
-        --pdump port=0,queue=0,rx-dev=/tmp/pkts.pcap \
-        --server-socket-path=/usr/local/var/run/openvswitch
+        --pdump port=0,queue=0,rx-dev=/tmp/pkts.pcap
 
 The above command captures traffic received on queue 0 of port 0 and stores it
 in ``/tmp/pkts.pcap``. Other combinations of port numbers, queues numbers and
@@ -50,11 +49,7 @@  pcap locations are of course also available to use. For example, to capture all
 packets that traverse port 0 in a single pcap file::
 
     $ sudo ./build/app/dpdk-pdump -- \
-        --pdump 'port=0,queue=*,rx-dev=/tmp/pkts.pcap,tx-dev=/tmp/pkts.pcap' \
-        --server-socket-path=/usr/local/var/run/openvswitch
-
-``server-socket-path`` must be set to the value of ``ovs_rundir()`` which
-typically resolves to ``/usr/local/var/run/openvswitch``.
+        --pdump 'port=0,queue=*,rx-dev=/tmp/pkts.pcap,tx-dev=/tmp/pkts.pcap'
 
 Many tools are available to view the contents of the pcap file. Once example is
 tcpdump. Issue the following command to view the contents of ``pkts.pcap``::
diff --git a/lib/dpdk.c b/lib/dpdk.c
index f90cda75a..748f63d31 100644
--- a/lib/dpdk.c
+++ b/lib/dpdk.c
@@ -27,7 +27,6 @@ 
 #include <rte_memzone.h>
 #include <rte_version.h>
 #ifdef DPDK_PDUMP
-#include <rte_mempool.h>
 #include <rte_pdump.h>
 #endif
 
@@ -434,17 +433,9 @@  dpdk_init__(const struct smap *ovs_other_config)
 
 #ifdef DPDK_PDUMP
     VLOG_INFO("DPDK pdump packet capture enabled");
-    err = rte_pdump_init(ovs_rundir());
+    err = rte_pdump_init();
     if (err) {
         VLOG_INFO("Error initialising DPDK pdump");
-        rte_pdump_uninit();
-    } else {
-        char *server_socket_path;
-
-        server_socket_path = xasprintf("%s/%s", ovs_rundir(),
-                                       "pdump_server_socket");
-        fatal_signal_add_file_to_unlink(server_socket_path);
-        free(server_socket_path);
     }
 #endif