Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2613398rdh; Wed, 27 Sep 2023 07:45:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE1/YjTRXlfHFhkpx1qqWdAyDP2ZduR+pajzh92PqNEicHPcNzJX0fNl9cY6p19ROuzUkxs X-Received: by 2002:a17:90b:1e0e:b0:269:2682:11fb with SMTP id pg14-20020a17090b1e0e00b00269268211fbmr1909160pjb.8.1695825936476; Wed, 27 Sep 2023 07:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695825936; cv=none; d=google.com; s=arc-20160816; b=GS76Mbn8WQgpOPa81aTq8s5RFE0N4ZGffevwQ+6NXYdZnN3OljyTLtb5cG0ddyGhKQ Q3/vjfdH6tMasnK+OZefit+HtK6A5zt3Ce8R/ejoDg9Ufp+/i/VHbEr2aWUnPoPDaixV GXgnfOqxFTc1hZ9aw9r/MlQFP+nQ6QC5qWdXk8R5OyLp+GyR8VHzdhhOVPgYFIKLbOiz FCnvE+uJ1dOpUD3EufLO4Kio2NkscQ0bkQfUOOSDBaMCSWk6NLRgzFRtoHOO+4rCW2U1 6/MSbGPM3T6Zz7UhBhgcG3SMSeZ5JdoqXtVY+IHV1cgbDVr+uI2XLnuZXaE8a8C1HSi7 1LVQ== 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=ELXRd2+VoCH1I99QYOA/3TEPv4nC2Y881FhqGK/auxc=; fh=6RZOHCpo4ae67O8gYrzU8pNIdjqDz47deIek3cnx8Vs=; b=lqSFNKpY7n9WqYgmpszRlsXkB7zNaH8hbL6l4Df2afcVX5KLRZ8UOfSmE6VX6qtDpF eYhYXxn9JZTI+N6VUErz+cBn2xAlmgJY5JcvwDWsjJqPP5+yXymkj48unhYKjuXi2CxT 1C4o3Ru/UF8WaGH8EiW3ilJqR4VWVwp9bomW55funCAIm5J/4J4cusVTGRrjQqpxNzS3 fTaSXK8RX6d4xNPNfWYdz4tJaImGstilLyKsFn5oihrKI5HwiFZHgr+mt/LT3wtetBms GiJ/DNE5JcEANCxXn4l0bjicroOg6bXAIVVU1omk0IV29UtyUr8MVDN6dTAs6/u8wHNK GDfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="YWKDH/Yi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ot13-20020a17090b3b4d00b00263bfa6e205si20240743pjb.50.2023.09.27.07.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 07:45:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="YWKDH/Yi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 6751C8335285; Wed, 27 Sep 2023 04:34:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231628AbjI0Ldx (ORCPT + 99 others); Wed, 27 Sep 2023 07:33:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231391AbjI0Ldl (ORCPT ); Wed, 27 Sep 2023 07:33:41 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E23D199; Wed, 27 Sep 2023 04:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ELXRd2+VoCH1I99QYOA/3TEPv4nC2Y881FhqGK/auxc=; b=YWKDH/YiyjT5Dq/JDiSk6c7qUD c5/JkA5GFfOxYnB/+9sbB9SGxVf8M24jp0utbGyNIKU852uCoZS5CqxpPznaCBrWe1luDFC68fBlw RJQ4M2K6sG6UhKeGNtNRKdMVH/5DuYyGcK4TxtDcLP4NwAig5vy69nnNMWbIVt/PtDs8souYj8kwD fXDliBfzL66rBFFMwPDc6/lw7zhkrL/X604/DSIW3Oz3cXE5vjWd0XknfxKYTcDx/Gx8HwKivqpCY Rm2TISRgyw6nOXPc0Tc8ePBGGsGUHUkeO47+sr0R2E5ljQgWgLG+0e7XhbdjEZqKAIC1u57yzITAv 6Ch4WpgA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qlSn3-00DcAy-8o; Wed, 27 Sep 2023 11:33:13 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id E8AF3300473; Wed, 27 Sep 2023 13:33:12 +0200 (CEST) Date: Wed, 27 Sep 2023 13:33:12 +0200 From: Peter Zijlstra To: Dapeng Mi Cc: Sean Christopherson , Paolo Bonzini , Arnaldo Carvalho de Melo , Kan Liang , Like Xu , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , kvm@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Zhenyu Wang , Zhang Xiong , Lv Zhiyuan , Yang Weijiang , Dapeng Mi Subject: Re: [Patch v4 07/13] perf/x86: Add constraint for guest perf metrics event Message-ID: <20230927113312.GD21810@noisy.programming.kicks-ass.net> References: <20230927033124.1226509-1-dapeng1.mi@linux.intel.com> <20230927033124.1226509-8-dapeng1.mi@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230927033124.1226509-8-dapeng1.mi@linux.intel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 27 Sep 2023 04:34:09 -0700 (PDT) On Wed, Sep 27, 2023 at 11:31:18AM +0800, Dapeng Mi wrote: > When guest wants to use PERF_METRICS MSR, a virtual metrics event needs > to be created in the perf subsystem so that the guest can have exclusive > ownership of the PERF_METRICS MSR. Urgh, can someone please remind me how all that is supposed to work again? The guest is just a task that wants the event. If the host creates a CPU event, then that gets scheduled with higher priority and the task looses out, no joy. So you cannot guarantee the guest gets anything. That is, I remember we've had this exact problem before, but I keep forgetting how this all is supposed to work. I don't use this virt stuff (and every time I try qemu arguments defeat me and I give up in disgust).