[ovs-dev] dpdk: Stop dumping memzones to stdout.

Message ID 20190314144348.20814-1-i.maximets@samsung.com
State Accepted
Delegated to: Ian Stokes
Headers show
Series
  • [ovs-dev] dpdk: Stop dumping memzones to stdout.
Related show

Commit Message

Ilya Maximets March 14, 2019, 2:43 p.m.
Information about memzones reserved on init is not much useful.
Anyway, we need to log it in more civilized manner, i.e. through
the OVS logging subsystem.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 lib/dpdk.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Aaron Conole March 14, 2019, 6:26 p.m. | #1
Ilya Maximets <i.maximets@samsung.com> writes:

> Information about memzones reserved on init is not much useful.
> Anyway, we need to log it in more civilized manner, i.e. through
> the OVS logging subsystem.
>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
> ---

Acked-by: Aaron Conole <aconole@redhat.com>
Ian Stokes March 19, 2019, 10:49 a.m. | #2
On 3/14/2019 6:26 PM, Aaron Conole wrote:
> Ilya Maximets <i.maximets@samsung.com> writes:
> 
>> Information about memzones reserved on init is not much useful.
>> Anyway, we need to log it in more civilized manner, i.e. through
>> the OVS logging subsystem.
>>
>> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>> ---
> 
> Acked-by: Aaron Conole <aconole@redhat.com>
> 

Thanks Ilya, applied to master and as far back as 2.9.

Thanks
Ian

Patch

diff --git a/lib/dpdk.c b/lib/dpdk.c
index d7901e175..dc6171546 100644
--- a/lib/dpdk.c
+++ b/lib/dpdk.c
@@ -403,7 +403,23 @@  dpdk_init__(const struct smap *ovs_other_config)
         return false;
     }
 
-    rte_memzone_dump(stdout);
+    if (VLOG_IS_DBG_ENABLED()) {
+        size_t size;
+        char *response = NULL;
+        FILE *stream = open_memstream(&response, &size);
+
+        if (stream) {
+            rte_memzone_dump(stream);
+            fclose(stream);
+            if (size) {
+                VLOG_DBG("rte_memzone_dump:\n%s", response);
+            }
+            free(response);
+        } else {
+            VLOG_DBG("Could not dump memzone. Unable to open memstream: %s.",
+                     ovs_strerror(errno));
+        }
+    }
 
     /* We are called from the main thread here */
     RTE_PER_LCORE(_lcore_id) = NON_PMD_CORE_ID;