Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3359468pxb; Thu, 10 Feb 2022 19:51:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwbyj1IWqKpLhnOOUhM5yCajS9QkfqhzMQSktw69G7E1ncQt9Mse+FEp+LfL6EaUYHwZ4Ge X-Received: by 2002:a62:8c57:: with SMTP id m84mr10413408pfd.28.1644551489347; Thu, 10 Feb 2022 19:51:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644551489; cv=none; d=google.com; s=arc-20160816; b=D7e8eKP7edOHJSE6IERUN8M4DmI0B1AZwNmTx+F41WNj9LY2SIXgPcn13OHI3+jk0/ fPxVD2vuiP0m19SIQ+YYmZxIubB2wF8gwSPNO5wQXUtyhN5t0atw8udO25U9k/4j/LbU Tw0I+7I5xOKlBSjPWngrDpqSuV8HLjZStc0x0EGBF6ctp51fBfhjuLfgX3z5QuEM9cN0 rRqd7yBwokmVg3cXHFlLoiSD3qG6K2HJvJSU7yPA4Tt7orNC3XzZJs16/fotvZj00lTV IBJ8o8gtZsJ1ty840e9KnmboQN4e7D+j71pbzrJLHsOUx2woHHOL2wIY/t5ZzPzNdH9f crMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yKXi8a/Wa+eHPps1BTbaSB0zXEKBLOSOppniPn0Pfis=; b=bYjlDyOjy61BG3JgaD/uMtzFY3+iWTEwApsdx/yn0wEsSUABkCMtiVRARvXd1m5KoR ph3+FocyufQ7l7pPZXRqJXPTjtJ2RY8oA5UN9CifV/4qaoNniIZlLix4QkgNAzgU8jaS JjfvQqdgJkIokp4FM8Eky2kDBx/c6VPn2D7pZ0YoaLGd0M2GQWmN1TrrUYPXwCyZqpxy lthp0G/8I96HxyQREF0425i5vXjjo+WoGMEV/5ywqWRlf9yb3tNAWjySFRQb3nUO1GwX VqRbPWGnMUDwD1PVkcafwx9tVIN9SdwNKugzPKDSTQutFZv3cmyKdMffpbFZh76AbSzT k6Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KIXghY7d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l72si7994870pge.619.2022.02.10.19.51.17; Thu, 10 Feb 2022 19:51:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=KIXghY7d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S241594AbiBJT4A (ORCPT + 99 others); Thu, 10 Feb 2022 14:56:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239114AbiBJTz6 (ORCPT ); Thu, 10 Feb 2022 14:55:58 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 006B75F58 for ; Thu, 10 Feb 2022 11:55:57 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id o24so8827020wro.3 for ; Thu, 10 Feb 2022 11:55:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yKXi8a/Wa+eHPps1BTbaSB0zXEKBLOSOppniPn0Pfis=; b=KIXghY7d76EqIZgH/qH4nyQVkopww5BOB6AJy5l4PXaZ5jCK7em88mfurNu5Ida8hL Hd+qyi5a01MP6MBUf4LDsMSa+Q/8B31GglQs5wpcLDcvT/hC6tt1QlH7qUDUoS8JAwOw 7uHT4UFJ8t2UVgK4jkm3eRQZVA0ct581Cve2ixO7l/cmytZ0lORhDcl+wgZfw2RqDVO0 z1N0LQMOp+1/fL734/hGMOcRUL0GCzFqxoAW3V43RR3NU3Zc2D/7ra3WXmw1mvTcTIo9 9pPeliJJD17cI7jkOpIxXlwlftl5ba7R4J8a30KTRiPadnfw1AmfUy4cVogqC4BybqtC SECg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yKXi8a/Wa+eHPps1BTbaSB0zXEKBLOSOppniPn0Pfis=; b=dxXb/7ohnQaJqORBCky8tnwNXhKscOz3FY6VyBSK9wgi1KvOWPSje4/L2ClaGwHhp9 r9IgmjVCAzlcMXKyf2fBEzmOdyNmleSBRUb8MB6+AwqnjTT+JUqhCn4zx0g82swPlnC7 0l9xUFJ6cjOmANcot5BOWvGc1/ph+E5KmgYKfS8sX/r2kFt6KHH69LsVW2Gm1dRV+TqV pC8f+im27pXl7/bMKRF6y7fYkqEdXe3DfL4ic5RVTHrnirrr5fMnXWMHlNSbAeYiWLhX 8D4ewNO8ql/R4UDpyaaAnZ46R7ofFZFCKkocteOpFC70gBhMwOUneEe/Hd5zn1PWJ2RK op1Q== X-Gm-Message-State: AOAM531GTBYgEuTaydCHgCM2xeSN32bszaMbI8lCfI1ug/DWI1/Z8bUp WDpo/ohlfaFAF28up0p8C7a0KPWEKAj4rkcyOG4V7A== X-Received: by 2002:a05:6000:1ac5:: with SMTP id i5mr7904367wry.703.1644522956333; Thu, 10 Feb 2022 11:55:56 -0800 (PST) MIME-Version: 1.0 References: <20220117085307.93030-1-likexu@tencent.com> <20220117085307.93030-3-likexu@tencent.com> <20220202144308.GB20638@worktop.programming.kicks-ass.net> <69c0fc41-a5bd-fea9-43f6-4724368baf66@intel.com> <67a731dd-53ba-0eb8-377f-9707e5c9be1b@intel.com> <7b5012d8-6ae1-7cde-a381-e82685dfed4f@linux.intel.com> In-Reply-To: From: David Dunn Date: Thu, 10 Feb 2022 11:55:45 -0800 Message-ID: Subject: Re: [PATCH kvm/queue v2 2/3] perf: x86/core: Add interface to query perfmon_event_map[] directly To: "Liang, Kan" Cc: Jim Mattson , Dave Hansen , Peter Zijlstra , Like Xu , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Like Xu , Stephane Eranian Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kan, On Thu, Feb 10, 2022 at 11:46 AM Liang, Kan wrote: > No, we don't, at least for Linux. Because the host own everything. It > doesn't need the MSR to tell which one is in use. We track it in an SW way. > > For the new request from the guest to own a counter, I guess maybe it is > worth implementing it. But yes, the existing/legacy guest never check > the MSR. This is the expectation of all software that uses the PMU in every guest. It isn't just the Linux perf system. The KVM vPMU model we have today results in the PMU utilizing software simply not working properly in a guest. The only case that can consistently "work" today is not giving the guest a PMU at all. And that's why you are hearing requests to gift the entire PMU to the guest while it is running. All existing PMU software knows about the various constraints on exactly how each MSR must be used to get sane data. And by gifting the entire PMU it allows that software to work properly. But that has to be controlled by policy at host level such that the owner of the host knows that they are not going to have PMU visibility into guests that have control of PMU. Dave Dunn