Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1740045
| From | Josh Triplett <josh@joshtriplett.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] KVM: VMX: check match table |
| Date | 2017-09-26 19:20 +0200 |
| Message-ID | <uu1Gy-7EH-9@gated-at.bofh.it> (permalink) |
| References | <utPvI-81j-15@gated-at.bofh.it> <utPFn-87N-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Sep 25, 2017 at 09:25:38PM -0700, Nick Desaulniers wrote:
> Fixes the warning:
> arch/x86/kvm/vmx.c:64:32: warning: variable 'vmx_cpu_id' is not needed
> and will not be emitted [-Wunneeded-internal-declaration]``
>
> Other callers of MODULE_DEVICE_TABLE() seem to check their second
> argument during driver init with the x86_match_cpu() function, if their
> first argument to MODULE_DEVICE_TABLE() is x86cpu. The documentation
> for x86_match_cpu() seems to agree.
>
> Suggested-by: Josh Triplett <josh@joshtriplett.org>
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
Comments below.
> ---
> arch/x86/kernel/cpu/match.c | 2 +-
> arch/x86/kvm/vmx.c | 7 ++++++-
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c
> index e42117d5f4d7..fb1aeafa5cc7 100644
> --- a/arch/x86/kernel/cpu/match.c
> +++ b/arch/x86/kernel/cpu/match.c
> @@ -5,7 +5,7 @@
> #include <linux/slab.h>
>
> /**
> - * x86_match_cpu - match current CPU again an array of x86_cpu_ids
> + * x86_match_cpu - match current CPU against an array of x86_cpu_ids
This is a good fix as well, but it shouldn't be in the same commit.
> * @match: Pointer to array of x86_cpu_ids. Last entry terminated with
> * {}.
> *
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 6970249c09fc..e1a00b130935 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -12074,7 +12074,12 @@ static struct kvm_x86_ops vmx_x86_ops __ro_after_init = {
>
> static int __init vmx_init(void)
> {
> - int r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx),
> + int r;
> +
> + if (!x86_match_cpu(vmx_cpu_id))
> + return -ENODEV;
Does this make any other checks redundant and removable?
> +
> + r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx),
> __alignof__(struct vcpu_vmx), THIS_MODULE);
> if (r)
> return r;
> --
> 2.11.0
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
unneeded internal declaration Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-09-26 05:10 +0200
Re: unneeded internal declaration Josh Triplett <josh@joshtriplett.org> - 2017-09-26 05:40 +0200
Re: unneeded internal declaration Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-09-26 06:20 +0200
[PATCH] KVM: VMX: check match table Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-09-26 06:30 +0200
Re: [PATCH] KVM: VMX: check match table Josh Triplett <josh@joshtriplett.org> - 2017-09-26 19:20 +0200
Re: [PATCH] KVM: VMX: check match table Paolo Bonzini <pbonzini@redhat.com> - 2017-09-27 14:40 +0200
Re: [PATCH] KVM: VMX: check match table Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-10-01 01:30 +0200
Re: [PATCH] KVM: VMX: check match table kbuild test robot <lkp@intel.com> - 2017-09-27 16:20 +0200
Re: unneeded internal declaration Paolo Bonzini <pbonzini@redhat.com> - 2017-09-27 14:40 +0200
Re: unneeded internal declaration Paolo Bonzini <pbonzini@redhat.com> - 2017-09-27 15:00 +0200
csiph-web