From: Paolo Bonzini <pbonzini@redhat.com>
To: "David Hildenbrand" <david@redhat.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Jim Mattson <jmattson@google.com>,
Wanpeng Li <wanpengli@tencent.com>,
Sean Christopherson <sean.j.christopherson@intel.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: kvm: hide the unused 'cpu' variable
Date: Wed, 4 Apr 2018 19:00:35 +0200 [thread overview]
Message-ID: <62c54f4b-a9f9-9f0c-bbd9-671b29722b97@redhat.com> (raw)
In-Reply-To: <9fb67f72-6bb9-d5e5-120a-1abf51449734@redhat.com>
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>
>
prev parent reply other threads:[~2018-04-04 17:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-04 10:44 Arnd Bergmann
2018-04-04 11:51 ` David Hildenbrand
2018-04-04 17:00 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=62c54f4b-a9f9-9f0c-bbd9-671b29722b97@redhat.com \
--to=pbonzini@redhat.com \
--cc=arnd@arndb.de \
--cc=david@redhat.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®