From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 16898A00C5 for ; Thu, 7 May 2020 12:46:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F2FA61DBE0; Thu, 7 May 2020 12:46:32 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id D24081DBC9; Thu, 7 May 2020 12:46:29 +0200 (CEST) IronPort-SDR: cR/O90PJgDsCIYSj04mIEOzF3vO/cRRhqIe0reMKZUY6B0s+ipbAct5AXHzYe982m0pd+S5v0z GfQO5GRp2aAw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2020 03:46:28 -0700 IronPort-SDR: s8/zxIekcVS87qNH0pC0ULCZ0SOSFGFenav3igM4Ky1ht4EWhLYtrwp65WDs3N56cnD8GYcEBd 2+vIj2uGnv3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,363,1583222400"; d="scan'208";a="435243918" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.52]) by orsmga005.jf.intel.com with ESMTP; 07 May 2020 03:46:27 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: David Hunt , stable@dpdk.org Date: Thu, 7 May 2020 11:46:28 +0100 Message-Id: <11d12e160790fbf3e6d1abae121c33e82bd18d8c.1588848367.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [dpdk-stable] [PATCH v3] l3fwd-power: add Rx interrupt timeout X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Currently, thread waiting on an interrupt does not have a timeout, so it will not ever wake up until traffic arrives. This means that, when time comes to exit the application, it will not quit unless there happens to be traffic coming in and waking up the thread from sleep. Fix it so that the interrupt thread sleeps for 10ms before waking up and attempting to poll again. Additionally, remove the log message to avoid spamming about entering interrupt mode. Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown") Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov Acked-by: David Hunt --- Notes: v3: - Turns out that log message was important, so bring it back, but prevent spam v2: - Remove log spam examples/l3fwd-power/main.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 293b3da4ae..23685c48fc 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -823,17 +823,24 @@ power_freq_scaleup_heuristic(unsigned lcore_id, static int sleep_until_rx_interrupt(int num) { + /* + * we want to track when we are woken up by traffic so that we can go + * back to sleep again without log spamming. + */ + static bool timeout; struct rte_epoll_event event[num]; int n, i; uint16_t port_id; uint8_t queue_id; void *data; - RTE_LOG(INFO, L3FWD_POWER, - "lcore %u sleeps until interrupt triggers\n", - rte_lcore_id()); + if (!timeout) { + RTE_LOG(INFO, L3FWD_POWER, + "lcore %u sleeps until interrupt triggers\n", + rte_lcore_id()); + } - n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, -1); + n = rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, 10); for (i = 0; i < n; i++) { data = event[i].epdata.data; port_id = ((uintptr_t)data) >> CHAR_BIT; @@ -844,6 +851,7 @@ sleep_until_rx_interrupt(int num) " port %d queue %d\n", rte_lcore_id(), port_id, queue_id); } + timeout = n == 0; return 0; } @@ -1306,7 +1314,8 @@ main_loop(__rte_unused void *dummy) /** * start receiving packets immediately */ - goto start_rx; + if (likely(!is_done())) + goto start_rx; } } stats[lcore_id].sleep_time += lcore_idle_hint; -- 2.17.1