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=-9.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT 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 EA843C43381 for ; Mon, 25 Mar 2019 21:58:36 +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 B2E7120830 for ; Mon, 25 Mar 2019 21:58:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kffTMJE8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qrINl1M+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2E7120830 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=8+N4ANP5HHopOze90Zam0xQhrXNGoVNhxt3epToB30w=; b=kffTMJE8M7fOzFLo/efVWjVlfk onCiXs36DZd2I48BrRBy39P0dZsaFtEF68xFIhzy+KQbDmwbAs0fOWWA63cMS6OrggzEUsEhUJABn x8TmU0guwrjI1zFs1Ibi9H9RReoWqJxC/iqPZMOOWGEv5JqxigfgV8qSNYBRKbwDLKYRVdyoY59VC 6fF1p/xhbdB+8FfaU55/vF0SEOJEPvxZIssyg3lcsQ58XSaaaQsyAe0ZimbpxzKfyAFj7Xr/pXDrV 1dza6nXKKHzBe8GJXVpAzjirW+TOqHi94gUKd/nliw1aJ8X+to+fCwOFRQTKLrDxSXSfNJ3VB0Xey WnV6q13Q==; 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 1h8Xbu-0005wi-44; Mon, 25 Mar 2019 21:58:26 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h8XaM-0003uA-MX for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2019 21:56:57 +0000 Received: by mail-pg1-x543.google.com with SMTP id r124so7225070pgr.3 for ; Mon, 25 Mar 2019 14:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3htge2VRmm5r+nRsT8mJwIBfRVfy6Z61FIF/jDsvIig=; b=qrINl1M+r7kTYAZ62D6IMOEDMddMilbSBTXj3Zr57hADEVRVsBXN0R6QC1KVTyAkEJ obTcSaK/2ExfJ4JMFZqky8ejqsb4pF/kFtEpLdp6D9JxI+n9B6F/ApxrV/WGfvTAuiNl HGobEswT4nutrG6KpBIARJ4khddrkoHPPdG345wXtFRyXxwLV45Ggs076iefFGz+fqI0 6KcJZC61avoHUvRVyoaBW0fgB8BQAqsxRxTjvWu/lRs0VlUXc9P0UwBO/pLGqYxRIYkc fHxdTzTc03668KTMxexpknLIGYxaErUlR/ZgeCSBXVHUeVqAHp8qgsp3BkeXlFlOxKnk 0q9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3htge2VRmm5r+nRsT8mJwIBfRVfy6Z61FIF/jDsvIig=; b=BXqMpzDBfQrDLh9sySERmVBkcytV0gwkvxOHM8S7uYZ5DisxwVbLxqYWNPly6DRR4e zTqBy9sdIfxxTpcYqGsP9FT7DfSz0pZOPsrS0WYW4Dud7aAcFkaDlnLGj1EXn424/F8w 4CHDrrW6sSMKVeTNywUWSvuuNnLdQTfzKqhCHs12Jrzt7BUEpXtyBqfJBEnuMqOs4UpV CnhHa2HoolVbJoZmQt5SFczaI3q5phL4zQd/UZP1rUEo0idAuHJHiq7tRoiHgnYSet/b G3slL6D4jmBFbTscMVVJn8hAUXyOCUBsmcuh5WiJrOEsFDEbWIg6ZS+7TtPap7tlwhMh WgRQ== X-Gm-Message-State: APjAAAVQDSQ3Slu5la4ouFc/5dCOPAX+pLSh58ft9ncnk3zsZSwWT2Wu HbhwGQsG/telNHmF6kgYMjh/u/0c7y0= X-Google-Smtp-Source: APXvYqxn8iU1EWDxKRW5RuUHWe4QiNsIwRKOKXinKeXxspGQC9VkWeaF5iAXCwDHvrOxHMVjrSguOg== X-Received: by 2002:a62:6ec3:: with SMTP id j186mr26901895pfc.89.1553551009831; Mon, 25 Mar 2019 14:56:49 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j20sm30645631pfi.27.2019.03.25.14.56.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 14:56:49 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 12/16] coresight: tmc-etr: Introduce the notion of process ID to ETR devices Date: Mon, 25 Mar 2019 15:56:28 -0600 Message-Id: <20190325215632.17013-13-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190325215632.17013-1-mathieu.poirier@linaro.org> References: <20190325215632.17013-1-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190325_145651_117404_5CE44343 X-CRM114-Status: GOOD ( 16.70 ) 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: suzuki.poulose@arm.com, alexander.shishkin@linux.intel.com, coresight@lists.linaro.org, peterz@infradead.org, mike.leach@arm.com, leo.yan@linaro.org MIME-Version: 1.0 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 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. 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; -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel