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 29CF6428D2; Wed, 5 Apr 2023 12:33:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0448F41153; Wed, 5 Apr 2023 12:33:57 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 8807141133 for ; Wed, 5 Apr 2023 12:33:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680690835; x=1712226835; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=wjrASWsl1/+o11eA3ZJRk4szrNyob4vuQhujRRyHeIQ=; b=Jy5clJD6p3cKVLl3c06NtBtonlHwYj6uGR7VpArE+iBQWaWNq4QtcKtj WrWOCVklulUDIbHqy+VCILI/AZgGTYXx8fPNeseEmYcml5oWOQacSy3st J/cWW9/Cu1POI6b2j/MQfX2ALiG8BJ2Af1TjrhaX2dEFq3TisaRnfHJcD AmqleIs5CxbAS+/DYx47pGPNl/PcPJ270LQNmjxfqP2tEIdmuS0zONxhv bD9Oa+M1uF5PUV36Qf2SRBA3uyq5IMc0yZd+GNdifoy9ei81zLZkawoi/ lMzNsrZ7PM2gAjo+miTPGo7jVBn+uuXWMTPH+bjErs7Pja8Z4VH1HDdDv g==; X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="370243243" X-IronPort-AV: E=Sophos;i="5.98,319,1673942400"; d="scan'208";a="370243243" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2023 03:33:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="689228098" X-IronPort-AV: E=Sophos;i="5.98,319,1673942400"; d="scan'208";a="689228098" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga007.fm.intel.com with ESMTP; 05 Apr 2023 03:33:54 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) 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:33:54 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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 via Frontend Transport; Wed, 5 Apr 2023 03:33:54 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.171) 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.2507.21; Wed, 5 Apr 2023 03:33:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KDIU45xknio47PHSXWaC37r6pj1bcr/WqT2wVfwS24CgXZCrxBX8oSnulOHa3Qm0i8slMyGkttVuIoIXpbrYcZQaB5ZeajlmBBHhvBG/g56isef8VPnbRSomTSMSqthwmfBhKqhvaqCIspy9t7pWX7fzmM/YFmxhOKEFbqbRXXW4CC93dZ9KPIjxRPrGBGb6qD15ExhaRM13cF0JZ/P4S2i016yg+Ck2fvHPiqFm3nbMSSqSpKjsmH9G+m7rjiP3cRLXn8hvuHAGPH0jpiIyrHdHak+KwIDeb5NSAbpKMJNNsu/F1Sh5sWvXxfXSwJzVozA7sszO34CiGewK9kouGg== 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=I9YUtr4Mcqp+FcYakh0NTbybM6+Vl1KOJZxHwfVetd4=; b=AvpbW2QqL21pIwiTeFcQjms3Xx6FadRfbqhOqjysKAXXCFHqDz0gRJLTO39pBeJHmjqi8Mr3oorzQsa7qWrlpMNDQkGHwRvHYsM4oXPkiyCUBDyksk2DDELz7OHligFLvaI59FS/hHc/OtF83APvqf56ttYYy5tbx6x0MMHhajg9vMWQZEkv4riUmmhMa6LO+h7EYY67/HtPRBe9AMOcRwJLFg7M1d5Oj7v9apiSaDtQwgkFIlkg+pabSrYUGS6+x2QNDOL5QBLLR9TtEb1gAVaRI9Mz63B0/gblUcBTdN8zMLtIdDh3T/Br6k24I7PnHT1sEjKu0H/3sYUeADQlUQ== 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 SJ0PR11MB6670.namprd11.prod.outlook.com (2603:10b6:a03:44a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Wed, 5 Apr 2023 10:33:51 +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:33:50 +0000 Date: Wed, 5 Apr 2023 11:33:45 +0100 From: Bruce Richardson To: Tyler Retzlaff CC: , , , , Subject: Re: [PATCH v2 3/9] eal: use barrier intrinsics when compiling with 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-4-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1680638847-26430-4-git-send-email-roretzla@linux.microsoft.com> X-ClientProxiedBy: LO4P123CA0371.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18e::16) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SJ0PR11MB6670:EE_ X-MS-Office365-Filtering-Correlation-Id: cd6bd199-5f13-4b51-5342-08db35c13f01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CXqxHaopYVkPCguwERTSWX0v3PnMrfl4QN0s84SP3u/NqR/xHjkh1HNBC9Q2Tto40XFkyWGXOc4ox/k/SxufT+6E5LF8tWIIBdsKlMzjsOGGTsUE5IFb0SI+r6XlMy4333ixi/5fIJmr7d11rcS3U6IhWNBuLuvJ0r7CjR4/aQyjdkUqHPSQLEjuZ5F0dy8u2DDdLpHD69oRZRVq1uTMJG0U47Pn9/2oxjNtBCt3C+yDkN2I1nJ/7tAItKWCS82zLnjrRdVO59uGpmTqMPcLENuqK443Ha+pUqgw9tJJyVJOacq6UA2rqdrDFRu8ciTQ3koS/u3dkdopCGG52hKFOj5Mlmve1AaRz8Vu3bK4hfeLXc0W/lL6Wskk6Ch5eEnbNlLsEYd6TnCix9+ER7xJEPP7Tgy0fXZ/7GuwO1AznT+PGbOMl7/sNvALLHdwSXxJOqFVLlDJKQxygweCa9wdshqcs4+M7/enT6WLljZOf4iUQYYJoZbGSy8SIM3q3NqTZlucmcG770dBZFbbWod+AzmucH8MVcgOhf0DQz4RDTbdOA74NRRVc/mjsfklJ4Db 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)(39860400002)(396003)(346002)(366004)(136003)(376002)(451199021)(478600001)(86362001)(6506007)(6512007)(6486002)(26005)(6666004)(316002)(186003)(66476007)(66556008)(66946007)(4326008)(6916009)(8676002)(5660300002)(82960400001)(38100700002)(83380400001)(44832011)(41300700001)(2906002)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?b9aC+Fq+A/Qwsms0Uecg55UjUdid75QlWBcE3dOasAlXK59+wAJHmMY9sxGq?= =?us-ascii?Q?T0e+gvJGbv7r8ef2ENjrypKdtQSYuMB4sxMcLORl1QpZAyvA5fFN4XsgDi7d?= =?us-ascii?Q?0iEjhSjXb17egPC/BOCJptzNtvmwf9ijSuQH4WjhIG6VQ1e71n+Tb4zhb2tN?= =?us-ascii?Q?Pi+QqpPSQnkQkSz0BWYYYckaHF1ispIScIMuzEDMr0N7AZiC82VHQBUd8nEi?= =?us-ascii?Q?SQ+Ta50E0MJOAiuDOrT7N1rU8+v8tY8q0BX8uFY/Pn2GQjTKwc6sU9B5ZEJM?= =?us-ascii?Q?EecqBoO5Q4vCnzKRbNXDZcTS9NNb8pGyVf8tXmNOtakwaUUBl2AjI+F6Uqwa?= =?us-ascii?Q?m9cREIGbOsFXn1zQlmqgu6K9bChjCGTDkxvHp4Icj2ZmGFsQ/t6RGCdCppNq?= =?us-ascii?Q?J8ZSae3CyNX9n+L6/Qu3astkeg4KDavEFmZ8wwjupJq2AiXbKuwfxMwbb1/p?= =?us-ascii?Q?6qZEVkW5vxtHAP5M+pRFh5AyyfRCraR2dw2xJLsnUQbJ3F32lZkucb0hwF8R?= =?us-ascii?Q?NT9I25mw01SgvgATZNqWdVf9QHbkvWEJOOMgiDiRBF0X2VXP+0/mWRZZ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PohPemEoZrprRL2b9gAHFjR3YIW2ItqnqEchDlFUr2di?= =?us-ascii?Q?JI382pN8dF6N9T+ZSZsBobVI4vtZx2V8LduAOD+HzENvqWqNIwi+HuCFgCGh?= =?us-ascii?Q?8+M0ZVMIOLouibUlYg6vEdHbhqWICgRZYpZEsBDwdH9coYB2VfHQkX3aKr4q?= =?us-ascii?Q?iQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: cd6bd199-5f13-4b51-5342-08db35c13f01 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:33:50.7539 (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: 6FJzbFZPPUKlVxAcK//x90wHgwNoC2BfbJT12gVYGz65gg+W6I7RaxLToi/fJVoCLJT0kzebC5kRrAFwZGChJu6IUnVCCqsU5jXW+T/S0M4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB6670 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:21PM -0700, Tyler Retzlaff wrote: > Inline assembly is not supported for msvc x64 instead use > _mm_{s,l,m}fence() intrinsics. > > Signed-off-by: Tyler Retzlaff > --- > lib/eal/include/generic/rte_atomic.h | 4 ++++ > lib/eal/x86/include/rte_atomic.h | 10 +++++++++- > 2 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h > index 234b268..e973184 100644 > --- a/lib/eal/include/generic/rte_atomic.h > +++ b/lib/eal/include/generic/rte_atomic.h > @@ -116,9 +116,13 @@ > * Guarantees that operation reordering does not occur at compile time > * for operations directly before and after the barrier. > */ > +#ifndef RTE_TOOLCHAIN_MSVC > #define rte_compiler_barrier() do { \ > asm volatile ("" : : : "memory"); \ > } while(0) > +#else > +#define rte_compiler_barrier() _ReadWriteBarrier() > +#endif > > /** > * Synchronization fence between threads based on the specified memory order. > diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h > index f2ee1a9..7ae3a41 100644 > --- a/lib/eal/x86/include/rte_atomic.h > +++ b/lib/eal/x86/include/rte_atomic.h > @@ -27,9 +27,13 @@ > > #define rte_rmb() _mm_lfence() > > +#ifndef RTE_TOOLCHAIN_MSVC > #define rte_smp_wmb() rte_compiler_barrier() > - > #define rte_smp_rmb() rte_compiler_barrier() > +#else > +#define rte_smp_wmb() _mm_sfence() > +#define rte_smp_rmb() _mm_lfence() > +#endif > I think this change can be dropped from the diff. "rte_compiler_barrier()" is valid in MSVC because you defined it above. > /* > * From Intel Software Development Manual; Vol 3; > @@ -66,11 +70,15 @@ > static __rte_always_inline void > rte_smp_mb(void) > { > +#ifndef RTE_TOOLCHAIN_MSVC > #ifdef RTE_ARCH_I686 > asm volatile("lock addl $0, -128(%%esp); " ::: "memory"); > #else > asm volatile("lock addl $0, -128(%%rsp); " ::: "memory"); > #endif > +#else > + _mm_mfence(); > +#endif > } > > #define rte_io_mb() rte_mb() > -- > 1.8.3.1 >