Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6064586imb; Fri, 8 Mar 2019 08:31:06 -0800 (PST) X-Google-Smtp-Source: APXvYqxreW94BZFq62N7nF4ecWG4lhSybORaXurOqZhDAkxIgwNVM4jddv0Ks96ZovdLuvRVo94j X-Received: by 2002:a63:4287:: with SMTP id p129mr295098pga.84.1552062666185; Fri, 08 Mar 2019 08:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552062666; cv=none; d=google.com; s=arc-20160816; b=EaH4IfMvpHBgqCp1KiiJlZZ7KZdCfriQILKvJyFDoekLdngno/zhUwxos4wnIWWEXN PVyDg2ZP0vYTAgv3EF104GtjrfP/455APy3rSnamoCrX2Yt8pV6SYjqYm8u8gxdmIBkT lNcShIzCbfJJKHvxzdN6qSsgBPH0Pide+9UdYl4NTM8C0Vg/xOWe/CznNf7cAyN2qyGz xWyarVekaB8079qrQjnzGyUH5PVTGThUM6FYiY34VKUx+VvWa5twOqpx1fIcDNP4uO7h /TnDmfH1UIFVwcHC2Msz5ZZP8uFJAN/lSWpie3aJj7Fi5f3kCxS3bCjj1tJlEJaAewqF jl/g== 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; bh=ftGzbrze0rPc4KnXWxoZj+hDtkbGQy9Bnrxj99W93pU=; b=yMNp5wY0jM1/DHiL5Jou5i9OJz0OA9IGTUX73QTkW/3ZKBil56n5wskAln1DAkc+wY SrJeqnXQbk3hzaV+Q8Q5FNuzWm+cqFMDVElIdc0EyzVix1Eo90Q9In3taCPHmDRYNr09 QkYx7BrtGy7KpdO6YbKFdj1IDk54M1LTgfbXDPyUljCGz7EnYVVZjqAl2Nxqy+8cT7lE vEdXKmWjSbkslw12mbkc3qeVaTkUoln5C80NR4spzWE5zVYcd09epz8FBoDRkeZ8O1lp S/A0Ogv8dKuSlu7GJp05E95TEN57Dbs+sxCIK/P/B/1woDrsHaRnQxRn0WeIJ3cHWm0N zk/Q== 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 k24si6866537pgj.228.2019.03.08.08.30.49; Fri, 08 Mar 2019 08:31:06 -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 S1726664AbfCHQ2h (ORCPT + 99 others); Fri, 8 Mar 2019 11:28:37 -0500 Received: from mga09.intel.com ([134.134.136.24]:8476 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726446AbfCHQ2h (ORCPT ); Fri, 8 Mar 2019 11:28:37 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2019 08:28:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,456,1544515200"; d="scan'208";a="153281553" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.181]) by fmsmga001.fm.intel.com with ESMTP; 08 Mar 2019 08:28:35 -0800 Date: Fri, 8 Mar 2019 08:28:35 -0800 From: Sean Christopherson To: Yang Weijiang Cc: pbonzini@redhat.com, rkrcmar@redhat.com, jmattson@google.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, mst@redhat.com, yu-cheng.yu@intel.com, Zhang Yi Z , wei.w.wang@intel.com, weijiang.yang@inte.com Subject: Re: [PATCH v3 6/8] KVM:VMX: Load Guest CET via VMCS when CET is enabled in Guest Message-ID: <20190308162835.GB2528@linux.intel.com> References: <20190225132716.6982-1-weijiang.yang@intel.com> <20190225132716.6982-7-weijiang.yang@intel.com> <20190228161715.GF6166@linux.intel.com> <20190228083844.GC12006@local-michael-cet-test.sh.intel.com> <20190301145819.GC22584@linux.intel.com> <20190303122608.GA32013@local-michael-cet-test.sh.intel.com> <20190304184307.GC17120@linux.intel.com> <20190304095640.GA3576@local-michael-cet-test.sh.intel.com> <20190305031202.GI17120@linux.intel.com> <20190304123655.GB4185@local-michael-cet-test.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190304123655.GB4185@local-michael-cet-test.sh.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 04, 2019 at 08:36:55PM +0800, Yang Weijiang wrote: > On Mon, Mar 04, 2019 at 07:12:02PM -0800, Sean Christopherson wrote: > > On Mon, Mar 04, 2019 at 05:56:40PM +0800, Yang Weijiang wrote: > > > Cannot agree with you more! > > > This is some design limitation, but from my point of view, once vmm > > > exposes CET capability to guest via CPUID, it grants the guest kernel freedom to choose > > > which features to be enabled, we don't need to add extra constraints on > > > the usage. > > > > But if KVM allows SHSTK and IBT to be toggled independently then the VMM > > has only exposed SHSTK or IBT, not CET as whole. > > > > Even if SHSTK and IBT are bundled together the guest still has to opt-in > > to enabling each feature. I don't see what we gain by pretending that > > SHSTK/IBT can be individually exposed to the guest, and on the flip side > > doing so creates a virtualization hole. > you almost convinced me ;-), maybe I'll make the feature as a bundle in > next release after check with kernel team. BTW, what do you mean by > saying "create a virtualization hole"? Is it what you stated in above > reply? By "virtualization hole" I mean the guest would be able to use a feature that the virtual CPU model says isn't supported. After rereading the XSS architecture, there's a marginally less crappy option for handling XRSTOR as we could use the XSS_EXIT_BITMAP to intercept XRSTOR if SHSTK != IBT and the guest is restoring CET state, e.g. to ensure the guest isn't setting IA32_PL*_SSP if !SHSTK and isn't setting bits that are effectively reserved in IA32_U_CET. But practically speaking that'd be the same as intercepting XRSTORS unconditionally when the guest is using CET, i.e. it's still going to tank the performance of a guest that uses CET+XSAVES/XRSTORS.