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 72BFBC4167B for ; Tue, 29 Nov 2022 15:54:58 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3liiIRcQLXzdI7jloaCQtgcBuO8GU6OgbaXxAVvP/4g=; b=txx9IQ19bX6/Wm t31gE6r8kFhHHUVicC3bRE+KqoAaMZbFG97YNKIBdLEsVTX5lQmE94F2NG1LiBkWBntyE5FDJU3z1 QmweCHa1vfTnZ+qNRA1/XrZ/qlRRB+HO6V8vJQ4sThmMnODEJE8WuH/LObMqgJUAq4+JUpD219FuH UeN8mavHsHIwuH4Cqg+uGduQ6Gtv5Kaj/qWK2q2qcoAtwUStzG0rg+CmB+PxqInrhpea76UBIMWkO vfEgpV7trnpgebJUfW8hQ1vTR+Bd6CvW2JvNsTlX95ycO1wD0TepvL8mxsWbNRK9RvrXjWOhC9hcY ObSPQb9y2GpJ2FlojE7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p02vr-009sI2-DM; Tue, 29 Nov 2022 15:54:03 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p02vo-009s6z-D4 for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2022 15:54:02 +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 DAAFED6E; Tue, 29 Nov 2022 07:53:44 -0800 (PST) Received: from [10.57.7.150] (unknown [10.57.7.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A5AD83F67D; Tue, 29 Nov 2022 07:53:35 -0800 (PST) Message-ID: <25658a70-0b37-966d-e46c-f86be2a76a8e@arm.com> Date: Tue, 29 Nov 2022 15:53:32 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH V5 6/7] arm64/perf: Add BRBE driver To: Anshuman Khandual Cc: Mark Brown , Rob Herring , Marc Zyngier , Suzuki Poulose , Ingo Molnar , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, peterz@infradead.org, acme@kernel.org, mark.rutland@arm.com, will@kernel.org, catalin.marinas@arm.com References: <20221107062514.2851047-1-anshuman.khandual@arm.com> <20221107062514.2851047-7-anshuman.khandual@arm.com> Content-Language: en-US From: James Clark In-Reply-To: <20221107062514.2851047-7-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221129_075400_593691_E1CA6ADA X-CRM114-Status: GOOD ( 16.41 ) 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 07/11/2022 06:25, Anshuman Khandual wrote: > This adds a BRBE driver which implements all the required helper functions > for struct arm_pmu. Following functions are defined by this driver which > will configure, enable, capture, reset and disable BRBE buffer HW as and > when requested via perf branch stack sampling framework. Hi Anshuman, I've got a rough version of an updated test for branch stacks here [1]. A couple of interesting things that I've noticed running it: First one is that sometimes I get (null) for the branch type. Debugging in GDB shows me that the type is actually type == PERF_BR_EXTEND_ABI && new_type == 11. I can't see how this is possible looking at the driver code. I think I saw this on a previous version of the patchset too but didn't mention it because I thought it wasn't significant, but now I see that something strange is going on. An interesting pattern is that they are always after ERET samples and go from userspace to kernel: 41992866945460 0x6e8 [0x360]: PERF_RECORD_SAMPLE(IP, 0x1): 501/501: 0xffff800008010118 period: 1229 addr: 0 ... branch stack: nr:34 .. 007a9988 -> 00000000 0 cycles P 9fbfbfbf IRQ .. 00000000 -> 007a9988 0 cycles P 9fbfbfbf ERET .. 007a9988 -> 00000000 0 cycles P 9fbfbfbf (null) .. 00747668 -> 007a9988 0 cycles P 9fbfbfbf CALL .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00747664 -> 00747660 0 cycles P 9fbfbfbf COND .. 00000000 -> 00747658 0 cycles P 9fbfbfbf ERET .. 00747658 -> 00000000 0 cycles P 9fbfbfbf ARM64_DEBUG_DATA .. 00000000 -> 00747650 0 cycles P 9fbfbfbf ERET .. 00747650 -> 00000000 0 cycles P 9fbfbfbf ARM64_DEBUG_DATA .. 00747624 -> 00747634 0 cycles P 9fbfbfbf COND .. 00000000 -> 007475f4 0 cycles P 9fbfbfbf ERET .. 007475f4 -> 00000000 0 cycles P 9fbfbfbf ARM64_DEBUG_DATA .. 00000000 -> 007475e8 0 cycles P 9fbfbfbf ERET .. 007475e8 -> 00000000 0 cycles P 9fbfbfbf (null) .. 004005ac -> 007475e8 0 cycles P 9fbfbfbf CALL .. 00000000 -> 00400564 0 cycles P 9fbfbfbf ERET .. 00400564 -> 00000000 0 cycles P 9fbfbfbf (null) .. 00000000 -> 00400564 0 cycles P 9fbfbfbf ERET .. thread: perf:501 ...... dso: [kernel.kallsyms] The second one is that sometimes I get kernel addresses and RET branches even if the option is any_call,u. The pattern here is that it's the last non empty branch stack of a run, so maybe there is some disable path where the filters aren't configured properly: armv8pmu_brbe_enable+0xc/arm64_pmu_brbe_enable+0x0/P/-/-/0/CALL armpmu_start+0xe0/armv8pmu_brbe_enable+0x0/P/-/-/0/IND_CALL armv8pmu_brbe_reset+0x18/armpmu_start+0xd0/P/-/-/0/RET arm64_pmu_brbe_reset+0x18/armv8pmu_brbe_reset+0x10/P/-/-/0/RET [1]: https://gitlab.arm.com/linux-arm/linux-jc/-/commit/7260b7bef06ac161eac88d05266e8c5c303d9881 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel