From patchwork Mon Jul 2 22:33:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 140853 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp464767ljj; Mon, 2 Jul 2018 15:33:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLo1cPyHed0ZPWpRtwpKcAlFp7uck76xkG0/iTEeYt3iUFlSUQEdyJ0yp0QruGV1dnsUVMn X-Received: by 2002:a63:3201:: with SMTP id y1-v6mr23621293pgy.419.1530570831720; Mon, 02 Jul 2018 15:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530570831; cv=none; d=google.com; s=arc-20160816; b=TD8dETZSUPVVhwMYsDZwZoQrCwqw10POul8aae4DWeCyS0tjkWNASZ3Vg8yN7im9Qn zqNZhsELcVQDURPPYqMEphtF6nxY7IfxbV56FSsKVfVrJeVYy/fBSULbMhMfHkuE+2Uv Q6AKVVw08kmBLxPfrxcBqTMYBG6nMTKw7aiM6GGgAng/0yhgJLXa9mK6r2P4Jj5mcQdy 0e1cng3t5Zjo5Sv3AB2dKqwu1ZpyaiwtETVNBqIgEJ5Ne25Rxb+iWk7et+Tpy48oCn22 VbU8+EuoY01mp1/+je9+T/87iNxWmw9WS9r599wajVriQBfX1r61eT7KBKs6y+G3po8d 2gjw== 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:arc-authentication-results; bh=LYBWjD9MwZq6AeXds2cnbJ8nNRd/Ae3mKj4z54DE1Zs=; b=OjuyWqBxDHusEbjCwxv1CC514eyHCA5RPxBKHcCg0iwUF4kAGnYpzrINPxCcDxvt8c pJ2RkeOy56lgIxQzqntULP8tbY6hQpa16ZptVWc5eqAEWhwpr9vN4VBoyMGQrnESkOuD 1rSVcAnKJoCNnU7Jwi2st3DGA7TQxzfzbo+D15gVxsSp0bDrzC17Bhjj2i7YfWJq2BOP XDv1ypnBKaHl8UFyMKasy2c4TpHOBimgEzkIGmA4sMKjxqP01sYYxDu9oKF90GtzNeUz kTID6c19v7OjEXMkfI47T9VXuKW42nyygBEEoEsD0ztn0O9Rb6eG3Z9JW9YjyOb3JyS5 kf6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AtMKy3NQ; 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 s82-v6si17574261pfj.338.2018.07.02.15.33.51; Mon, 02 Jul 2018 15:33:51 -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=AtMKy3NQ; 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 S932379AbeGBWds (ORCPT + 31 others); Mon, 2 Jul 2018 18:33:48 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:43689 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932100AbeGBWdn (ORCPT ); Mon, 2 Jul 2018 18:33:43 -0400 Received: by mail-pl0-f65.google.com with SMTP id c41-v6so8581279plj.10 for ; Mon, 02 Jul 2018 15:33:43 -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=LYBWjD9MwZq6AeXds2cnbJ8nNRd/Ae3mKj4z54DE1Zs=; b=AtMKy3NQmBdR9DRsALEIXaFSpIUgdc/SJ8gjwuATA71vLVImd02gY8iqPxZ+lzyH4c RekUEJmI3/Zb0q5IqvJ0Bw1x+73Tq+SYyPvCKR9bdKteSheDI6PMB4+7B6AUVdP4af0i qXPwUL6fdrsUn9rQI2ij7H1+EwhH9MTYTLxIk= 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=LYBWjD9MwZq6AeXds2cnbJ8nNRd/Ae3mKj4z54DE1Zs=; b=t0ApM0VcHfMldFrcTyRjlyKHcrRmsuI+Z6ARQTjxiISEZvAdGSwqerKs5MiXwcGLif 0GvAc7h60F5ANdkeEQDV6w/gc2cCTW0S+AWG2SVLnsGFB9/cLoQFptQ+gOK3wfvN71TJ 7JyH+NuC1zvJVNbp2XklqH4khWFN+wIyo7ooxibe2Na0Y2/gLd/IYMscupHNpn8mrVL3 z1fcA1u3kpXpjOf8yW485wS5gH22/mKa7QnCRj3bM+j1WFWjbHmoBl/bZPWh9lJxRnxo /NfAyf3ByLSkRIZqRchCFa4yyoNHWFRTIPLeQrIgCoTx/fAa3j0TNfZpyaWuXdW132Tl uKcQ== X-Gm-Message-State: APt69E0T74wQyBkP/j0QUWr0MP6t5+zaihuZ1J63Nyo067j0zq+WqAy1 +U+I8aw7MXW8ZBn2NnVbFbVp9Q== X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr28197745plt.288.1530570822617; Mon, 02 Jul 2018 15:33:42 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id p11-v6sm21764132pgu.16.2018.07.02.15.33.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Jul 2018 15:33:41 -0700 (PDT) From: Mathieu Poirier To: peterz@infradead.org, acme@kernel.org Cc: mingo@redhat.com, tglx@linutronix.de, alexander.shishkin@linux.intel.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, will.deacon@arm.com, mark.rutland@arm.com, jolsa@redhat.com, namhyung@kernel.org, adrian.hunter@intel.com, ast@kernel.org, gregkh@linuxfoundation.org, hpa@zytor.com, mathieu.poirier@linaro.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/6] perf/aux: Make perf_event accessible to setup_aux() Date: Mon, 2 Jul 2018 16:33:28 -0600 Message-Id: <1530570810-28929-5-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530570810-28929-1-git-send-email-mathieu.poirier@linaro.org> References: <1530570810-28929-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 It can be advantagous to have access to all the information conveyed by a perf_event when setting up the AUX buffer, as it is the case when dealing with PMU specific driver configuration communicated to the kernel using an ioctl() call. As such simply replace the cpu information by the complete perf_event structure and change all affected customers. Signed-off-by: Mathieu Poirier --- arch/s390/kernel/perf_cpum_sf.c | 4 ++-- arch/x86/events/intel/bts.c | 4 +++- arch/x86/events/intel/pt.c | 5 +++-- drivers/hwtracing/coresight/coresight-etm-perf.c | 6 +++--- drivers/perf/arm_spe_pmu.c | 6 +++--- include/linux/perf_event.h | 2 +- kernel/events/ring_buffer.c | 2 +- 7 files changed, 16 insertions(+), 13 deletions(-) -- 2.7.4 diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 0292d68e7dde..e06daaa08894 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -1601,8 +1601,8 @@ static void aux_buffer_free(void *data) * * Return the private AUX buffer structure if success or NULL if fails. */ -static void *aux_buffer_setup(int cpu, void **pages, int nr_pages, - bool snapshot) +static void *aux_buffer_setup(struct perf_event *event, void **pages, + int nr_pages, bool snapshot); { struct sf_buffer *sfb; struct aux_buffer *aux; diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c index 24ffa1e88cf9..7139f6bf27ad 100644 --- a/arch/x86/events/intel/bts.c +++ b/arch/x86/events/intel/bts.c @@ -77,10 +77,12 @@ 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) { struct bts_buffer *buf; struct page *page; + int cpu = event->cpu; int node = (cpu == -1) ? cpu : cpu_to_node(cpu); unsigned long offset; size_t size = nr_pages << PAGE_SHIFT; diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c index 8d016ce5b80d..8f4c98fdd03c 100644 --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c @@ -1104,10 +1104,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 677695635211..0f5e03e4df22 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -181,15 +181,15 @@ 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; + int cpu = event->cpu; cpumask_t *mask; struct coresight_device *sink; struct etm_event_data *event_data = NULL; - event_data = alloc_event_data(event_cpu); + event_data = alloc_event_data(cpu); if (!event_data) return NULL; INIT_WORK(&event_data->work, free_event_data); diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c index 54ec278d2fc4..4dcd7bf14dcc 100644 --- a/drivers/perf/arm_spe_pmu.c +++ b/drivers/perf/arm_spe_pmu.c @@ -824,10 +824,10 @@ static void arm_spe_pmu_read(struct perf_event *event) { } -static void *arm_spe_pmu_setup_aux(int cpu, void **pages, int nr_pages, - bool snapshot) +static void *arm_spe_pmu_setup_aux(struct perf_event *event, void **pages, + int nr_pages, bool snapshot) { - int i; + int i, cpu = event->cpu; struct page **pglist; struct arm_spe_pmu_buf *buf; diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 1fa12887ec02..4d9c8f30ca6c 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -409,7 +409,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 5d3cf407e374..4c96c7575224 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -648,7 +648,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;