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=-8.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_MUTT 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 7BAD7C10F05 for ; Tue, 26 Mar 2019 18:07:09 +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 5355A2082F for ; Tue, 26 Mar 2019 18:07:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mTKlpWId"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="opbd33bn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5355A2082F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject: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=aFSpIe35VS0JkL1+JPDoAMTJxMIozj0xZ3lJEPD+T/E=; b=mTKlpWIdWyVacF HJsnVzf/w/XTKWS69/Wy96nc+t3U4pplBO2iHCSks89QzOZ99P4VspMNnex/D32pX+8bNbMZt4j+k qposC0AjLoym32UvaC4Foj6Fp000ouaDBWsXIdbuObbTlvs1QMcX5Cii0vLt7BVVKkodKIdJcqd1W m0WS3ZCbPGi36X0CibeJkf/ZTvp8vsjL9zkNIy/s/OqidHSwzNuOJWtvl3MfrtRdoGGass5OqFqlq OqfE6P8AfBCZaLwaMEC3gqVgVeTAIxKxz+WHEq0oOQCbcPg4TaHBSMjNrxfP0+3LsLxVnKDAihwlH nXCnS6Lvkprepq9dtvUQ==; 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 1h8qTT-0000Aj-3n; Tue, 26 Mar 2019 18:06:59 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8qTP-0000AF-LL for linux-arm-kernel@lists.infradead.org; Tue, 26 Mar 2019 18:06:57 +0000 Received: by mail-pl1-x644.google.com with SMTP id m10so2000511plt.10 for ; Tue, 26 Mar 2019 11:06:55 -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:user-agent; bh=BTcpFAbGWjtL2N3LVX1fEmFiKDN9De6qWiCS3/cVP+k=; b=opbd33bnjPf8lSSlCNuagT7WL7DF66PXAcb5dmTTP/HZ2vBzNPJ5PakgI2wVIoHS1b GO9E6Vm2Joxl3nhTgdDsVWGWagC6b08sAd5HNIDeSvQdQuDrgFY0+GxXj9zi00ESFy1h 6BsW6Z91wOvLiCMudKhjJDInGm0N3UB+x964T1fIQmDqDuWLGyZCUULloQAggxFGCI4m q6p81N4zaKaE3pZyDcHxgWHJGuKJ/cCN5oLliUXobf0Ix31zjoUj0+cLn2GRwnTZ5//g WP1k6YVVpkaQxHFhiykmP4y/5LSi4uoyErV9BwXfassAuYn5R05kn25D8kcyjHxvKpal Zqzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BTcpFAbGWjtL2N3LVX1fEmFiKDN9De6qWiCS3/cVP+k=; b=L2maKSYreiLhSbtgB2BhacLWRh/XEnJCD+Oinc9VibUIL8zw+ifNNJHyRY5IVXWaTD mIjyppfwrkpMzQO8LPlUtPml/vOxaw1sIDpbgGTg/cXtBrZXhsJq9mUduYLr8xpcX0Jn 5rtCQ7YYHy6UByv2mWybNSW0cjGY2WrPX6lLFd38V0sPvweNpMUpIdzI1LcZsB/57wy4 MMcjiO/6buPY/Xb1rPy8yxP0juRpuxO7Lv1h0e+ERLd0nDFS0d80kagA2J9W4nUtX12S tQY7msb5FXNTcMfVTQYDkcXokEVlUt9sGAnXqFjCsO2s0XMwja3dVfUPc/EAmw4Qdvi9 s7AA== X-Gm-Message-State: APjAAAVUCN7crIgb4FI6SpACLbuBk3aPvo3hO202yPntwmOJvsY76hjb VBqZftsSJzZrbYfl/BzOiRSL/w== X-Google-Smtp-Source: APXvYqyxrm6mPFDRDm5u/HQrhsylSq8rWjhq/s6G0XfGSbFXplfZ3hXeBPjD6DbUO4ieray/jJ57/Q== X-Received: by 2002:a17:902:421:: with SMTP id 30mr32119860ple.142.1553623614364; Tue, 26 Mar 2019 11:06:54 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id v19sm40143566pfa.138.2019.03.26.11.06.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2019 11:06:53 -0700 (PDT) Date: Tue, 26 Mar 2019 12:06:51 -0600 From: Mathieu Poirier To: Suzuki K Poulose Subject: Re: [PATCH v2 12/16] coresight: tmc-etr: Introduce the notion of process ID to ETR devices Message-ID: <20190326180651.GB17902@xps15> References: <20190325215632.17013-1-mathieu.poirier@linaro.org> <20190325215632.17013-13-mathieu.poirier@linaro.org> <08b9ad38-403a-9e0a-7ad3-5e9a4b4f6bf9@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <08b9ad38-403a-9e0a-7ad3-5e9a4b4f6bf9@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190326_110655_729908_4A6812B0 X-CRM114-Status: GOOD ( 23.84 ) 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, coresight@lists.linaro.org, peterz@infradead.org, Mike.Leach@arm.com, leo.yan@linaro.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 26, 2019 at 04:46:06PM +0000, Suzuki K Poulose wrote: > 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. I wasted a lot of time thinking about this... Theoretically it should be split in two but the changes would be so trivial it would hardly be worth the trouble. I'll rework 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