From patchwork Wed Nov 1 21:26:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Luck, Tony" X-Patchwork-Id: 160680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp719327vqx; Wed, 1 Nov 2023 14:26:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCxOAg4ANpJK1ddeknUlRPAvbJE6UnEgHWydBmWKgIGmfprSDgU+9wkk618KIkFiu6Z1+C X-Received: by 2002:a17:90a:1b8e:b0:27f:fcdb:89c1 with SMTP id w14-20020a17090a1b8e00b0027ffcdb89c1mr13103157pjc.41.1698874011117; Wed, 01 Nov 2023 14:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698874011; cv=none; d=google.com; s=arc-20160816; b=lY5xmmXpBkFu7ubd6IzbPG0yX8dYSsy9IKYT0akY421RO4d+UDPzIQsBf4sRz7j7Gf fwmc/5UfWCpRl7DUAYKfoGvuDGqHEEy1gSfiubL+NYYYc2OuZpIuh91WCioE0vKYNnBn W66ROuPFnLvtDbg+7TC9kNbPS2t/GAV9ol3Z44MprQLzS5Z5p0IJ6+gYvADN9vNSLAPM HHZ/8o0rfQk3yd8IXi9hrsUGWx4suyEjXSCYsXrxBr8/WT26ME50G1r5WPzW3+GqkPio KjblvKW7tUTjSSOtLSsgUt8UpIJYc2FaI+494FMyrfDxbF8GAoe/+vqPsWnal++HwlmO 8p1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TYznC4Ba2w7P8whegdh9nfzaur0ZoCXIEwB2uF6027c=; fh=fPeCjUcfyw8i8skiX06N5dr0nnedBh1fpz0K59kWKqo=; b=HLNkfkF5WAAjjonotQtKWJInQHQPcrFn85NjAYUsHhi+IkvkFtpkmp1XiAyD43HG5y IyGJUwJlhEQbzf4tpCMcdoiE0wj+pfidD0K30Az0ZQFBxeantTA+hQCZ4fx0ERGUPJM7 u5Vd3o1voBT+9fbCUSowb8dLclurdsXcT4JrmerAA3ubxcxO+RidqcWRKJqosFFWczO9 hhvNLFp4nwSfEcTrKw8+fhkmGQGFSdtDuv2MQSoik2QWP9Pif99cz1S5dqHjgcWoZbe3 KJcE8TwijWqkZ4yCZ00HUvQwEMVA6ePA47We689ZW0wmRghZRp8GlTIQ0En+lHQxz4wC B8qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=griO7eMp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i10-20020a17090a974a00b0028014e41ff7si1532686pjw.48.2023.11.01.14.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 14:26:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=griO7eMp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 14E8A8194765; Wed, 1 Nov 2023 14:26:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345581AbjKAV03 (ORCPT + 35 others); Wed, 1 Nov 2023 17:26:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345432AbjKAV0Z (ORCPT ); Wed, 1 Nov 2023 17:26:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45E5F122 for ; Wed, 1 Nov 2023 14:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698873977; x=1730409977; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=W/tSw6Scof6Iowi5GgeffcVwE78iqgrLgeV/J7eZZQI=; b=griO7eMpF5cxCy9ltVStBpzPF2mB1vmoZv+Z/MVuusupU7zT53OCpWjS i6Y0sjK0LMpNojeOUIirzA/Y/6WPsW2dOrtdcsIGzwgF1td6hKjlhnurj yRqbsfPCQ6S04UT5iaGf91geIlE/dcb2LFshSw+V9Mge1jh2BZ7QCVINT Y+DxrZdKhJ9xxvhCpXcKgbqLrBx2fb9X2zCriqcCwjUn5yaKzook73ZTo 2TnTzIkvc+C2I876vF/hAmuTVSjnjXAB3yfgB6qpKpJAIKs+fSriY/Sf5 8Fs/ANZCWoULgrNcwthmoMyVG38sb2ds2OQHpjwOj8dCuHNICxxyCm6CD g==; X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="419699894" X-IronPort-AV: E=Sophos;i="6.03,269,1694761200"; d="scan'208";a="419699894" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2023 14:26:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10881"; a="764691693" X-IronPort-AV: E=Sophos;i="6.03,269,1694761200"; d="scan'208";a="764691693" Received: from agluck-desk3.sc.intel.com (HELO agluck-desk3) ([172.25.222.74]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2023 14:26:16 -0700 Date: Wed, 1 Nov 2023 14:26:15 -0700 From: Tony Luck To: "Moger, Babu" Cc: "Yu, Fenghua" , "Chatre, Reinette" , Peter Newman , "x86@kernel.org" , Shaopeng Tan , James Morse , Jamie Iles , Randy Dunlap , "linux-kernel@vger.kernel.org" , "patches@lists.linux.dev" Subject: [PATCH v2] x86/resctrl: Fix unused variable warning in cache_alloc_hsw_probe() Message-ID: References: <20231031220534.37730-1-tony.luck@intel.com> <9e6a979a-48db-4b25-884f-ac8d4c2bb078@amd.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9e6a979a-48db-4b25-884f-ac8d4c2bb078@amd.com> X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 01 Nov 2023 14:26:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781310405072899362 X-GMAIL-MSGID: 1781398514726921398 In a "W=1" build gcc throws a warning: arch/x86/kernel/cpu/resctrl/core.c: In function ‘cache_alloc_hsw_probe’: arch/x86/kernel/cpu/resctrl/core.c:139:16: warning: variable ‘h’ set but not used Fix by switching from wrmsr_safe() to wrmsrl_safe(), and from rdmsr() to rdmsrl() using a single u64 argument for the MSR value instead of the pair of u32 for the high and low halves. Signed-off-by: Tony Luck Reviewed-by: Babu Moger Acked-by: Reinette Chatre --- Changes since v1 (suggested by Babu) Switch both the wrmsr() and rdmsr() to the 64-bit versions. arch/x86/kernel/cpu/resctrl/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 19e0681f0435..d29ebe345de6 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -136,15 +136,15 @@ static inline void cache_alloc_hsw_probe(void) { struct rdt_hw_resource *hw_res = &rdt_resources_all[RDT_RESOURCE_L3]; struct rdt_resource *r = &hw_res->r_resctrl; - u32 l, h, max_cbm = BIT_MASK(20) - 1; + u64 max_cbm = BIT_ULL_MASK(20) - 1, l3_cbm_0; - if (wrmsr_safe(MSR_IA32_L3_CBM_BASE, max_cbm, 0)) + if (wrmsrl_safe(MSR_IA32_L3_CBM_BASE, max_cbm)) return; - rdmsr(MSR_IA32_L3_CBM_BASE, l, h); + rdmsrl(MSR_IA32_L3_CBM_BASE, l3_cbm_0); /* If all the bits were set in MSR, return success */ - if (l != max_cbm) + if (l3_cbm_0 != max_cbm) return; hw_res->num_closid = 4;