From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 3/7] drm/xe: Prepare format for GT-oriented messages in one place
Date: Tue, 9 Sep 2025 09:55:13 -0400 [thread overview]
Message-ID: <aMAxwcgCOHcNtCGg@intel.com> (raw)
In-Reply-To: <20250903213712.6364-4-michal.wajdeczko@intel.com>
On Wed, Sep 03, 2025 at 11:36:08PM +0200, Michal Wajdeczko wrote:
> To avoid code duplication (and thus potential mistakes) and to
> allow easier changes (if needed) of the prefix format of the
> GT-oriented messages, prepare that prefix in dedicated macro.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_printk.h | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_printk.h b/drivers/gpu/drm/xe/xe_gt_printk.h
> index f2091c734aba..5aaacaa6780c 100644
> --- a/drivers/gpu/drm/xe/xe_gt_printk.h
> +++ b/drivers/gpu/drm/xe/xe_gt_printk.h
> @@ -10,8 +10,10 @@
>
> #include "xe_gt_types.h"
>
> +#define __xe_gt_printk_fmt(_gt, _fmt, _args...) "GT%u: " _fmt, (_gt)->info.id, ##_args
> +
> #define xe_gt_printk(_gt, _level, _fmt, ...) \
> - drm_##_level(>_to_xe(_gt)->drm, "GT%u: " _fmt, (_gt)->info.id, ##__VA_ARGS__)
> + drm_##_level(>_to_xe(_gt)->drm, __xe_gt_printk_fmt((_gt), _fmt, ##__VA_ARGS__))
I honestly hate macros, and macros over macros makes things worse imho.
Specially with this format that looks like a function call inside an argument area.
But I do understand the motivations of the macro and the reasoning exposed above.
So, no hard blocker from my side...
Perhaps if we at least use all CAPS XE_GT_PRINTK_FMT?!
>
> #define xe_gt_err(_gt, _fmt, ...) \
> xe_gt_printk((_gt), err, _fmt, ##__VA_ARGS__)
> @@ -34,11 +36,14 @@
> #define xe_gt_dbg(_gt, _fmt, ...) \
> xe_gt_printk((_gt), dbg, _fmt, ##__VA_ARGS__)
>
> +#define xe_gt_WARN_type(_gt, _type, _condition, _fmt, ...) \
> + drm_WARN##_type(>_to_xe(_gt)->drm, _condition, _fmt, ## __VA_ARGS__)
> +
> #define xe_gt_WARN(_gt, _condition, _fmt, ...) \
> - drm_WARN(>_to_xe(_gt)->drm, _condition, "GT%u: " _fmt, (_gt)->info.id, ##__VA_ARGS__)
> + xe_gt_WARN_type((_gt),, _condition, __xe_gt_printk_fmt((_gt), _fmt, ##__VA_ARGS__))
>
> #define xe_gt_WARN_ONCE(_gt, _condition, _fmt, ...) \
> - drm_WARN_ONCE(>_to_xe(_gt)->drm, _condition, "GT%u: " _fmt, (_gt)->info.id, ##__VA_ARGS__)
> + xe_gt_WARN_type((_gt), _ONCE, _condition, __xe_gt_printk_fmt((_gt), _fmt, ##__VA_ARGS__))
>
> #define xe_gt_WARN_ON(_gt, _condition) \
> xe_gt_WARN((_gt), _condition, "%s(%s)", "WARN_ON", __stringify(_condition))
> @@ -72,7 +77,7 @@ static inline void __xe_gt_printfn_dbg(struct drm_printer *p, struct va_format *
> dbg = drm_dbg_printer(>_to_xe(gt)->drm, DRM_UT_DRIVER, NULL);
> dbg.origin = p->origin;
>
> - drm_printf(&dbg, "GT%u: %pV", gt->info.id, vaf);
> + drm_printf(&dbg, __xe_gt_printk_fmt(gt, "%pV", vaf));
> }
>
> /**
> --
> 2.47.1
>
next prev parent reply other threads:[~2025-09-09 13:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 21:36 [PATCH 0/7] RFC: Add dedicated printk macros for tile and device Michal Wajdeczko
2025-09-03 21:36 ` [PATCH 1/7] drm/xe: Keep xe_gt_err() macro definitions together Michal Wajdeczko
2025-09-03 21:59 ` Lucas De Marchi
2025-09-03 21:36 ` [PATCH 2/7] drm/xe: Drop "gt_" prefix from xe_gt_WARN() macros Michal Wajdeczko
2025-09-03 22:00 ` Lucas De Marchi
2025-09-03 21:36 ` [PATCH 3/7] drm/xe: Prepare format for GT-oriented messages in one place Michal Wajdeczko
2025-09-09 13:55 ` Rodrigo Vivi [this message]
2025-09-03 21:36 ` [PATCH 4/7] drm/xe: Add dedicated printk macros for tile and device Michal Wajdeczko
2025-09-09 13:57 ` Rodrigo Vivi
2025-09-03 21:36 ` [PATCH 5/7] drm/xe: Define verbose debug macros Michal Wajdeczko
2025-09-03 22:06 ` Lucas De Marchi
2025-09-03 22:19 ` Michal Wajdeczko
2025-09-09 14:01 ` Rodrigo Vivi
2025-09-03 21:36 ` [PATCH 6/7] drm/xe: Use tile-oriented messages in GGTT code Michal Wajdeczko
2025-09-09 13:58 ` Rodrigo Vivi
2025-09-03 21:36 ` [PATCH 7/7] drm/xe: Use tile-oriented messages in LMTT code Michal Wajdeczko
2025-09-09 13:58 ` Rodrigo Vivi
2025-09-03 21:43 ` ✗ CI.checkpatch: warning for RFC: Add dedicated printk macros for tile and device Patchwork
2025-09-03 21:44 ` ✓ CI.KUnit: success " Patchwork
2025-09-03 22:21 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-09-04 4:49 ` ✗ Xe.CI.Full: " Patchwork
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=aMAxwcgCOHcNtCGg@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.