From patchwork Thu Apr 25 19:53:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 162874 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2363003jan; Thu, 25 Apr 2019 12:54:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDAxIfG5eoSzIOp/CeinyrBhuPCgakWNReXHzOivkghPrPzlEvbBfc1gndm28QoCW7W+RB X-Received: by 2002:aa7:83d1:: with SMTP id j17mr42478065pfn.78.1556222060745; Thu, 25 Apr 2019 12:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556222060; cv=none; d=google.com; s=arc-20160816; b=oZYPhF6aZAy3OKqsUndTC9udplp8g//kWiiAuVqkjFmTHLYnHyKxvZg+o0NHSsL4Xy Y3A4kPzvAtuNiH6tNP+xxo3Y45Z39RMYBAvhL6W8L5ofuyBFJhCDQcURIth3wx4jddOk 9tUYu3pA2RNN/KOOS4NkwbnI7ksIWpffZq0Ju7FpNtftiYbA+DSxiAvaEsWJSnAg6gUd UjfbBp/UFP7EuJq/YgKMAro/u5RzzBKCyP2kjooN8dADkjYCqWuJTyGA3nIuoDaZ8prn g/fhEH7+oVK2AwCGuN3pUzpzRhyqL2HeLjFiNlrX26J4/8VGI+CRgFNE00IndG1vhzIt Ccww== 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=hCKOOh4hib7nPM65HtU8D/wwQ4e+FlOROgf2ArtIPlk=; b=Rcuf+bsfFYJ/JnZz0fc5uAaAmYZrYOd1rg1CVNrXKEgIYS8CUXtI1jFrz7G8cVK5IE hMLNWVtXONXleNxAUKVrHpFA6J2+dzANK0U2Qc307CUX3nB6v2DEqO2Vif63707ga6zA qGvAgu4HCI85ElK6s/pnJ+D6tM3bWHAIy92L2A4rcb2P5f9i9nL+7U3rHHXWAE58bdZO 4M9KvDxFcFDhfMnVbsruBiFAbx9vBmkmfKKOGMMmdke+L9Vt9dz6+BjzJVLN/JGFKJ33 +AgFRiSTLf4sOG8Abg2H1Sdkzuc1d5/pufxLmuVoytYI7dRsqczfVH9idKCnXibCi+4b qqDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NLl1Qh73; 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 g3si23721807plq.400.2019.04.25.12.54.20; Thu, 25 Apr 2019 12:54:20 -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=NLl1Qh73; 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 S1730849AbfDYTyT (ORCPT + 30 others); Thu, 25 Apr 2019 15:54:19 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38492 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730710AbfDYTxp (ORCPT ); Thu, 25 Apr 2019 15:53:45 -0400 Received: by mail-pf1-f195.google.com with SMTP id 10so439204pfo.5 for ; Thu, 25 Apr 2019 12:53:45 -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=hCKOOh4hib7nPM65HtU8D/wwQ4e+FlOROgf2ArtIPlk=; b=NLl1Qh73x0bruajqwDy06dnBABzmAWNzw/fQwjVFDhO+q7EdS71MBwjXbx0j+siM2N nYF4xGB2mOWxEm3CU2B/+ruf9UJX7b4nVeFGVdNVE+4itmPOhktkdL3C/fOO9pA7TTP0 74WI3W5YES935RHXmLvg34016AovPe1mwqku21t/buu9pSTm2R3fBLvi06J/d4ea+0q9 4qFTr+hLI/NtawuF6E7Xq+Lo7d2ocdgm/GPJzHwI8+9nGuZ8eXyn7x9+nNJWep2jSuvQ jY9vX8RqltoCPs5FdQQjPfyQvErA2W/StfdzAS+GeUVMwBWnJcelbqqsc8/e6s8z/t0/ 4NEQ== 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=hCKOOh4hib7nPM65HtU8D/wwQ4e+FlOROgf2ArtIPlk=; b=JbK3b/CDFGO61mNdKXHTocI1dX1pgnxfmwp+SHLmMIpaVW2GY6fxjXMcbatjBEMYt4 k//dutx0KaOLzvU6R01rWuGAIU/2p0Fu+8q1hczclkzKnKAAeCJt31mBhfO7/99TvzrB 2XwC3QTjfUoNMF91HPwzxmV/p9nR3ffamAQftZRsLAFPaA8OZcZx+P7fGnWIhOgUpwZK R5BlaotVrHvSgcKpNfP0OgaSEfV7BEB9lB2YExpQCyR9TOrvVs+B/SMPzJq8wq2Kez5f LHZgGRC5p4848fHVqjXMNRYGrqsoHVeOBg7tG6zS66tb3aVh4D2v9IiPi5konYA31d6d RwhA== X-Gm-Message-State: APjAAAUn8eRC32OlbDumjT/1l+5wtHH9Le6nO2RKvYpr93C7Co/qsQcH Jj44pQkk4tqMrByX1X33ATtGig== X-Received: by 2002:a63:cd50:: with SMTP id a16mr20241249pgj.394.1556222024673; Thu, 25 Apr 2019 12:53:44 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id t64sm47261961pfa.86.2019.04.25.12.53.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 12:53:44 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 25/32] coresight: tmc-etr: Create per-thread buffer allocation function Date: Thu, 25 Apr 2019 13:53:03 -0600 Message-Id: <20190425195310.31562-26-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190425195310.31562-1-mathieu.poirier@linaro.org> References: <20190425195310.31562-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 Tested-by: Leo Yan Tested-by: Robert Walker --- .../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 e1d2128ee757..bca1b2d9ef2e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1207,6 +1207,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) @@ -1223,7 +1250,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;