From patchwork Fri Aug 25 15:28:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 130770 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 74B7643101; Fri, 25 Aug 2023 17:29:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C77440A89; Fri, 25 Aug 2023 17:29:28 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 887B940A7A for ; Fri, 25 Aug 2023 17:29:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692977367; x=1724513367; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=7bjAwnXxzn9YVpSRKAIhFNSGLcMKT154uBZGazaqwG4=; b=N6qEc0ExfxtXtcYmFLvOat/Ihp3RGL0Rgf3UA1hwb2zkcqfCpKlhlkrc gZL4HxkzwbfStTox2k4mwayvPl49p1mZYWeOw970081mGw0QwV+6IEZAO iKdoFhUw2Sq/efQRecN8IPoYc7OmQ32lOJS4vZj7k/aJPmAJaxcGoLIgD LWOKsjsQgZtQibMfb643G20XpT6PHXqURLuM2uWbDI4MNndHB484P0u4i HlroXO5z22yHHiYhPO0kmMyRCMPKNC+eMAnim59CVAcryvevInvRq63by QjwQG4nndCQgjSFsLx11XyR7Lt1mZDVMX6HvOZ/yA15ukCaP7uImCQayc Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10813"; a="441084005" X-IronPort-AV: E=Sophos;i="6.02,201,1688454000"; d="scan'208";a="441084005" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2023 08:28:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10813"; a="772505028" X-IronPort-AV: E=Sophos;i="6.02,201,1688454000"; d="scan'208";a="772505028" Received: from silpixa00401385.ir.intel.com ([10.237.214.14]) by orsmga001.jf.intel.com with ESMTP; 25 Aug 2023 08:28:56 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: mb@smartsharesystems.com, david.marchand@redhat.com, Bruce Richardson , roretzla@linux.microsoft.com Subject: [PATCH] eal/x86: fix build on systems with WAITPKG support Date: Fri, 25 Aug 2023 16:28:50 +0100 Message-Id: <20230825152850.1107690-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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 When doing a build for a system with WAITPKG support and a modern compiler, we get build errors for the "_umonitor" intrinsic, due to the casting away of the "volatile" on the parameter. ../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); | ~~~^~~~~~ We can avoid this issue by using RTE_PTR_ADD(..., 0) to cast the pointer through "uintptr_t" and thereby remove the volatile without warning. We also ensure comments are correct for each leg of the ifdef..else..endif block. Fixes: 60943c04f3bc ("eal/x86: use intrinsics for power management") Cc: roretzla@linux.microsoft.com Signed-off-by: Bruce Richardson Acked-by: Morten Brørup Tested-by: David Marchand --- lib/eal/x86/rte_power_intrinsics.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_intrinsics.c index 4066d1392e..4f0404bfb8 100644 --- a/lib/eal/x86/rte_power_intrinsics.c +++ b/lib/eal/x86/rte_power_intrinsics.c @@ -103,15 +103,15 @@ rte_power_monitor(const struct rte_power_monitor_cond *pmc, rte_spinlock_lock(&s->lock); s->monitor_addr = pmc->addr; - /* - * we're using raw byte codes for now as only the newest compiler - * versions support this instruction natively. - */ - /* set address for UMONITOR */ #if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) - _umonitor(pmc->addr); + /* use RTE_PTR_ADD to cast away "volatile" when using the intrinsic */ + _umonitor(RTE_PTR_ADD(pmc->addr, 0)); #else + /* + * we're using raw byte codes for compiler versions which + * don't support this instruction natively. + */ asm volatile(".byte 0xf3, 0x0f, 0xae, 0xf7;" : : "D"(pmc->addr));