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 08C2DA00BE; Tue, 28 Apr 2020 13:20:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D8CE71D58A; Tue, 28 Apr 2020 13:20:06 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D1B7B1D587 for ; Tue, 28 Apr 2020 13:20:04 +0200 (CEST) IronPort-SDR: OPdyhwmVzh8ljyAZ9dRzwkoXl8itXT4YmC8H2FriwAdQLI0OenwfeLn/XlAOXu3DYp86diRz6S 2DuxUtsbHTxQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2020 04:20:04 -0700 IronPort-SDR: 7IZt0BsBK5YZm7IDgrAPKpJnsfIqMpTwFwwXnYooOXeU7pyYODswjJy2saRJBD5WQ7gapTC7/g ntMqPD2RPR5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,327,1583222400"; d="scan'208";a="246473748" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga007.jf.intel.com with ESMTP; 28 Apr 2020 04:20:03 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Apr 2020 04:20:03 -0700 Received: from cdsmsx152.ccr.corp.intel.com (172.17.4.41) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 28 Apr 2020 04:20:03 -0700 Received: from cdsmsx102.ccr.corp.intel.com ([169.254.2.104]) by CDSMSX152.ccr.corp.intel.com ([169.254.6.50]) with mapi id 14.03.0439.000; Tue, 28 Apr 2020 19:19:59 +0800 From: "Xie, WeiX" To: "Burakov, Anatoly" , "dev@dpdk.org" CC: "Hunt, David" , "Pattan, Reshma" Thread-Topic: [dpdk-dev] [PATCH v2 1/2] l3fwd-power: exit if initializing power library failed Thread-Index: AQHWF8q0vDXujQbT+UqqOdXKh4yPAqiObjxg Date: Tue, 28 Apr 2020 11:19:58 +0000 Message-ID: <6FD6A7610D20924F885A4ECF34E8AC91045E782A@CDSMSX102.ccr.corp.intel.com> References: <854770a880777e7ad200481294a7aa5ac9a45f2d.1586361368.git.anatoly.burakov@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.17.6.105] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 1/2] l3fwd-power: exit if initializing power library failed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Tested-by: Xie,WeiX < weix.xie@intel.com> Regards, Xie Wei -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Anatoly Burakov Sent: Tuesday, April 21, 2020 1:57 AM To: dev@dpdk.org Cc: Hunt, David ; Pattan, Reshma Subject: [dpdk-dev] [PATCH v2 1/2] l3fwd-power: exit if initializing power = library failed Currently, if power library initialization fails, only a log message is dis= played. This is suboptimal for a number of reasons, but the main one is tha= t telemetry mode does not depend on the power library and can therefore run= in environments where l3fwd-power would normally not run correctly (such a= s inside a VM). This will lead to attempts to deinitialize the power librar= y on exit, with a subsequent forced unclean shutdown of DPDK. Fix this by only initializing the power library in modes that actually need= it, and change a log message to a failure to initialize. Signed-off-by: Anatoly Burakov Acked-by: David Hunt Reviewed-by: Reshma Pattan --- examples/l3fwd-power/main.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c inde= x b46aa7bac..be50ec049 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -2065,15 +2065,17 @@ static int check_ptype(uint16_t portid) static int init_power_library(void) { - int ret =3D 0, lcore_id; - for (lcore_id =3D 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { - if (rte_lcore_is_enabled(lcore_id)) { - /* init power management library */ - ret =3D rte_power_init(lcore_id); - if (ret) - RTE_LOG(ERR, POWER, + unsigned int lcore_id; + int ret =3D 0; + + RTE_LCORE_FOREACH(lcore_id) { + /* init power management library */ + ret =3D rte_power_init(lcore_id); + if (ret) { + RTE_LOG(ERR, POWER, "Library initialization failed on core %u\n", lcore_id); + return ret; } } return ret; @@ -2224,8 +2226,8 @@ main(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n"); =20 - if (init_power_library()) - RTE_LOG(ERR, L3FWD_POWER, "init_power_library failed\n"); + if (app_mode !=3D APP_MODE_TELEMETRY && init_power_library()) + rte_exit(EXIT_FAILURE, "init_power_library failed\n"); =20 if (update_lcore_params() < 0) rte_exit(EXIT_FAILURE, "update_lcore_params failed\n"); -- 2.17.1