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 9D569428D2; Wed, 5 Apr 2023 12:44:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 305CD41153; Wed, 5 Apr 2023 12:44:56 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id A4A6F41133 for ; Wed, 5 Apr 2023 12:44:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680691494; x=1712227494; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=3em7S+/3/NAnj15U0aUWp2Egms+sIQdHZfyol1lwhPM=; b=WN+2qMRzUUNQuQl64uEnEkKp++Il5QDSYeFSvt+TPzXIVkuL8OHSc7/4 d/WFS3GpUKuF1sOuFvYyZPmm6nlUEfg5amRgRA7aHINxcUmRyJww5HON1 ePTyENueQ7L4o3gShRx4+4rzRSQhpPD8uRWDoIV0ySzjSGtrUv57aKHjH S9Q8Us9BgD6ZzlWgXbcGofzgY04RRHMpdyJrFmV1LwQ2omc7b8ySgrJxr BHRCrmW8zuoRpq4/guC3yccg9Hk+hOqJosLzPS5X4fFLOB8/ZosxCUjFe 7fFqpLRyBMlhbPxG7Zi0eByX4JTGGjJT2Pc7RXv3mdm9eKTlux6M/vgM6 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="322799642" X-IronPort-AV: E=Sophos;i="5.98,319,1673942400"; d="scan'208";a="322799642" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2023 03:44:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="636843124" X-IronPort-AV: E=Sophos;i="5.98,319,1673942400"; d="scan'208";a="636843124" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga003.jf.intel.com with ESMTP; 05 Apr 2023 03:44:53 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.2507.21; Wed, 5 Apr 2023 03:44:52 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 5 Apr 2023 03:44:52 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Wed, 5 Apr 2023 03:44:52 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.105) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Wed, 5 Apr 2023 03:44:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jIwA82BQCYgmhOT6ptb4Lf8EzNLNAjQ3YFKBLbHdDf1JiRo36Ypmx+7MAUWGqC8YKjIqrNrO0YKbojjL6GutBePyYgZGiT2+ap4CIkSKhi5/5UMFSZhPqKCS7AM+dDYkj34gnp0a6X2l49RsFnN0/h+8Y5TOyK/37OWHP6b8kijNT4GuuJjTsL9JlkQ09WxD+lPa0q+JkfenKVObXoNo+NWLrgTPSDC3Lar/HlKkWUZS5mFBiwpvT55XbcI2U0fQPmvjRA1aAXqiPLWm4ZyQbaPFGwDqW+UxRHA10Z9wEPlNosqbEC5TMlgsm09uCrZeGUp5qnZX9tyHSQdKLx7T1g== 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=2UBPQIIvG+6KjP2ybShIl04MpURFclizGk8ZsYCj+Jo=; b=VpAIrSw5szfYVDIOu5NaIB/xaUABgNBb72qLq5o46h0/+K75mD8rXIVXkQtR++r7K1V2/EB5znt3oFHrZbT3zXxSNpWkHodQ5q6AtbnEcSf9TevDoLi5aZjurZND7UXHhvHETskc9X2KUjNIGcxVG67t5C+DrkjYqUCiaRUU3Tj/2WWs3gmVtKUP38lMQutZ4xLBzAp58HReCqjnkjqQUTQCIWUv44zQpis9F9zuO8q7Qfmb36VAlWYAUKITVgc5AeemYjjSnwJ/vJz6L5fjQRWnoPKfMTkvxOXAhA3TWEclyk6Xjt4En3T59lM+0SpFD4/904/+Wjz3j6XYZQKYtQ== 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 DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by MW4PR11MB5774.namprd11.prod.outlook.com (2603:10b6:303:182::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22; Wed, 5 Apr 2023 10:44:50 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::18d0:ac53:aa1d:d19c]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::18d0:ac53:aa1d:d19c%6]) with mapi id 15.20.6254.035; Wed, 5 Apr 2023 10:44:50 +0000 Date: Wed, 5 Apr 2023 11:44:43 +0100 From: Bruce Richardson To: Tyler Retzlaff CC: , , , , Subject: Re: [PATCH v2 6/9] eal: expand most macros to empty when using msvc Message-ID: References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1680638847-26430-1-git-send-email-roretzla@linux.microsoft.com> <1680638847-26430-7-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1680638847-26430-7-git-send-email-roretzla@linux.microsoft.com> X-ClientProxiedBy: LO2P265CA0493.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::18) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|MW4PR11MB5774:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b6b6a2e-1570-479c-1624-08db35c2c7ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CHq4VDOB6PkZeWMPoUC67yHhyYQDDvEYxkjY8OkUtwgE0ZXPzNeitPdqy3vF0i546Nr+xb+vm5ubw0w0bhk81cJkaC2L2SqUYdLJfttxnYD7OKKOTOJtNmY1zh76PUjMATLE4mJhJCN+Lr1WG+C45IHF90PLoY/zQ4lvD9uqmB+HGBzqYzp9Az8mEvgTGjofaSfjLC4k2fcphZLO8kqh6HDZOHZ8VG85tKJaiWGN+zAwIAtOt2kkzBjtNghLB6kGqelfJgJ0stN5hywymbx4/v6PGMAX8NukRC0A5xQYt8mJ+SjdlSO+HE4UEbedGv6YxlIo6hqAkDs3I2Y7NMvWUhEBLXcViiUvS53HR5sCD9fibhmdnt+1zysk+tKtHDYtJdFgxCG5VkDKQPC/MGJ/T9ftVtJTIs7CFftybaJvjtSw0+s1b6Z0Oo5pEkpq+BtsC0ko8QN5FlDYWJdYivZhRDLN0GzVU5mphdTyxBBfd6q9shz8C9zUP6SbeN9Jt0Az1D0MkXFgDAmqZ5cmuuvXw5mKMGbY/Z67DmzEttnwZf5t+lhC3S4p/uoRa/eFpKUv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(376002)(39860400002)(366004)(396003)(346002)(136003)(451199021)(6486002)(83380400001)(66556008)(82960400001)(66946007)(38100700002)(4326008)(316002)(66476007)(6916009)(8676002)(5660300002)(44832011)(26005)(41300700001)(2906002)(6666004)(86362001)(8936002)(6506007)(478600001)(6512007)(186003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uduDe7oPTkTQTLUpOKqlqKrRDclhtm0pWkfoEEWblPYgfxLeGVILmHocBU2z?= =?us-ascii?Q?GXugdowwU84OR2MGHTFYwHC7Ye5BY98XHjXx4g1oqNMOSxsmTQMdqNBp9lLz?= =?us-ascii?Q?W0DPoWIZQuoMwdH505bIZDKaGkWNrCfWcxfIUwnmzIfF9Gd4SQ3l6ocoJ1E6?= =?us-ascii?Q?Pna6z05ngmduVVZ726JKdsrbNvfjjhdOX8+NWq/QRtfGT4aYMeL9Iwqq0d8g?= =?us-ascii?Q?Xf0Olo+4R3o6TClLn6PiJDOZ/uaPOYfsvnpgg4y2haYslpsR62xnGWGahnjl?= =?us-ascii?Q?cSH7dX6uTcjTQ3sH7V9c28NJ2NBaEYbu3QD9rA6zPWmn80jpSVTVaKnu7PbG?= =?us-ascii?Q?5bj2Kz86zQrnv7A1DXP5c4Ao8CZYH73gB3BZdEyV2ws4lTnEKB38oiwm2ETs?= =?us-ascii?Q?H0QaF1td0Jyez09BcZBh0AQUMnreany+nGqo/f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VqPpj84Vqw14C3Es+wx2NjplzVksGxJZXjEdZZVKnA5TBVjWZkyCD6eD?= =?us-ascii?Q?YbRU5y+5sNn94TU5UNEliCduGQVkc9AlTTmXZJPx7TU/cKbmoFqfHrqZc0jf?= =?us-ascii?Q?/GE2m+G+WUOrOGf3vUKHMgcYEBpuJ6YR/wayxpZe9Q+9eKER38yj5Tgk0Zn9?= =?us-ascii?Q?qv+40SuR7hl69+VcgMIS4joJ3nGeVaunRt025QVhLDHrQzdk5A2oT5049JZW?= =?us-ascii?Q?K4xXPCwN5T+LfNHOhZ/Mi2RnXRgXWGxnrG37fNBh9A37toM0n2rj7vZQ49kc?= =?us-ascii?Q?NQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 5b6b6a2e-1570-479c-1624-08db35c2c7ae X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2023 10:44:49.5552 (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: szUxI7sdcOota7hlSFNxtZgxY6BjqZzk2+++Rgs0wHqtcyLvnmkSRYlzpuGYOs9qsD7xzGkDQlDOs+Ycboi1fCp0sUtc38EDeFSIEx8zLHU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB5774 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Apr 04, 2023 at 01:07:24PM -0700, Tyler Retzlaff wrote: > For now expand a lot of common rte macros empty. The catch here is we > need to test that most of the macros do what they should but at the same > time they are blocking work needed to bootstrap of the unit tests. > > Later we will return and provide (where possible) expansions that work > correctly for msvc and where not possible provide some alternate macros > to achieve the same outcome. > > Signed-off-by: Tyler Retzlaff > --- > lib/eal/include/rte_branch_prediction.h | 8 ++++++++ > lib/eal/include/rte_common.h | 33 +++++++++++++++++++++++++++++++++ > lib/eal/include/rte_compat.h | 20 ++++++++++++++++++++ > 3 files changed, 61 insertions(+) > > diff --git a/lib/eal/include/rte_branch_prediction.h b/lib/eal/include/rte_branch_prediction.h > index 0256a9d..3589c97 100644 > --- a/lib/eal/include/rte_branch_prediction.h > +++ b/lib/eal/include/rte_branch_prediction.h > @@ -25,7 +25,11 @@ > * > */ > #ifndef likely > +#ifndef RTE_TOOLCHAIN_MSVC > #define likely(x) __builtin_expect(!!(x), 1) > +#else > +#define likely(x) (!!(x) == 1) > +#endif I think this should just be "#define likely(x) (x)", since the likely is just a hint as to which way we expect the branch to go. It does not change the logic in the expression. > #endif /* likely */ > > /** > @@ -39,7 +43,11 @@ > * > */ > #ifndef unlikely > +#ifndef RTE_TOOLCHAIN_MSVC > #define unlikely(x) __builtin_expect(!!(x), 0) > +#else > +#define unlikely(x) (!!(x) == 0) > +#endif This expansion is wrong, because it changes the logic of the expression, rather than being a hint. As above with likely, I think this should just expand as "(x)", making the unlikely ignored. > #endif /* unlikely */ > > #ifdef __cplusplus > diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h > index 2f464e3..a724e22 100644 > --- a/lib/eal/include/rte_common.h > +++ b/lib/eal/include/rte_common.h This file has a lot of ifdefs in it now for msvc. Couple of suggestions: 1. can we group these defines together so we can hit multiple entries with a single msvc block? 2. alternatively, for those we want to just permanently null, we could split the responsibility for them between the currnet headers and possibly the build system. Specifically, rather than doing macros based on MSVC, change each macro to the simpler: #ifndef MACRO #define MACRO macro_definition #endif Then in the meson.build processing, we can have some separte MSVC processing to put null defines for these into rte_build_config.h, or put in null defines for them in some MSVC-specific header. Just some thoughts. /Bruce