Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp5015844pxb; Tue, 5 Oct 2021 15:39:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznWj6UwYOT9Sc+NwSg5uO81u54DbGMuxtIlZu1XP5RdQkuJdfKCNgcCbZEIDFh/73fvRhh X-Received: by 2002:a17:906:22c9:: with SMTP id q9mr1194150eja.216.1633473575452; Tue, 05 Oct 2021 15:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633473575; cv=none; d=google.com; s=arc-20160816; b=mskkVug854bVj+ZByTe29I7YYMRpBqGjFQSCfOtwpaFY3FrbSEO4+l0jGIJv0CmU4D Al2WuAO1yq8TLEFyZTjMPt8aThejZwFJ8SVTioU0x/E5Pwy1yM+DOYzczD0xKFDZtl+X i6BK/+LvO9TcWwwjvnOfmd1syIPsx2Do97EaZVcWQ2lcnX/d5gwgDbTNWpLdeqJtpPrj jk2F1WXy/1VrYcZQWE8jsjiGNmbmGZCm3JGVb36rFYnl8hHxzIVQg6M21w7O827ZLlI9 WeK1jXM9f5NobqhdTgOZP1TOqOYsN/zrApkbJIxOdUuYsF71YMs51lw3GdTBtNs1yZrg c9ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=pCjAzjZZQ7/lTHPJiax0h/IlMiipAzgpaYTk/v/Soso=; b=O0YTTUoovB6utEZuOJXrZZt748ByQ3RqbeyuxDcEg2/lgzcTcxnchH49OFwPkQZsOb n2ZlcSHnowUbxGxCWZaxhYPsa5J8bKYc8qBn9Lt+rMuL0MRcq/L3HV23QgGdNqFVWtNg OidQ3O6/AJzDz1NpHL+iI/IagIZiEUAZC+VQQ2TUcfNK61r+KlFS0kuO0cX7qzcOxUvg LcyFe0n/psAWuzoRumvCYs4kI3ml3mC5G+7rNBSwjl/QLQLNwh/IKE26vuks2i1N1ST0 NPscvpsi5k8APSx8n+tkdO79JtohgAe/W4+ruOx3ELpY8Ezh3qBmhEAWHyeadWXVVBKe 91KA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si25370736ejn.615.2021.10.05.15.39.11; Tue, 05 Oct 2021 15:39:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233567AbhJEWhI (ORCPT + 99 others); Tue, 5 Oct 2021 18:37:08 -0400 Received: from foss.arm.com ([217.140.110.172]:35688 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbhJEWhH (ORCPT ); Tue, 5 Oct 2021 18:37:07 -0400 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 8C44C6D; Tue, 5 Oct 2021 15:35:16 -0700 (PDT) Received: from [10.57.72.173] (unknown [10.57.72.173]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 924273F66F; Tue, 5 Oct 2021 15:35:14 -0700 (PDT) Subject: Re: [PATCH v2 12/17] coresight: trbe: Add a helper to fetch cpudata from perf handle To: Mathieu Poirier Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, maz@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, james.morse@arm.com, anshuman.khandual@arm.com, leo.yan@linaro.org, mike.leach@linaro.org, will@kernel.org, lcherian@marvell.com, coresight@lists.linaro.org References: <20210921134121.2423546-1-suzuki.poulose@arm.com> <20210921134121.2423546-13-suzuki.poulose@arm.com> <20211004174239.GB3263478@p14s> From: Suzuki K Poulose Message-ID: <0ff450f4-ab3e-b409-5278-35cdfb883284@arm.com> Date: Tue, 5 Oct 2021 23:35:13 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211004174239.GB3263478@p14s> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mathieu On 04/10/2021 18:42, Mathieu Poirier wrote: > On Tue, Sep 21, 2021 at 02:41:16PM +0100, Suzuki K Poulose wrote: >> Add a helper to get the CPU specific data for TRBE instance, from >> a given perf handle. This also adds extra checks to make sure that >> the event associated with the handle is "bound" to the CPU and is >> active on the TRBE. >> >> Cc: Anshuman Khandual >> Cc: Mike Leach >> Cc: Mathieu Poirier >> Cc: Leo Yan >> Signed-off-by: Suzuki K Poulose >> --- >> drivers/hwtracing/coresight/coresight-trbe.c | 12 ++++++++++-- >> 1 file changed, 10 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c >> index 983dd5039e52..797d978f9fa7 100644 >> --- a/drivers/hwtracing/coresight/coresight-trbe.c >> +++ b/drivers/hwtracing/coresight/coresight-trbe.c >> @@ -268,6 +268,15 @@ static unsigned long trbe_snapshot_offset(struct perf_output_handle *handle) >> return buf->nr_pages * PAGE_SIZE; >> } >> >> +static inline struct trbe_cpudata * >> +trbe_handle_to_cpudata(struct perf_output_handle *handle) >> +{ >> + struct trbe_buf *buf = etm_perf_sink_config(handle); >> + >> + BUG_ON(!buf || !buf->cpudata); >> + return buf->cpudata; >> +} >> + >> /* >> * TRBE Limit Calculation >> * >> @@ -533,8 +542,7 @@ static enum trbe_fault_action trbe_get_fault_act(struct perf_output_handle *hand >> { >> int ec = get_trbe_ec(trbsr); >> int bsc = get_trbe_bsc(trbsr); >> - struct trbe_buf *buf = etm_perf_sink_config(handle); >> - struct trbe_cpudata *cpudata = buf->cpudata; >> + struct trbe_cpudata *cpudata = trbe_handle_to_cpudata(handle); > > There is two other places where this pattern is present: is_perf_trbe() and > __trbe_normal_offset(). I skipped them, as they have to get access to the "trbe_buf" anyways. So the step by step, made sense. But I could replace them too to make it transparent. What do you think ? Suzuki