From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51B2AC433B4 for ; Mon, 17 May 2021 23:51:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2EED661285 for ; Mon, 17 May 2021 23:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344634AbhEQXw1 (ORCPT ); Mon, 17 May 2021 19:52:27 -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-Google-Smtp-Source: ABdhPJy8M5KJcW4TRV2dftH65iRsAgNwKFLBhhOCVmnyCTlC+Arb4tKW4flEnKoQ6PD5dAYF65aeBw== 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 :-/