Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752805AbdI0MgP (ORCPT ); Wed, 27 Sep 2017 08:36:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41964 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751959AbdI0MgO (ORCPT ); Wed, 27 Sep 2017 08:36:14 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AC0FC81E01 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH] KVM: VMX: check match table To: Josh Triplett , Nick Desaulniers Cc: kay@vrfy.org, avi@redhat.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20170926042540.10100-1-nick.desaulniers@gmail.com> <20170926171219.ulnknakiohm2whpd@x> From: Paolo Bonzini Message-ID: <498ed7dc-41b2-a075-cdce-e63a80842d39@redhat.com> Date: Wed, 27 Sep 2017 14:36:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170926171219.ulnknakiohm2whpd@x> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 27 Sep 2017 12:36:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 865 Lines: 30 On 26/09/2017 19:12, Josh Triplett wrote: >> 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? It would make sense to place it in cpu_has_kvm_support instead, and the same in svm.c's has_svm. But there's a lot of pointless indirection to clean up there... Paolo >> + >> + r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx), >> __alignof__(struct vcpu_vmx), THIS_MODULE); >> if (r) >> return r; >> --