dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
To: Krzysztof Karas <krzysztof.karas@intel.com>,
	<intel-gfx@lists.freedesktop.org>
Cc: <dri-devel@lists.freedesktop.org>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Andi Shyti <andi.shyti@linux.intel.com>,
	Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
	"Sebastian Brzezinka" <sebastian.brzezinka@intel.com>,
	Krzysztof Niemiec <krzysztof.niemiec@intel.com>,
	Andi Shyti <andi.shyti@kernel.org>
Subject: Re: [PATCH v4 2/7] drm/i915: Add i915_* printer macros
Date: Thu, 24 Sep 2026 15:58:01 +0200	[thread overview]
Message-ID: <DLNLLGHRVHT9.2TW4LJ2SFXO5P@intel.com> (raw)
In-Reply-To: <20260924120147.1305127-3-krzysztof.karas@intel.com>

Hi,

On Thu Sep 24, 2026 at 2:01 PM CEST, Krzysztof Karas wrote:
> Add i915_* family of printer macros, following existing example
> of gt_* and xe_* prints.
>
> Suggested-by: Andi Shyti <andi.shyti@kernel.org>
> Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_printk.h | 53 ++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
>  create mode 100644 drivers/gpu/drm/i915/i915_printk.h
>
> diff --git a/drivers/gpu/drm/i915/i915_printk.h b/drivers/gpu/drm/i915/i915_printk.h
> new file mode 100644
> index 000000000000..5bbbe604cae8
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/i915_printk.h
> @@ -0,0 +1,53 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#ifndef _I915_PRINTK_H_
> +#define _I915_PRINTK_H_
> +
> +#include <drm/drm_print.h>
> +
> +#define i915_printk(_i915, _level, _fmt, ...) \
> +	drm_##_level(&(_i915)->drm, _fmt, ## __VA_ARGS__)
> +
> +#define i915_err(_i915, _fmt, ...) \
> +	i915_printk((_i915), err, _fmt, ##__VA_ARGS__)
> +
> +#define i915_err_once(_i915, _fmt, ...) \
> +	i915_printk((_i915), err_once, _fmt, ##__VA_ARGS__)
> +
> +#define i915_err_ratelimited(_i915, _fmt, ...) \
> +	i915_printk((_i915), err_ratelimited, _fmt, ##__VA_ARGS__)
> +
> +#define i915_warn(_i915, _fmt, ...) \
> +	i915_printk((_i915), warn, _fmt, ##__VA_ARGS__)
> +
> +#define i915_notice(_i915, _fmt, ...) \
> +	i915_printk((_i915), notice, _fmt, ##__VA_ARGS__)
> +
> +#define i915_info(_i915, _fmt, ...) \
> +	i915_printk((_i915), info, _fmt, ##__VA_ARGS__)
> +
> +#define i915_dbg(_i915, _fmt, ...) \
> +	i915_printk((_i915), dbg, _fmt, ##__VA_ARGS__)
> +
> +#define i915_dbg_ratelimited(_i915, _fmt, ...) \
> +	i915_printk((_i915), dbg_ratelimited, _fmt, ##__VA_ARGS__)
> +
> +#define i915_WARN_type(_i915, _type, _condition, _fmt, ...) \
> +	drm_WARN##_type(&(_i915)->drm, _condition, _fmt, ## __VA_ARGS__)
> +
> +#define i915_WARN(_i915, _condition, _fmt, ...) \
> +	i915_WARN_type((_i915), _condition, __I915_PRINTK_FMT((_i915), _fmt, ## __VA_ARGS__))
> +
> +#define i915_WARN_ONCE(_i915, _condition, _fmt, ...) \
> +	i915_WARN_type((_i915), _ONCE, _condition, __I915_PRINTK_FMT((_i915), _fmt, ## __VA_ARGS__))
> +
> +#define i915_WARN_ON(_i915, _condition) \
> +	i915_WARN((_i915), _condition, "%s(%s)", "WARN_ON", __stringify(_condition))
> +
> +#define i915_WARN_ON_ONCE(_i915, _condition) \
> +	i915_WARN_ONCE((_i915), _condition, "%s(%s)", "WARN_ON_ONCE", __stringify(_condition))

There is something wrong with the WARN macros. I noticed that they aren't
used anywhere in the series, so the compiler never expands them. I added
one to a file just to test it.
diff --git a/drivers/gpu/drm/i915/selftests/i915_selftest.c b/drivers/gpu/drm/i915/selftests/i915_selftest.c
index 4e2566189879..7446c265813a 100644
--- a/drivers/gpu/drm/i915/selftests/i915_selftest.c
+++ b/drivers/gpu/drm/i915/selftests/i915_selftest.c
@@ -50,6 +50,7 @@ int i915_mock_sanitycheck(void)
 int i915_live_sanitycheck(struct drm_i915_private *i915)
 {
        i915_info(i915, "%s() - ok!\n", __func__);
+       i915_WARN_ON(i915, false);
        return 0;
 }


This is what I get when compiled:
vers/gpu/drm/i915/selftests/i915_selftest.c: In function 'i915_live_sanitycheck':
drivers/gpu/drm/i915/selftests/i915_selftest.c:53:33: error: macro "i915_WARN_type" requires 5 arguments, but only 3 given
   53 |         i915_WARN_ON(i915, false); /* TEMP: reviewer repro, will be reverted */
      |                                 ^
In file included from drivers/gpu/drm/i915/selftests/i915_selftest.c:26:
./drivers/gpu/drm/i915/i915_printk.h:38:9: note: macro "i915_WARN_type" defined here
   38 | #define i915_WARN_type(_i915, _type, _condition, _fmt, ...) \
      |         ^~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_printk.h:42:9: error: 'i915_WARN_type' undeclared (first use in this function); did you mean 'i915_map_type'?
   42 |         i915_WARN_type((_i915), _condition, __I915_PRINTK_FMT((_i915), _fmt, ## __VA_ARGS__))
      |         ^~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_printk.h:48:9: note: in expansion of macro 'i915_WARN'
   48 |         i915_WARN((_i915), _condition, "%s(%s)", "WARN_ON", __stringify(_condition))
      |         ^~~~~~~~~
drivers/gpu/drm/i915/selftests/i915_selftest.c:53:9: note: in expansion of macro 'i915_WARN_ON'
   53 |         i915_WARN_ON(i915, false); /* TEMP: reviewer repro, will be reverted */
      |         ^~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_printk.h:42:9: note: each undeclared identifier is reported only once for each function it appears in
   42 |         i915_WARN_type((_i915), _condition, __I915_PRINTK_FMT((_i915), _fmt, ## __VA_ARGS__))
      |         ^~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_printk.h:48:9: note: in expansion of macro 'i915_WARN'
   48 |         i915_WARN((_i915), _condition, "%s(%s)", "WARN_ON", __stringify(_condition))
      |         ^~~~~~~~~
drivers/gpu/drm/i915/selftests/i915_selftest.c:53:9: note: in expansion of macro 'i915_WARN_ON'
   53 |         i915_WARN_ON(i915, false); /* TEMP: reviewer repro, will be reverted */
      |         ^~~~~~~~~~~~
  CC [M]  drivers/gpu/drm/i915/gvt/cmd_parser.o
make[6]: *** [scripts/Makefile.build:290: drivers/gpu/drm/i915/selftests/i915_selftest.o] Error 1


-- 
Best regards,
Sebastian


  reply	other threads:[~2026-09-24 13:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 12:01 [PATCH v4 0/7] drm/i915/selftests: Modernize printing in i915 selftests Krzysztof Karas
2026-09-24 12:01 ` [PATCH v4 1/7] drm/i915/selftests: Use gt_*/drm_* prints in core selftests Krzysztof Karas
2026-09-24 12:01 ` [PATCH v4 2/7] drm/i915: Add i915_* printer macros Krzysztof Karas
2026-09-24 13:58   ` Sebastian Brzezinka [this message]
2026-09-25 10:47   ` Jani Nikula
2026-09-29 12:00     ` Krzysztof Karas
2026-09-24 12:01 ` [PATCH v4 3/7] drm/i915/selftests: Use gt_*/i915_* prints in selftest helpers Krzysztof Karas
2026-09-24 12:01 ` [PATCH v4 4/7] drm/i915/gt/selftests: Use gt_* prints in aggregated gt selftests Krzysztof Karas
2026-09-24 12:01 ` [PATCH v4 5/7] drm/i915/gt/selftests: Use gt_* prints in gt standalone tests Krzysztof Karas
2026-09-24 12:01 ` [PATCH v4 6/7] drm/i915/gt/selftests: Use gt_* prints in gt selftest helpers Krzysztof Karas
2026-09-24 12:01 ` [PATCH v4 7/7] drm/i915/selftests: Use i915_* prints in i915_selftest.c Krzysztof Karas
2026-09-25 10:51   ` Jani Nikula

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=DLNLLGHRVHT9.2TW4LJ2SFXO5P@intel.com \
    --to=sebastian.brzezinka@intel.com \
    --cc=andi.shyti@kernel.org \
    --cc=andi.shyti@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=janusz.krzysztofik@linux.intel.com \
    --cc=krzysztof.karas@intel.com \
    --cc=krzysztof.niemiec@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