2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

dpdk: Add debug appctl to get malloc statistics.

New appctl 'dpdk/get-malloc-stats' implemented to get result of
'rte_malloc_dump_stats()' function.

Could be used for debugging.

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Reviewed-by: Salem Sol <salems@nvidia.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Eli Britstein
2021-05-19 08:00:53 +00:00
committed by Ilya Maximets
parent c16b9ac74d
commit ad256c3140
3 changed files with 13 additions and 0 deletions

1
NEWS
View File

@@ -16,6 +16,7 @@ Post-v2.15.0
- DPDK: - DPDK:
* OVS validated with DPDK 20.11.1. It is recommended to use this version * OVS validated with DPDK 20.11.1. It is recommended to use this version
until further releases. until further releases.
* New debug appctl command 'dpdk/get-malloc-stats'.
- ovsdb-tool: - ovsdb-tool:
* New option '--election-timer' to the 'create-cluster' command to set the * New option '--election-timer' to the 'create-cluster' command to set the
leader election timer during cluster creation. leader election timer during cluster creation.

View File

@@ -10,5 +10,7 @@ list of words separated by spaces: a word can be either a logging \fBlevel\fR
\fBnotice\fR, \fBinfo\fR or \fBdebug\fR) or a \fBpattern\fR matching DPDK \fBnotice\fR, \fBinfo\fR or \fBdebug\fR) or a \fBpattern\fR matching DPDK
components (see \fBdpdk/log-list\fR command on \fBovs\-appctl\fR(8)) separated components (see \fBdpdk/log-list\fR command on \fBovs\-appctl\fR(8)) separated
by a colon from the logging \fBlevel\fR to apply. by a colon from the logging \fBlevel\fR to apply.
.IP "\fBdpdk/get-malloc-stats\fR"
Prints the heap information statistics about DPDK malloc.
.RE .RE
. .

View File

@@ -25,6 +25,7 @@
#include <rte_cpuflags.h> #include <rte_cpuflags.h>
#include <rte_errno.h> #include <rte_errno.h>
#include <rte_log.h> #include <rte_log.h>
#include <rte_malloc.h>
#include <rte_memzone.h> #include <rte_memzone.h>
#include <rte_version.h> #include <rte_version.h>
@@ -356,6 +357,12 @@ dpdk_unixctl_log_set(struct unixctl_conn *conn, int argc, const char *argv[],
unixctl_command_reply(conn, NULL); unixctl_command_reply(conn, NULL);
} }
static void
malloc_dump_stats_wrapper(FILE *stream)
{
rte_malloc_dump_stats(stream, NULL);
}
static bool static bool
dpdk_init__(const struct smap *ovs_other_config) dpdk_init__(const struct smap *ovs_other_config)
{ {
@@ -525,6 +532,9 @@ dpdk_init__(const struct smap *ovs_other_config)
dpdk_unixctl_mem_stream, rte_log_dump); dpdk_unixctl_mem_stream, rte_log_dump);
unixctl_command_register("dpdk/log-set", "{level | pattern:level}", 0, unixctl_command_register("dpdk/log-set", "{level | pattern:level}", 0,
INT_MAX, dpdk_unixctl_log_set, NULL); INT_MAX, dpdk_unixctl_log_set, NULL);
unixctl_command_register("dpdk/get-malloc-stats", "", 0, 0,
dpdk_unixctl_mem_stream,
malloc_dump_stats_wrapper);
/* We are called from the main thread here */ /* We are called from the main thread here */
RTE_PER_LCORE(_lcore_id) = NON_PMD_CORE_ID; RTE_PER_LCORE(_lcore_id) = NON_PMD_CORE_ID;