diff mbox

[ovs-dev,1/2] poll: Suppress logging for pmd threads.

Message ID 1450794408-17970-2-git-send-email-i.maximets@samsung.com
State Accepted
Headers show

Commit Message

Ilya Maximets Dec. 22, 2015, 2:26 p.m. UTC
'Unreasonably long poll interval's are reasonable for PMD threads.
Also reporting of high CPU usage is not necessary.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 lib/ovs-thread.c | 9 +++++++++
 lib/ovs-thread.h | 1 +
 lib/poll-loop.c  | 4 +++-
 lib/timeval.c    | 2 +-
 4 files changed, 14 insertions(+), 2 deletions(-)

Comments

Ben Pfaff Jan. 11, 2016, 6:11 p.m. UTC | #1
On Tue, Dec 22, 2015 at 05:26:47PM +0300, Ilya Maximets wrote:
> 'Unreasonably long poll interval's are reasonable for PMD threads.
> Also reporting of high CPU usage is not necessary.
> 
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>

Thanks, applied to master and branch-2.5.
Joe Stringer Jan. 12, 2016, 2:26 a.m. UTC | #2
On 11 January 2016 at 10:11, Ben Pfaff <blp@ovn.org> wrote:
> On Tue, Dec 22, 2015 at 05:26:47PM +0300, Ilya Maximets wrote:
>> 'Unreasonably long poll interval's are reasonable for PMD threads.
>> Also reporting of high CPU usage is not necessary.
>>
>> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>
> Thanks, applied to master and branch-2.5.

This patch broke the DPDK build:
https://travis-ci.org/openvswitch/ovs/jobs/101648756

I sent a patch:
http://openvswitch.org/pipermail/dev/2016-January/064327.html
Ilya Maximets Jan. 12, 2016, 6:16 a.m. UTC | #3
On 12.01.2016 05:26, Joe Stringer wrote:
> On 11 January 2016 at 10:11, Ben Pfaff <blp@ovn.org> wrote:
>> On Tue, Dec 22, 2015 at 05:26:47PM +0300, Ilya Maximets wrote:
>>> 'Unreasonably long poll interval's are reasonable for PMD threads.
>>> Also reporting of high CPU usage is not necessary.
>>>
>>> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>>
>> Thanks, applied to master and branch-2.5.
> 
> This patch broke the DPDK build:
> https://travis-ci.org/openvswitch/ovs/jobs/101648756

Oh, sorry. I lost netdev-dpdk part while formatting the patch. 
 
> I sent a patch:
> http://openvswitch.org/pipermail/dev/2016-January/064327.html
> 
>
diff mbox

Patch

diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
index 2f6bc58..7855b3a 100644
--- a/lib/ovs-thread.c
+++ b/lib/ovs-thread.c
@@ -584,6 +584,15 @@  count_cpu_cores(void)
 
     return n_cores > 0 ? n_cores : 0;
 }
+
+/* Returns 'true' if current thread is PMD thread. */
+bool
+thread_is_pmd(void)
+{
+    const char *name = get_subprogram_name();
+    return !strncmp(name, "pmd", 3);
+}
+
 
 /* ovsthread_key. */
 
diff --git a/lib/ovs-thread.h b/lib/ovs-thread.h
index 26b2ccd..55e51a4 100644
--- a/lib/ovs-thread.h
+++ b/lib/ovs-thread.h
@@ -523,5 +523,6 @@  bool may_fork(void);
 /* Useful functions related to threading. */
 
 int count_cpu_cores(void);
+bool thread_is_pmd(void);
 
 #endif /* ovs-thread.h */
diff --git a/lib/poll-loop.c b/lib/poll-loop.c
index 60e1f6e..e83d989 100644
--- a/lib/poll-loop.c
+++ b/lib/poll-loop.c
@@ -253,7 +253,9 @@  log_wakeup(const char *where, const struct pollfd *pollfd, int timeout)
     cpu_usage = get_cpu_usage();
     if (VLOG_IS_DBG_ENABLED()) {
         level = VLL_DBG;
-    } else if (cpu_usage > 50 && !VLOG_DROP_INFO(&rl)) {
+    } else if (cpu_usage > 50
+               && !thread_is_pmd()
+               && !VLOG_DROP_INFO(&rl)) {
         level = VLL_INFO;
     } else {
         return;
diff --git a/lib/timeval.c b/lib/timeval.c
index 8f1c97f..d390df1 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -270,7 +270,7 @@  time_poll(struct pollfd *pollfds, int n_pollfds, HANDLE *handles OVS_UNUSED,
     time_init();
     coverage_clear();
     coverage_run();
-    if (*last_wakeup) {
+    if (*last_wakeup && !thread_is_pmd()) {
         log_poll_interval(*last_wakeup);
     }
     start = time_msec();