Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2964034ybl; Fri, 20 Dec 2019 01:26:30 -0800 (PST) X-Google-Smtp-Source: APXvYqzA2coGPtBlIGFhwkSz/GYIVafWSgRxg2Vk8LbjoRwMy/SWjcRfxlEejtY8JH2sbCCaBUvD X-Received: by 2002:a05:6830:1e8a:: with SMTP id n10mr3320822otr.303.1576833990267; Fri, 20 Dec 2019 01:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576833990; cv=none; d=google.com; s=arc-20160816; b=HXDsOPHED0DHpdNCtz9G22Gc2KAsYLvX/iJXKC415cbBciITJA+ZlQ7Z/pQy3NoXP7 5uQrcc+qaKcwgA4mEOMhOFk8qP3aJT0JMhrzDL7761wUxy5ho5PPkC6rEJYFfPClfzVo fvqqGF06dVpF6bFuRd27b8JsoGDNNiR/Av2N7dhPEeKq7MP3GoPJJLIwZQEb4qIgJsvp V8LfBPMh3PLP2QVLWLL42oV9HX+yn4Ab2b7AsnjmWHdCHf6fc+cCckWcE8UWDPS6IcnW 0eXHRy568sUcBmFapx2YGivK5+d/9A1yZvj49aN745hQnEuR5MO12HHNTEXA+Zinhgp0 g/GQ== 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:dkim-signature; bh=LsxcLVbBun1f96xBFFfgPOlzuKGlq4r29EdM+SsmX7k=; b=WfoWGidy7Mqe1RXduuhQ+meWOkdtNAxEczjIKTw+60PwMn9XY7J3UeFSvtp3M6YUll SNdnjNgSzMcPcTYWHCEUrUBNSqVbSb9yH/4zfyn41uFJTjQHM3yds59oYoxWc5BpYP+3 W7zngxsDhHlMd5yXokTEAFGEc/JA3I3nQ2r4Ulh8tKRyLPkm3St1NDTOVqGdx5RyDCDh mQJ6F7XZ0nIgBEM2sXOCayvIAznxsIWj73TRpr62SpoydtWxZ38IPuHawGR7SZuSgked JV+51jT8eV2Oxq3S80JwriAn22U6QbQCwfVzQNSmc07eKknt2/LDxIi+fpDuIbJP3xmN fsnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XCSvcuHZ; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p21si2028356otr.58.2019.12.20.01.26.18; Fri, 20 Dec 2019 01:26: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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XCSvcuHZ; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727269AbfLTJZV (ORCPT + 99 others); Fri, 20 Dec 2019 04:25:21 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:28404 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727188AbfLTJZT (ORCPT ); Fri, 20 Dec 2019 04:25:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576833918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LsxcLVbBun1f96xBFFfgPOlzuKGlq4r29EdM+SsmX7k=; b=XCSvcuHZl4fYpSg3+lJGo7wB9zu/5eGQ/Sk161B0dNiEKY/TWOPMT4PKIswsjbfsgWmozX 30WcZ2NxviW42XxYvpMCXrNS4PQvI3F//kMadPHcURTdX5+TGwZjCutY6tAVNbdh0tM9XC VNIv2l6v3eIrXbxeJYOQ8yICFjiWQr0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-DN7bz1JNNq-O5ERHkaPWew-1; Fri, 20 Dec 2019 04:25:17 -0500 X-MC-Unique: DN7bz1JNNq-O5ERHkaPWew-1 Received: by mail-wr1-f70.google.com with SMTP id z15so915952wrw.0 for ; Fri, 20 Dec 2019 01:25:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LsxcLVbBun1f96xBFFfgPOlzuKGlq4r29EdM+SsmX7k=; b=BxhYflSWIamtWaqafq9ptcVlKqEOwwtJFh7/2nEnj/3uSaoRSScv84Ya0DWLDk3uNc jUZ8N6GlYlUzrF4y/V9U9HzH5l20CQavFHpw914qMgY2MTxIe2SHElVGlz0VWYFQHmpA OQisBnJunPs0TROHzgIjae4SUfmAMpGsMLQ6dvVRsjn8kl9BdVEvuQ8nng61oqvNAyZ/ K+XPyJK/MX5cwir6NtfekFws1D9t/FGLLWsK1NW7fV+A2BcMmdkUVNrih5S9oeE8Liyw 7+Ko5DaQ8VTGVR9Yt93+Qr3sJupvdgUsZ3KdCY3j+dm+ud7DzNOLJsPUwqpYryL4sAu3 U7kQ== X-Gm-Message-State: APjAAAU56jsobPB+iDtI6wDjuAl2EVY8OkEGUpxudbdff3X8aUDei+Km SLUiJEf0HfiaJjKfJNyoNQFDRoKuN8DljpevPDyiK968iEyWdKOYkuRBlKR2/n+dack+WA2EyIH Mu0clu8kxFuLKPcA+2FdES3/0 X-Received: by 2002:a05:600c:246:: with SMTP id 6mr15371254wmj.122.1576833916356; Fri, 20 Dec 2019 01:25:16 -0800 (PST) X-Received: by 2002:a05:600c:246:: with SMTP id 6mr15371232wmj.122.1576833916119; Fri, 20 Dec 2019 01:25:16 -0800 (PST) Received: from [192.168.10.150] ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id m7sm9097969wrr.40.2019.12.20.01.25.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Dec 2019 01:25:15 -0800 (PST) Subject: Re: [PATCH v2] kvm/svm: PKU not currently supported To: Sean Christopherson , John Allen Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, rkrcmar@redhat.com, vkuznets@redhat.com References: <20191219201759.21860-1-john.allen@amd.com> <20191219203214.GC6439@linux.intel.com> From: Paolo Bonzini Message-ID: <8a77e3b9-049e-e622-9332-9bebb829bc3d@redhat.com> Date: Fri, 20 Dec 2019 10:25:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191219203214.GC6439@linux.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/12/19 21:32, Sean Christopherson wrote: > 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. > I sort of liked the V1 approach better, in that I liked using set_supported_cpuid but I didn't like *removing* features from it. I think all *_supported() should be removed, and the code moved from __do_cpuid_func() to set_supported_cpuid. For now, however, this one is consistent with other features so I am applying it. Paolo