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 6CEBEA034E for ; Fri, 8 May 2020 03:50:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5649A1DBBC; Fri, 8 May 2020 03:50:51 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 909791D9B3; Fri, 8 May 2020 03:50:47 +0200 (CEST) IronPort-SDR: Ai4gohzdNuzmUrMGRcNmS7qPDHl8eTd8V8prv4dh3c1NbUV0iwmD/uldJdkFaLOze5x9U9NC8q MF80CBLZmS9A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2020 18:50:45 -0700 IronPort-SDR: wKAjDRk2sWxUPK5Ig6fJtoG7Zd3GLEA4QvhZ5ROnSS1Gu+TWfqHpXAZKIqY4Z9h53jmhKhLq/X dzhesavMkreQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,366,1583222400"; d="scan'208";a="407858400" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 07 May 2020 18:50:45 -0700 Received: from shsmsx604.ccr.corp.intel.com (10.109.6.214) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 7 May 2020 18:50:45 -0700 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by SHSMSX604.ccr.corp.intel.com (10.109.6.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 8 May 2020 09:50:42 +0800 Received: from shsmsx603.ccr.corp.intel.com ([10.109.6.143]) by SHSMSX603.ccr.corp.intel.com ([10.109.6.143]) with mapi id 15.01.1713.004; Fri, 8 May 2020 09:50:42 +0800 From: "Ma, LihongX" To: "Burakov, Anatoly" , "dev@dpdk.org" CC: "Hunt, David" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3] l3fwd-power: add Rx interrupt timeout Thread-Index: AQHWJFzYhfF3tqZh3EmA2f8TqpG4uaidbUGA Date: Fri, 8 May 2020 01:50:42 +0000 Message-ID: References: <11d12e160790fbf3e6d1abae121c33e82bd18d8c.1588848367.git.anatoly.burakov@intel.com> In-Reply-To: <11d12e160790fbf3e6d1abae121c33e82bd18d8c.1588848367.git.anatoly.burakov@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [dpdk-dev] [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" Tested-by:ma,lihong Regards, Ma,lihong -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Anatoly Burakov Sent: Thursday, May 7, 2020 6:46 PM To: dev@dpdk.org Cc: Hunt, David ; stable@dpdk.org Subject: [dpdk-dev] [PATCH v3] l3fwd-power: add Rx interrupt timeout Currently, thread waiting on an interrupt does not have a timeout, so it wi= ll 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 traff= ic coming in and waking up the thread from sleep. Fix it so that the interrupt thread sleeps for 10ms before waking up and at= tempting to poll again. Additionally, remove the log message to avoid spamm= ing 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 inde= x 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, stat= ic 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; =20 - 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()); + } =20 - n =3D rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, -1); + n =3D rte_epoll_wait(RTE_EPOLL_PER_THREAD, event, num, 10); for (i =3D 0; i < n; i++) { data =3D event[i].epdata.data; port_id =3D ((uintptr_t)data) >> CHAR_BIT; @@ -844,6 +851,7 @@ sleep_unt= il_rx_interrupt(int num) " port %d queue %d\n", rte_lcore_id(), port_id, queue_id); } + timeout =3D n =3D=3D 0; =20 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 +=3D lcore_idle_hint; -- 2.17.1