From patchwork Thu Aug 4 16:53:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 73293 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1495254qga; Thu, 4 Aug 2016 09:55:45 -0700 (PDT) X-Received: by 10.98.201.2 with SMTP id k2mr127449891pfg.95.1470329745187; Thu, 04 Aug 2016 09:55:45 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id e74si15443784pfk.131.2016.08.04.09.55.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2016 09:55:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bVLuA-0008VQ-JW; Thu, 04 Aug 2016 16:53:58 +0000 Received: from mail-it0-x22d.google.com ([2607:f8b0:4001:c0b::22d]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bVLu0-0008R4-NX for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2016 16:53:51 +0000 Received: by mail-it0-x22d.google.com with SMTP id u186so754628ita.0 for ; Thu, 04 Aug 2016 09:53:29 -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=zLBpwuurgRNxfkDdk3YSF7S4IdeJz2Dh9caM3Mb5zyY=; b=bAdUxPj59FWZXKmPkrpWUP0LpVqog6xeCC2ETg5ndlK3WlNwx3jdA2WhFVV0zr+LMm L1u/pAzd1RWLIYA5HwPTHBn/6rdbjgQjlcA4byf0ScGt5YmWJ9jZXdkUq3uRXZywQRv1 9S2kGG3IVWkyRbvyy7e0MEwvB/WaSwIKU481s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zLBpwuurgRNxfkDdk3YSF7S4IdeJz2Dh9caM3Mb5zyY=; b=aVCKd2RvlOisPrdM5+d0Kc48HMPfHUXZqIWaDUsVE7g1UUEgVl1AAyD1nc8E2au4Nb 9hLmpcWKlvfZ8dylz3RdkZdOGsPl55OKrxNwLT1k7S9y7+U/HAByCfwtEa/N+pYHHlBP p1ORT9IU5sbzTa3G4RB7OVXS32NKlwx2QXKIrQuhFjEMyo4egraDNq7Snfv+Qk7oDUp9 4ualSszwTV+YbwnKs9/ooj+AtGVPtjAg+NO17V7hfiK+aYbsOd7ajBxM8Yyav18FBqSH t4TZkF1BVyozf9rWWFZ3RRzJyE1xJME9NVDXyYgVR2mFcujl6b/YqJcLMmnrl4++eWIK VexA== X-Gm-Message-State: AEkooutObF2I9JY7Q2t7fPwHaJ/Nykd8FoGb9jjJKgloJY70xi9wlAQRhxeSglb6bpM8VuGV X-Received: by 10.36.19.75 with SMTP id 72mr74275459itz.83.1470329608839; Thu, 04 Aug 2016 09:53:28 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id l19sm6117846iod.10.2016.08.04.09.53.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Aug 2016 09:53:28 -0700 (PDT) From: Mathieu Poirier To: acme@kernel.org, jolsa@kernel.org Subject: [PATCH V4 2/6] perf: Passing struct perf_event to function setup_aux() Date: Thu, 4 Aug 2016 10:53:20 -0600 Message-Id: <1470329604-14356-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470329604-14356-1-git-send-email-mathieu.poirier@linaro.org> References: <1470329604-14356-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160804_095349_101311_5CC4DE20 X-CRM114-Status: GOOD ( 13.40 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4001:c0b:0:0:0:22d listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Some information, like driver specific configuration, is found in the hw_perf_event structure. As such pass a 'struct perf_event' to function setup_aux() rather than just the CPU number so that individual drivers can make the right configuration when setting up a session. Signed-off-by: Mathieu Poirier Cc: Alexander Shishkin --- arch/x86/events/intel/bts.c | 4 +++- arch/x86/events/intel/pt.c | 5 +++-- drivers/hwtracing/coresight/coresight-etm-perf.c | 4 ++-- include/linux/perf_event.h | 2 +- kernel/events/ring_buffer.c | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c index 0a6e393a2e62..98155c2dfcce 100644 --- a/arch/x86/events/intel/bts.c +++ b/arch/x86/events/intel/bts.c @@ -68,8 +68,10 @@ static size_t buf_size(struct page *page) } static void * -bts_buffer_setup_aux(int cpu, void **pages, int nr_pages, bool overwrite) +bts_buffer_setup_aux(struct perf_event *event, void **pages, + int nr_pages, bool overwrite) { + int cpu = event->cpu; struct bts_buffer *buf; struct page *page; int node = (cpu == -1) ? cpu : cpu_to_node(cpu); diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c index 04bb5fb5a8d7..5178c5de0b19 100644 --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c @@ -1003,10 +1003,11 @@ static int pt_buffer_init_topa(struct pt_buffer *buf, unsigned long nr_pages, * Return: Our private PT buffer structure. */ static void * -pt_buffer_setup_aux(int cpu, void **pages, int nr_pages, bool snapshot) +pt_buffer_setup_aux(struct perf_event *event, void **pages, + int nr_pages, bool snapshot) { struct pt_buffer *buf; - int node, ret; + int node, ret, cpu = event->cpu; if (!nr_pages) return NULL; diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 755125f7917f..f4174f36c5a0 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -155,7 +155,7 @@ static void etm_free_aux(void *data) schedule_work(&event_data->work); } -static void *etm_setup_aux(int event_cpu, void **pages, +static void *etm_setup_aux(struct perf_event *event, void **pages, int nr_pages, bool overwrite) { int cpu; @@ -163,7 +163,7 @@ static void *etm_setup_aux(int event_cpu, void **pages, struct coresight_device *sink; struct etm_event_data *event_data = NULL; - event_data = alloc_event_data(event_cpu); + event_data = alloc_event_data(event->cpu); if (!event_data) return NULL; diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 59d61a12cf9d..5275b6594989 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -407,7 +407,7 @@ struct pmu { /* * Set up pmu-private data structures for an AUX area */ - void *(*setup_aux) (int cpu, void **pages, + void *(*setup_aux) (struct perf_event *event, void **pages, int nr_pages, bool overwrite); /* optional */ diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index ae9b90dc9a5a..56aba90af437 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -616,7 +616,7 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, goto out; } - rb->aux_priv = event->pmu->setup_aux(event->cpu, rb->aux_pages, nr_pages, + rb->aux_priv = event->pmu->setup_aux(event, rb->aux_pages, nr_pages, overwrite); if (!rb->aux_priv) goto out;