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 BC9AAA04B1; Sat, 10 Oct 2020 12:22:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9749E1D8CE; Sat, 10 Oct 2020 12:22:12 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2083.outbound.protection.outlook.com [40.107.21.83]) by dpdk.org (Postfix) with ESMTP id AC2451D70F for ; Sat, 10 Oct 2020 12:22:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TEtUGjMxTPik+CcX3jOt5Y5NlgRC4XCqq3b8P3SaTh8=; b=TfGjUdcbUjszWgxQ9UivwBFw1gqC3FKNIghDkOk7TDEVR5U5r+wAm7Jwo8uQkCPOQKdas4uTJh8eXrZWIlWF30UE1QT35ylo9/TIq0jqXyuifleQdDkKHBfk23vrQyGfu1QSiggwlmDwB6dgGnmRvNC4g+XZtWVpE80qIsVtfDA= Received: from MR2P264CA0060.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:31::24) by DBAPR08MB5861.eurprd08.prod.outlook.com (2603:10a6:10:1a3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.24; Sat, 10 Oct 2020 10:22:07 +0000 Received: from VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:31:cafe::4a) by MR2P264CA0060.outlook.office365.com (2603:10a6:500:31::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.22 via Frontend Transport; Sat, 10 Oct 2020 10:22:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT032.mail.protection.outlook.com (10.152.18.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.23 via Frontend Transport; Sat, 10 Oct 2020 10:22:06 +0000 Received: ("Tessian outbound 34b830c8a0ef:v64"); Sat, 10 Oct 2020 10:22:05 +0000 X-CR-MTA-TID: 64aa7808 Received: from b204bc797306.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 73DF42E3-4F8F-494C-9514-ABA4530AE520.1; Sat, 10 Oct 2020 10:22:00 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b204bc797306.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 10 Oct 2020 10:22:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QObjpQ409RBtFkn3ALxYj74jdpt/Gr4SBm8hR8aw4hHIU4zdh4zWsmgycfuqFLqzNhEupLhzFk0H03n49UYX2epnKp98rxEOfs4t1vGeRtIZ9ZPaBXGhCpm2Quu1Wnyl5zgfxbo+eBpbDIhvzn2gzp9DJM+TSc8th5DC6EpDOHgBeOxreRK5sixEFkkKMrM5I32f1I4MmoGPApMQLFWsKQhB7/+8pzVennn5Q6RfE5PhZknzKn5iWQ6vetgK6aEc4Uoa9U9bFHvVlAyKrjf3EMfZTIWY5fQgJrcND1q8Hu/vIu21JNsQHxaknFw1zblTWECxHAxeRzmZmKCtnD3jkg== 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-SenderADCheck; bh=TEtUGjMxTPik+CcX3jOt5Y5NlgRC4XCqq3b8P3SaTh8=; b=H8wyvW0XYYNFGpjCVnEkpMQd40I5spreN0c0bipZWTFwnlScqAdePyNLhMyX4fresmJMecnVhuXAnfLoPPbWPeL6PWuoTm30+G2huXuDgXc+sxlxGJHDMGKlC60jTvwSIuOn7J8PEGh7cqUTLFQmSchh0r1T1gFm/h5kVRf7ReraQwFg1ZSm6TLhQZ5JiFBH0uYxlwPnyM6l/UP1wb1u7j/aOU3EaUxpZRPwXLr4MCRvnPVFE41JzqCUrBZOkdK/WPdydq/a+z4p6HHudTkrCj9fOqMnQf3BZ53fUgLTKiSVoRADo27fJjOqfNMKO/u8Z+eR9rbo4p5IeWwW1R73oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TEtUGjMxTPik+CcX3jOt5Y5NlgRC4XCqq3b8P3SaTh8=; b=TfGjUdcbUjszWgxQ9UivwBFw1gqC3FKNIghDkOk7TDEVR5U5r+wAm7Jwo8uQkCPOQKdas4uTJh8eXrZWIlWF30UE1QT35ylo9/TIq0jqXyuifleQdDkKHBfk23vrQyGfu1QSiggwlmDwB6dgGnmRvNC4g+XZtWVpE80qIsVtfDA= Received: from VI1PR0802MB2351.eurprd08.prod.outlook.com (2603:10a6:800:a0::10) by VE1PR08MB5760.eurprd08.prod.outlook.com (2603:10a6:800:1af::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.25; Sat, 10 Oct 2020 10:21:58 +0000 Received: from VI1PR0802MB2351.eurprd08.prod.outlook.com ([fe80::14d4:6ade:368a:204b]) by VI1PR0802MB2351.eurprd08.prod.outlook.com ([fe80::14d4:6ade:368a:204b%3]) with mapi id 15.20.3455.028; Sat, 10 Oct 2020 10:21:57 +0000 From: Ruifeng Wang To: Harry van Haaren , "dev@dpdk.org" CC: "pbhagavatula@marvell.com" , nd Thread-Topic: [dpdk-dev] [PATCH v2] eal: add new prefetch write variants Thread-Index: AQHWiqkcHUqPk/D3QUKEb8xRQR3eXqmQyOmw Date: Sat, 10 Oct 2020 10:21:57 +0000 Message-ID: References: <20200911091919.62167-1-harry.van.haaren@intel.com> <20200914151021.23806-1-harry.van.haaren@intel.com> In-Reply-To: <20200914151021.23806-1-harry.van.haaren@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: C4A9F89BFB9FBB438DBB2D6625D9F9BA.0 x-checkrecipientchecked: true Authentication-Results-Original: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [203.126.0.112] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d48519aa-c209-4982-2324-08d86d0656af x-ms-traffictypediagnostic: VE1PR08MB5760:|DBAPR08MB5861: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:1284;OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: zA2Z+gbCKCiz0F4XuaRAqJ6rG2ckogzk4dxtm9YE8Wy2QuiqNN5bvVITmxjD8vb6CMSoPZA8mUjJSPh2wrDrerijVn1M7nm7t9Qgm4j0zZIHWom99R3HCs3cCsqqGOQDofnwO2fMMUkefM38qOB0tZKTMf2viUwOn8C3260i4rJ+Q5nzdUo3dwEGYBEKmarcfIkh62c2Ij8zorQgpj1SUyzvaZHSoZJEqASTj9M0OPnr0vY972E/jGqA3uHCTfWTyW1ZiNsJ9mHW3YCn5aT0S6hqd187aBPULNB3wck2B/Re9F2fb07BBWVVK15xDdeH5AFu1M4U3ucSahfPFF/84hmbA/NWJjkio5Z4qoRDY7Shj3+aA9ao/hSLTuueOwjUbluLvyQ+hAQbW5rKdBmAEg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR0802MB2351.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(346002)(39850400004)(376002)(396003)(136003)(5660300002)(64756008)(66946007)(26005)(66446008)(52536014)(7696005)(71200400001)(66476007)(478600001)(76116006)(53546011)(83380400001)(83080400001)(110136005)(6506007)(55016002)(66556008)(54906003)(316002)(966005)(186003)(4326008)(86362001)(8936002)(33656002)(8676002)(2906002)(9686003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: tm3j5Nc9BUWTy8CRHzqi9r2ZMEhMqzWMK8ow+TRiMbAsE+lC36zS/PXqBWVTJIELDeqJVtKPZ+4RwvI0BrX7yhU9faCaFfYZpWYBxMXQCHcnaF5RHcJyVdJCSHO3QQgNFkJuwyI7jRhKzrsk/kiQ91Wdfahmhx0ff3Gad2ZZpqe5JJ2K87uwQlCO1aQLugUMqQBRDJ0IgGaG3Y2pS+NXwvejh5Hq3u9aUWwinxI7bNPzt8il3YIFcGacYZVidQQLVgiCHEEW4r/jnWCXdBlPy8qC+RMQjlsWeL3PwStr699cJrAJZHULMhvqhT2HxRXHAvpgQNQrimBc5S3kn8Yhuww49X8N/aAOE4KDxaGlqtXuYQaDndAVg0XPUst31+w9sUyXwADm3Q4s/3+eKH8i0vzH35F9ahwQ8ObQ9LuEk3wxn0mnd03FnPOA8sFpFAsr8YUte2F7tEfXU1MGxHOxfGnb/Ip4Q90V+4wdto19LN36CiOEZgWPdePrluy8qipvLs4GEQeJijDzl97me75AOGxJUhk2aa6ZoO136fuivSo3LDy1PObp/mDTwub1u0N5NZl53dXjD+PE5nFuWobClGlRt0COob6ObvEeBMswzvzmauhXM3aJ4N2cdEmPNJN98C7bgL+gu3w3VNeVtBxGOg== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5760 Original-Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 7629842a-931f-4168-aa8b-08d86d0651a5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aZjvfBQCUI6h3DeiZCSxCY+D8b66Jhte34q8ioW2sABumhXk0lMI4onIh6MOIz3o+G344d22qTkKqJnjpPbHp6Z5/MzeNmIyVfG83R1W7WI4755HB8oVv7/Ma4lYfQExV0gfZOSjLABRfIEgg/8cAOwBC0gvaY7uprIuzVWnTR1bknUbnWPRSIfUCVfT0Ni9AvU0nTSAc1QnDRC8+CZ99fqRifXysCQRgMHTR+j6qq682+Ko15vBiKFf8Pl/bGqKCq4B82oKRMxqv596xCML1+WWKtWxeJ+nDxuWpG2Fv7WhVe29Lt8/NgKmz0XeltecbxonsIsXVLeY9In8gkDSTTeK/s8Qfg1V7MaPAQDjtGgSHuX+DVbCfO04S81w3qh/ACSNfuKVnbx0+Z2QNQ68nuWQvXWwfhPkfeOM9gh07qysYb+eDIsli8SYfc2SyPzw/iXR1wUkMDZwLNF5mrpVHj4mDieiIz1r74zGj66gGFk= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(136003)(346002)(39840400004)(396003)(376002)(46966005)(36906005)(2906002)(55016002)(478600001)(966005)(82310400003)(110136005)(54906003)(81166007)(47076004)(316002)(70206006)(70586007)(356005)(86362001)(336012)(5660300002)(53546011)(33656002)(52536014)(4326008)(186003)(26005)(8676002)(9686003)(83080400001)(83380400001)(6506007)(7696005)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2020 10:22:06.3355 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d48519aa-c209-4982-2324-08d86d0656af X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5861 Subject: Re: [dpdk-dev] [PATCH v2] eal: add new prefetch write variants 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" > -----Original Message----- > From: dev On Behalf Of Harry van Haaren > Sent: Monday, September 14, 2020 11:10 PM > To: dev@dpdk.org > Cc: pbhagavatula@marvell.com; Harry van Haaren > > Subject: [dpdk-dev] [PATCH v2] eal: add new prefetch write variants >=20 > This commit adds a new rte_prefetch0_write() variants, suggesting to the > compiler to use a prefetch instruction with intention to write. As a comp= iler > builtin, the compiler can choose based on compilation target what the bes= t > implementation for this instruction is. >=20 > Signed-off-by: Harry van Haaren >=20 > --- >=20 > v2: > - Add L1, L2, and L3 variants as ARM64 uarch supports them (Pavan) >=20 > The integer constants passed to the builtin are not available as a #defin= e > value, and doing #defines just for this write variant does not seems a ni= ce > solution to me... particularly for those using IDEs where any #define val= ue is > auto-hinted for code-completion. > --- > lib/librte_eal/include/generic/rte_prefetch.h | 49 +++++++++++++++++++ > 1 file changed, 49 insertions(+) >=20 > diff --git a/lib/librte_eal/include/generic/rte_prefetch.h > b/lib/librte_eal/include/generic/rte_prefetch.h > index 6e47bdfbad..3dfca77a74 100644 > --- a/lib/librte_eal/include/generic/rte_prefetch.h > +++ b/lib/librte_eal/include/generic/rte_prefetch.h > @@ -51,4 +51,53 @@ static inline void rte_prefetch2(const volatile void *= p); > */ > static inline void rte_prefetch_non_temporal(const volatile void *p); >=20 > +/** > + * Prefetch a cache line into all cache levels, with intention to > +write. This > + * prefetch variant hints to the CPU that the program is expecting to > +write to > + * the cache line being prefetched. > + * > + * @param p Address to prefetch > + */ > +static inline void rte_prefetch0_write(const void *p) { > + /* 1 indicates intention to write, 3 sets target cache level to L1. See > + * GCC docs where these integer constants are described in more > detail: > + * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html > + */ > + __builtin_prefetch(p, 1, 3); > +} > + > +/** > + * Prefetch a cache line into all cache levels, except the 0th, with > +intention > + * to write. This prefetch variant hints to the CPU that the program is > + * expecting to write to the cache line being prefetched. > + * > + * @param p Address to prefetch > + */ > +static inline void rte_prefetch1_write(const void *p) { > + /* 1 indicates intention to write, 2 sets target cache level to L2. See > + * GCC docs where these integer constants are described in more > detail: > + * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html > + */ > + __builtin_prefetch(p, 1, 2); > +} > + > +/** > + * Prefetch a cache line into all cache levels, except the 0th and 1st, > +with > + * intention to write. This prefetch variant hints to the CPU that the > +program > + * is expecting to write to the cache line being prefetched. > + * > + * @param p Address to prefetch > + */ > +static inline void rte_prefetch2_write(const void *p) { > + /* 1 indicates intention to write, 1 sets target cache level to L3. See > + * GCC docs where these integer constants are described in more > detail: > + * https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html > + */ > + __builtin_prefetch(p, 1, 1); > +} > + > + > #endif /* _RTE_PREFETCH_H_ */ > -- > 2.17.1 Reviewed-by: Ruifeng Wang