Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2378819ybl; Thu, 19 Dec 2019 12:33:06 -0800 (PST) X-Google-Smtp-Source: APXvYqwWLcypybiehWgrW0Lte6a4iKDmgABqLBlppmut0yfg+dxR13L0FKFGoQM112aYuIIlyGVH X-Received: by 2002:a9d:7593:: with SMTP id s19mr10132323otk.219.1576787586119; Thu, 19 Dec 2019 12:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576787586; cv=none; d=google.com; s=arc-20160816; b=moFodf1r0jAMufh6XjcSlAFy9Au8slJBJua3AUzA7LgEA4X2Xrkj2Sg37o8wE7I0II 5/OGu7bfUZMil2BWqucCY/NipbF1UfT2xWhk7Etbe5FvZNtSleiOaJ9NRT4e3BaRHh7X u5ydS8H6D/AXsBy5vUoBOFHdyhMtlFJ95SlcKAcOpImiKTCn5vVNlCVA0hhCYgly/AEg OCVY4xp0IDP6VtSQSR3yNEua7Awudyin9CnCX6FVwtpnF1GKGFSqeD7EabsUatvic769 fyGnXTzMib8RaK/CYOTUPCtGW1E9aP5+4Y2yvKImtWr0fYYMf1gRZUFO/WIYeT4PufHC Wx9w== 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=J/A1P79yAdnacoY5haslt/28qG9YZXehFMIWlhPp0SM=; b=mRW6NZeS423I1TC+ddUCFUawd8nMZNoS3JGxL4YEL59JFa4dHa7MZqMYHSQCc2qF9V a3twMSVMoKe42nOv8hQMBy3dalf+2Z6iHw00qBYMx7sHVSS4OCIrOmHYNZD56zGHMz7G oxGN9Mh+bF/Va6dGkU9BZQsgOs8ja2vwFZ3F6Hb5tbFLoWaj90SfsJSMunkRS+ycMEEU +IGFea8kTIN9n8PbWAr0Yotyzi3ppcwA8wmV5pC0x/bymVzR6OoQyVvenLXy3R8G79+h SuI5TfsKDb10SbJM7r3h/mD0sXyT70n9xBPIzGEtx7z1zYtxtYGXP+uAS+QrWaxT4vk8 GdXw== 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 8si3633683ota.266.2019.12.19.12.32.54; Thu, 19 Dec 2019 12:33: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 S1727180AbfLSUcP (ORCPT + 99 others); Thu, 19 Dec 2019 15:32:15 -0500 Received: from mga12.intel.com ([192.55.52.136]:34389 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726906AbfLSUcP (ORCPT ); Thu, 19 Dec 2019 15:32:15 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2019 12:32:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,333,1571727600"; d="scan'208";a="228370439" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by orsmga002.jf.intel.com with ESMTP; 19 Dec 2019 12:32:14 -0800 Date: Thu, 19 Dec 2019 12:32:14 -0800 From: Sean Christopherson To: John Allen Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, vkuznets@redhat.com Subject: Re: [PATCH v2] kvm/svm: PKU not currently supported Message-ID: <20191219203214.GC6439@linux.intel.com> References: <20191219201759.21860-1-john.allen@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191219201759.21860-1-john.allen@amd.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 Thu, Dec 19, 2019 at 02:17:59PM -0600, John Allen wrote: > Current SVM implementation does not have support for handling PKU. Guests > running on a host with future AMD cpus that support the feature will read > garbage from the PKRU register and will hit segmentation faults on boot as > memory is getting marked as protected that should not be. Ensure that cpuid > from SVM does not advertise the feature. > > Signed-off-by: John Allen > --- > v2: > -Introduce kvm_x86_ops->pku_supported() I like the v1 approach better, it's less code to unwind when SVM gains support for virtualizaing PKU. The existing cases of kvm_x86_ops->*_supported() in __do_cpuid_func() are necessary to handle cases where it may not be possible to expose a feature even though it's supported in hardware, host and KVM, e.g. VMX's separate MSR-based features and PT's software control to hide it from guest. In this case, hiding PKU is purely due to lack of support in KVM. The SVM series to enable PKU can then delete a single line of SVM code instead of having to go back in and do surgery on x86 and VMX.