Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3907807pxf; Mon, 22 Mar 2021 19:45:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWgmSmtsv3c+F/Vm0hCEuAmVGRG41g9fIJhh+sgm+yV/kaMSX/RZqaHQExT+Vp/Zh6Rtpq X-Received: by 2002:a17:906:2ac1:: with SMTP id m1mr2658002eje.472.1616467503906; Mon, 22 Mar 2021 19:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616467503; cv=none; d=google.com; s=arc-20160816; b=gDq8urvffcN5Cf9suKM17gBlELkTJOSi7S55c4d/SqQ4wSTVoFuAyiw65mCyZFrMTj 5eUY0vlGC04ujEEwdtJm33qd7ANi/wKnSJ5mz2NY0o2AlJi562OfgKsJk8i3cBku9/eN AQDmgVdIyfQIrAJ4hgBGqjoRqo7xdyEYE6QHkzOyYOCs1iHDwaQabJjM5rn1dPZjHuWI A/6rSCYsOoN67lpiz6YcnUZTaszcGYEGcfOuhCAU5ebvWvB8CPFTKAsUsshsuNlj5ikY 3HvTs2Iys3apWU2TuhfY7nGcYENmD48nqmO1GYPSqoP01DdXtUcoTeGaSZdH4HTAPO4p YRyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=VPIZFTi5uoOOsJ8ssiNmLpIIc4td8jakIo+3T6ouA00=; b=L5pvLikp9PipafZgnb/AcaMt2H6ehNMRZQFZU53IovQIxsjkga4cmSWL1+G5QCXdOt 53UkSuN3dwJpNqnPcuOnl5Rq3Biz7DhuxVfZ4mZFVRhJDHy8BpfDenNfn/U2ZAJnoXmC BPXbPSB+5vf86IFUD/Hm23V2MtJJ5u7Qj1t1pQUF6A9hoWnmvjyRe4VJWlyK5KY31yB1 sfMdMXAj+5YJqA7mNSQpaUiclHQVjAyqbHXq8ER1E37wO6sHsDXzgjs3BJM5Q1CJx9aL fn16hjncOqT4QR1Dm88C2l6B7UxFyup+L1smw24yvEB3hDrbVJfgGkQCoMt54pzEeWUQ WjFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bl1si2444291ejb.408.2021.03.22.19.44.41; Mon, 22 Mar 2021 19:45:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229548AbhCWCnh (ORCPT + 99 others); Mon, 22 Mar 2021 22:43:37 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:14062 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229673AbhCWCnU (ORCPT ); Mon, 22 Mar 2021 22:43:20 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4F4FwZ1bCpzNqR6; Tue, 23 Mar 2021 10:40:46 +0800 (CST) Received: from vm-Yoda-Ubuntu1804.huawei.com (10.67.174.59) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Tue, 23 Mar 2021 10:43:08 +0800 From: Xu Yihang To: , , , , , , CC: , , , , Subject: [PATCH -next] x86: Fix unused variable 'msr_val' warning Date: Tue, 23 Mar 2021 10:43:02 +0800 Message-ID: <20210323024302.174434-1-xuyihang@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210322031713.23853-1-xuyihang@huawei.com> References: <20210322031713.23853-1-xuyihang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.174.59] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes the following W=1 kernel build warning(s): arch/x86/hyperv/hv_spinlock.c:28:16: warning: variable ‘msr_val’ set but not used [-Wunused-but-set-variable] unsigned long msr_val; As Hypervisor Top-Level Functional Specification states in chapter 7.5 Virtual Processor Idle Sleep State, "A partition which possesses the AccessGuestIdleMsr privilege (refer to section 4.2.2) may trigger entry into the virtual processor idle sleep state through a read to the hypervisor-defined MSR HV_X64_MSR_GUEST_IDLE". That means only a read is necessary, msr_val is not uesed, so potentially cast to void in order to silent this warning. Reference: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs Reported-by: Hulk Robot Signed-off-by: Xu Yihang --- arch/x86/hyperv/hv_spinlock.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/hyperv/hv_spinlock.c b/arch/x86/hyperv/hv_spinlock.c index f3270c1fc48c..91cfe698bde0 100644 --- a/arch/x86/hyperv/hv_spinlock.c +++ b/arch/x86/hyperv/hv_spinlock.c @@ -25,7 +25,6 @@ static void hv_qlock_kick(int cpu) static void hv_qlock_wait(u8 *byte, u8 val) { - unsigned long msr_val; unsigned long flags; if (in_nmi()) @@ -48,8 +47,13 @@ static void hv_qlock_wait(u8 *byte, u8 val) /* * Only issue the rdmsrl() when the lock state has not changed. */ - if (READ_ONCE(*byte) == val) + if (READ_ONCE(*byte) == val) { + unsigned long msr_val; + rdmsrl(HV_X64_MSR_GUEST_IDLE, msr_val); + + (void)msr_val; + } local_irq_restore(flags); } -- 2.17.1