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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FD0FC4345F for ; Thu, 11 Apr 2024 14:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5T6n/6c1M7fnvBlDQ5Ojh4jYMJfHWLhYv7+HAzY+rQA=; b=pSPFkNQRxrhqx4 4G2f+Lv6Z2ac1dJDED1fb6QLQlQKO6is3X0SrM+Ssi+u3BrXH7fFsaP3Wq0wHdTMXi/6S2gHwFq3d aUFKHRgrEMfa+ooV6Y6ikXWqDewqedZCcJ9pPQe/tvnT5+8/2qQ/gKpyMxkrICY+Lz0QptH2upKmT BAtdGBVn8A7WDHP0S2apuNz6TpJiW/TwqXZrdJwwRkhjhgUtPdLevyBUE8OFgET7Oe6M0bfnyW36I tcUsW8UyFqdrod6HEn3nSZvEj04e4Z+XfkOluzrN3o78Df00RdAxgWcl+/A78SxjCjKtI8ahWZtJZ f77mdbMI2nD98kAZIo8Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruvPs-0000000CSDg-0lUw; Thu, 11 Apr 2024 14:28:40 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruvPp-0000000CSCz-29vP for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2024 14:28:38 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 686E06059D; Thu, 11 Apr 2024 14:28:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74B94C113CD; Thu, 11 Apr 2024 14:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712845716; bh=1TSbZPA1LdtoWaeej5Sf78ysxSi20ZfLUfKomvk4xkQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dZCC82e55mXPpKrO+VRjgErSLXlDZ1jJFeY05u7ulsYrsBXrZsHauYsoLpt0L/Bgi xMmdkcX5IKU6m30PZgeeD8OM+iL5fYMe+VFMzU79xLoHIJl5qabvBYigO2Y2YGa56k BKaQRJOKetbb1Ht4W8Ka6kb94zG+82lhOnZDWAD5QIl5XhV3iPApBjRGfxRi3ZOTyD G/V2G0HFjcjkIYXqPexMztlHW33vYQHYzTrP3liykfSCM8wTR1HDHpsPC1J7LTwwaX MUmvytmHAtm25bbSq1ym4l8CHl3Z5ghG2Cofq5v3xj/P4mrDCKhXFz2DzAdCeeKs4Q S7PwF4eHMJ9zQ== Date: Thu, 11 Apr 2024 15:28:29 +0100 From: Will Deacon To: Yicong Yang Cc: mark.rutland@arm.com, catalin.marinas@arm.com, broonie@kernel.org, james.morse@arm.com, anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, jonathan.cameron@huawei.com, shameerali.kolothum.thodi@huawei.com, prime.zeng@hisilicon.com, fanghao11@huawei.com, yangyicong@hisilicon.com, linuxarm@huawei.com, maz@kernel.org Subject: Re: [PATCH v2 3/3] perf: arm_spe: Enable the profiling of EL0&1 translation regime Message-ID: <20240411142829.GA26681@willie-the-truck> References: <20231130074609.58668-1-yangyicong@huawei.com> <20231130074609.58668-4-yangyicong@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231130074609.58668-4-yangyicong@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240411_072837_634549_51509FB2 X-CRM114-Status: GOOD ( 22.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Nov 30, 2023 at 03:46:09PM +0800, Yicong Yang wrote: > From: Yicong Yang > > On a VHE enabled host, the PMSCR_EL1 will be redirect to PMSCR_EL2 > and we're actually enabling E0SPE and E2SPE in the driver. This means > the data from EL0&1 translation regime of a VM will not be profiled. > So this patch tries to add the support of profiling EL0 and EL1 of > a VM. Users can filter data of different exception level by using > the perf's exclude_* attributes. The exclude_* decision is referred > to Documentation/arch/arm64/perf.rst and the implementation of > arm_pmuv3. > > Signed-off-by: Yicong Yang > --- > drivers/perf/arm_spe_pmu.c | 37 ++++++++++++++++++++++++++++++------- > 1 file changed, 30 insertions(+), 7 deletions(-) > > diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c > index 09570d4d63cd..a647d625f359 100644 > --- a/drivers/perf/arm_spe_pmu.c > +++ b/drivers/perf/arm_spe_pmu.c > @@ -316,21 +316,44 @@ static u64 arm_spe_event_to_pmscr(struct perf_event *event) > static void arm_spe_pmu_set_pmscr(struct perf_event *event) > { > struct perf_event_attr *attr = &event->attr; > - u64 reg = 0; > + u64 pmscr_el1, pmscr_el12; > > - reg = arm_spe_event_to_pmscr(event); > - if (!attr->exclude_user) > - reg |= PMSCR_EL1x_E0SPE; > + pmscr_el1 = pmscr_el12 = arm_spe_event_to_pmscr(event); > + > + /* > + * Map the exclude_* descision to ELx according to > + * Documentation/arch/arm64/perf.rst. > + */ > + if (is_kernel_in_hyp_mode()) { > + if (!attr->exclude_kernel && !attr->exclude_host) > + pmscr_el1 |= PMSCR_EL1x_E1SPE; > > - if (!attr->exclude_kernel) > - reg |= PMSCR_EL1x_E1SPE; > + if (!attr->exclude_kernel && !attr->exclude_guest) > + pmscr_el12 |= PMSCR_EL1x_E1SPE; > + > + if (!attr->exclude_user && !attr->exclude_host) { > + pmscr_el1 |= PMSCR_EL1x_E0SPE; > + pmscr_el12 |= PMSCR_EL1x_E0SPE; > + } Hmm, I don't understand this part. Doesn't this mean that setting 'exclude_host' to true will also exclude userspace (EL0) profiling for the guest? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel