From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE398A00C4 for ; Fri, 25 Mar 2022 15:02:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E24764284A; Fri, 25 Mar 2022 15:02:26 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 8626040140; Fri, 25 Mar 2022 15:02:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648216943; x=1679752943; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=VympjdBtWq+8eMI4KofiH1llWS/IuSspLdE6CIB2jyY=; b=ObyBTY+iQzlg8ZRng/XU+vq2Z/QtTwBdZBPHP0x3qtlm8kCU2OQL5BW0 dL5WFO/vD4xXi3vv/63x44pRC4REZYvitRMnv9aovA/1+++NMQGa9JRB2 iVc2LshcXyD9G9gr5yXQi9/rCJz0fZqwdj5FlBzEoyv2YJjb2T/uX8dWH neUyiNAJox1DTYrdxDQ0mfsrfD4TJj02OdfZhETJmfF4UvRseL3sZ1N82 KlGd6/6n7T4mUbW2VwX/cq4yOCDaQSoZT2+32jadO8EclcLJlOdg8sp+k 2cNR+qQ2OGSWMadXa2/Agr6YmK7Z3RzhkEtS8N/k0pg0wKPlWMht0Xswo Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10296"; a="321831979" X-IronPort-AV: E=Sophos;i="5.90,209,1643702400"; d="scan'208";a="321831979" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2022 07:02:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,209,1643702400"; d="scan'208";a="516552699" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga002.jf.intel.com with ESMTP; 25 Mar 2022 07:02:21 -0700 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 25 Mar 2022 07:02:21 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Fri, 25 Mar 2022 07:02:21 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.43) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.21; Fri, 25 Mar 2022 07:02:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c2tBLvEAEv5CpSVnYcaTOnR7ORzKvirNuHHFvER4WxDBmSz67lFygTdwK2FZfpaijeaj4ltqTAllLKk9d+SKUlnE3Uw/VVtMfso/7cQ/k9yKQ/iuyzacYTcopUytp/jIepaKsSjwXkG6f+mDIw5kiZOHY3YQjYneafHTigNyFO1v05WiqypJUXX0B5Vz302DJhu4ZXrIrq8lp8WdY2pBfOoFcpH4UMqwVDBA2bGtNfzihmWhEwP7joajsRD1sKqC00lSH05aqpAWEUGKSEBYtV8yhHsTCHIrjgw8aWHUiMzLdwO4zabA1KaMSxThivri2qKKQe0OXrRUtKfxAGrXJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bzPNUJVYxDZn+opNTbE0GE6KW46tFuwENKaOradd/Pk=; b=SbYNQEPUcE31WXSSY8rygiJCuUAB1yqdv5924q7zA61gZ8BzxaMCoqx6ywxx2XkbBm4Y+aX1FTY9HTOaZtKnuAFbwwuLbIEoUit7xqhziKVTftKAKiUfCMwScgctin2NvWU7g+6zIl8ETQWeDIfBH7/Sau6y7/mB6ZS2nLYbkGyN5Hap/6BA3jRw0o4y5Vr7s9NDZaylY/6XJzzNFuP+ytapFA/eH8zqt3XnUdhATV4ifRSNkgkowCqS/1q6gULvT6NX8xiHsm8Tn8JHMuQ3M5f4s3zGTB0KUD+Tiv2q8Wlfw/aAXUAork+/SgzsDWyLyjx4dXghae2h4SBPclEDpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) by SA2PR11MB4969.namprd11.prod.outlook.com (2603:10b6:806:111::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.17; Fri, 25 Mar 2022 14:02:19 +0000 Received: from BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::4992:e2b:3fe0:e000]) by BN8PR11MB3795.namprd11.prod.outlook.com ([fe80::4992:e2b:3fe0:e000%6]) with mapi id 15.20.5102.019; Fri, 25 Mar 2022 14:02:19 +0000 Message-ID: Date: Fri, 25 Mar 2022 14:02:13 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.7.0 Subject: Re: [PATCH v3] examples/vm_power: add support for list_foreach_safe To: Shibin Koikkara Reeny CC: , , References: <20220321093342.1223208-1-shibin.koikkara.reeny@intel.com> <20220322144356.1258169-1-shibin.koikkara.reeny@intel.com> From: David Hunt In-Reply-To: <20220322144356.1258169-1-shibin.koikkara.reeny@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DU2PR04CA0033.eurprd04.prod.outlook.com (2603:10a6:10:234::8) To BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1fe4c61-805d-4d78-dfc0-08da0e681316 X-MS-TrafficTypeDiagnostic: SA2PR11MB4969:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d633LQxXP2ilB0fWJFyHXIxbscPGPe3T2l4krWIQeXTn6SFmZ2jyOPct+DOaK7+z3Q2fFg4PhtHiyQys5QP68gmjDw4ESVIk7lkmIVH401LmjkrCcIh0944yvJom3UIotd27lNkRMVk2YcnN5ZH2wH09mpYvM8H6/+rxTXyjhBB3xO2UBdJ+aXj+Il0c7Y3SDC13HSjymWNCcDqeS2jMTcJUQe/eV2LZFePX0pMLsD1nAiaq8mB8piKxzRUUQTmcF69MLCuAJNZdbF7rFg99+LSeYtbCw0/EiuVpRsihE5BaQm3AWENCX7u+2fkMOI4hwOJwsRUqmW7JaIZfh2SH2xT/Um5tAVHOB5nuUyVK2lvf3Ta3mLP5TnJ5v0r3Hvlak0j/d7mCeUAS7zBWqTtcBOllmL1fZsOGSt1WP7B+rU0zdpsq7Y7ybq+iSL9GWurClR2JffgjL6qycJGyLSXTMI/h3wZ3lXLoBuhtfJ0oYNpLUt0iaNro17NIMXA313aLxV8xVjc85VCNbyaySdcLXGa2KdK+DbaYIHDVMYH66OXUurEeIbMESQOZMfEdfimCPH2NwrK0Ycn7BgLnSuUZPuR/G3GcpLYtsV1klJs3x/dNutoea5AQoKn1nQzKkMwxMXxksZo8FmY/AnrDjmKzzvCR4lwNABONtsjjiL60rNWgYZZgEd3OnIe9VzXzf8/IrGgsrps60l0QToPVQWT8Q2eW1V20uY8yKGcn3IxdOP8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR11MB3795.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(6486002)(508600001)(37006003)(6512007)(450100002)(86362001)(316002)(31696002)(6506007)(6666004)(4326008)(66556008)(66946007)(66476007)(8676002)(6862004)(53546011)(31686004)(44832011)(38100700002)(36756003)(2616005)(5660300002)(2906002)(83380400001)(6636002)(186003)(26005)(82960400001)(8936002)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dTRCTDhEeFJkUkxZWmxORXByZjNsU3pabHFxUTdoMGlyektGZlU2cGd3TXVz?= =?utf-8?B?di83NVB6M1pNdHZGMHd0QnFOMmE2U25kaEJ1NklIL2tHOVFQVDBobnFyblUx?= =?utf-8?B?cWs1bWFPNmQvWFZnc1VoRDlKY0R0Tk85QjcwbHRraW5obnlsR3ZBUEFRWC9P?= =?utf-8?B?eGtxK1ZDMDlZYSt6Yis5aEtjaDMxLzlqZGpjUjlmVlYvNVZvdlFvQ1VDV3VN?= =?utf-8?B?VSs3UmRhQkorQzNDRWhLOWhKeTQ3cmlJQ0VmbHlyTGllbjVmNGNzVTRldUhT?= =?utf-8?B?NUx5VVhVVmRiMEVyR004RFhIN2NsYVRlZHdnS1NHOVJ5SCs5RVVwdndJVlRX?= =?utf-8?B?THd2eHZqZWpQTXBKZ0tVaWYzbGpvVEVEUVlMSEhyTzcxRVFNRmo1ZzVUVXMy?= =?utf-8?B?cnJMUFMwZElhTkZGbjdPOThBSk5IVXFNZ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M3SkxRSitnK2NSN2FRd3hSZThvcHlFaUxnNTdxSzMxUnBU?= =?utf-8?B?bko3QkJqRTBZK3pGLzNISk1TUTIvREtsaW5HVUllVW5GR2FoWklRMjMyY1V3?= =?utf-8?Q?a15mu5VUpOM5/ipM=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: e1fe4c61-805d-4d78-dfc0-08da0e681316 X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3795.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2022 14:02:19.3812 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tiHZnH/wmCSTPxLER7U86JW1iun2vtCh6T13p193pK9DdyC7XTNGdlYWjbxeolF/0bP/hbSFywz24tJPKPKYpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4969 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 Hi Shibin, On 22/3/2022 2:43 PM, Shibin Koikkara Reeny wrote: > Asan tool reported LIST_FOREACH should be replaced with > LIST_FOREACH_SAFE. Added support for LIST_FOREACH_SAFE > macro in rte_os.h file as Linux header file sys/queue.h > don't support LIST_FOREACH_SAFE macro. > RTE_LIST_FOREACH_SAFE is alias for LIST_FOREACH_SAFE. > > Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host") > Cc: alan.carew@intel.com > Cc: stable@dpdk.org > > Signed-off-by: Shibin Koikkara Reeny > > --- > v3: add blank line after declaration > v2: add support for list_foreach_safe > --- > examples/vm_power_manager/channel_manager.c | 10 ++++++---- > lib/eal/linux/include/rte_os.h | 11 +++++++++++ > 2 files changed, 17 insertions(+), 4 deletions(-) > > diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c > index 838465ab4b..2d54641f2e 100644 > --- a/examples/vm_power_manager/channel_manager.c > +++ b/examples/vm_power_manager/channel_manager.c > @@ -66,8 +66,9 @@ LIST_HEAD(, virtual_machine_info) vm_list_head; > static struct virtual_machine_info * > find_domain_by_name(const char *name) > { > - struct virtual_machine_info *info; > - LIST_FOREACH(info, &vm_list_head, vms_info) { > + struct virtual_machine_info *info, *t_info; > + > + RTE_LIST_FOREACH_SAFE(info, &vm_list_head, vms_info, t_info) { > if (!strncmp(info->name, name, CHANNEL_MGR_MAX_NAME_LEN-1)) > return info; > } > @@ -1005,9 +1006,9 @@ channel_manager_exit(void) > { > unsigned i; > char mask[RTE_MAX_LCORE]; > - struct virtual_machine_info *vm_info; > + struct virtual_machine_info *vm_info, *t_info; > > - LIST_FOREACH(vm_info, &vm_list_head, vms_info) { > + RTE_LIST_FOREACH_SAFE(vm_info, &vm_list_head, vms_info, t_info) { > > rte_spinlock_lock(&(vm_info->config_spinlock)); > > @@ -1024,6 +1025,7 @@ channel_manager_exit(void) > > LIST_REMOVE(vm_info, vms_info); > rte_free(vm_info); > + > } > > if (global_hypervisor_available) { > diff --git a/lib/eal/linux/include/rte_os.h b/lib/eal/linux/include/rte_os.h > index c72bf5b7e6..3acff49360 100644 > --- a/lib/eal/linux/include/rte_os.h > +++ b/lib/eal/linux/include/rte_os.h > @@ -25,6 +25,8 @@ extern "C" { > #define RTE_TAILQ_NEXT(elem, field) TAILQ_NEXT(elem, field) > #define RTE_STAILQ_HEAD(name, type) STAILQ_HEAD(name, type) > #define RTE_STAILQ_ENTRY(type) STAILQ_ENTRY(type) > +#define RTE_LIST_FIRST(head) LIST_FIRST(head) > +#define RTE_LIST_NEXT(elem, field) LIST_NEXT(elem, field) > > #ifdef CPU_SETSIZE /* may require _GNU_SOURCE */ > typedef cpu_set_t rte_cpuset_t; > @@ -46,6 +48,15 @@ typedef cpu_set_t rte_cpuset_t; > } while (0) > #endif > > +#ifndef LIST_FOREACH_SAFE > +#define LIST_FOREACH_SAFE(var, head, field, tvar) \ > + for ((var) = RTE_LIST_FIRST(head); \ > + (var) && ((tvar) = RTE_LIST_NEXT((var), field), 1); \ > + (var) = (tvar)) > +#endif > +#define RTE_LIST_FOREACH_SAFE(var, head, field, tvar) \ > + LIST_FOREACH_SAFE(var, head, field, tvar) > + > #ifdef __cplusplus > } > #endif Looks cleaner that the previous version. Acked-by: David Hunt