From patchwork Thu May 7 14:15:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Bragg X-Patchwork-Id: 6358501 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CDD3F9F399 for ; Thu, 7 May 2015 14:16:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5D2F203B7 for ; Thu, 7 May 2015 14:16:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D4B23203B8 for ; Thu, 7 May 2015 14:16:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3CFF06E840; Thu, 7 May 2015 07:16:05 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by gabe.freedesktop.org (Postfix) with ESMTP id 8FE646E83F; Thu, 7 May 2015 07:16:03 -0700 (PDT) Received: by wief7 with SMTP id f7so15016553wie.0; Thu, 07 May 2015 07:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9XZJm2jcQoPVjrTKVD2d8xeXYIQR6M+sR/o8pc5pg68=; b=mpU27rHMYYw6R5ypQaUWWiI9thwip+GPbgvQr7rhhNRF5L+xLZ6VVxoDNqRCcAc5qa sIBhS90d2aiYLRmCnJHOhDdaSdun4tVS7sZRUZ0mJ5BVAjFiX2+3nbAW8cXoqzns5xb2 rxzpQQa2stFvOCxDMhV7vl6UsMOWZlwh/pp7IjMOcA2VEQeO5y8GNhOc04RXUgEN/Ki9 5/ReuhHjsjpLlV4acRwSrYpsQCCc8OCA1KiTiLVJ85bzyYdn7BYJVQi5CX28Q2XtAQF0 2QrVqk8VqgcODN0170YLKjVH2ynyMGIvBS1fV/E3wP2VDrFZfJiXHWJw+HfaI1fAn93O DJzA== X-Received: by 10.195.17.232 with SMTP id gh8mr7756445wjd.145.1431008162750; Thu, 07 May 2015 07:16:02 -0700 (PDT) Received: from sixbynine.org (cpc26-heme10-2-0-cust305.9-1.cable.virginm.net. [86.3.57.50]) by mx.google.com with ESMTPSA id i13sm7654847wic.13.2015.05.07.07.16.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 07:16:01 -0700 (PDT) From: Robert Bragg To: intel-gfx@lists.freedesktop.org Date: Thu, 7 May 2015 15:15:48 +0100 Message-Id: <1431008154-6833-6-git-send-email-robert@sixbynine.org> X-Mailer: git-send-email 2.3.2 In-Reply-To: <1431008154-6833-1-git-send-email-robert@sixbynine.org> References: <1431008154-6833-1-git-send-email-robert@sixbynine.org> Cc: Peter Zijlstra , David Airlie , linux-api@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Ingo Molnar , Paul Mackerras , Arnaldo Carvalho de Melo , Daniel Vetter Subject: [Intel-gfx] [RFC PATCH 05/11] perf: allow drivers more control over event logging X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This exports enough api to allow drivers to output their own PERF_RECORD_DEVICE events. Signed-off-by: Robert Bragg --- include/linux/perf_event.h | 7 +++++++ kernel/events/core.c | 2 ++ kernel/events/internal.h | 9 --------- kernel/events/ring_buffer.c | 3 +++ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 69a0cb9..293f041 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -633,6 +633,10 @@ struct perf_sample_data { PERF_MEM_S(LOCK, NA) |\ PERF_MEM_S(TLB, NA)) +extern void perf_event_header__init_id(struct perf_event_header *header, + struct perf_sample_data *data, + struct perf_event *event); + static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr, u64 period) { @@ -654,6 +658,9 @@ extern void perf_prepare_sample(struct perf_event_header *header, struct perf_sample_data *data, struct perf_event *event, struct pt_regs *regs); +extern void perf_event__output_id_sample(struct perf_event *event, + struct perf_output_handle *handle, + struct perf_sample_data *sample); extern int perf_event_overflow(struct perf_event *event, struct perf_sample_data *data, diff --git a/kernel/events/core.c b/kernel/events/core.c index 340deaa..26b84fc 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -4793,6 +4793,7 @@ void perf_event_header__init_id(struct perf_event_header *header, if (event->attr.sample_id_all) __perf_event_header__init_id(header, data, event); } +EXPORT_SYMBOL_GPL(perf_event_header__init_id); static void __perf_event__output_id_sample(struct perf_output_handle *handle, struct perf_sample_data *data) @@ -4825,6 +4826,7 @@ void perf_event__output_id_sample(struct perf_event *event, if (event->attr.sample_id_all) __perf_event__output_id_sample(handle, sample); } +EXPORT_SYMBOL_GPL(perf_event__output_id_sample); static void perf_output_read_one(struct perf_output_handle *handle, struct perf_event *event, diff --git a/kernel/events/internal.h b/kernel/events/internal.h index 569b2187..3c86bb3 100644 --- a/kernel/events/internal.h +++ b/kernel/events/internal.h @@ -44,15 +44,6 @@ extern struct ring_buffer * rb_alloc(int nr_pages, long watermark, int cpu, int flags); extern void perf_event_wakeup(struct perf_event *event); -extern void -perf_event_header__init_id(struct perf_event_header *header, - struct perf_sample_data *data, - struct perf_event *event); -extern void -perf_event__output_id_sample(struct perf_event *event, - struct perf_output_handle *handle, - struct perf_sample_data *sample); - extern struct page * perf_mmap_to_page(struct ring_buffer *rb, unsigned long pgoff); diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index eadb95c..fa100d4 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -202,12 +202,14 @@ out: return -ENOSPC; } +EXPORT_SYMBOL_GPL(perf_output_begin); unsigned int perf_output_copy(struct perf_output_handle *handle, const void *buf, unsigned int len) { return __output_copy(handle, buf, len); } +EXPORT_SYMBOL_GPL(perf_output_copy); unsigned int perf_output_skip(struct perf_output_handle *handle, unsigned int len) @@ -220,6 +222,7 @@ void perf_output_end(struct perf_output_handle *handle) perf_output_put_handle(handle); rcu_read_unlock(); } +EXPORT_SYMBOL_GPL(perf_output_end); static void ring_buffer_init(struct ring_buffer *rb, long watermark, int flags)