Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1118546imm; Thu, 5 Jul 2018 15:15:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc9k05+zheetXqc4WosIEfoapDneRzPPNHRQPJEBf50ovwcYX37u7lZkhMjzZqnK0qzQhgt X-Received: by 2002:a63:5660:: with SMTP id g32-v6mr7269350pgm.227.1530828951922; Thu, 05 Jul 2018 15:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530828951; cv=none; d=google.com; s=arc-20160816; b=tcYIrud5Q1MNMwn7Y9iv6UPRnHVRicuFwTguonXAoq1/Pc6syARYaHDG1b4eoMN31t pv6YI8uwg132lQD3eNt2PznGIg/j513ZxPfWANI4SebmPDw1cUYwFLzY2sHblZTydOwt F5KG+2y7o7z8pic/z1owIXRjXPYB8pydpKlEVAIT6wV1YpvfQD14yGAzOgKNM7YfDMcm 2D0EDWcq1LU7foSwv8+rmgXVuh0jZazHnC86zsh8d65XDe2JTru4orOCnsfS7aS4isZn k6WRkk4sT/dRFuDYzqvAQ//MIex/w4mns3yNLo/5oNKbOXtIv46Q4J3152jV2sArMKT2 9XJQ== 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=tl2nPFuLq8bk2g+y2jmt6bYP8uuyjskDl1MjLjXUIBs=; b=ZRVwWEHF4m1gZ+qKvIXB5wrjrtTgsg3rz04K76Hsb+hceiGjFQZH/nyV5GcC7+4Sf2 2Fs0Plcal+Rgtgk3LGPy3jSB2J/Cp36qQ45r1PG+3zVCsRzoz1DqQ9R5CfFSXmvf50CL n4g3E7oD8uUu+p+Fgqk0/UYggXQQ3dttfYq2oxeP9uMOtgS7GkA5sy9sbS7IDRLpwxSO dHykraKcwoUDgffxGFW9lRwwZwx3IJL3o4prV/2CZ2/PMft0jf86p/Vkj8aqhWSFHe9y 31BlkfW68pzvXkGntsi+g9HcvoDQwF7foeenDYQ5hhW4pZCSZOHuf6pODq5Q2rxygHnf cBiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FTUmKl+S; 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 u7-v6si6573736pgn.194.2018.07.05.15.15.37; Thu, 05 Jul 2018 15:15: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=FTUmKl+S; 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 S1753779AbeGEWOB (ORCPT + 99 others); Thu, 5 Jul 2018 18:14:01 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:39978 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753439AbeGEWN5 (ORCPT ); Thu, 5 Jul 2018 18:13:57 -0400 Received: by mail-pf0-f193.google.com with SMTP id z24-v6so6579559pfe.7 for ; Thu, 05 Jul 2018 15:13:57 -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=tl2nPFuLq8bk2g+y2jmt6bYP8uuyjskDl1MjLjXUIBs=; b=FTUmKl+Su3xkTm9qCLJVOtO43Ck72h5TnxqbW48DH85h1BZtNZKYBpBWaS5BW9MwYO hxvpFLcfAUSMI3TcRy3B4Doah+fsXghiXaHmdwk+l4H2RiVcLWZ/x+NLQdTe7EVorsJT uwEGbC5Yzv8CYCuYYgJKAQqpzEdO26+FYOOTE= 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=tl2nPFuLq8bk2g+y2jmt6bYP8uuyjskDl1MjLjXUIBs=; b=SwiLYYjSd92rbhurFUPa/K2Ln/vM/o7Lumph3+4pHdfWpKy8q4On+mzDey/M/EdvN6 Gezs7bYzd2Vea07wf426PTBzqtimJWB5MJZcrGaK9LRvIFwff2x97HmBakfEamVdnM1T gxr2RLDeWhq/lGbrBD/Lkft6ubtuIH2BHTszQSoc0zDJ3nhN546ldwKbKoTeprqS+5jD xTsqynYNwow8pFBB277bHetWM7vwmgkOFqZpRpK4OSyL3pqLgioYNN5rweMTEWIU5RWj V5fW0aUMkrZXLzeYB0CdCJzBuIyNeQYxryxoZN+Q+TqZKDEB89K53Ux7Z6FAF6oIoTm6 H1eQ== X-Gm-Message-State: APt69E23hQUi5lGTwL47SPb5CjhDN2D6z5+WUPPcGl+KBYd7jvuytlkL 5egxyeHGPqgGPbYgUoZb8ti/Uw== X-Received: by 2002:a62:170c:: with SMTP id 12-v6mr8074871pfx.139.1530828837126; Thu, 05 Jul 2018 15:13:57 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id r89-v6sm13297486pfa.75.2018.07.05.15.13.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Jul 2018 15:13:56 -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, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/7] perf/aux: Make perf_event accessible to setup_aux() Date: Thu, 5 Jul 2018 16:13:43 -0600 Message-Id: <1530828827-11604-4-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530828827-11604-1-git-send-email-mathieu.poirier@linaro.org> References: <1530828827-11604-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(-) 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 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 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; -- 2.7.4