Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2582279ybh; Mon, 9 Mar 2020 08:45:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtqqEfQijIPxdptkESCmrCFRG8l+LFOLpsOCLp50EE5/+O8hLIQMewOsQf+v+QrNULIW0t/ X-Received: by 2002:a54:4890:: with SMTP id r16mr8813543oic.121.1583768717943; Mon, 09 Mar 2020 08:45:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583768717; cv=none; d=google.com; s=arc-20160816; b=iKCI/wH9JmPGbRpFD4gNX0umINFunr4nNQhofPS8Aqo1xOFmdkaJuTnyNNvpQNROJI b+9NCLI2sY3CEL+LhT43MyCBBD/+MJHK/U+uzN/dLi592B3/RvrHIphgDSmBOLrg0oOf AkYP8V1YgNJiX1jVa3S3YlHBUKY0s8XUhQbVbI3SfWirEKrnkeQc6iYCChVlY2Ma5VGr +wpL9AVv3OXQG5JideNKMJwvdRFMYfNIi+1/Pkz70H7poKo+TXdj0haEBzZ00qUT0/BA EJYqDDFOYqUrX1DCFGaHqWifDvLbESGm5CpZbkWE8So3ybzIbw+iVoPIX7j/DEgmtcrT Fg4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=PNnmpZo/BonsbyjQtphGxGn3+FmhKWEO75Q4/MC0cjI=; b=z06IWxLJT6iSkrrQ8gqeVm6WiDQfeoa4PjgUDWufLfoA4dAG0QjIjp/oY38q5kwZGO 0s7VBXt/3xPYTgCayVZoklJASKxHUwA87ilSW+9ZeilhD8lIlfhIrH9FX7Mvr7QWRLbY lMYNLFYXWL+yfrMgCxNkB7akdf0oH64AQu1deMecOB6EuvbQk6Ce9KnU6eJelruVPKtz jK72ex3s8uSTd3FpZwMun/l961bywXEOdmqXyip1fAwkHSmB0jm7lwksNQKExFGuDGQD J3F8Sdx5CPdFG2U/LYfdPte8XLc4BqzqgY/6bvEdQsiw660OrxFwFgiJegabkslY1yqF 1osQ== 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 q124si4429142oig.228.2020.03.09.08.45.05; Mon, 09 Mar 2020 08:45:17 -0700 (PDT) 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 S1727131AbgCIPoq (ORCPT + 99 others); Mon, 9 Mar 2020 11:44:46 -0400 Received: from mga11.intel.com ([192.55.52.93]:48920 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726804AbgCIPoq (ORCPT ); Mon, 9 Mar 2020 11:44:46 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2020 08:44:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,533,1574150400"; d="scan'208";a="245377488" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.21]) by orsmga006.jf.intel.com with ESMTP; 09 Mar 2020 08:44:45 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id A0610301BCC; Mon, 9 Mar 2020 08:44:45 -0700 (PDT) Date: Mon, 9 Mar 2020 08:44:45 -0700 From: Andi Kleen To: Peter Zijlstra Cc: "Liang, Kan" , Luwei Kang , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, tglx@linutronix.de, bp@alien8.de, hpa@zytor.com, pbonzini@redhat.com, sean.j.christopherson@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, pawan.kumar.gupta@linux.intel.com, thomas.lendacky@amd.com, fenghua.yu@intel.com, like.xu@linux.intel.com Subject: Re: [PATCH v1 01/11] perf/x86/core: Support KVM to assign a dedicated counter for guest PEBS Message-ID: <20200309154445.GL1454533@tassilo.jf.intel.com> References: <1583431025-19802-1-git-send-email-luwei.kang@intel.com> <1583431025-19802-2-git-send-email-luwei.kang@intel.com> <20200306135317.GD12561@hirez.programming.kicks-ass.net> <20200309100443.GG12561@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200309100443.GG12561@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Suppose your KVM thing claims counter 0/2 (ICL/SKL) for some random PEBS > event, and then the host wants to use PREC_DIST.. Then one of them will > be screwed for no reason what so ever. It's no different from some user using an event that requires some specific counter. > > How is that not destroying scheduling freedom? Any other situation we'd > have moved the !PREC_DIST PEBS event to another counter. Anyways what are you suggesting to do instead? Do you have a better proposal? The only alternative I know to doing this would be to go through the PEBS buffer in the guest and patch the applicable counter field up on each PMI. I tried that at some point (still have code somewhere), but it was quite complicated and tricky and somewhat slow, so I gave up eventually. It's also inherently racy because if the guest starts looking at the PEBS buffer before an PMI it could see the unpatched values Given I don't know any real software which would break from this, but such "polled PEBS" usages are certainly concievable. The artificial constraint is a lot simpler and straight forward, and also doesn't have any holes like this. -Andi