Re: [ovs-dev] [PATCH v4 2/2] netdev-dpdk: Add debug appctl to get mempool information.
On Mon, Dec 11, 2017 at 04:18:43PM +0300, Ilya Maximets wrote: > New appctl 'netdev-dpdk/get-mempool-info' implemented to get result > of 'rte_mempool_list_dump()' function if no arguments passed and > 'rte_mempool_dump()' if DPDK netdev passed as argument. > > Could be used for debugging mbuf leaks and other mempool related > issues. Most useful in pair with `grep -v "cache_count.*=0"`. > > Signed-off-by: Ilya Maximets> --- Acked-by: Flavio Leitner ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH v4 2/2] netdev-dpdk: Add debug appctl to get mempool information.
Still LGTM, please add Acked-by: Antonio Fischetti> -Original Message- > From: Kavanagh, Mark B > Sent: Monday, December 11, 2017 4:37 PM > To: Ilya Maximets ; ovs-dev@openvswitch.org > Cc: Heetae Ahn ; Fischetti, Antonio > ; Loftus, Ciara ; > Stokes, Ian ; Wojciechowicz, RobertX > ; Flavio Leitner > Subject: RE: [PATCH v4 2/2] netdev-dpdk: Add debug appctl to get mempool > information. > > >From: Ilya Maximets [mailto:i.maxim...@samsung.com] > >Sent: Monday, December 11, 2017 1:19 PM > >To: ovs-dev@openvswitch.org > >Cc: Heetae Ahn ; Fischetti, Antonio > > ; Loftus, Ciara ; > >Kavanagh, Mark B ; Stokes, Ian > > ; Wojciechowicz, RobertX > > ; Flavio Leitner ; > Ilya > >Maximets > >Subject: [PATCH v4 2/2] netdev-dpdk: Add debug appctl to get mempool > >information. > > > >New appctl 'netdev-dpdk/get-mempool-info' implemented to get result > >of 'rte_mempool_list_dump()' function if no arguments passed and > >'rte_mempool_dump()' if DPDK netdev passed as argument. > > > >Could be used for debugging mbuf leaks and other mempool related > >issues. Most useful in pair with `grep -v "cache_count.*=0"`. > > > >Signed-off-by: Ilya Maximets > >--- > > NEWS| 1 + > > lib/netdev-dpdk-unixctl.man | 5 + > > lib/netdev-dpdk.c | 54 > >+ > > 3 files changed, 60 insertions(+) > > > >diff --git a/NEWS b/NEWS > >index 69d5dab..e60514e 100644 > >--- a/NEWS > >+++ b/NEWS > >@@ -18,6 +18,7 @@ Post-v2.8.0 > >- DPDK: > > * Add support for DPDK v17.11 > > * Add support for vHost IOMMU > >+ * New debug appctl command 'netdev-dpdk/get-mempool-info'. > > * All the netdev-dpdk appctl commands described in ovs-vswitchd > man > >page. > > > > v2.8.0 - 31 Aug 2017 > >diff --git a/lib/netdev-dpdk-unixctl.man b/lib/netdev-dpdk-unixctl.man > >index 5af6eca..ac274cd 100644 > >--- a/lib/netdev-dpdk-unixctl.man > >+++ b/lib/netdev-dpdk-unixctl.man > >@@ -7,3 +7,8 @@ If \fIinterface\fR is not specified, then it applies to > all > >DPDK ports. > > Detaches device with corresponding \fIpci-address\fR from DPDK. This > command > > can be used to detach device if it wasn't detached automatically after > port > > deletion. Refer to the documentation for details and instructions. > > Hi Ilya, > > I would still prefer if the pointer to documentation were more specific; > however, I won't block on that basis alone. > > Acked-by: Mark Kavanagh > Tested-by: Mark Kavanagh > > Thanks for the series, > Mark > > >+.IP "\fBnetdev-dpdk/get-mempool-info\fR [\fIinterface\fR]" > >+Prints the debug information about memory pool used by DPDK > \fIinterface\fR. > >+If called without arguments, information of all the available mempools > will > >+be printed. For additional mempool statistics enable > >+\fBCONFIG_RTE_LIBRTE_MEMPOOL_DEBUG\fR while building DPDK. > >diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c > >index 8f22264..3bf461b 100644 > >--- a/lib/netdev-dpdk.c > >+++ b/lib/netdev-dpdk.c > >@@ -2586,6 +2586,56 @@ error: > > free(response); > > } > > > >+static void > >+netdev_dpdk_get_mempool_info(struct unixctl_conn *conn, > >+ int argc, const char *argv[], > >+ void *aux OVS_UNUSED) > >+{ > >+size_t size; > >+FILE *stream; > >+char *response = NULL; > >+struct netdev *netdev = NULL; > >+ > >+if (argc == 2) { > >+netdev = netdev_from_name(argv[1]); > >+if (!netdev || !is_dpdk_class(netdev->netdev_class)) { > >+unixctl_command_reply_error(conn, "Not a DPDK Interface"); > >+goto out; > >+} > >+} > >+ > >+stream = open_memstream(, ); > >+if (!stream) { > >+response = xasprintf("Unable to open memstream: %s.", > >+ ovs_strerror(errno)); > >+unixctl_command_reply_error(conn, response); > >+goto out; > >+} > >+ > >+if (netdev) { > >+struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); > >+ > >+ovs_mutex_lock(>mutex); > >+ovs_mutex_lock(_mp_mutex); > >+ > >+rte_mempool_dump(stream, dev->mp); > >+ > >+ovs_mutex_unlock(_mp_mutex); > >+ovs_mutex_unlock(>mutex); > >+} else { > >+ovs_mutex_lock(_mp_mutex); > >+rte_mempool_list_dump(stream); > >+ovs_mutex_unlock(_mp_mutex); > >+} > >+ > >+fclose(stream); > >+ > >+unixctl_command_reply(conn, response); > >+out: > >+free(response); >
Re: [ovs-dev] [PATCH v4 2/2] netdev-dpdk: Add debug appctl to get mempool information.
>From: Ilya Maximets [mailto:i.maxim...@samsung.com] >Sent: Monday, December 11, 2017 1:19 PM >To: ovs-dev@openvswitch.org >Cc: Heetae Ahn; Fischetti, Antonio > ; Loftus, Ciara ; >Kavanagh, Mark B ; Stokes, Ian > ; Wojciechowicz, RobertX > ; Flavio Leitner ; Ilya >Maximets >Subject: [PATCH v4 2/2] netdev-dpdk: Add debug appctl to get mempool >information. > >New appctl 'netdev-dpdk/get-mempool-info' implemented to get result >of 'rte_mempool_list_dump()' function if no arguments passed and >'rte_mempool_dump()' if DPDK netdev passed as argument. > >Could be used for debugging mbuf leaks and other mempool related >issues. Most useful in pair with `grep -v "cache_count.*=0"`. > >Signed-off-by: Ilya Maximets >--- > NEWS| 1 + > lib/netdev-dpdk-unixctl.man | 5 + > lib/netdev-dpdk.c | 54 >+ > 3 files changed, 60 insertions(+) > >diff --git a/NEWS b/NEWS >index 69d5dab..e60514e 100644 >--- a/NEWS >+++ b/NEWS >@@ -18,6 +18,7 @@ Post-v2.8.0 >- DPDK: > * Add support for DPDK v17.11 > * Add support for vHost IOMMU >+ * New debug appctl command 'netdev-dpdk/get-mempool-info'. > * All the netdev-dpdk appctl commands described in ovs-vswitchd man >page. > > v2.8.0 - 31 Aug 2017 >diff --git a/lib/netdev-dpdk-unixctl.man b/lib/netdev-dpdk-unixctl.man >index 5af6eca..ac274cd 100644 >--- a/lib/netdev-dpdk-unixctl.man >+++ b/lib/netdev-dpdk-unixctl.man >@@ -7,3 +7,8 @@ If \fIinterface\fR is not specified, then it applies to all >DPDK ports. > Detaches device with corresponding \fIpci-address\fR from DPDK. This command > can be used to detach device if it wasn't detached automatically after port > deletion. Refer to the documentation for details and instructions. Hi Ilya, I would still prefer if the pointer to documentation were more specific; however, I won't block on that basis alone. Acked-by: Mark Kavanagh Tested-by: Mark Kavanagh Thanks for the series, Mark >+.IP "\fBnetdev-dpdk/get-mempool-info\fR [\fIinterface\fR]" >+Prints the debug information about memory pool used by DPDK \fIinterface\fR. >+If called without arguments, information of all the available mempools will >+be printed. For additional mempool statistics enable >+\fBCONFIG_RTE_LIBRTE_MEMPOOL_DEBUG\fR while building DPDK. >diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c >index 8f22264..3bf461b 100644 >--- a/lib/netdev-dpdk.c >+++ b/lib/netdev-dpdk.c >@@ -2586,6 +2586,56 @@ error: > free(response); > } > >+static void >+netdev_dpdk_get_mempool_info(struct unixctl_conn *conn, >+ int argc, const char *argv[], >+ void *aux OVS_UNUSED) >+{ >+size_t size; >+FILE *stream; >+char *response = NULL; >+struct netdev *netdev = NULL; >+ >+if (argc == 2) { >+netdev = netdev_from_name(argv[1]); >+if (!netdev || !is_dpdk_class(netdev->netdev_class)) { >+unixctl_command_reply_error(conn, "Not a DPDK Interface"); >+goto out; >+} >+} >+ >+stream = open_memstream(, ); >+if (!stream) { >+response = xasprintf("Unable to open memstream: %s.", >+ ovs_strerror(errno)); >+unixctl_command_reply_error(conn, response); >+goto out; >+} >+ >+if (netdev) { >+struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); >+ >+ovs_mutex_lock(>mutex); >+ovs_mutex_lock(_mp_mutex); >+ >+rte_mempool_dump(stream, dev->mp); >+ >+ovs_mutex_unlock(_mp_mutex); >+ovs_mutex_unlock(>mutex); >+} else { >+ovs_mutex_lock(_mp_mutex); >+rte_mempool_list_dump(stream); >+ovs_mutex_unlock(_mp_mutex); >+} >+ >+fclose(stream); >+ >+unixctl_command_reply(conn, response); >+out: >+free(response); >+netdev_close(netdev); >+} >+ > /* > * Set virtqueue flags so that we do not receive interrupts. > */ >@@ -2842,6 +2892,10 @@ netdev_dpdk_class_init(void) > "pci address of device", 1, 1, > netdev_dpdk_detach, NULL); > >+unixctl_command_register("netdev-dpdk/get-mempool-info", >+ "[netdev]", 0, 1, >+ netdev_dpdk_get_mempool_info, NULL); >+ > ovsthread_once_done(); > } > >-- >2.7.4 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
[ovs-dev] [PATCH v4 2/2] netdev-dpdk: Add debug appctl to get mempool information.
New appctl 'netdev-dpdk/get-mempool-info' implemented to get result of 'rte_mempool_list_dump()' function if no arguments passed and 'rte_mempool_dump()' if DPDK netdev passed as argument. Could be used for debugging mbuf leaks and other mempool related issues. Most useful in pair with `grep -v "cache_count.*=0"`. Signed-off-by: Ilya Maximets--- NEWS| 1 + lib/netdev-dpdk-unixctl.man | 5 + lib/netdev-dpdk.c | 54 + 3 files changed, 60 insertions(+) diff --git a/NEWS b/NEWS index 69d5dab..e60514e 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ Post-v2.8.0 - DPDK: * Add support for DPDK v17.11 * Add support for vHost IOMMU + * New debug appctl command 'netdev-dpdk/get-mempool-info'. * All the netdev-dpdk appctl commands described in ovs-vswitchd man page. v2.8.0 - 31 Aug 2017 diff --git a/lib/netdev-dpdk-unixctl.man b/lib/netdev-dpdk-unixctl.man index 5af6eca..ac274cd 100644 --- a/lib/netdev-dpdk-unixctl.man +++ b/lib/netdev-dpdk-unixctl.man @@ -7,3 +7,8 @@ If \fIinterface\fR is not specified, then it applies to all DPDK ports. Detaches device with corresponding \fIpci-address\fR from DPDK. This command can be used to detach device if it wasn't detached automatically after port deletion. Refer to the documentation for details and instructions. +.IP "\fBnetdev-dpdk/get-mempool-info\fR [\fIinterface\fR]" +Prints the debug information about memory pool used by DPDK \fIinterface\fR. +If called without arguments, information of all the available mempools will +be printed. For additional mempool statistics enable +\fBCONFIG_RTE_LIBRTE_MEMPOOL_DEBUG\fR while building DPDK. diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 8f22264..3bf461b 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -2586,6 +2586,56 @@ error: free(response); } +static void +netdev_dpdk_get_mempool_info(struct unixctl_conn *conn, + int argc, const char *argv[], + void *aux OVS_UNUSED) +{ +size_t size; +FILE *stream; +char *response = NULL; +struct netdev *netdev = NULL; + +if (argc == 2) { +netdev = netdev_from_name(argv[1]); +if (!netdev || !is_dpdk_class(netdev->netdev_class)) { +unixctl_command_reply_error(conn, "Not a DPDK Interface"); +goto out; +} +} + +stream = open_memstream(, ); +if (!stream) { +response = xasprintf("Unable to open memstream: %s.", + ovs_strerror(errno)); +unixctl_command_reply_error(conn, response); +goto out; +} + +if (netdev) { +struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + +ovs_mutex_lock(>mutex); +ovs_mutex_lock(_mp_mutex); + +rte_mempool_dump(stream, dev->mp); + +ovs_mutex_unlock(_mp_mutex); +ovs_mutex_unlock(>mutex); +} else { +ovs_mutex_lock(_mp_mutex); +rte_mempool_list_dump(stream); +ovs_mutex_unlock(_mp_mutex); +} + +fclose(stream); + +unixctl_command_reply(conn, response); +out: +free(response); +netdev_close(netdev); +} + /* * Set virtqueue flags so that we do not receive interrupts. */ @@ -2842,6 +2892,10 @@ netdev_dpdk_class_init(void) "pci address of device", 1, 1, netdev_dpdk_detach, NULL); +unixctl_command_register("netdev-dpdk/get-mempool-info", + "[netdev]", 0, 1, + netdev_dpdk_get_mempool_info, NULL); + ovsthread_once_done(); } -- 2.7.4 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev