Received: by 10.223.185.116 with SMTP id b49csp4945471wrg; Wed, 7 Mar 2018 03:55:34 -0800 (PST) X-Google-Smtp-Source: AG47ELvPCpnoyzhxTa7dHj/xiRXPhi+RbwLwHwTj2+kP5depZwKZf0ulLKFUki/oFleqLRFgElAE X-Received: by 10.101.91.3 with SMTP id y3mr18086441pgq.149.1520423734449; Wed, 07 Mar 2018 03:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520423734; cv=none; d=google.com; s=arc-20160816; b=E/ProtprHUQpRDfnUhin56B9UteWkh8eHZin2guZ9XjVUdov5i+1uai5XOvWazeJwz hFoH6krw3OqyH80sudDXGYlU4kgCAY0PURp4MYSw1QEGhaOFG+Zcp5tgBw7KCKSmXPyL lH5c3bsKY8Zi8aiWvjXumtJq1kt4X516G4VK5VqUC3vwNDI0jG0niH/R2J7eUkH/kghd hRVZBPu6fvlK4mCvR0/JhB8Yh+6g6uzJBOghN1C1bO/4A7r9CbFRSa17dG8mzMYBsqhO Rt0kQNL0rL9MA0El4akhLv7G4GXBKNWSMBEypIaWTmiUfannlRApMAZgKemeG1OoPKpN VQFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=X+YR82PvMIPnDGErBVy+Vd97RiZw9pE3YFVJieNnJWc=; b=d2RRHrrdfRxiyJ4ep1XXqkxcUG+ACUrTO184VmlRLy+RTdV5NTMINBKS0vfQyddvwE pYtwOqVNoUxQD196PTY7ss3v6Hevb5AQPf247uErp5DryJL0bmqz8/KgTo+7jr/WrzPM ynO6ZyuO9ypypiYr9PPt9wv9daZPKm25gNc2CFpnEUZk8TtJ8gq9uVtMczMzVxC3nj0V zsX+ZnMfzxqM8fFF/TLQDWmT9oAvYA1L2V3DNuF6Up2LDZ18e1lEen1YGWS50v2CCmZs y6X7MItsxT9db+oFogdRa2jxvVmw9cP8kIgKd/6edSDkMPjUc8/+NclkEXXdL44/0hgt 2UQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si11283425pgv.684.2018.03.07.03.55.19; Wed, 07 Mar 2018 03:55:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754366AbeCGLyC (ORCPT + 99 others); Wed, 7 Mar 2018 06:54:02 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38490 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751176AbeCGLx6 (ORCPT ); Wed, 7 Mar 2018 06:53:58 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06476416974F; Wed, 7 Mar 2018 11:53:58 +0000 (UTC) Received: from [10.36.118.61] (unknown [10.36.118.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CAB421102E20; Wed, 7 Mar 2018 11:53:56 +0000 (UTC) Subject: Re: [PATCH] KVM: VMX: expose the host's ARCH_CAPABILITIES MSR to userspace To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Cc: Konrad Rzeszutek Wilk , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, David Woodhouse , KarimAllah Ahmed References: <1519433546-33879-1-git-send-email-pbonzini@redhat.com> <20180226221300.GK22024@char.us.oracle.com> <20180301213205.GB29001@flask> <20180302214212.GB13606@flask> From: Paolo Bonzini Message-ID: <9cad32c8-fdb6-95db-2cd3-a0e3297b1811@redhat.com> Date: Wed, 7 Mar 2018 12:53:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180302214212.GB13606@flask> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 07 Mar 2018 11:53:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 07 Mar 2018 11:53:58 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/2018 22:42, Radim Krčmář wrote: > Ok, sounds good. I've deferred it to rc5 as I think we'll want to use > this to replace the auto setting: I would not bet that it is going to > be safe to expose future bits, so having the userspace always sanitize > the capabilities would be safer (and more in line with what we do with > other MSRs). i.e. this patch would also > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 051dab74e4e9..86ea4a83af1f 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -5740,9 +5740,6 @@ static void vmx_vcpu_setup(struct vcpu_vmx *vmx) > ++vmx->nmsrs; > } > > - if (boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES)) > - rdmsrl(MSR_IA32_ARCH_CAPABILITIES, vmx->arch_capabilities); > - > vm_exit_controls_init(vmx, vmcs_config.vmexit_ctrl); > > /* 22.2.1, 20.8.1 */ I don't know. There are good reasons for both behaviors, and especially the following two for _not_ removing the rdmsr: 1) so far you could just pass the result of KVM_GET_SUPPORTED_CPUID to KVM_SET_CPUID2, and expect the result to be "as close as possible to the host"; 2) having different behavior for VMX and ARCH_CAPABILITIES MSRs would be confusing. I think I'm leaning more towards the following direction: whitelist ARCH_CAPABILITIES, like we do for the AMD LFENCE MSR already, and default the AMD LFENCE MSR to the host value. Thanks, Paolo