* [PATCH] x86: kvm: hide the unused 'cpu' variable
@ 2018-04-04 10:44 Arnd Bergmann
2018-04-04 11:51 ` David Hildenbrand
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2018-04-04 10:44 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář,
Thomas Gleixner, Ingo Molnar, x86
Cc: Arnd Bergmann, H. Peter Anvin, Jim Mattson, David Hildenbrand,
Wanpeng Li, Sean Christopherson, Vitaly Kuznetsov, kvm,
linux-kernel
The local variable was newly introduced but is only accessed in one
place on x86_64, but not on 32-bit:
arch/x86/kvm/vmx.c: In function 'vmx_save_host_state':
arch/x86/kvm/vmx.c:2175:6: error: unused variable 'cpu' [-Werror=unused-variable]
This puts it into another #ifdef.
Fixes: 35060ed6a1ff ("x86/kvm/vmx: avoid expensive rdmsr for MSR_GS_BASE")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/kvm/vmx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 8307f625ea99..7399a4a17f78 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2357,7 +2357,9 @@ static unsigned long segment_base(u16 selector)
static void vmx_save_host_state(struct kvm_vcpu *vcpu)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
+#ifdef CONFIG_X86_64
int cpu = raw_smp_processor_id();
+#endif
int i;
if (vmx->host_state.loaded)
--
2.9.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] x86: kvm: hide the unused 'cpu' variable
2018-04-04 10:44 [PATCH] x86: kvm: hide the unused 'cpu' variable Arnd Bergmann
@ 2018-04-04 11:51 ` David Hildenbrand
2018-04-04 17:00 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: David Hildenbrand @ 2018-04-04 11:51 UTC (permalink / raw)
To: Arnd Bergmann, Paolo Bonzini, Radim Krčmář,
Thomas Gleixner, Ingo Molnar, x86
Cc: H. Peter Anvin, Jim Mattson, Wanpeng Li, Sean Christopherson,
Vitaly Kuznetsov, kvm, linux-kernel
On 04.04.2018 12:44, Arnd Bergmann wrote:
> The local variable was newly introduced but is only accessed in one
> place on x86_64, but not on 32-bit:
>
> arch/x86/kvm/vmx.c: In function 'vmx_save_host_state':
> arch/x86/kvm/vmx.c:2175:6: error: unused variable 'cpu' [-Werror=unused-variable]
>
> This puts it into another #ifdef.
>
> Fixes: 35060ed6a1ff ("x86/kvm/vmx: avoid expensive rdmsr for MSR_GS_BASE")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/x86/kvm/vmx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 8307f625ea99..7399a4a17f78 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -2357,7 +2357,9 @@ static unsigned long segment_base(u16 selector)
> static void vmx_save_host_state(struct kvm_vcpu *vcpu)
> {
> struct vcpu_vmx *vmx = to_vmx(vcpu);
> +#ifdef CONFIG_X86_64
> int cpu = raw_smp_processor_id();
> +#endif
> int i;
>
> if (vmx->host_state.loaded)
>
Can't we get rid of the variable and just do it inline?
Anyhow, fixes the problem
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] x86: kvm: hide the unused 'cpu' variable
2018-04-04 11:51 ` David Hildenbrand
@ 2018-04-04 17:00 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2018-04-04 17:00 UTC (permalink / raw)
To: David Hildenbrand, Arnd Bergmann, Radim Krčmář,
Thomas Gleixner, Ingo Molnar, x86
Cc: H. Peter Anvin, Jim Mattson, Wanpeng Li, Sean Christopherson,
Vitaly Kuznetsov, kvm, linux-kernel
On 04/04/2018 13:51, David Hildenbrand wrote:
> On 04.04.2018 12:44, Arnd Bergmann wrote:
>> The local variable was newly introduced but is only accessed in one
>> place on x86_64, but not on 32-bit:
>>
>> arch/x86/kvm/vmx.c: In function 'vmx_save_host_state':
>> arch/x86/kvm/vmx.c:2175:6: error: unused variable 'cpu' [-Werror=unused-variable]
>>
>> This puts it into another #ifdef.
>>
>> Fixes: 35060ed6a1ff ("x86/kvm/vmx: avoid expensive rdmsr for MSR_GS_BASE")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> arch/x86/kvm/vmx.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 8307f625ea99..7399a4a17f78 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -2357,7 +2357,9 @@ static unsigned long segment_base(u16 selector)
>> static void vmx_save_host_state(struct kvm_vcpu *vcpu)
>> {
>> struct vcpu_vmx *vmx = to_vmx(vcpu);
>> +#ifdef CONFIG_X86_64
>> int cpu = raw_smp_processor_id();
>> +#endif
>> int i;
>>
>> if (vmx->host_state.loaded)
>>
>
> Can't we get rid of the variable and just do it inline?
Neither is particularly nice, but one thing we can do is simplify the
#ifdef maze by combining conditionals that have no code in between.
Paolo
> Anyhow, fixes the problem
>
> Reviewed-by: David Hildenbrand <david@redhat.com>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-04 17:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 10:44 [PATCH] x86: kvm: hide the unused 'cpu' variable Arnd Bergmann
2018-04-04 11:51 ` David Hildenbrand
2018-04-04 17:00 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®