Message ID | Y9AftBkWXcFflHbm@zn.tnic |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2302908wrn; Tue, 24 Jan 2023 10:19:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXtHSe5uytbg6Sbf2eXgb9WuV+zf91u8onxsslMDwBLhs+ljsBJdSLsKqiQJ9JKOZXK3eu3r X-Received: by 2002:a05:6402:3226:b0:498:1ca:80d0 with SMTP id g38-20020a056402322600b0049801ca80d0mr37670939eda.28.1674584398927; Tue, 24 Jan 2023 10:19:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674584398; cv=none; d=google.com; s=arc-20160816; b=Cnsd/LWiIxSiyMZKNK+BvMbctK3PzmvNTBS0hwVBN7J4yL62yhnhjanM3p/TxK7PLF f/y6T8Zn4MTAxjMj8k3aSBiRvtByvec/b1Pipba3+BqUcVkhMdgcKO3ab9fZIwbxBkOD DY0qo6iMRYrPFWgpLXHpjECjFijIxoD7C/c4FOTi+ZOLO4T3o5tOy+1/MLZA23qtYxFw 2Bb2sNWYzoxB09s+xH9LRFpQD11R8H7l7FgAsh+MpTlRRRTsreaTSyYGd8FVr80eITiC lyWKeNk/ix424UDIjB6eWSulgXaAJ9C8NZMT+46kZqb6JyeNcaxtgUwKQ2lS764e/6OZ tm5Q== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3OaM/Y7cpBAJC25XKxOdjIh925a815HwLPCmt8PUDd8=; b=WKvJcDLxKJcP+Es1rSscocycnYhon5TVjNZGg4Jl7AQVUthJoe83q5laGZ1tQXio74 UVzUWibxzMx/Ytwk4sk7pzZ3tOuFxrI4egusF8T0qmMSCox2GDjUhtydsCTVFwWPYGUE 7rOYF66WbOYrqpgDOh/7UchRbzSBInBg9dTiqzw66DK42L5O45Xq6fGnAvLcqNGXAjn1 0rEqj0LM1iTimAblMoknNUclYP0AAFnWFsqTaoeNYUfwOmj14c2Ff8PnjWH14/JIfYBG iVcE96+mnj1d2Xkhs5gI4xIAvIw/F01pe3V/54NbLHYXbachOWHiBdjuVXOqX/QDzAwq cKMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=p3MCMLxU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020aa7d1d9000000b0049eefb19395si3699796edp.330.2023.01.24.10.19.35; Tue, 24 Jan 2023 10:19:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=p3MCMLxU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233809AbjAXSNT (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Tue, 24 Jan 2023 13:13:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233568AbjAXSNQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 24 Jan 2023 13:13:16 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4BDA1B564 for <linux-kernel@vger.kernel.org>; Tue, 24 Jan 2023 10:13:14 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 42AFE1EC052A; Tue, 24 Jan 2023 19:13:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1674583993; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=3OaM/Y7cpBAJC25XKxOdjIh925a815HwLPCmt8PUDd8=; b=p3MCMLxU/XSZCSU4FcOfH7BSFsLViqs0jWglNhNj9YL9CH0VdQ78XOJjxu/3xrO80+jlUU EckGi1HJUI+t2niKhmrv307y1fR4fT3hMyCK4YtYSS5+OfdQgNSBREzzGTa5AXnlR/i9F9 ecPGlkkj9ttT7s96xe1lGeVQS0gUOIs= Date: Tue, 24 Jan 2023 19:13:08 +0100 From: Borislav Petkov <bp@alien8.de> To: Babu Moger <babu.moger@amd.com> Cc: kernel test robot <lkp@intel.com>, llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, x86@kernel.org, Reinette Chatre <reinette.chatre@intel.com> Subject: [PATCH] x86/resctrl: Fix a silly -Wunused-but-set-variable warning Message-ID: <Y9AftBkWXcFflHbm@zn.tnic> References: <202301242015.kbzkVteJ-lkp@intel.com> <Y8/XoT23HVXHSY73@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <Y8/XoT23HVXHSY73@zn.tnic> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755929010969841310?= X-GMAIL-MSGID: =?utf-8?q?1755929010969841310?= |
Series |
x86/resctrl: Fix a silly -Wunused-but-set-variable warning
|
|
Commit Message
Borislav Petkov
Jan. 24, 2023, 6:13 p.m. UTC
From: "Borislav Petkov (AMD)" <bp@alien8.de> clang correctly complains arch/x86/kernel/cpu/resctrl/rdtgroup.c:1456:6: warning: variable \ 'h' set but not used [-Wunused-but-set-variable] u32 h; ^ but it can't know whether this use is innocuous or really a problem. There's a reason why those warning switches are behind a W=1 and not enabled by default - yes, one needs to do: make W=1 CC=clang HOSTCC=clang arch/x86/kernel/cpu/resctrl/ with clang 14 in order to trigger it. I would normally not take a silly fix like that but this one is simple and doesn't make the code uglier so... Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/202301242015.kbzkVteJ-lkp@intel.com --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Comments
Hi Boris, On 1/24/2023 10:13 AM, Borislav Petkov wrote: > From: "Borislav Petkov (AMD)" <bp@alien8.de> > > clang correctly complains > > arch/x86/kernel/cpu/resctrl/rdtgroup.c:1456:6: warning: variable \ > 'h' set but not used [-Wunused-but-set-variable] > u32 h; > ^ > > but it can't know whether this use is innocuous or really a problem. > There's a reason why those warning switches are behind a W=1 and not > enabled by default - yes, one needs to do: > > make W=1 CC=clang HOSTCC=clang arch/x86/kernel/cpu/resctrl/ > > with clang 14 in order to trigger it. > > I would normally not take a silly fix like that but this one is simple > and doesn't make the code uglier so... > > Reported-by: kernel test robot <lkp@intel.com> > Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> > Link: https://lore.kernel.org/r/202301242015.kbzkVteJ-lkp@intel.com > --- Thank you very much. Acked-by: Reinette Chatre <reinette.chatre@intel.com> Reinette
Boris, Thanks for the fix. Tested-by: Babu Moger <babu.moger@amd.com> On 1/24/23 12:13, Borislav Petkov wrote: > From: "Borislav Petkov (AMD)" <bp@alien8.de> > > clang correctly complains > > arch/x86/kernel/cpu/resctrl/rdtgroup.c:1456:6: warning: variable \ > 'h' set but not used [-Wunused-but-set-variable] > u32 h; > ^ > > but it can't know whether this use is innocuous or really a problem. > There's a reason why those warning switches are behind a W=1 and not > enabled by default - yes, one needs to do: > > make W=1 CC=clang HOSTCC=clang arch/x86/kernel/cpu/resctrl/ > > with clang 14 in order to trigger it. > > I would normally not take a silly fix like that but this one is simple > and doesn't make the code uglier so... > > Reported-by: kernel test robot <lkp@intel.com> > Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> > Link: https://lore.kernel.org/r/202301242015.kbzkVteJ-lkp@intel.com > --- > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > index 5990589f8a21..e2c1599d1b37 100644 > --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c > +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > @@ -1453,17 +1453,17 @@ static void mon_event_config_read(void *info) > { > struct mon_config_info *mon_info = info; > unsigned int index; > - u32 h; > + u64 msrval; > > index = mon_event_config_index_get(mon_info->evtid); > if (index == INVALID_CONFIG_INDEX) { > pr_warn_once("Invalid event id %d\n", mon_info->evtid); > return; > } > - rdmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, h); > + rdmsrl(MSR_IA32_EVT_CFG_BASE + index, msrval); > > /* Report only the valid event configuration bits */ > - mon_info->mon_config &= MAX_EVT_CONFIG_BITS; > + mon_info->mon_config = msrval & MAX_EVT_CONFIG_BITS; > } > > static void mondata_config_read(struct rdt_domain *d, struct mon_config_info *mon_info)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 5990589f8a21..e2c1599d1b37 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1453,17 +1453,17 @@ static void mon_event_config_read(void *info) { struct mon_config_info *mon_info = info; unsigned int index; - u32 h; + u64 msrval; index = mon_event_config_index_get(mon_info->evtid); if (index == INVALID_CONFIG_INDEX) { pr_warn_once("Invalid event id %d\n", mon_info->evtid); return; } - rdmsr(MSR_IA32_EVT_CFG_BASE + index, mon_info->mon_config, h); + rdmsrl(MSR_IA32_EVT_CFG_BASE + index, msrval); /* Report only the valid event configuration bits */ - mon_info->mon_config &= MAX_EVT_CONFIG_BITS; + mon_info->mon_config = msrval & MAX_EVT_CONFIG_BITS; } static void mondata_config_read(struct rdt_domain *d, struct mon_config_info *mon_info)