Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3937900imu; Mon, 7 Jan 2019 12:16:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN6HchPCm/DfjL7uxezQiQBNGb1aI2uLwm6HtwKiYax8wYJVXwYMgeM5vZWZI9+V8+eTCh17 X-Received: by 2002:a17:902:7c85:: with SMTP id y5mr62253027pll.63.1546892179866; Mon, 07 Jan 2019 12:16:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546892179; cv=none; d=google.com; s=arc-20160816; b=rCcpUP7BYmkaV3evJyVFu465nR4fgeSgxcjG/uAtoqir8U0R8Pz3MrsEMQOFRB+/6H dRBPzZniIreEiczSytwzCHE7ac8ngLXZZfs86tQiqOtnGyzd7HUOIlr5tnf9sGnbSCrB L47GAbUXU9eVk3Mf/Ej8dv8dkOreLHoJpnpI5y8purnjzhqBJsx64oExeRKAyO+UFOc5 T58orDX0WRTMU/Lb7R8Mj8ynJJ6KhWw5B5SQcovDfJu6xRvQcP1zOAj4A5DwXqW92oBD 3d2bJSWts+27Z2nLlMYGJ6Zv5R+dQVdfVmInwjUjI4JMuXgDvOXVneFVQGKqZpCM5zf8 wqug== 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=xLKa+QhBGZlkKSb0Be4TUL1ntZegK6Fe5/m5oAdHit8=; b=Es8SlyQqvEIWtqTz6YyEaLQST1XV2uLxDwLNyOBlkZGhWqWqAiZg7AgmXbO/ezHnj1 zMWYWSY3kAlFc684isQrQPmNZOTwVrt17dtvtTRBoYtYIY7GWkXA/vX3zqeCWBEn66+c 0MCOBmiPO6wA5xH0cZUMT5J5HbHHtRfJyzcLBorQkddq7NHGh9VTHD8kG2qNOfOqvEGJ StQJ3ggT+yEuiiL/vLQ+zvI+LoPHVJaXHOmbLKXkOUUYGvlZPJ38KpjZGf75nQle0N/w CUfDvvFg7ThqVjAW4UCuDmkfDqr9MnRw/QsIjBcELuIOXUupCr6X0cppYPl7FWN88LUR jmXQ== 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 t4si65273071pfj.183.2019.01.07.12.16.04; Mon, 07 Jan 2019 12:16:19 -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 S1726869AbfAGUOt (ORCPT + 99 others); Mon, 7 Jan 2019 15:14:49 -0500 Received: from mga18.intel.com ([134.134.136.126]:47023 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726392AbfAGUOs (ORCPT ); Mon, 7 Jan 2019 15:14:48 -0500 X-Amp-Result: UNSCANNABLE 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 Jan 2019 12:14:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,451,1539673200"; d="scan'208";a="114886619" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by fmsmga008.fm.intel.com with ESMTP; 07 Jan 2019 12:14:47 -0800 Received: by tassilo.localdomain (Postfix, from userid 1000) id 80A1B301BEF; Mon, 7 Jan 2019 12:14:47 -0800 (PST) Date: Mon, 7 Jan 2019 12:14:47 -0800 From: Andi Kleen To: Jim Mattson Cc: Wei Wang , LKML , kvm list , Paolo Bonzini , Peter Zijlstra , Kan Liang , Ingo Molnar , Radim =?utf-8?B?S3LEjW3DocWZ?= , like.xu@intel.com, Jann Horn , arei.gonglei@huawei.com Subject: Re: [PATCH v4 05/10] KVM/x86: expose MSR_IA32_PERF_CAPABILITIES to the guest Message-ID: <20190107201447.GM6118@tassilo.jf.intel.com> References: <1545816338-1171-1-git-send-email-wei.w.wang@intel.com> <1545816338-1171-6-git-send-email-wei.w.wang@intel.com> <5C2DC132.9050103@intel.com> <5C3318A1.9090009@intel.com> <20190107182012.GL6118@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 07, 2019 at 10:48:38AM -0800, Jim Mattson wrote: > On Mon, Jan 7, 2019 at 10:20 AM Andi Kleen wrote: > > > > > The issue is compatibility. Prior to your change, reading this MSR > > > from a VM would raise #GP. After your change, it won't. That means > > > that if you have a VM migrating between hosts with kernel versions > > > before and after this change, the results will be inconsistent. In the > > > > No it will not be. All Linux kernel uses of this MSR are guarded > > by a CPUID check. > > Linux usage is irrelevant to the architected behavior of the virtual > CPU. According to volume 4 of the SDM, this MSR is only supported when > CPUID.01H:ECX.PDCM [bit 15] is set. Therefore, kvm should raise #GP > whenever a guest tries to read this MSR and the guest's > CPUID.01H:ECX.PDCM [bit 15] is clear. That's not general practice in KVM. There are lots of MSRs that don't fault even if their CPUID doesn't support them. It's also not generally true for instructions, where it is even impossible. You could argue it should be done for MSRs, but that would be a much larger patch for lots of MSRs. It seems pointless to single out this particular one. In practice I doubt it will make any difference for real software either way. -Andi