From patchwork Mon Dec 17 17:21:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 154023 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2715995ljp; Mon, 17 Dec 2018 09:21:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/VSCQAyfE2TH/Uny60DpZivtGYaMOUkzkNZ8EF0c9OspE2FuO9a6n9PaKc6L6LmaQPkZ9+g X-Received: by 2002:a17:902:6b09:: with SMTP id o9mr13392175plk.208.1545067317525; Mon, 17 Dec 2018 09:21:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545067317; cv=none; d=google.com; s=arc-20160816; b=CZddo2gg/506QgGjdbp7FqSDmpampHxcfq/pn+fOnGqJY+NONGPukbQYPBSWNk0SMD PrQYZ+P/rn5PUN7ScLzjqWRwxVUKsOHJj48FW85TCmGJ5vcVUZKVHSjQq6nEY93fxsSR 3AxfB1BHsPlrqmlkfQErRZKqJa3y5En19kzO3ULyTjGIQHCqnV5B46M63Po89UYJKdec AKEuNQB/JBvpe2ugSuLD16bAXyDPZ/xZdfphv7+QFfmJNtGCwJJUFAIOQXn3YoThBx4x 7SiRCy3GAL+WsWnOm3wUEx99Br8fqJoDBqRYK8tjY2miR3bsxIi5BoerWEZfR1rXL/K7 MfVg== 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=ydPIIvwp7JBz3247k2TeCqAjfpttVF2V+RHCfDoclY8=; b=oA+0h25djz1g+3DAVPgILqu9czCJfyPsALgj7zun2WJRGhcvSwvrq7z0Utbx95tkoZ IjKXcOGfH27WhT2Vr6gA5S67d+srsxxoVKfk/gBmqcX6JDuaa11/3HHDTOLSrnZNwTbD PxUzLEkLiu067gJQf3SEj6+50EN4bJIXkZ/LvAuAP+gti2xBeA3E4EoBzNnCi4BqtAhW wlC0OkkQFX6eVr9BvRKzMcRE2PHkhpquECg6encY6qo44oFcZxe5hLixeKjLxauozRS1 +UgK81BhbT3+f02c1fGXkThWig9qykkBspq5APROwAddP6POW4LmTDwpH3Ex1TR46AT8 bnTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bFXHmWDg; 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 g12si11206338pgd.567.2018.12.17.09.21.57; Mon, 17 Dec 2018 09:21:57 -0800 (PST) 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=bFXHmWDg; 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 S2388348AbeLQRV4 (ORCPT + 31 others); Mon, 17 Dec 2018 12:21:56 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34051 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387698AbeLQRVz (ORCPT ); Mon, 17 Dec 2018 12:21:55 -0500 Received: by mail-pl1-f195.google.com with SMTP id w4so6450076plz.1 for ; Mon, 17 Dec 2018 09:21:55 -0800 (PST) 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=ydPIIvwp7JBz3247k2TeCqAjfpttVF2V+RHCfDoclY8=; b=bFXHmWDgkZqoXIobAE+FI43Ux8IdZjsFC39FgIUq/Kr8vG1aXSlYrZMeGMkvMMVmbc FX+9kU9osL2/DFcIxUBiUDVlrz9H0rYNIEcIwwT/IyZP7ILrWbQAqAR7uwtuNAk7Uvzb OSqQEJ/43Bn+uyCieHa6d0zJ+GUJahZUjSnKA= 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=ydPIIvwp7JBz3247k2TeCqAjfpttVF2V+RHCfDoclY8=; b=lJA30JDbVbuVsFr5l5m6TkBic5G6Fm9SzgreSz9JCJynQ1OFmBJc+Da6ntSFaH01ho qyE/iqPkIjsxcfk8ObrNjUctJ38QTHkPrBxxnhCCIluQU4uVG8KRMLPn0ctVk7x0xUel 1V+Lv9KYQ3MiNZrN8F7mkUqnBEWQh+fvhvtWfRBd0X8UuJ09GyMY+3E8AN2a3nTfV04t pfIFDFmEvQII1ZYhkhQfNMrkvfcgCV7yY16jJWW8LPCHpeQAbNnwfIu8UxAF31UZ1llt 2ERM17Pg1kryODpTzUJwXMSgeEyRH8Ga54nqDfFoNg9CQCN2T5mX8E40X8hv87u4xxDA pM6A== X-Gm-Message-State: AA+aEWb2LIB3ZipH6fFB7qNLnJIPxG7Kr0jIFm4EIswYnWGgQUDYiVmM hLCKCpLqFRTem0Jrqz5jJvDvgQ== X-Received: by 2002:a17:902:d202:: with SMTP id t2mr13608602ply.193.1545067314681; Mon, 17 Dec 2018 09:21:54 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id j6sm20526648pfg.126.2018.12.17.09.21.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Dec 2018 09:21:54 -0800 (PST) From: Mathieu Poirier To: acme@kernel.org, peterz@infradead.org, gregkh@linuxfoundation.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, hpa@zytor.com, suzuki.poulosi@arm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH v5 3/6] perf/aux: Make perf_event accessible to setup_aux() Date: Mon, 17 Dec 2018 10:21:43 -0700 Message-Id: <1545067306-31687-4-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545067306-31687-1-git-send-email-mathieu.poirier@linaro.org> References: <1545067306-31687-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 When pmu::setup_aux() is called the coresight PMU needs to know which sink to use for the session by looking up the information in the drv_config field of the hw_perf_event structure. 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 | 6 +++--- 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, 17 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 7bf604ff50a1..df92c2af99b6 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -1600,7 +1600,7 @@ static void aux_sdb_init(unsigned long sdb) /* * aux_buffer_setup() - Setup AUX buffer for diagnostic mode sampling - * @cpu: On which to allocate, -1 means current + * @event: Event the buffer is setup for, event->cpu == -1 means current * @pages: Array of pointers to buffer pages passed from perf core * @nr_pages: Total pages * @snapshot: Flag for snapshot mode @@ -1612,8 +1612,8 @@ static void aux_sdb_init(unsigned long sdb) * * 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 3a0aa83cbd07..f7ec5c5fbf0a 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 abe8249b893b..f21eb28b6782 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -177,15 +177,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 8e69b7e309e7..b772ea2441a7 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -420,7 +420,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 4a9937076331..857308295f63 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -658,7 +658,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;