Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1246254imm; Fri, 27 Jul 2018 13:47:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfvVBqGjAOLM0GTObGc2oJ00qVpXK1fmu2qo1sRkk889vF3pEBCOYObij5cs/IhnO+9fEUv X-Received: by 2002:a62:3a5b:: with SMTP id h88-v6mr8097430pfa.61.1532724473272; Fri, 27 Jul 2018 13:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532724473; cv=none; d=google.com; s=arc-20160816; b=cmt5PFUJMd48qUEYg6bu8qbOxiYrPBEfPc5qPVqlxmsevILBeHBmMnTnyoxLU9xLKl s6VEj5OGm94SIZO+UxLpCipvrGn6jEV/RFYB50sHnAM79Nr5QVk9UkJ29QXonbjjFLPD TwgivO6y1KrCjxeeboOU7cPI+IrlCV5JVeWJiDs3KG1xTxLCbo7iQSiX4RA7xUqlCSWX +sm1vHy8I80wCa662ceIzrsN3ajUwXKhoRS52PMo316DwbZDfMCrKOYLep3mgh5PGyWu PLgM9VYyII9Aa339L769rR/E0g0exd/80+VHj0bjkSs0oQCrWw6eYSM1I61xijWB5qxC fiUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=RsX8RTCn6/cO8NIE+mAWEJg/Q8Os81gZ7TxKhJQu0cg=; b=YKl+PR88+5EpDpmIIapk2LEtYsE5Mh/U4hFyn3A/AFh/YaiF3ZTe0AJFVE5oCtv8Hg pifxxVoZltSrQvzHj0fL3FA/WeW7eEMOf5xgWQq+/jobWZeggUQbtVBc9xR3FqMW9MjE 8oN1edpdPDgwiEJTGVSrBLCisJRR8b83CWkBBMOyGxgn0H3Za1vHQDIKAONKQGTu4J0n d+ZLknk3K0Umgu8lqmFHsP1gML0sCLYr7X4nTIcooyuvV0So+NBOd7zh9CLRpHfJsqie Ia90vyadViKFMer+FVRB3l8PiptC3BC0U2ruah98JEI3KE+M0wwCpDNB+SGewHNuhPIU xRWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=oxvgiyIC; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si4305321pgi.500.2018.07.27.13.47.27; Fri, 27 Jul 2018 13:47:53 -0700 (PDT) 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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=oxvgiyIC; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389561AbeG0WJp (ORCPT + 99 others); Fri, 27 Jul 2018 18:09:45 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44512 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389368AbeG0WJp (ORCPT ); Fri, 27 Jul 2018 18:09:45 -0400 Received: by mail-pg1-f193.google.com with SMTP id r1-v6so3867717pgp.11 for ; Fri, 27 Jul 2018 13:46:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RsX8RTCn6/cO8NIE+mAWEJg/Q8Os81gZ7TxKhJQu0cg=; b=oxvgiyICCqiUMQEtCTIXZoVgX5fx7IR1bWBtVf2wZRuRxS451GrCyq2pAamkrWSsze EY0m/sLkr5BfiCIsIwIeDuIbp+0/Z1vWAhb+i+DTlGA7ZcsWtqNViMuMLp9OB7cTQZtp F/mDjN+R4rRCgGXm08WDY/8/cHJh7slY07S8mW4OSdSCb7Q1IXV+hHVG+xC19acmf0S1 tR/1bJilenNkXl/xGiOImGKDagcM7BiKRF3HYSC7Zz94nEPeFkG/Q7eQZqjvfq6PIox5 WzcdDlpFXTyEyXvGkNAx+TU1lKQAwiA18mJxx/nqO2Neowa9s2BJMdZ2rbOWnISs30cs gbAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=RsX8RTCn6/cO8NIE+mAWEJg/Q8Os81gZ7TxKhJQu0cg=; b=S6GUvMQPlQh4JV7++eTtpSibCzQnS7FsyAVNFe1SLs5f4EFEj833Cm3ycthaaVsfSL QPMyUfMUUZOyQDiQWe95HxXuf6gLzmm6KOvPIkSXkVDrt7UUK9NANrz8qhCxKz4iAJ4q 0RbFKaD3Ff1Lyn7SPli6/jYfWgNThcmUU/POW4VC/ZMiAlamtwi4cpppnzDBdcjbtfbS EIzEhzSWm0V6lBL4Q7kj7iMUS9Vtvvq4kTmyLSy/eemBC8AtsUZWuDyjYm+CRat2XpJn Fm7WE6In5PqhN06XxQVRq5XKFArDAome1rABeZ2TAO16OC7kGlHP/FYvZ5rk4X3mfynT Q6gQ== X-Gm-Message-State: AOUpUlGxulRODV/ZOQr1qI9TNZcW9GSven4hfDhByI/+/XDU0a4kXit+ B1v1Cg6jRrAuY9gMGI19ABDWzw== X-Received: by 2002:a63:ac57:: with SMTP id z23-v6mr7203192pgn.74.1532724370107; Fri, 27 Jul 2018 13:46:10 -0700 (PDT) Received: from ?IPv6:2600:1010:b060:8c99:8451:6653:eac8:e7c1? ([2600:1010:b060:8c99:8451:6653:eac8:e7c1]) by smtp.gmail.com with ESMTPSA id g85-v6sm14032573pfk.39.2018.07.27.13.46.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 13:46:08 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v14 8/9] KVM: x86: virtualize cpuid faulting From: Andy Lutomirski X-Mailer: iPhone Mail (15G77) In-Reply-To: Date: Fri, 27 Jul 2018 13:46:06 -0700 Cc: Andy Lutomirski , Kyle Huey , Robert O'Callahan , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , X86 ML , Paolo Bonzini , =?utf-8?Q?Radim_Kr=C4=8Dm=C3=A1=C5=99?= , Jeff Dike , Richard Weinberger , Alexander Viro , Shuah Khan , Dave Hansen , Borislav Petkov , Peter Zijlstra , Boris Ostrovsky , Len Brown , "Rafael J. Wysocki" , Dmitry Safonov , David Matlack , Nadav Amit , Andi Kleen , LKML , user-mode-linux-devel@lists.sourceforge.net, "open list:USER-MODE LINUX (UML)" , Linux FS Devel , "open list:KERNEL SELFTEST FRAMEWORK" , kvm list Content-Transfer-Encoding: quoted-printable Message-Id: <6F48D384-B29C-41B4-83F1-B02FC2480205@amacapital.net> References: <20170208080917.24320-1-khuey@kylehuey.com> <20170208080917.24320-9-khuey@kylehuey.com> To: Jim Mattson Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 27, 2018, at 1:28 PM, Jim Mattson wrote: >=20 >> On Fri, Jul 27, 2018 at 12:41 PM, Andy Lutomirski wrote= : >>> On Wed, Feb 8, 2017 at 12:09 AM, Kyle Huey wrote: >>> Hardware support for faulting on the cpuid instruction is not required t= o >>> emulate it, because cpuid triggers a VM exit anyways. KVM handles the re= levant >>> MSRs (MSR_PLATFORM_INFO and MSR_MISC_FEATURES_ENABLE) and upon a >>> cpuid-induced VM exit checks the cpuid faulting state and the CPL. >>> kvm_require_cpl is even kind enough to inject the GP fault for us. >>>=20 >>> Signed-off-by: Kyle Huey >>> Reviewed-by: David Matlack >>> --- >>> ... >>> @@ -7613,16 +7636,19 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool i= nit_event) >>>=20 >>> kvm_clear_async_pf_completion_queue(vcpu); >>> kvm_async_pf_hash_reset(vcpu); >>> vcpu->arch.apf.halted =3D false; >>>=20 >>> if (!init_event) { >>> kvm_pmu_reset(vcpu); >>> vcpu->arch.smbase =3D 0x30000; >>> + >>> + vcpu->arch.msr_platform_info =3D MSR_PLATFORM_INFO_CPUID= _FAULT; >>> + vcpu->arch.msr_misc_features_enables =3D 0; >>=20 >> Jim, I assume you're worried about this bit? It seems like >> msr_platform_info should maybe be initialized to zero to avoid causing >> an unintended migration issue. >=20 > Initializing this bit to zero helps with migration, but then if the > CPUID faulting bits in both MSRs are set, userspace has to take pains > to ensure that MSR_PLATFORM_INFO is restored first, or the > MSR_MISC_FEATURES_ENABLES value will be rejected. The code could drop the constraint and just let the entry possibly fail if t= he MSRs are set wrong >=20 > I'm also concerned about the 0 in the "Maximum Non-Turbo Ratio" field > feeding into someone's calculated TSC frequency. Hmm. I don=E2=80=99t have a good answer to that. Are there any real CPUs tha= t have this MSR but don=E2=80=99t have that field?=