Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5508317imb; Thu, 7 Mar 2019 17:58:30 -0800 (PST) X-Google-Smtp-Source: APXvYqw32+9JQwA4dhsiu6WgZs71HMRstN3yJ7OiYmXrRxObdxvxyLbZgdHvpI4kSpAJT5sWO41M X-Received: by 2002:a63:29c9:: with SMTP id p192mr14440028pgp.176.1552010310110; Thu, 07 Mar 2019 17:58:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552010310; cv=none; d=google.com; s=arc-20160816; b=BTGM7IG3iLspdaQ4Iu4VxPv85Zrhh8uw7Ton6MZYH9eJaC8OgD7L0hDP+Jls8bXgDl 4cOyV2+9RaxFzjddOpY4m6ffSBatt1IcUE1YHEiQ8K5ac6Btp0qUiO7RqulGyzQXVqTQ BmSp4qNMy1U8YpCknYC4NQ8Aon9ztlqJAmhVEI1fM0bqG+R4NS1giakONaxfZ7UIRj4n FyCNfxcROVB49HXcGuxuy0MhJj7ADyVFGQAtyrgdCI8gynWicShALK2kwB/h3RAFc/vh +yAuWOVZWH/cUkPV2ESKvgKKqzG3ccEg5TvweDjCzRESRd+ZYM/3F4DWL/lpynEUogsE S7qQ== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=ijjf4GvPVX1yar9oB5+ogLz1Zvit3tTq4ys/yHVzR/o=; b=kcXtlvwm4oiV4rFpak8kODk+200ed1vIcHXNhFBzoB7wMG9g9cYpxq86NXV6zkdtfA 6wgQkPjhmmX2H9jWijxVVfZQeKypke5PdYs/u7oBqaA7UMnUHCnXLb4+QkYnBDBWcOlA AaV1AB982ikpnkQyTSAeFxAMoJZu4TyY6l2mtDojbTU8E2J61o6XsqdIVwAqmiLRupNy s3rlMAR8qJwW6V6kheyrHZwQdSSMAGXAk2LZnggpZT+2KAZe1uvm2V9W8OSUTnzApRL0 BdVmkcA8xZwCiymGurqCSvFKxioJunRCwdqoL4JGCw2nNAevjhWMxl5X4IJ4pJpDZB14 srFg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12si5874096pli.428.2019.03.07.17.58.12; Thu, 07 Mar 2019 17:58:30 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726309AbfCHB4c (ORCPT + 99 others); Thu, 7 Mar 2019 20:56:32 -0500 Received: from mga18.intel.com ([134.134.136.126]:27470 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbfCHB4c (ORCPT ); Thu, 7 Mar 2019 20:56:32 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Mar 2019 17:56:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,454,1544515200"; d="scan'208";a="129808401" Received: from lxy-dell.sh.intel.com ([10.239.159.147]) by fmsmga008.fm.intel.com with ESMTP; 07 Mar 2019 17:56:29 -0800 Message-ID: <1622bef446a79151c78960f61674495b0857b716.camel@linux.intel.com> Subject: Re: [PATCH] kvm/x86/vmx: Make the emulation of MSR_IA32_ARCH_CAPABILITIES only for vmx From: Xiaoyao Li To: Paolo Bonzini , Sean Christopherson Cc: Radim =?UTF-8?Q?Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 08 Mar 2019 09:53:14 +0800 In-Reply-To: <55caabc3-e075-3282-a000-88356ddb15c2@redhat.com> References: <20190307093143.77182-1-xiaoyao.li@linux.intel.com> <20190307173744.GB4986@linux.intel.com> <55caabc3-e075-3282-a000-88356ddb15c2@redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-2.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-03-07 at 19:15 +0100, Paolo Bonzini wrote: > On 07/03/19 18:37, Sean Christopherson wrote: > > On Thu, Mar 07, 2019 at 05:31:43PM +0800, Xiaoyao Li wrote: > > > At present, we report F(ARCH_CAPABILITIES) for x86 arch(both vmx and svm) > > > unconditionally, but we only emulate this MSR in vmx. It will cause #GP > > > while guest kernel rdmsr(MSR_IA32_ARCH_CAPABILITIES) in an AMD host. > > > > > > Since MSR IA32_ARCH_CAPABILITIES is an intel-specific MSR, it makes no > > > sense to emulate it in svm. Thus this patch chooses to only emulate it > > > for vmx, and moves the related handling to vmx related files. > > > > What about emulating the MSR on an AMD host for testing purpsoes? It > > might be a useful way for someone without Intel hardware to test spectre > > related flows. > > > > In other words, an alternative to restricting emulation of the MSR to > > Intel CPUS would be to move MSR_IA32_ARCH_CAPABILITIES handling into > > kvm_{get,set}_msr_common(). Guest access to MSR_IA32_ARCH_CAPABILITIES > > is gated by X86_FEATURE_ARCH_CAPABILITIES in the guest's CPUID, e.g. > > RDMSR will naturally #GP fault if userspace passes through the host's > > CPUID on a non-Intel system. > > This is also better because it wouldn't change the guest ABI for AMD > processors. Dropping CPUID flags is generally not a good idea. > > Paolo Hi, Paolo and Sean, OK, as you think it's better to emulate MSR ARCH_CAPABILITIES on all x86 host, so should I make the same to MSR CORE_CAPABILITY? If so, I will make it for our v5 patches of split lock detection to emualte MSR CORE_CAPABILITY in this way. Thanks, Xiaoyao