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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C903AC433F5 for ; Mon, 4 Oct 2021 17:42:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A262261108 for ; Mon, 4 Oct 2021 17:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235071AbhJDRod (ORCPT ); Mon, 4 Oct 2021 13:44:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231911AbhJDRoc (ORCPT ); Mon, 4 Oct 2021 13:44:32 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57629C061745 for ; Mon, 4 Oct 2021 10:42:43 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id b22so429814pls.1 for ; Mon, 04 Oct 2021 10:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dO2y9+bfdzEZFh/wkilYc1mXoP9qeWdBq8NEv0mAdf4=; b=G0Tyo1GVhmWLaHbDIGf7yb4Q/Rp5vjpVmNvgnGF+MQze6XmH2O02CWD7rxDWfGHilE TD9CQaVf3DQsRk8GyJIVFIH8sm+7wGJU3d52JAYO7Vs1NwT2nWZSLWS+ibkrDoxBOkBI MITFi+GKwRwlyWPQtnyrIMTbSbBT2NawJggXQBZTXbme8asi4nUcqAqYr4E3ulTANIfX DyzQNMp/KEK0kEbTn1i7i6opxNq3K/rHAqGCLbbChY/AidVSoUelDU74JxbwBxl7+pL0 ryyt7Id9P5Kfte5KMyrSciNnMQ5/mGij4dgJOauKAfLQO4YXTWlfcISVvGDM0TS+4NaB RIPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dO2y9+bfdzEZFh/wkilYc1mXoP9qeWdBq8NEv0mAdf4=; b=5ubOXEogqZpf7HJEuZvGIzg62UWUVSSc+71/j8tnPaxG/jnfSzmKyeuzAqcgkChiR7 /cgBmiph1PJhHVxrfHYNiNyc3esk/OBCLShYsTguMcJoK+fi4gBuFwYLWIwp0Lv53S3P pG3Ey8X0WdFK4aHiayJ+NZXt31NzyenWeIj6XWgdipl7Kg5tYu2BkPtTar6NeOcvPozZ IhkwqdTYk/Scc7oQBH2zj2AdltSelJ2XwTeGhCT20GjK9AgYwIVxr8QshvA8+GPwmWXP ieq4ESA9xCJe7tSlYaIVnFwDKldrwr4WdflC0dY2iM89ACdNORWki+ppfeoCug5JzZ7G 527w== X-Gm-Message-State: AOAM530JiiZQszb185ZRwADcjiX8CpBruVCcXFyjGYitotOa6p1Ibr/+ V9THGo8xSNW4yQzks4r18MDrcA== X-Google-Smtp-Source: ABdhPJxmsPdHjvy96hiG5usgWEIqZSTGCKVPzejOVkZBQIrXaUNb1nwHUQ/rtjbqX4P2mPg+LhPwXQ== X-Received: by 2002:a17:902:c406:b0:13b:7b40:9c5a with SMTP id k6-20020a170902c40600b0013b7b409c5amr846984plk.81.1633369362841; Mon, 04 Oct 2021 10:42:42 -0700 (PDT) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id o72sm11108725pjo.50.2021.10.04.10.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 10:42:41 -0700 (PDT) Date: Mon, 4 Oct 2021 11:42:39 -0600 From: Mathieu Poirier To: Suzuki K Poulose 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 Subject: Re: [PATCH v2 12/17] coresight: trbe: Add a helper to fetch cpudata from perf handle Message-ID: <20211004174239.GB3263478@p14s> References: <20210921134121.2423546-1-suzuki.poulose@arm.com> <20210921134121.2423546-13-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210921134121.2423546-13-suzuki.poulose@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 have to stop here for today. More comments tomorrow. Thanks, Mathieu > > WARN_ON(is_trbe_running(trbsr)); > if (is_trbe_trg(trbsr) || is_trbe_abort(trbsr)) > -- > 2.24.1 > 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3DA5C433F5 for ; Mon, 4 Oct 2021 17:44:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 70E1E61108 for ; Mon, 4 Oct 2021 17:44:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 70E1E61108 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=4fhBGN7Cx3o8N1/SlCZuAOyRZthm79hann5+dTFNerk=; b=Rti1yh67Av8NK+ luwIs4v5DIdc0ZAgEsGo51X9Q5YDNRC4xy5w+85eHaIT3mdMGWmMmpTBZlWiRB86cGRXgBj463ngK ER7rMsx35xz4j3pvUkH1+1bEq7+50JlOcmA8xc9swF7tJz4b73D+UWygZn1wUwtB7MKoIV6Av4XV4 0JvCpsnX3GWclFb5eoZUBvsts0s2pqddTv8GLKPy6SOcWB81D90ConhPZlC2wX9vj4aazGdc6gqr4 0y0RrMG9ohSyMaHr1mDIfRursm1H9iujdnoPv2eaAoLwZa9nhx2+bbHqvm8hitQFBfze5AmNYEuCc O+widanSNDuEwwAVA/ZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXRzE-007Q2D-Ei; Mon, 04 Oct 2021 17:42:48 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXRzA-007Q1V-Uj for linux-arm-kernel@lists.infradead.org; Mon, 04 Oct 2021 17:42:46 +0000 Received: by mail-pj1-x1030.google.com with SMTP id pf6-20020a17090b1d8600b0019fa884ab85so4090470pjb.5 for ; Mon, 04 Oct 2021 10:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dO2y9+bfdzEZFh/wkilYc1mXoP9qeWdBq8NEv0mAdf4=; b=G0Tyo1GVhmWLaHbDIGf7yb4Q/Rp5vjpVmNvgnGF+MQze6XmH2O02CWD7rxDWfGHilE TD9CQaVf3DQsRk8GyJIVFIH8sm+7wGJU3d52JAYO7Vs1NwT2nWZSLWS+ibkrDoxBOkBI MITFi+GKwRwlyWPQtnyrIMTbSbBT2NawJggXQBZTXbme8asi4nUcqAqYr4E3ulTANIfX DyzQNMp/KEK0kEbTn1i7i6opxNq3K/rHAqGCLbbChY/AidVSoUelDU74JxbwBxl7+pL0 ryyt7Id9P5Kfte5KMyrSciNnMQ5/mGij4dgJOauKAfLQO4YXTWlfcISVvGDM0TS+4NaB RIPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dO2y9+bfdzEZFh/wkilYc1mXoP9qeWdBq8NEv0mAdf4=; b=eMbeeAWhVDSXt2uAcC1Wh3uIMFy8ukT06FyOw0gltO2A0qlu3rt4hzssEXTcUflhhN bufEIBWzx2X12rRU9Snn5O/M+SWAAHneQeBZnKd2oXJVl/1SLcQJbZxrfK2fYxlTM7vA nbGR3wih/czpqesWKkwbMg2C7a5tMdnj2lN7vd7OfN3axFmRenSG9QbNrSs6ZZFX/ht/ +HyTTMhAPWI0XCZXHOFXuo6DkfprInd485Gp6HsPFaOK+jARy2KdFZfSwjLB8EbbEDJk VL8oynkPsXrFmK4GTsfkAW7o6F/h+ing//zCp8hyP+6amW5qqALFz4qchhxSZnDUeDd8 QYnw== X-Gm-Message-State: AOAM530zsySELhRCwkkPSi/E5lgelVaUQuxhJqvUy7jVNgnK3WJL8brH 1SfZU8Czwe7zQ0ZCLHcmiey9AQ== X-Google-Smtp-Source: ABdhPJxmsPdHjvy96hiG5usgWEIqZSTGCKVPzejOVkZBQIrXaUNb1nwHUQ/rtjbqX4P2mPg+LhPwXQ== X-Received: by 2002:a17:902:c406:b0:13b:7b40:9c5a with SMTP id k6-20020a170902c40600b0013b7b409c5amr846984plk.81.1633369362841; Mon, 04 Oct 2021 10:42:42 -0700 (PDT) Received: from p14s (S0106889e681aac74.cg.shawcable.net. [68.147.0.187]) by smtp.gmail.com with ESMTPSA id o72sm11108725pjo.50.2021.10.04.10.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 10:42:41 -0700 (PDT) Date: Mon, 4 Oct 2021 11:42:39 -0600 From: Mathieu Poirier To: Suzuki K Poulose 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 Subject: Re: [PATCH v2 12/17] coresight: trbe: Add a helper to fetch cpudata from perf handle Message-ID: <20211004174239.GB3263478@p14s> References: <20210921134121.2423546-1-suzuki.poulose@arm.com> <20210921134121.2423546-13-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210921134121.2423546-13-suzuki.poulose@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211004_104245_022183_77C78A8C X-CRM114-Status: GOOD ( 21.08 ) 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 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 have to stop here for today. More comments tomorrow. Thanks, Mathieu > > WARN_ON(is_trbe_running(trbsr)); > if (is_trbe_trg(trbsr) || is_trbe_abort(trbsr)) > -- > 2.24.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel