From patchwork Wed Nov 28 22:01:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 10703445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C3AC15A8 for ; Wed, 28 Nov 2018 22:09:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A67B2DECA for ; Wed, 28 Nov 2018 22:09:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B1A32DED1; Wed, 28 Nov 2018 22:09:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E6BCE2DECA for ; Wed, 28 Nov 2018 22:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=go7NOdvhqr88TFu8tMrEQw/WpaPQ2GsM/5kbS1oyHx8=; b=ERmTPv8jeyUYx4/ZfcZQVp1MSR 4wu6o1ddb0QpobUpndstzuDQztv/Exhp8RG/9LsyTyQiN9lVlk56yegKv3fpsPJqTmKtn8yK8k7QL FFMRK0vNwqwG5x9Bt1M0nDU4bP579BKLrMe9urosL2IyIgTrzJPkeBPmbHk/6M36tgyk3ITKxmm/H LXimi9fT2b5A3Ft3ktFqDu5rX702N7RHKz4o8s5KdOzCrfzQPJ8YPntNf8eEeVAQvvbBwR0T+OhM/ ZkHky7oejmrZ8DZZeakT80RtXy+Urzqp54XUHMIqTjgLldzKuSS15Rcy22ZurdbPvf+6J/NPh+gI+ M7sMt9ag==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gS81q-00040M-Bo; Wed, 28 Nov 2018 22:09:54 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gS7to-0008IY-0v for linux-arm-kernel@lists.infradead.org; Wed, 28 Nov 2018 22:01:44 +0000 Received: by mail-pf1-x441.google.com with SMTP id u6so10831918pfh.11 for ; Wed, 28 Nov 2018 14:01:25 -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=aO5e9mjvolCn0fX+5uiKyzMENpxHFbYAI7Gf3JIbCzs=; b=LIb69zDpggSwsrnZSXdw8fh5h+VMymg+tQ/k0aNgoR6l/uHrM4162nNKZvlbpmIw5g ZlElfNOqSjbdVimuRuq3q8KtWKFXv0rltF9cDv4lpqtSEHIco4MFKXtRmgYpcubkFWTe PUG4mWjcMpM15A/3BcFb2kl9Ex/SoU00fElbQ= 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=aO5e9mjvolCn0fX+5uiKyzMENpxHFbYAI7Gf3JIbCzs=; b=cM9YuFkvhx/pdILtXKD1kq2VcwUtgmeLJdvijrMzxIhcBIRdSljre48fv8z+TZmzOK 0LwW/rdkVYFb9jM4gxUzr+ejPxGaGbSs9f75F63KupicDqBSXgWfG3bqdTSheHskdXXh 6vlRalhR97eGe9W6YzJJ6IkH0wK7v9xB48+ic/8SjVyqe7a/pBuLW7kO7a81WcJMyeJB 3I36/x6pjr7tLhYdX4GzQamfWvRJCMTkX1tobNRdcNQ7JMilmNeMFNT9tQ6eh+o9ouxs aJkOZDeJ+39E2goc0TD3yAi0lUYZLDE1R6SvCr5dRgDq/QcLDkGDtFf/fD5nc4s47kEl UsQg== X-Gm-Message-State: AGRZ1gLUT6n48/GkFLl0uHkjtCTGh9aKhGHN7SVnCpo9c0ugSd8vRhii 11CVv+Rz67I+kNid1fqwGtoTPw== X-Google-Smtp-Source: AJdET5d6xYt+YflnX477HE4amdP+Nhpbq3fmFjIdJDOE8XtXuAd+2aDN+zPqjTX8P8p7Crt6p0hEBg== X-Received: by 2002:a62:d2c1:: with SMTP id c184mr39554719pfg.248.1543442485402; Wed, 28 Nov 2018 14:01:25 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 12sm8698051pgd.35.2018.11.28.14.01.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Nov 2018 14:01:24 -0800 (PST) From: Mathieu Poirier To: acme@kernel.org, peterz@infradead.org, mingo@redhat.com Subject: [PATCH v4 3/6] perf/aux: Make perf_event accessible to setup_aux() Date: Wed, 28 Nov 2018 15:01:15 -0700 Message-Id: <1543442478-31465-4-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543442478-31465-1-git-send-email-mathieu.poirier@linaro.org> References: <1543442478-31465-1-git-send-email-mathieu.poirier@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181128_140136_318048_46D072A1 X-CRM114-Status: GOOD ( 16.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-s390@vger.kernel.org, alexander.shishkin@linux.intel.com, will.deacon@arm.com, hpa@zytor.com, heiko.carstens@de.ibm.com, adrian.hunter@intel.com, ast@kernel.org, suzuki.poulosi@arm.com, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, schwidefsky@de.ibm.com, namhyung@kernel.org, tglx@linutronix.de, jolsa@redhat.com, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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 629fa1e1d6cf..c17cbba10b30 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;