Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1277968pxj; Wed, 19 May 2021 02:19:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzji1IGlyIMqKM6Sf7nYoEbAUX+dlN6Drv5Xm73rYtWudkAFmitQFlXnOfpA3nLcIbBJQlm X-Received: by 2002:a92:cda7:: with SMTP id g7mr8792907ild.50.1621415974224; Wed, 19 May 2021 02:19:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621415974; cv=none; d=google.com; s=arc-20160816; b=SjmdqeTWlhfJ8YOavIXx0bjpNonKHMflXscxoZIbQr/FmCW27liqqn+vWvlYxjCo/t lF1PyKECH0yXTOBYrIYZd1o5ZqCc3OUKzur+iXOM6JFUZz/1qUs7G0PqvstkUq/Wu3Md +E30sFPQ/rKo6eoe6WKu7F5hf1MbObACodzgg/skQR+Urgd6YVQeARp3fhnztLkClkrH aT3EmTrg+QA+nVIDMSy0dDao7H0AYwlJu9bg+5L+Tw4icg3S72hpUxJoRzFli7EEnZl0 SnCME0IQwoSeSkjXBdhtl/NAqI6YcNkpRWaZp+r1ocOl8OwvvFj7dQpRArhMJv+r0yK7 nYVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=e8p080PXTTnw/mGJdgaG2dRlb1VLC74jwJ4oms85ovM=; b=hQt6dSQlxKji4n03CkUyRGmEZonfOYcurQ9tLpEkc8PvcCPaJGzYSdxUSzMqGdn3kr 91tqfj/l4UmG4lR37nirYEm3zxOh7NYomC7XX0zH+hFkKwAkGQskuUvydo0D4mBPaQQX kZofuoxnofo0WyUsO133CKRUjDD0212Wmx9e+qM5qSH51Ok9PQ4O/Z69gStCPjXKGP2y HiM2XL1aijgE3TJ7OojmVLbTVihE97b4YrGLhajPh94zRtCOLEFAx6ElXfN45wo3RNid fhPgNzmSZ0o38hBscbn8fLuOX0siCm84srj0ABp9UOJ46MxLzKK5Iynosp7HAnGFPoF0 4XkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BJBxNVCn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n3si30058247ioh.98.2021.05.19.02.19.21; Wed, 19 May 2021 02:19:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=BJBxNVCn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344622AbhEQXw0 (ORCPT + 99 others); Mon, 17 May 2021 19:52:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239156AbhEQXwZ (ORCPT ); Mon, 17 May 2021 19:52:25 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5BD6C061573 for ; Mon, 17 May 2021 16:51:08 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id z4so1866584plg.8 for ; Mon, 17 May 2021 16:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=e8p080PXTTnw/mGJdgaG2dRlb1VLC74jwJ4oms85ovM=; b=BJBxNVCnYLqjeBb2TLEgklDLswSa1dsafY3bTgcKnVrup8QGT5m+TmEtllrZ795rw6 aTxT/UiSeqTuy/Np2IeXbxGsifga/wEo07a/3wu7K3/HHzHKqWounuEOoSZPzQrgNJIs KZ2rRzFf4Kor+Q5Zgq9OivlQjAQSgHIv/OQJJbefoLtRWQ98YzalqUYURo63Yb4lcx/+ T67dkr6RCm/gVpXKKzRZGVpdZqWNAA7gXHiBA/2AhCTnWP36L2bKTNMW1t/xAcNS4gQ1 0i4RyHECIh2yHR2wgnQAmS/iJOlCjt5D/OENmgPgnxqBRcxIB7PGvpLeY2az30vzleUW /6tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=e8p080PXTTnw/mGJdgaG2dRlb1VLC74jwJ4oms85ovM=; b=h5g80oLmlMZRPuP0LawEQEk+fe1k/bzUcduQKkfWA4GRDDX+0gF+bYFpgEY7hIjEUn zpEwld8ZCmeyQwtcoXvA/XxGOrk5boMfQd61x7dLG24AGes84whywg/yqFbSZCqrZ2M1 Dg/5hH3dKk5TTmE+uDQ49D05DieT+o+S7XvYkFlhZKQXYQB7QbPVtREP8BQcVb7C36m0 rINJ20B1mUx3VVV36wYv4pl4vVxapxXseWWKj0OXRYdRb3YAXv/TbNEZBJ6COmWBL/8U Myw+ju3IPVXdmYDuY5yvqfA96uvFWmjzhdpDSh6eqbEhXtgt1UlEBH/7doxCpbBf2Ysq aXlA== X-Gm-Message-State: AOAM532BVOw4xWnLq6cJBH2TbRJR2FezCJAECXT7e4xRnVNomu0AaAQ9 A3IM7Ekkz6+4H42Nm7wYvMZpXw== X-Received: by 2002:a17:902:7144:b029:f0:d8e7:95a3 with SMTP id u4-20020a1709027144b02900f0d8e795a3mr1191431plm.52.1621295468069; Mon, 17 May 2021 16:51:08 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id v6sm2731806pgk.33.2021.05.17.16.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 16:51:07 -0700 (PDT) Date: Mon, 17 May 2021 23:51:03 +0000 From: Sean Christopherson To: "Xu, Like" Cc: Venkatesh Srinivas , Peter Zijlstra , Paolo Bonzini , Borislav Petkov , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , weijiang.yang@intel.com, Kan Liang , ak@linux.intel.com, wei.w.wang@intel.com, eranian@google.com, liuxiangdong5@huawei.com, linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org, Yao Yuan , Like Xu Subject: Re: [PATCH v6 04/16] KVM: x86/pmu: Set MSR_IA32_MISC_ENABLE_EMON bit when vPMU is enabled Message-ID: References: <20210511024214.280733-1-like.xu@linux.intel.com> <20210511024214.280733-5-like.xu@linux.intel.com> <5ef2215b-1c43-fc8a-42ef-46c22e093f40@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 17, 2021, Sean Christopherson wrote: > On Thu, May 13, 2021, Xu, Like wrote: > > On 2021/5/12 23:18, Sean Christopherson wrote: > > > On Wed, May 12, 2021, Xu, Like wrote: > > > > Hi Venkatesh Srinivas, > > > > > > > > On 2021/5/12 9:58, Venkatesh Srinivas wrote: > > > > > On 5/10/21, Like Xu wrote: > > > > > > On Intel platforms, the software can use the IA32_MISC_ENABLE[7] bit to > > > > > > detect whether the processor supports performance monitoring facility. > > > > > > > > > > > > It depends on the PMU is enabled for the guest, and a software write > > > > > > operation to this available bit will be ignored. > > > > > Is the behavior that writes to IA32_MISC_ENABLE[7] are ignored (rather than #GP) > > > > > documented someplace? > > > > The bit[7] behavior of the real hardware on the native host is quite > > > > suspicious. > > > Ugh. Can you file an SDM bug to get the wording and accessibility updated? The > > > current phrasing is a mess: > > > > > > Performance Monitoring Available (R) > > > 1 = Performance monitoring enabled. > > > 0 = Performance monitoring disabled. > > > > > > The (R) is ambiguous because most other entries that are read-only use (RO), and > > > the "enabled vs. disabled" implies the bit is writable and really does control > > > the PMU. But on my Haswell system, it's read-only. > > > > On your Haswell system, does it cause #GP or just silent if you change this > > bit ? > > Attempting to clear the bit generates a #GP. *sigh* Venkatesh and I are exhausting our brown paper bag supply. Attempting to clear bit 7 is ignored on both Haswell and Goldmont. This _no_ #GP, the toggle is simply ignored. I forgot to specify hex format (multiple times), and Venkatesh accessed the wrong MSR (0x10a instead of 0x1a0). So your proposal to ignore the toggle in KVM is the way to go, but please document in the changelog that that behavior matches bare metal. It would be nice to get the SDM cleaned up to use "supported/unsupported", and to pick one of (R), (RO), and (R/O) for all MSRs entries for consistency, but that may be a pipe dream. Sorry for the run-around :-/