From patchwork Thu Apr 4 03:35:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 161732 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1087486jan; Wed, 3 Apr 2019 20:36:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqztDDiuLuGjYRsmGXiSy2dIQwIH0BnyVt4e2BrQ8FTm7h8nyUKC5jT7012477GpBwe4OzZx X-Received: by 2002:aa7:8092:: with SMTP id v18mr3257950pff.35.1554349002355; Wed, 03 Apr 2019 20:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554349002; cv=none; d=google.com; s=arc-20160816; b=IP7+kwrNuJlpacAAr7YIvLcEjx8PaSmA2jVflbhb3+ya2sUjm/XcHFPxxHdUXYq8pQ DgSNxT+aG/BGT8+D0u4uSbC7vSoqhltmyVhyeD7hlUBGjUM0uaYIai5y1e6PxV2mV6Kf go2RnBRVr4xBUc6dPhSxY7e1AnFZgndwhryysqQZdZc/ocxmp3dgH0HbN5ONpu5bm8df +bxiC7w9O0Tit5V/tuaOaSRKZD3vuOj8tc3OaYVDd2YJlpnDipCAyYlC6s0Zgu21Ajc1 DeuoCLMvheqLB+W6U+WEfDQ4zaKwM8oBPCB+LuiRuohPw7N9D3z28/AfF6WQWBohWiRp HtRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=3HdOcyQCq9wrU1AdvtM6R2lHiYyKElGkieSf9jn2Q7c=; b=F5Ts18t5PuEgCr3mJYVbGyA+2x2yLF1VYbHztedo+C667fxrQmn7PvAoEn8UOsNqpe 2qLg4YabGwbHZLdynd8qV0nJx3qJgkztmgEMw7Jjlinnp/hBv3v0L75gliEtCuHeqlOW d/PphvFktQbPtRAgRjgYYxF8XAc/PFqQv41VVvgap1C/9Uz75Czh903c3jB9WH0QKigJ k3FE+xHcPEPku2flGhG1itDxOydFrjBt/T9V8IRdZSZi5vJ3enmBZg8WS6O9mqq2HdIq +h2lFbLWN0DXClgVtHlv4s+S1eAdgXrdEpXNbJU1DmoL3DN7Lcm8VrkS4DGACKdttu/+ HW0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=slFc+tqc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si5350508pgm.258.2019.04.03.20.36.42; Wed, 03 Apr 2019 20:36:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=slFc+tqc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728658AbfDDDgk (ORCPT + 31 others); Wed, 3 Apr 2019 23:36:40 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:38159 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728553AbfDDDgh (ORCPT ); Wed, 3 Apr 2019 23:36:37 -0400 Received: by mail-pf1-f193.google.com with SMTP id 10so625638pfo.5 for ; Wed, 03 Apr 2019 20:36:37 -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=3HdOcyQCq9wrU1AdvtM6R2lHiYyKElGkieSf9jn2Q7c=; b=slFc+tqcLXHYhCkIxgtfmG/A+C0SXJdQV/GnM6Oqifk9ED1Eb60jGCl5ehaz7kum9f /zzsI+zMaS64QEk6OeKJbO9qcb/orb7/xJSHlQTFmSoO32iuFd/gtifKgQiWwjEWAw+6 pa6GUmvQyLt3tUY8/QjNRxSLmNSas0E/Vo+nPOcrBRcyZs+DpdNZqr8OqkDEwiGMwzfI Nt1zrt4RMmEeVYi0JspPGlerBrJ5vgpDHQm5WSpokzXHsTwI0k4oGUWbnJmADATo1Rer zBYu9x1qeJzwAjdBEnorMU8S20jXoX2i/GxSjd69q//Voh0psQhboexDaqx5hpCqCiP2 Hfow== 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=3HdOcyQCq9wrU1AdvtM6R2lHiYyKElGkieSf9jn2Q7c=; b=nuiKpkIvz6mT6WTvzZcCY+4e1Hmf4SzhBUf9BvIZ4vqc9BnTiZd6cVk2MpG40HZkX/ Fn3XfjIeyQetEpjWcrocgmG7awlzqp72sybUCFQ31/Jxk0XjXz14Tp0DgKLjthER5ZZm yNntY/+09lMvMJN/j1bVn1HnEuiLgQyK6uEw11XVCdZyOWbyax1V8zJQV2HckOnF2btC WznIVoKxICMMTpROYJ7ZjgLpN2GNq11BlQIxyxqTBR58+2KGtT7aKUzz2cnt4PzQw24l A82roVTrcYMMdfm0SMXdR+sCy5CkPk4lIeOBVgJotBiB0lR/svGLuB25AB276AwnGoiq g++w== X-Gm-Message-State: APjAAAWEGiLSlNNvZDHxeCSAfqYsf+Wo6SHBjApZxVC2MqPJ5i2hvqYH PH/YXXEuQKh8qRZulff0ORRvlw== X-Received: by 2002:a63:b64:: with SMTP id a36mr3487712pgl.58.1554348996718; Wed, 03 Apr 2019 20:36:36 -0700 (PDT) Received: from xps15.imgcgcw.net ([147.50.13.10]) by smtp.gmail.com with ESMTPSA id u5sm12212780pfm.121.2019.04.03.20.36.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 20:36:36 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Cc: alexander.shishkin@linux.intel.com, peterz@infradead.org, suzuki.poulose@arm.com, mike.leach@arm.com, leo.yan@linaro.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 13/20] coresight: tmc-etr: Create per-thread buffer allocation function Date: Wed, 3 Apr 2019 21:35:34 -0600 Message-Id: <20190404033541.14072-14-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190404033541.14072-1-mathieu.poirier@linaro.org> References: <20190404033541.14072-1-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Buffer allocation is different when dealing with per-thread and CPU-wide sessions. In preparation to support CPU-wide trace scenarios simplify things by keeping allocation functions for both type separate. Signed-off-by: Mathieu Poirier --- .../hwtracing/coresight/coresight-tmc-etr.c | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index e9c77009188a..ac1efdfc0d07 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1206,6 +1206,33 @@ alloc_etr_buf(struct tmc_drvdata *drvdata, struct perf_event *event, return etr_buf; } +static struct etr_buf * +get_perf_etr_buf_per_thread(struct tmc_drvdata *drvdata, + struct perf_event *event, int nr_pages, + void **pages, bool snapshot) +{ + struct etr_buf *etr_buf; + + /* + * In per-thread mode the etr_buf isn't shared, so just go ahead + * with memory allocation. + */ + etr_buf = alloc_etr_buf(drvdata, event, nr_pages, pages, snapshot); + + return etr_buf; +} + +static struct etr_buf * +get_perf_etr_buf(struct tmc_drvdata *drvdata, struct perf_event *event, + int nr_pages, void **pages, bool snapshot) +{ + if (event->cpu == -1) + return get_perf_etr_buf_per_thread(drvdata, event, nr_pages, + pages, snapshot); + + return ERR_PTR(-ENOENT); +} + static struct etr_perf_buffer * tmc_etr_setup_perf_buf(struct tmc_drvdata *drvdata, struct perf_event *event, int nr_pages, void **pages, bool snapshot) @@ -1222,7 +1249,7 @@ tmc_etr_setup_perf_buf(struct tmc_drvdata *drvdata, struct perf_event *event, if (!etr_perf) return ERR_PTR(-ENOMEM); - etr_buf = alloc_etr_buf(drvdata, event, nr_pages, pages, snapshot); + etr_buf = get_perf_etr_buf(drvdata, event, nr_pages, pages, snapshot); if (!IS_ERR(etr_buf)) goto done;