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 X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A0C5C43381 for ; Tue, 26 Mar 2019 16:45:30 +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 C766D205F4 for ; Tue, 26 Mar 2019 16:45:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uoFUAgNo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C766D205F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NAqoht3qMtEqSdmQzeHEwnZ0AI912f9gEhsFdXLeUHk=; b=uoFUAgNoa2LHj71qRQhmeSdNL zcfIJiJJGHJmq9X2ERjsFnYMYEEZNr4GycPTedRzH2UIFkYQgPlMfIzTJ5+fUJ5uRPGEqhVrZlyJb vr3w6nC/n7bqRvPMr3cKWchFRCP3WykqJm2XeNt9oYLSUeKMbF7a5IQ8x/iF6C5f67J4jMfQx9S6s ow+cVaZBYrwK/7nKvVopiSi2BV5/pPk4bXKi9SaW6jRqL3GPnpCSb/Cn3hpAEl5o/h7WksnkSMibM Ppngeei2OtXrXWdB3YKtj32e3Ulxw8Qqe86A44Bdu8tXmYy6FnawdTOEd57mt97WkDf8m7zrhBnbQ AL+jU9Q8A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8pCS-0004B7-Ch; Tue, 26 Mar 2019 16:45:20 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8pB6-0001jl-Cj for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2019 16:44:39 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CBD84374; Tue, 26 Mar 2019 09:43:54 -0700 (PDT) Received: from [10.37.12.89] (unknown [10.37.12.89]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0A60A3F614; Tue, 26 Mar 2019 09:43:52 -0700 (PDT) Subject: Re: [PATCH v2 12/16] coresight: tmc-etr: Introduce the notion of process ID to ETR devices To: mathieu.poirier@linaro.org, linux-arm-kernel@lists.infradead.org References: <20190325215632.17013-1-mathieu.poirier@linaro.org> <20190325215632.17013-13-mathieu.poirier@linaro.org> From: Suzuki K Poulose Message-ID: <08b9ad38-403a-9e0a-7ad3-5e9a4b4f6bf9@arm.com> Date: Tue, 26 Mar 2019 16:46:06 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20190325215632.17013-13-mathieu.poirier@linaro.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190326_094356_972378_ED154D94 X-CRM114-Status: GOOD ( 23.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexander.shishkin@linux.intel.com, peterz@infradead.org, coresight@lists.linaro.org, Mike.Leach@arm.com, leo.yan@linaro.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Mathieu, On 03/25/2019 09:56 PM, Mathieu Poirier wrote: > In preparation to support CPU-wide trace scenarios, add the notion of > process ID to ETR devices so that memory buffers can be shared between > events. This patch looks fine to me. However it seems to do more than what the commit describes. e.g, refcounting. It may be worth fixing the description. Either way: Reviewed-by: Suzuki K Poulose > > Signed-off-by: Mathieu Poirier > --- > .../hwtracing/coresight/coresight-tmc-etr.c | 22 +++++++++++++++++-- > drivers/hwtracing/coresight/coresight-tmc.h | 3 +++ > 2 files changed, 23 insertions(+), 2 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c > index 79fee9341446..7254fafdf1c2 100644 > --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c > +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c > @@ -26,6 +26,7 @@ struct etr_flat_buf { > /* > * etr_perf_buffer - Perf buffer used for ETR > * @etr_buf - Actual buffer used by the ETR > + * @pid - The PID this etr_perf_buffer belongs to. > * @snaphost - Perf session mode > * @head - handle->head at the beginning of the session. > * @nr_pages - Number of pages in the ring buffer. > @@ -33,6 +34,7 @@ struct etr_flat_buf { > */ > struct etr_perf_buffer { > struct etr_buf *etr_buf; > + pid_t pid; > bool snapshot; > unsigned long head; > int nr_pages; > @@ -1160,8 +1162,8 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev) > } > > static struct etr_buf * > -tmc_etr_get_etr_buf(struct tmc_drvdata *drvdata, int node, > - int nr_pages, void **pages) > +alloc_etr_buf(struct tmc_drvdata *drvdata, int node, > + int nr_pages, void **pages) > { > struct etr_buf *etr_buf; > unsigned long size; > @@ -1195,6 +1197,20 @@ tmc_etr_get_etr_buf(struct tmc_drvdata *drvdata, int node, > return etr_buf; > } > > +static struct etr_buf * > +tmc_etr_get_etr_buf(struct tmc_drvdata *drvdata, int node, > + int nr_pages, void **pages) > +{ > + struct etr_buf *etr_buf; > + > + etr_buf = alloc_etr_buf(drvdata, node, nr_pages, pages); > + if (IS_ERR(etr_buf)) > + return etr_buf; > + > + refcount_set(&etr_buf->refcount, 1); > + return etr_buf; > +} > + > /* > * tmc_etr_setup_perf_buf: Allocate ETR buffer for use by perf. > * The size of the hardware buffer is dependent on the size configured > @@ -1231,6 +1247,7 @@ static void *tmc_alloc_etr_buffer(struct coresight_device *csdev, > int nr_pages, bool snapshot) > { > int cpu = event->cpu; > + pid_t pid = task_pid_nr(event->owner); > struct etr_perf_buffer *etr_perf; > struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent); > > @@ -1244,6 +1261,7 @@ static void *tmc_alloc_etr_buffer(struct coresight_device *csdev, > return NULL; > } > > + etr_perf->pid = pid; > etr_perf->snapshot = snapshot; > etr_perf->nr_pages = nr_pages; > etr_perf->pages = pages; > diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h > index 487c53701e9c..7675138ff9fc 100644 > --- a/drivers/hwtracing/coresight/coresight-tmc.h > +++ b/drivers/hwtracing/coresight/coresight-tmc.h > @@ -9,6 +9,7 @@ > > #include > #include > +#include > > #define TMC_RSZ 0x004 > #define TMC_STS 0x00c > @@ -133,6 +134,7 @@ struct etr_buf_operations; > > /** > * struct etr_buf - Details of the buffer used by ETR > + * @refcount : Number of sources currently using this etr_buf. > * @mode : Mode of the ETR buffer, contiguous, Scatter Gather etc. > * @full : Trace data overflow > * @size : Size of the buffer. > @@ -143,6 +145,7 @@ struct etr_buf_operations; > * @private : Backend specific information for the buf > */ > struct etr_buf { > + refcount_t refcount; > enum etr_mode mode; > bool full; > ssize_t size; > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel