mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
x86/hyperv: Fix unused variable 'msr_val' warning in hv_qlock_wait
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 of the MSR is necessary. The returned value msr_val is not used. Cast it to void to silence this warning. Reference: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Xu Yihang <xuyihang@huawei.com> Link: https://lore.kernel.org/r/20210323024302.174434-1-xuyihang@huawei.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
parent
6bbdc3db76
commit
13c4d4626a
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user