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 6C73742925; Wed, 12 Apr 2023 11:06:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3491940FAE; Wed, 12 Apr 2023 11:06:21 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 483B84067B for ; Wed, 12 Apr 2023 11:06:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681290379; x=1712826379; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=wKnWAnTLyOqCm+FVL89mBZw9XGghIIw1E0AAUs5TFZM=; b=ERkxev4DVMv2O5s4ZW+E+SEUnJsSq3IHPzxkP+1MeHfS8t0+5y0rL5xH 7i5gP9384AKrki+jRDxFP3LZfae6Lo96tErAzeybJCSp1j/GPQNPZ19vw q9OB/mDAgyJhOxlbBDB2a1mMxJahSVCM/1Czt2DodqzkhlB9DYBYbtt26 t1KpD17jTysMXOXST5ZShI1kmiTRUzHrZmZvidjcWOLnT+9qf54TvTxv/ euuM2gPsA6nwpOfHOj/0m75f+RFOTnH3lkgm7mvGfPqRLxv8+7vrpJGgv XGe9wE4griQcb2d/vDLcIYMm7DAJLcv9Ss/0r0hvf9O9fqkRQyUrfP9qr A==; X-IronPort-AV: E=McAfee;i="6600,9927,10677"; a="408983047" X-IronPort-AV: E=Sophos;i="5.98,338,1673942400"; d="scan'208";a="408983047" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 02:06:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10677"; a="721496063" X-IronPort-AV: E=Sophos;i="5.98,338,1673942400"; d="scan'208";a="721496063" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga001.jf.intel.com with ESMTP; 12 Apr 2023 02:06:10 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.23; Wed, 12 Apr 2023 02:06:07 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 12 Apr 2023 02:06:07 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Wed, 12 Apr 2023 02:06:07 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.175) 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.23; Wed, 12 Apr 2023 02:06:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gegLEl+A6JvTgEq8a+tLILoH7WNUinNBFeN9hnN6jDYYz2tC8CYvqs8BJ73P9mCV95dcUpyif4aecDFX8OmMkEd1IHurjdV7+kM+L1+hAtol/HKH+NNaReMMGtxPNb1cm3DXvcrG12UUsFWsKPJ5cP1Hx2IfYJ15lfeWYL2rVxp1Z7Gs5iKJlBBebhcCGPMRpBHwrkxnVz10nrILsGqEy2EyL/dHsCSEBfCppIyRIWwYHD2olYdot/YccnGqAJ68kPk94KUBw/++81wMWSd91Fpys2I01h9+gs95p+58I4AUGmj3MTqJgrzG0J8uJPivCIymv44c0xVXxdsR7wCWPg== 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=C+uLJ9KrnDJdAqafMnqnpI2YHzJev83RG9/uYRdHYZs=; b=KtUsM0C/tZ/yd5R1fGN6W+YwuAGmnp3xzbjWYv0Gf7Ca3h03Dc6JVIdHSQbgrGeZON/OVTFk+0XOQjx78PWc4jzeK0S3na5/soUMJvqgupDBjtNa76QrZe3z78NJQ3VS8HK+G3Hu/dolTamzNdV6AZhiQQOYiUyWIucJexyJTPMk8aX2fShfStz+3XgxvaNLQOO/5IqTGbXyCqj+6uXwbTOjEmQ5m5qFnGmVWou69hxPAM2j38uY5iqtC3vKmS+ofFM9g8dP9DFtwfrn2XDM+QF0DYInJltf6DXBbWma7va4BIZMLor5WEGhqwwuW/NHQRe7rgacd3eMecmlcGWXFw== 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 MW4PR11MB6739.namprd11.prod.outlook.com (2603:10b6:303:20b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.34; Wed, 12 Apr 2023 09:06:04 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::695b:260c:f397:2b69]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::695b:260c:f397:2b69%4]) with mapi id 15.20.6298.030; Wed, 12 Apr 2023 09:06:03 +0000 Date: Wed, 12 Apr 2023 10:05:57 +0100 From: Bruce Richardson To: Tyler Retzlaff CC: , , , , Subject: Re: [PATCH v4 06/14] eal: use prefetch intrinsics Message-ID: References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681247548-18590-1-git-send-email-roretzla@linux.microsoft.com> <1681247548-18590-7-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1681247548-18590-7-git-send-email-roretzla@linux.microsoft.com> X-ClientProxiedBy: LO4P123CA0268.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:194::21) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|MW4PR11MB6739:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e86c0d4-f293-40dc-c8da-08db3b352446 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HhZtOnKMoNqfSfDQhoL1bDUkD3VduqTR5CCt51S3cbkJ/Ypx6SnEYqYUnkEAAcKKe5bo/1tIv07ztF8dLO3Z5I6PxvTQSrzKcoQ55tzNrgnfd8OS28MHX4stIJSmHt2+YyKAMAVTjaLwM1mBcUHF4ldecils9sjYfXMg6REnd8TmpxghvZ6aGoW+90q3tcCwl3ywcShRm43DBD/+rdNvWECIRw5IRL1rBp7KnDqMtAEyK2DodEsUI7cHbz+cz0tBB1YHjswN4wmav4a0tUP7I3RYkIxDVZJUXCKAtfThm+Sjzqh6Wcf2ptWBTF3RAcivKGDukV+KbfTw9FP7vPEYAELFHQ4EC/+/WvdKfn1QTrpTmzZK5d+cNteBmk41aMkoKn24h4AMuecn30q1xFHyc/VTbTlYB0h/+NJjO4WsMpJCt2TzziWrbCncmdwqEybHNubf4Ip8gzPLJ9jnyeG/ERDRMewzfIITCseyA+6i3mUXWqrSggBbk6fmuVPWEMaae40Xvhw+8KPSOaf+aYdbbMWbHhXq8xbtdeTlEazZ2Dthrw3qJAOQyDKXS3lUOS+l 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)(366004)(136003)(346002)(376002)(396003)(451199021)(478600001)(82960400001)(38100700002)(86362001)(316002)(44832011)(2906002)(186003)(6506007)(6512007)(26005)(5660300002)(66556008)(6486002)(41300700001)(6666004)(6916009)(66476007)(8936002)(8676002)(66946007)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?JeT9VpLk/q+ORALtt66gMOoCcmXfOTUi2yu/18E+hrqBorDJGjGw5cdJQUhk?= =?us-ascii?Q?auTGOuGlFBxzPgHGD8UiTROrYH8y6XCn2N2bcH7ihJPeEwpQRFvi5BW3eboW?= =?us-ascii?Q?nBtS5BewNrAUoa/Hl3LTOGMbb7VTiaQBHwDNAevmTlQVzGTboOohEvTm5Mlc?= =?us-ascii?Q?8OUdThViXP4PUaiZDlPGGtSDLroRcIF/VV+iOPV/d5on+F8INvVuQfXCnjno?= =?us-ascii?Q?FssN8H5gZ35xCMlTeuggpcAVbsXVri+RNfOprPnHpttsXW72m03WMHsLhA14?= =?us-ascii?Q?rISw8/BRYmyn/M2DbAcBRlgwKJrLT0sBJN5FmE5rFtzAZ5Qh/Fq2mx5hV/eU?= =?us-ascii?Q?g+vkK12CllJDbwYU2LdXd9RWlqrCY4gmslqoPBvrLx0bw+/cuLlkFOBlJFNP?= =?us-ascii?Q?5qelhtpJyxjd0mBSles5GP755zAq+GsStmX7gzyay4sDio1mRozMGE2juXP0?= =?us-ascii?Q?NrnSL7JJiuPxCeFcg09HhXAP+78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URq91RF7VyFyhs8ZXITQc7VDaJPA1dE7nhlNUaLdEnM40gnxvKOSE3O?= =?us-ascii?Q?XS8rB7iP4BhKbOuMmILStMjF3Wmsgig0/9omP5ERgtgz5ViSlCfWAXhLW+j5?= =?us-ascii?Q?k9PHgidJzMPmkEOPCi/CBgqiy+x4vrLFZLipb0iursbGUgBByvbBrK6jntIU?= =?us-ascii?Q?5EH6M72mTHCBsYnIS5vDKvOo8XDKKOs9JjdAPeOMrCIc0y3ojGXhuS55onJL?= =?us-ascii?Q?RA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6e86c0d4-f293-40dc-c8da-08db3b352446 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2023 09:06:03.3551 (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: zEn3ze+yUB3kqvePPo6L3IS/tvkgDL0dJPOO4xRk4j8Yirpwo8bizoAwUl9fwW3SHPe+mdqZAzHR7Zvnx5gMEI9XnotKLFCSxMnYZcALM2U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6739 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 11, 2023 at 02:12:20PM -0700, Tyler Retzlaff wrote: > Inline assembly is not supported for MSVC x64 instead use _mm_prefetch > and _mm_cldemote intrinsics. > > Signed-off-by: Tyler Retzlaff > --- Acked-by: Bruce Richardson One comment inline below for future consideration. > lib/eal/x86/include/rte_prefetch.h | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/lib/eal/x86/include/rte_prefetch.h b/lib/eal/x86/include/rte_prefetch.h > index 7fd01c4..1391af0 100644 > --- a/lib/eal/x86/include/rte_prefetch.h > +++ b/lib/eal/x86/include/rte_prefetch.h > @@ -13,6 +13,7 @@ > #include > #include "generic/rte_prefetch.h" > > +#ifndef RTE_TOOLCHAIN_MSVC > static inline void rte_prefetch0(const volatile void *p) > { > asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile char *)p)); > @@ -43,6 +44,34 @@ static inline void rte_prefetch_non_temporal(const volatile void *p) > { > asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p)); > } > +#else > +static inline void rte_prefetch0(const volatile void *p) > +{ > + _mm_prefetch(p, 1); > +} > + > +static inline void rte_prefetch1(const volatile void *p) > +{ > + _mm_prefetch(p, 2); > +} > + > +static inline void rte_prefetch2(const volatile void *p) > +{ > + _mm_prefetch(p, 3); > +} > + > +static inline void rte_prefetch_non_temporal(const volatile void *p) > +{ > + _mm_prefetch(p, 0); > +} For these prefetch instructions, I'm not sure there is any reason why we can't drop the inline assembly versions. The instructions are very old at this point and should be widely supported by all compilers we use. Rather than using hard-coded 1, 2, 3 values in the prefetch calls, I believe there should be defines for the levels: "_MM_HINT_T0", "_MM_HINT_T1" etc. > +__rte_experimental > +static inline void > +rte_cldemote(const volatile void *p) > +{ > + _mm_cldemote(p); > +} > +#endif > + > > #ifdef __cplusplus > } > -- > 1.8.3.1 >