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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D590C43334 for ; Tue, 14 Jun 2022 01:44:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229633AbiFNBoX (ORCPT ); Mon, 13 Jun 2022 21:44:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiFNBoW (ORCPT ); Mon, 13 Jun 2022 21:44:22 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 472552872A; Mon, 13 Jun 2022 18:44:21 -0700 (PDT) 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 2A93623A; Mon, 13 Jun 2022 18:44:21 -0700 (PDT) Received: from [10.162.40.17] (unknown [10.162.40.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B8D463F792; Mon, 13 Jun 2022 18:44:16 -0700 (PDT) Message-ID: <0bc0f99d-41ad-3ce3-deeb-c4c713100e74@arm.com> Date: Tue, 14 Jun 2022 07:14:14 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 7/8] arm64/perf: Add BRBE driver Content-Language: en-US To: German Gomez , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, peterz@infradead.org, acme@kernel.org, mark.rutland@arm.com, will@kernel.org Cc: Catalin Marinas , James Clark , Rob Herring , Marc Zyngier , Ingo Molnar , linux-perf-users@vger.kernel.org References: <20220613100119.684673-1-anshuman.khandual@arm.com> <20220613100119.684673-8-anshuman.khandual@arm.com> From: Anshuman Khandual In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org On 6/13/22 17:46, German Gomez wrote: > Hi Anshuman, thanks for the update, > > As I mentioned offline, I have a perf test that I've been using for the > branch records and filters. I'll let you know the result using this set. Sure, thanks ! > > On 13/06/2022 11:01, Anshuman Khandual wrote: >> [...] >> >> + >> +static int brbe_fetch_perf_priv(u64 brbinf) >> +{ >> + int brbe_el = brbe_fetch_el(brbinf); >> + >> + switch (brbe_el) { >> + case BRBINF_EL_EL0: >> + return PERF_BR_PRIV_USER; >> + case BRBINF_EL_EL1: >> + return PERF_BR_PRIV_KERNEL; >> + case BRBINF_EL_EL2: >> + if (is_kernel_in_hyp_mode()) >> + return PERF_BR_PRIV_KERNEL; >> + return PERF_BR_PRIV_HV; >> + default: >> + pr_warn("unknown branch privilege captured\n"); >> + return -1; > > This looks like it should return PERF_BR_PRIV_UNKNOWN. Right, return from this function gets into perf branch record's priv element and '-1' is not something that can be parsed correctly in the user space tools as the corresponding enum itself starts with 0 i.e PERF_BR_PRIV_UNKNOWN. cpuc->brbe_entries[idx].priv = brbe_fetch_perf_priv(brbinf) Will change the return as PERF_BR_PRIV_UNKNOWN instead.