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 0398743101; Fri, 25 Aug 2023 17:13:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E32B40A7A; Fri, 25 Aug 2023 17:13:13 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 4D56B40695 for ; Fri, 25 Aug 2023 17:13:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692976391; x=1724512391; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=5em4pNWo7+shakKMsgG/msTFK6yRCjJCf9f+asB6RbI=; b=XlwdVsgUOq1+EHMutKn4ySZ+P1JW4O4GmC2YuBkTjl0KPPqjxfoaYmhs XkJ219cwT5kAZNAhj6BI2F04Z7iCGWSwatcXfVld2tcsf03hktsfoDj1o S0L73tJTIhmGvsPXv0HNUUkZKNyUPNNXTW8zRSl+4xltWn9FHk8V1CetQ niH+BvJEkcoa36jBfl45bCH3FaJTDNllqB2rcULdvL20EvAyefAU2axDa jsc0QKkabSEXNtGdl3wS1GQCnK5DcaR9d2k+4UDrrEapho9zYaQf/8PqP xidPj7hrnV4PZLILDjXF16AxzTRd+2gCtiUI7AfsElTCfhmHv34EXhdk/ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10813"; a="461094911" X-IronPort-AV: E=Sophos;i="6.02,201,1688454000"; d="scan'208";a="461094911" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2023 08:13:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10813"; a="984143225" X-IronPort-AV: E=Sophos;i="6.02,201,1688454000"; d="scan'208";a="984143225" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga006.fm.intel.com with ESMTP; 25 Aug 2023 08:13:09 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 25 Aug 2023 08:13:09 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Fri, 25 Aug 2023 08:13:09 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.49) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Fri, 25 Aug 2023 08:13:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O7oXjveZwjpzUt0A6aw3ajam+2JkP/usyLQtaFHPCSg6nRgjtbbMkuYWLfhVG3cTkHwDP29DqZq645yAnewf+JPvvBilKKwhmGzyg0crS5lg0qS82FB61X6vqowuCHQdBI68XAPOdjZQVvdqjz69b2f98+FKsmJp3YwiUYtihKiH8Vhonzrg+4Q6ACGcvG1AMP+2rP/g8V4ous7qfyeYDu3OCJ+4/G31QL/HmacT08fecfcggkMekliq6k1nKF35YMvhsGT52s2F/IIrRPb6CKMUGuw5jlxUWTkfdGZFeFX1FpfR2Q5o7tsrqsvJwAw0BBvfvqX4KmIfBgfZQsvZ1A== 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=UOuqGa27my2RmEPfe9uduFZd1uEEWb8US/UIdJYfhis=; b=jx+eKbG0O+z31TZCQuAC1eLtgF9KowET9OOVpkAV6XfjA3ZPz4ZlJtT1ZERCxePnvfkp4trHCWY9i/8VINOto46nKM96Oj1F2duGXAToqqtfPJPpagJTBh84BE7E1gZ/rAs7yVTEF0M4qQYgkHPkR8ETbq4VoA1EQ7U2myAcUQm7azE/bShbfogg2gRP//jB9iQvt/3cr0XFViMgea50D0Z4/wwbU8l6uwBQfGcvcmyXX3JRwLua9fjegCvq3B8Wd+rfH1qJLbE5SlmSleNufw/PzYLSo1MSphPB/Q10jt8Y86RPr8XwLc0wlwg98kvQ6WSaFrdsRzs4ohMPPvEOGQ== 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 SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Fri, 25 Aug 2023 15:13:07 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::43d1:af60:464:347]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::43d1:af60:464:347%5]) with mapi id 15.20.6699.027; Fri, 25 Aug 2023 15:13:07 +0000 Date: Fri, 25 Aug 2023 16:12:59 +0100 From: Bruce Richardson To: Morten =?iso-8859-1?Q?Br=F8rup?= CC: Tyler Retzlaff , , "Konstantin Ananyev" , Ciara Power , , , Subject: Re: [PATCH v11 05/16] eal: use umonitor umwait and tpause intrinsics Message-ID: References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1691781658-32520-1-git-send-email-roretzla@linux.microsoft.com> <1691781658-32520-6-git-send-email-roretzla@linux.microsoft.com> <98CBD80474FA8B44BF855DF32C47DC35D87B41@smartserver.smartshare.dk> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D87B41@smartserver.smartshare.dk> X-ClientProxiedBy: DB8PR06CA0066.eurprd06.prod.outlook.com (2603:10a6:10:120::40) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: b6724d33-2fd0-4b20-2672-08dba57dc938 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QotDkwSZMrffoiOyW5A7tLugvVIBnfMDVs/6bZ8a2H+3eDa7MwxS/AqGxDt2AYKiOw75JMsBpyGM6EQfmgKkLkzeuCfxsL+9xx3vFLklRMibVh52RAyJazIQACccyFJyKeg54DQMiuGxxifRcnDB0505RNwQvFagb1YRiM1EobBcGq1v6QyodIGKulXFCZXI5NzKRJDYxiWbHp3V1+Beo71dLDAvIk/cwn5AM60tha4UTVDxzl9TBWb88nujIMvuKKvkMh6dXuJ0CZj2quUPaGpptXKh4uYt1jdvYPXWIefvIkeX02feiW/tUZ07qd08YTdqW5n1co0tYA3FqzzbcmCZjXy6WEYyleMF7DrEL1v+LQdgAfekkIB2zmt3IrHDAQDsKwESSlI11wfe+NTdJ/cOaz80/lYpZI2NFVSkxTv6P/2QN81Utdb9N22kstOKNfQjd7Py6UMGLtT74D8bM4YHnP86QqihM2ud4OqmVDHBmGrOBpu5Yg/slXG9u6KluH4bjLjdeSuBsCm2yJGOK+uN6Jpa731BhUQfiJ1qmwoDI4FEgN5Z+NmGTmJpi9AIECR0meQPVumTBZyveYyD6+f3LPF3bYIkdEbQEvbGw6xAZ/W9OrJLkLjhDjdjwINE0XOVmtCHCrBw6L+e4vDlDg== 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:(13230031)(346002)(366004)(39860400002)(376002)(396003)(136003)(1800799009)(451199024)(186009)(6486002)(66946007)(83380400001)(6512007)(107886003)(66574015)(41300700001)(66556008)(66476007)(316002)(6916009)(54906003)(2906002)(8676002)(5660300002)(4326008)(44832011)(8936002)(478600001)(6506007)(6666004)(26005)(82960400001)(86362001)(38100700002)(23180200003)(67856001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?EAWAjLSl4qv4Vm+7N6JkSaHG/afKbjlzCq0MaYqn85pOQ2LA+LoJT7vjjm?= =?iso-8859-1?Q?/xW9xBOsyQtlLhYPYJr7UPv6M7yzW7m34GsPR2SS/BDtqqqgd3iPtnhwVn?= =?iso-8859-1?Q?9hm3GKTbwim7q1zAOoI6CidWHhjKiOBwvm0qisuWg8cXIrB3sSx+Eyuv8g?= =?iso-8859-1?Q?WMGSQxFx1Mf0MOTpHG/1g1ZZFxGjFIcxLpThOPVeQT2tFPGh4JZMmTJ4TS?= =?iso-8859-1?Q?WSLDszR0vf8TbcjvR8bvVGwfhmXH0D4+ct8Gtzy5tE+4z/Pcsl46EwhBkY?= =?iso-8859-1?Q?D1p6Sq86pnstY0/us64AzEykjG9H3KZTgc84Dv+ASRiPPMrHPehAgdPF9c?= =?iso-8859-1?Q?aj200bVUHxUbWjK25r0i27biT4fOZnleljC1zJfIjBz5+QIauU3ybG0tfK?= =?iso-8859-1?Q?1FwnP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P6VwO1KytG6h0YxB8Vo?= =?iso-8859-1?Q?cPLNRlWo7csGZBlGBkJe6Mrxu94nGQT4lKGtsXV+/nBuEHup0TJQERs2kV?= =?iso-8859-1?Q?6YfscpAE+mbAeVc/lW6/2dvEaTrTHVwcK+8vFsA26CmqSJz2YMlFQaupCX?= =?iso-8859-1?Q?6PD2jeYmk/GxgQosT4Vui0+jpgj1jX8QvoE46DK6BUmNIvzedQ4LFcDCQg?= =?iso-8859-1?Q?EHUqY8FL0j+16VWRL4+idMgGlC5lhrbaB7PFIgMH2C0OmuzeRVXw5AyYHr?= =?iso-8859-1?Q?XMGvoj/FuLKrFkw17TxjHmJ+6sMuxe2Wyc1qaAhawL/SaBYr/4NIwMsr63?= =?iso-8859-1?Q?FwVnt7fd+XnQg25lqROR64DIpD1RaQfneRPdd9yujtLUnqdgn0/Wlbnw?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: b6724d33-2fd0-4b20-2672-08dba57dc938 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 15:13:07.1213 (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: /J2+oVtxMH7yU7zYgc2KV092EB4E32Gs0uzFBJ7C0283N5JpngsC1xEgvvxMLen4XHJ/xaSA4LxbEe6Y2wfXmlfAt+RGH4l5vC7v+lhHv1E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 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 Fri, Aug 25, 2023 at 04:56:51PM +0200, Morten Brørup wrote: > > From: Bruce Richardson [mailto:bruce.richardson@intel.com] > > Sent: Friday, 25 August 2023 16.13 > > > > On Fri, Aug 11, 2023 at 12:20:47PM -0700, Tyler Retzlaff wrote: > > > Inline assembly is not supported for MSVC x64 instead use _umonitor, > > > _umwait and _tpause intrinsics. > > > > > > Signed-off-by: Tyler Retzlaff > > > Acked-by: Morten Brørup > > > Acked-by: Konstantin Ananyev > > > --- > > > lib/eal/x86/rte_power_intrinsics.c | 12 ++++++++++++ > > > 1 file changed, 12 insertions(+) > > > > > > diff --git a/lib/eal/x86/rte_power_intrinsics.c > > b/lib/eal/x86/rte_power_intrinsics.c > > > index f749da9..4066d13 100644 > > > --- a/lib/eal/x86/rte_power_intrinsics.c > > > +++ b/lib/eal/x86/rte_power_intrinsics.c > > > @@ -109,9 +109,13 @@ > > > */ > > > > > > /* set address for UMONITOR */ > > > +#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) > > > + _umonitor(pmc->addr); > > > +#else > > > > This change is unfortunately giving build errors on system with WAITPKG, > > since the intrinsics do not take volatile parameters, unlike the inline > > ASM > > which works fine with both volatile and non-volatile variables. This is > > the > > error I see: > > > > ../lib/eal/x86/rte_power_intrinsics.c: In function 'rte_power_monitor': > > ../lib/eal/x86/rte_power_intrinsics.c:113:22: error: passing argument 1 > > of '_umonitor' discards 'volatile' qualifier from pointer target type [- > > Werror=discarded-qualifiers] > > 113 | _umonitor(pmc->addr); > > | ~~~^~~~~~ > > > > The easy fix for now seems to be just dropping the "|| > > defined(__WAITPKG__)" part of the #ifdef, and leave the intrinsic for > > MSVC > > only. > > Any objections? > > I wonder if omitting the "volatile" qualifier is correct for this parameter. Although the authors of _umonitor() apparently think so, I have seen built-ins with questionable qualifiers before, so I wouldn't trust it to be correct. > > Replacing inline assembly with built-ins is generally preferable. So I would prefer if you typecast it away, or temporarily disable that warning. > Simple typecasting doesn't work to remove the warning. However, if we typecast via "uintptr_t" it does seem to work. #if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) - _umonitor(pmc->addr); + uintptr_t addr_val = (uintptr_t)pmc->addr; + _umonitor((void *)addr_val); #else Seems bit clunky to me. If we want a one-line workaround, we can probably use RTE_PTR_ADD to do the typecasting via uintptr_t for us. /Bruce