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 BBA63C7EE29 for ; Fri, 9 Jun 2023 12:38:13 +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=k0Dd8fSEotHZVJOBGzydz3C+FR81f03WR84cHNXTDV4=; b=UC4hf6N6WnBAuM 5YT82Ur70oT7jRQL0DBqt7d5mEKUMeelc9tXyj7IKulq6DUTA+57fMdVnF02XWRconONwMl2/JHhf ZcR4BiFb/3fuCROf1c4o77tPu3grHcl+J0pw1CJrD0sR1sGAnS7w/XSD9I3S8q3F9Pvnw98TBwDl5 QRjZIA6mBDk908MIedZn6jGdXq6CxMQoT+C9aqDYKMaOMftKsfwERHYwa58Pif9XOuDTVsFhSbnLl Cv8c3avBvwJxNAOMhgJjd1iAcDTo26EWcTDGK3sEmID9ye7d6Ij+TvFz300l6lrUzWXUBTjizAxi6 +Jf399PPjuGGiNFPlkTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7bNG-00D0Ua-0a; Fri, 09 Jun 2023 12:37:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7bNC-00D0Sr-14 for linux-arm-kernel@lists.infradead.org; Fri, 09 Jun 2023 12:37:48 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 04D55AB6; Fri, 9 Jun 2023 05:38:25 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.38.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BEE0D3F6C4; Fri, 9 Jun 2023 05:37:37 -0700 (PDT) Date: Fri, 9 Jun 2023 13:37:32 +0100 From: Mark Rutland To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org, catalin.marinas@arm.com, Mark Brown , James Clark , Rob Herring , Marc Zyngier , Suzuki Poulose , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org Subject: Re: [PATCH V11 06/10] arm64/perf: Enable branch stack events via FEAT_BRBE Message-ID: References: <20230531040428.501523-1-anshuman.khandual@arm.com> <20230531040428.501523-7-anshuman.khandual@arm.com> <006be03c-43da-6482-6bc4-83fe65dcd706@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <006be03c-43da-6482-6bc4-83fe65dcd706@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230609_053746_414968_482C60AC X-CRM114-Status: GOOD ( 20.89 ) 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 Fri, Jun 09, 2023 at 10:00:09AM +0530, Anshuman Khandual wrote: > >> +static u64 branch_type_to_brbcr(int branch_type) > >> +{ > >> + u64 brbcr = BRBCR_EL1_DEFAULT_TS; > >> + > >> + /* > >> + * BRBE need not be paused on PMU interrupt while tracing only > >> + * the user space, bcause it will automatically be inside the > >> + * prohibited region. But even after PMU overflow occurs, the > >> + * interrupt could still take much more cycles, before it can > >> + * be taken and by that time BRBE will have been overwritten. > >> + * Let's enable pause on PMU interrupt mechanism even for user > >> + * only traces. > >> + */ > >> + brbcr |= BRBCR_EL1_FZP; > > I think this is trying to say that we *should* use FZP when sampling the > > kernel (due to IRQ latency), and *can* safely use it when sampling userspace, > > so it would be good to explain it that way around. > > Agreed, following updated comment explains why we should enable FZP > when sampling kernel, otherwise BRBE will capture unwanted records. > It also explains why we should enable FZP even when sampling user > space due to IRQ latency. > > /* > * BRBE should be paused on PMU interrupt while tracing kernel > * space to stop capturing further branch records. Otherwise > * interrupt handler branch records might get into the samples > * which is not desired. > * > * BRBE need not be paused on PMU interrupt while tracing only > * the user space, because it will automatically be inside the > * prohibited region. But even after PMU overflow occurs, the > * interrupt could still take much more cycles, before it can > * be taken and by that time BRBE will have been overwritten. > * Hence enable pause on PMU interrupt mechanism even for user > * only traces as well. > */ > brbcr |= BRBCR_EL1_FZP; Thanks; I think that's a lot clearer! Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel