From patchwork Wed Jul 18 21:48:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 142305 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1022362ljj; Wed, 18 Jul 2018 14:48:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcu/d/bRmHk6FEza/hXsqI45Khi8wfax/BOZe8WxNnVEprYlewpIgr5LMs1bddyGN+pHouN X-Received: by 2002:a17:902:bc85:: with SMTP id bb5-v6mr7497113plb.229.1531950503859; Wed, 18 Jul 2018 14:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531950503; cv=none; d=google.com; s=arc-20160816; b=qmandj96GUed1It8U3wDVgkFBuWrOYUsy7v5nl0meX0qd3GtMcOD5GQhb8a5+NW3yZ 5XiULjeyPqDm1T66yFbIotSCNnNnPEm1lEnkeklmzXtWiMHExyo7WVzcryGcjJzD3Uc1 pW9dTE91UiX2lVI40ziY66/bkpzANDGLmHuANU+zN2AHQ0y19tbsukIhSLt4zHcLESTa Iur6zfooeJeigY/pGhth1S2QOUUWQ6IMTxP8SRI6s4cRFwIyfXjgvnJ9n7KPvQn6WnZ7 qtyQkLkX8wn1RHtQG7y2lYQclbqmhmdpO29OE8N7TDLR6jXwp+xNDAHh1HuCg+zSoH4h uq4w== 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=7WnrWOlEDU+ZAtImQoRhxjXSprA05PTjN3muEnfClcE=; b=p1hUFcGdpuFScOvjZdWHaN4EoB2m8TZSrTEZO8zpECIMEwvOqnX3//UCEyYB1qJIuQ XsUeBWGnLCB8x0Te/kGNxGmjraehCVT747UijoB9rWo5vx4s9A1a64TJ4AshnfxVByx5 N/iJwghyP20dhz88XRir43uP2xuxb4js04MPZIyX+gaeQ5avcVDMwq2UJl4VdQe+ULa4 yuewoAlL0aajfwFbYg3Zh7r5LfLg+JzUFy9va56rk2+SrvS1A3xMfca+TOuuB/2WPBaB K51oWkP6FsT4oCRhljNKesixIybZJB27gnBsLYMFyF6w9yv+nvvmdNuS/C+dpetVDrMJ vK3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GEeTzdPy; 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 j189-v6si4017269pgd.498.2018.07.18.14.48.23; Wed, 18 Jul 2018 14:48:23 -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=GEeTzdPy; 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 S1730693AbeGRW2L (ORCPT + 31 others); Wed, 18 Jul 2018 18:28:11 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:52109 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729753AbeGRW2K (ORCPT ); Wed, 18 Jul 2018 18:28:10 -0400 Received: by mail-it0-f66.google.com with SMTP id h2-v6so6325679itj.1 for ; Wed, 18 Jul 2018 14:48:19 -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=7WnrWOlEDU+ZAtImQoRhxjXSprA05PTjN3muEnfClcE=; b=GEeTzdPy9hJ3su3hBl1ScRWmFCT2STQdwtwRbc3xpRrQ1P01EQX8/dLFgWpUs5aZal KY7vgtzwE/TCB7RPyuH1KP6i3NCWfYpiQkqe+9fHKVngnIJUzYTzflBeYW8eagLo+Wod 4cmbSpZSY+ruucuCWi2Ij6ZMtqLzhf7Mp2qc8= 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=7WnrWOlEDU+ZAtImQoRhxjXSprA05PTjN3muEnfClcE=; b=LEcNhGTPFMHaKBB1ugW1HAGqC1jCwSHd1GY8A7ZNM9rGt4jxpm0W0DP5FtoSI3YF3/ yyypNUlZdsZ9X1AuW6C9oSrQxTWkGpJReuufFTSYaWVmO0RynxExjKKFYiz3gyEfqUrc 7FO8ckXjssdJ06m2Sm1nk6FWwyDd86xIJ5lHyoKZSMVhnnjcUQKrOItufmMXqpbhdPCn LmXMt6npZN7XjK5GoX8QpI4V+YFuCRqwWf1FjJKN/nWuQpRGe7oPe9A5/NZ3Df4qOR41 vf8T/u+1+gxeQ8L4gYMe6DSNY0+hmbWKADEvBmNb8+VaCK1ztfUmlhEzxEvJzlUcOLAI RtSg== X-Gm-Message-State: AOUpUlEq5FSJGxdwAcVv06iQnAqqccuYMfkKu5IBW1O3EGXwjiPd/yh1 XvbBku09O94iWLDOidiFW9aRYw== X-Received: by 2002:a24:7584:: with SMTP id y126-v6mr3530511itc.11.1531950498675; Wed, 18 Jul 2018 14:48:18 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id w193-v6sm2093386ita.35.2018.07.18.14.48.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Jul 2018 14:48:17 -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, kim.phillips@arm.com, suzuki.poulosi@arm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 3/7] perf/aux: Make perf_event accessible to setup_aux() Date: Wed, 18 Jul 2018 15:48:03 -0600 Message-Id: <1531950487-24554-4-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531950487-24554-1-git-send-email-mathieu.poirier@linaro.org> References: <1531950487-24554-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 0292d68e7dde..2d55fc2bb185 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -1589,7 +1589,7 @@ static void aux_buffer_free(void *data) /* * 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 @@ -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 16b9c87d9d00..2bbd3240ff72 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -184,15 +184,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 7064b513ca2b..d67074f81c23 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 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;