From patchwork Wed Jul 20 20:38:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 72490 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp74304qga; Wed, 20 Jul 2016 13:38:54 -0700 (PDT) X-Received: by 10.66.170.44 with SMTP id aj12mr78142946pac.131.1469047133921; Wed, 20 Jul 2016 13:38:53 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si5216120pfi.100.2016.07.20.13.38.53; Wed, 20 Jul 2016 13:38:53 -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; 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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755264AbcGTUi2 (ORCPT + 29 others); Wed, 20 Jul 2016 16:38:28 -0400 Received: from mail-io0-f170.google.com ([209.85.223.170]:34450 "EHLO mail-io0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755222AbcGTUi0 (ORCPT ); Wed, 20 Jul 2016 16:38:26 -0400 Received: by mail-io0-f170.google.com with SMTP id q83so58422259iod.1 for ; Wed, 20 Jul 2016 13:38:25 -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=dSYNweQJTIczgTkMBGnuSZ7pT5df2/33sxrjWtI5/YddTCj76WgSU1X9chGS0HVvOA w9XsbW2N4rmPPXMCj6DH9x/MYqa7Xdoj1hFYb4v1XKOxtk0RBm6PifnlesCaFz2p6ncd ox93hgTo4dGRf0hfWM92gISa1vfI6OjiJ7jD4= 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=MoBq+Uj2D0JfJ4QYp6pvsSdD16VSjjeIF4xuSnB98SUwn4RhLKQdSaWM1gcyOc95Hf W1C5S2+E848fIt++WFvxK0UwTIKxbm8GFf+kp7hwloe2xArWRpfKTi8Xo3A35dQvoPm7 hZu1NB9jKZ6UF+97Xdx+LSuHXzedGUqYaac+d4xYGdWmR4xuYgs1WporxWlLzZ5hAxS6 FOR0KKZm96Z2nnPd6BULLHelCzAHJODtvXgOcxRWUgkEn4BM5PIwqmSxEAKtJzrdFZjx J7SWjn27ZZsuStDvvHMSGi4ZIDMAyrESQ0Bl/+1ngzKkzIYDB3kcRJtS7x9XCrblbqW2 Zwlg== X-Gm-Message-State: ALyK8tLlpzV3n3rCse+flnEYHWcBNkEmRdeAw4xqKouk1VnHJ0u+tdLX6/opPkxGgoMYsJjS X-Received: by 10.107.31.130 with SMTP id f124mr16158412iof.180.1469047105083; Wed, 20 Jul 2016 13:38:25 -0700 (PDT) Received: from t430.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id b14sm9580262itd.11.2016.07.20.13.38.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jul 2016 13:38:24 -0700 (PDT) From: Mathieu Poirier To: acme@kernel.org, jolsa@kernel.org Cc: peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH V2 2/6] perf: Passing struct perf_event to function setup_aux() Date: Wed, 20 Jul 2016 14:38:16 -0600 Message-Id: <1469047100-18131-3-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469047100-18131-1-git-send-email-mathieu.poirier@linaro.org> References: <1469047100-18131-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 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;