Received: by 10.223.185.116 with SMTP id b49csp4268078wrg; Mon, 26 Feb 2018 14:25:47 -0800 (PST) X-Google-Smtp-Source: AG47ELtWfkioJx3PQCSOVfpdG+4f0fSG/pnKCAl0SOqGjheerw+atJW+VwIR+8tebddKtjg1AwIt X-Received: by 10.98.133.86 with SMTP id u83mr2296849pfd.172.1519683947312; Mon, 26 Feb 2018 14:25:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519683947; cv=none; d=google.com; s=arc-20160816; b=Ahvqp9zo9cjj9EPBpkMUyd+71pCqQWEMpHXRVvRJgQwQIt0FkDrQqxWTGgOlCIhOV1 D+GWfA42jxi6nxJT6iT/kwhIorovAwbBlFFqTL0oG/c/H8NFrA9/NzcyDr0tX8tDC1bm xfuN4LxjqGWmPm70mWXrSudRAXM4aUxKgOaPGhlxmTZglp8jURHcd0E6kYaup4l8I29h x+7PZWYZQBrON92+5MPmT0FT25um8MXETTF6mSgm0bqiPRRW3kGU3jWYzgKZASfwkRtK KulcAFAgoS9PmKNd1ehzqPDj3xDUxQDbaIshz9Opr5hKEw/cS7V61n1E7JuJY1mYFshz 3qBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=DZAchxmFHQRysFw90B39VvKBQ4NCYmSzNxZ8s5nZKQY=; b=ddlLmLDNlVsw6XJ6tjeC+PLKkrUmm4rEPbOzOLAoeJBF48vXgSP5qTarFS0gv9fGw9 bLkytLSpf6yleuIobHGnJuh+pMilTzQIQdomHw6n8Wx8iK6xMDD6w1z80vMJmEOsYuy0 Ql0BTXcam0aQ00DCQaEaS7gtGGXQbm0IzKy+kxUaO5HcdIPKxPUcWBX9YyYRRPGmf/1R T4hXrn5JaHg1ofUtBzjOwCdsycV5D64gfsGXLM3MHyL9ewXo7hNIvhq9lmNqwoBnLFaW G+DbuhmstuZVgAb9Xbgm6a5cl/yQP3nLHMoXRExM8MWDs9Yw/m+bzpHqbFWlJ3m+9Y0x ua5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=vCTQR+bn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f29si3339836pff.364.2018.02.26.14.25.30; Mon, 26 Feb 2018 14:25:47 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=vCTQR+bn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751818AbeBZWYH (ORCPT + 99 others); Mon, 26 Feb 2018 17:24:07 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:47686 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751784AbeBZWYE (ORCPT ); Mon, 26 Feb 2018 17:24:04 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1QMMLOJ060699; Mon, 26 Feb 2018 22:23:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=DZAchxmFHQRysFw90B39VvKBQ4NCYmSzNxZ8s5nZKQY=; b=vCTQR+bnZpYmZhZM7ztYCio7ESeHtFYatT1YNMq5RbgyWPeJT9EvJYNPJH/nOxMlotCE uL+i2ocLVanLG2N8h/60E3nDTPOPKRRVsKzlr/tJt14F1m2hyew1NC8xJi4GAMV66S6q FQ6C8dyQzfnrXahQqoJqv0DzoJS96//k7a+M/38HVFoFa76lh7W65BY3wtyP/78BQe1c iRDxU9Zp1c0xcm5SwqxW8TsEHo93yDNDrUPrZREW5WBSdaHtM6uQRZA9qPhUx35maQQf I/5R9kFxtkEji99wwXR9TbjN7FxsVapX5cdku3+57o+tmgrjxIYQxp9PIzjfZx9Pcigz uA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2gctvd8130-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Feb 2018 22:23:57 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1QMNugb019642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 26 Feb 2018 22:23:56 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1QMNuLl014970; Mon, 26 Feb 2018 22:23:56 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Feb 2018 14:23:56 -0800 Received: by char.us.oracle.com (Postfix, from userid 1000) id 337BC6A09E6; Mon, 26 Feb 2018 17:23:55 -0500 (EST) Date: Mon, 26 Feb 2018 17:23:55 -0500 From: Konrad Rzeszutek Wilk To: Paolo Bonzini , g@char.us.oracle.com Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, David Woodhouse , KarimAllah Ahmed Subject: Re: [PATCH] KVM: VMX: expose the host's ARCH_CAPABILITIES MSR to userspace Message-ID: <20180226222355.GL22024@char.us.oracle.com> References: <1519433546-33879-1-git-send-email-pbonzini@redhat.com> <20180226221300.GK22024@char.us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180226221300.GK22024@char.us.oracle.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8816 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802260281 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 26, 2018 at 05:13:00PM -0500, Konrad Rzeszutek Wilk wrote: > On Sat, Feb 24, 2018 at 01:52:26AM +0100, Paolo Bonzini wrote: > > Use the new MSR feature framework to expose the ARCH_CAPABILITIES MSR to > > userspace. This way, userspace can access the capabilities even if it > > does not have the permissions to read MSRs. > > ... That is good but could you expand a bit of why it would want this? > > I am 99% sure it is due to the lovely spectre_v2 mitigation but > could you include that in the commit message so that in say a year > folks would know what this is? > > Also what branch is this based on? I am not seeing this vmx_get_msr_feature > in kvm/master or kvm/linux-next ? Ah I see you posted them! Sorry for that particular noise. > > > > Signed-off-by: Paolo Bonzini > > --- > > arch/x86/kvm/vmx.c | 12 +++++++++++- > > arch/x86/kvm/x86.c | 1 + > > 2 files changed, 12 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > > index 130fca0ea1bf..99689061e11e 100644 > > --- a/arch/x86/kvm/vmx.c > > +++ b/arch/x86/kvm/vmx.c > > @@ -3228,7 +3228,17 @@ static inline bool vmx_feature_control_msr_valid(struct kvm_vcpu *vcpu, > > > > static int vmx_get_msr_feature(struct kvm_msr_entry *msr) > > { > > - return 1; > > + switch (msr->index) { > > + case MSR_IA32_ARCH_CAPABILITIES: > > + if (!boot_cpu_has(X86_FEATURE_ARCH_CAPABILITIES)) > > + return 1; > > + rdmsrl(msr->index, msr->data); > > + break; > > + default: > > + return 1; > > + } > > + > > + return 0; > > } > > > > /* > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index 54b4ed55945b..e9a8cc9e3b2b 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -1054,6 +1054,7 @@ bool kvm_rdpmc(struct kvm_vcpu *vcpu) > > * can be used by a hypervisor to validate requested CPU features. > > */ > > static u32 msr_based_features[] = { > > + MSR_IA32_ARCH_CAPABILITIES, > > MSR_F10H_DECFG, > > }; > > > > -- > > 1.8.3.1 > >