public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: <intel-xe@lists.freedesktop.org>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Vinay Belgaumkar <vinay.belgaumkar@intel.com>,
	Riana Tauro <riana.tauro@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-perf-users@vger.kernel.org,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH v14 1/7] perf/core: Add PMU_EVENT_ATTR_ID_STRING
Date: Tue, 21 Jan 2025 22:23:35 -0800	[thread overview]
Message-ID: <20250122062341.1100173-2-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20250122062341.1100173-1-lucas.demarchi@intel.com>

struct perf_pmu_events_attr has both id and event_str however zeroes
the id and only set event_str. Add another macro that allows to set both
so drivers can make use of them. The id is useful for determining the
visibility of the attributes without resorting to creating separate
groups passed via update_attr, while the event_str is still useful for
attributes like *.unit or *.scale.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 include/linux/perf_event.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index cb99ec8c9e96f..423f21b51cb0f 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1923,13 +1923,16 @@ static struct perf_pmu_events_attr _var = {				\
 	.id   =  _id,							\
 };
 
-#define PMU_EVENT_ATTR_STRING(_name, _var, _str)			    \
+#define PMU_EVENT_ATTR_ID_STRING(_name, _var, _id, _str)		    \
 static struct perf_pmu_events_attr _var = {				    \
 	.attr		= __ATTR(_name, 0444, perf_event_sysfs_show, NULL), \
-	.id		= 0,						    \
+	.id		= _id,						    \
 	.event_str	= _str,						    \
 };
 
+#define PMU_EVENT_ATTR_STRING(_name, _var, _str)			\
+	PMU_EVENT_ATTR_ID_STRING(_name, _var, 0, _str)
+
 #define PMU_EVENT_ATTR_ID(_name, _show, _id)				\
 	(&((struct perf_pmu_events_attr[]) {				\
 		{ .attr = __ATTR(_name, 0444, _show, NULL),		\
-- 
2.48.0


  reply	other threads:[~2025-01-22  6:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22  6:23 [PATCH v14 0/7] drm/xe/pmu: PMU interface for Xe Lucas De Marchi
2025-01-22  6:23 ` Lucas De Marchi [this message]
2025-02-22 12:42   ` [PATCH v14 1/7] perf/core: Add PMU_EVENT_ATTR_ID_STRING Ingo Molnar
2025-01-22  6:23 ` [PATCH v14 2/7] drm/xe/pmu: Enable PMU interface Lucas De Marchi
2025-01-22 10:51   ` Riana Tauro
2025-01-22 15:31     ` Lucas De Marchi
2025-01-22  6:23 ` [PATCH v14 3/7] drm/xe/pmu: Assert max gt Lucas De Marchi
2025-01-22  6:23 ` [PATCH v14 4/7] drm/xe/pmu: Extract xe_pmu_event_update() Lucas De Marchi
2025-01-22  6:23 ` [PATCH v14 5/7] drm/xe/pmu: Add attribute skeleton Lucas De Marchi
2025-01-22  6:23 ` [PATCH v14 6/7] drm/xe/pmu: Get/put runtime pm on event init Lucas De Marchi
2025-01-22 10:26   ` Rodrigo Vivi
2025-01-22  6:23 ` [PATCH v14 7/7] drm/xe/pmu: Add GT C6 events Lucas De Marchi
2025-01-22 10:23   ` Riana Tauro
2025-01-22 10:32   ` Rodrigo Vivi
2025-01-23  0:11     ` Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250122062341.1100173-2-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=vinay.belgaumkar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox