From: Paolo Bonzini <pbonzini@redhat.com>
To: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>
Cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: nVMX: allow compiling with W=1
Date: Fri, 28 Feb 2020 10:36:10 +0100 [thread overview]
Message-ID: <96d8eb48-2961-8b85-9687-6bbc27e443a9@redhat.com> (raw)
In-Reply-To: <263441.1582858192@turing-police>
On 28/02/20 03:49, Valdis Klētnieks wrote:
> Compile error with CONFIG_KVM_INTEL=y and W=1:
>
> CC arch/x86/kvm/vmx/vmx.o
> arch/x86/kvm/vmx/vmx.c:68:32: error: 'vmx_cpu_id' defined but not used [-Werror=unused-const-variable=]
> 68 | static const struct x86_cpu_id vmx_cpu_id[] = {
> | ^~~~~~~~~~
> cc1: all warnings being treated as errors
>
> When building with =y, the MODULE_DEVICE_TABLE macro doesn't generate a
> reference to the structure (or any code at all). This makes W=1 compiles
> unhappy.
>
> Wrap both in a #ifdef to avoid the issue.
>
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 40a1467d1655..5c2fc2177b0d 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -65,11 +65,13 @@
> MODULE_AUTHOR("Qumranet");
> MODULE_LICENSE("GPL");
>
> +#ifdef MODULE
> static const struct x86_cpu_id vmx_cpu_id[] = {
> X86_FEATURE_MATCH(X86_FEATURE_VMX),
> {}
> };
> MODULE_DEVICE_TABLE(x86cpu, vmx_cpu_id);
> +#endif
>
> bool __read_mostly enable_vpid = 1;
> module_param_named(vpid, enable_vpid, bool, 0444);
>
Queued, and doing the same for AMD.
Paolo
prev parent reply other threads:[~2020-02-28 9:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 2:49 [PATCH] KVM: nVMX: allow compiling with W=1 Valdis Klētnieks
2020-02-28 9:36 ` 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=96d8eb48-2961-8b85-9687-6bbc27e443a9@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=valdis.kletnieks@vt.edu \
--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