Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp249773pxb; Wed, 22 Sep 2021 01:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtp8kBa2K+BgkEO7H/lOHx7dYpvGSLi71Z8aOIplGc4j0BcXOs/BaVSEilE83RBnjceX6k X-Received: by 2002:a17:907:1c01:: with SMTP id nc1mr39883690ejc.504.1632297653366; Wed, 22 Sep 2021 01:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632297653; cv=none; d=google.com; s=arc-20160816; b=cfAt/sZrvdMbhPKZG6+BvP5r4pCgZQ0nN8ljNQPmZe/nu6LFAHaY5gwco3SVRF7TVf Ub9DWWHRnj1w8cUpqausrEeXAzFc1WGkpfxcGyDw91zFjC3LXkiJq33IzuN9fIwATP29 D8e8MXsiFts1JBaPFtreOCsiRsyxS+vMWnHIW9Kv5uACEl5prs1x5PelS20wwaCq1/fK 7RzCtT0UwJErGsUL759uoZjqPOE/Grzjq6mmKJYsJPJCp6yWKFbf5chWpxmBqkc3AFo3 1qC39G1le5xgjzZgMkzMZ3bWZMLdeLWdy3v/ejQM4D6ROWJTE0mvl82Y7ZKFXaMCQi7P WLtQ== 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=tfoxuBoEXrxl/0x7rtwfM/d9LGPChRQAMVxfeOFaQB4=; b=NcQa7kcdUIpNt+lxtH8rOfU0Sq6CaYuLFTKXvai/aK3nj/0P4Sla2lCMIokRB2Db+4 h0ViiX1aAUl1cyuLajqYs3vMmr3aIgFa8eeXbV7MEHVo6c4OMQLf7+nplavJo2LfOLsf 88e2djBm2HKTzPeteKmtFL58J/GzUaZmBdH+VUzSTuDLjKcyweKdUymEM70uYFpg0DnO GQgbHXbUy1vFe4RpGVQ004bJfzdj5kDRwW2xrcyOGavQtpqQGJVEUIwtGgAnOWL7VNmf u0tImbDPBIIkOuc8cIUaEvM9HZ8upTnw4EyvHQV+g2YxARmj6dyhSnmWAtBzpPyUYmQ3 R24w== 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 v1si2009119ejk.111.2021.09.22.01.00.26; Wed, 22 Sep 2021 01:00:53 -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 S233443AbhIVIAJ (ORCPT + 99 others); Wed, 22 Sep 2021 04:00:09 -0400 Received: from foss.arm.com ([217.140.110.172]:44558 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233394AbhIVIAI (ORCPT ); Wed, 22 Sep 2021 04:00:08 -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 E6D7811B3; Wed, 22 Sep 2021 00:58:38 -0700 (PDT) Received: from [10.163.73.113] (unknown [10.163.73.113]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BD4D33F719; Wed, 22 Sep 2021 00:58:34 -0700 (PDT) Subject: Re: [PATCH v2 12/17] coresight: trbe: Add a helper to fetch cpudata from perf handle To: Suzuki K Poulose , linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, maz@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, james.morse@arm.com, leo.yan@linaro.org, mike.leach@linaro.org, mathieu.poirier@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> From: Anshuman Khandual Message-ID: Date: Wed, 22 Sep 2021 13:29:40 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210921134121.2423546-13-suzuki.poulose@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/21/21 7:11 PM, 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) This is actually a perf handle not a TRBE handle. Hence should be renamed as 'perf_handle_to_cpudata' instead. > +{ > + 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); > > WARN_ON(is_trbe_running(trbsr)); > if (is_trbe_trg(trbsr) || is_trbe_abort(trbsr)) >