public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	Intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFC v2 0/6] DRM logging tidy
Date: Thu, 25 Jan 2018 13:32:47 +0200	[thread overview]
Message-ID: <87mv12dvhc.fsf@intel.com> (raw)
In-Reply-To: <2e4a1546-8ed2-909b-c8e6-bef64f037827@linux.intel.com>

On Wed, 24 Jan 2018, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> On 24/01/2018 16:23, Chris Wilson wrote:
>> Quoting Tvrtko Ursulin (2018-01-24 16:18:15)
>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>
>>> This series tries to solve a few issues in the current DRM logging code to
>>> primarily make it clearer which messages belong to which driver.
>>>
>>> Main problem is that currently some logging functions allow individual drivers
>>> to override the log prefix (since they are defined as macros, or static
>>> inlines), while other hardcode the "drm" prefix into them due being situated in
>>> the DRM core modules.
>>>
>>> Another thing is that I noticed the DRM_NAME macro which is used for this is
>>> defined in the uAPI header and had a comment which looked outdated.
>>>
>>> Therefore I introduce a new define, called, DRM_LOG_NAME, this time defined
>>> internally in the kernel headers and not exported in the uAPI.
>>>
>>> I also refactored some logging functions to take this string as a parameter
>>> instead of hardcoding it.
>>>
>>> Individual drivers can then override this define to make DRM logging functions
>>> prefix their message with the respective driver prefix.
>>>
>>> End result in the case of the i915 driver looks like this:
>>>
>>> Old log:
>>>
>>>   [drm] Found 128MB of eDRAM
>>>   [drm:skl_enable_dc6 [i915]] Enabling DC6
>>>
>>> New log:
>>>
>>>   [i915] Found 128MB of eDRAM
>>>   [i915:skl_enable_dc6 [i915]] Enabling DC6
>> 
>> And still not conforming to the standard logging string. DRM_LOG should
>
> What is the standard logging string? the dev_ one?
>
>> be killed off as an anachronistic OS compat layer.
>
> You mean only dev variants should be kept?

I think the DRM_LOG_NAME override mechanism is too fragile, as it
depends on #include ordering. For our driver, I think it basically means
always including one of our headers (i915_drv.h) first everywhere (to
have a single point of truth for DRM_LOG_NAME), and including
drm_print.h first from there. That's not currently true, and I don't
want to see a massive #include reordering patchset to make it so.

This is like pr_fmt() which I think has been a mistake and should not be
repeated.

I think the direction to go is using dev_printk, dev_dbg, dev_err,
dev_warn, and friends, which use dev_driver_string internally. We
already have some drm wrappers for those. The problem with them is
passing dev, and I think that's the problem we should think about.

We also seem to have opted to use drm_dev_printk (which calls dev_printk
or printk) for DRM_DEV_DEBUG and friends. This is arguably a bad choice,
because using dev_dbg would let us make use of dynamic debug.

BR,
Jani.



>
> Regards,
>
> Tvrtko
>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-01-25 11:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 16:18 [RFC v2 0/6] DRM logging tidy Tvrtko Ursulin
2018-01-24 16:18 ` [RFC 1/6] drm/armada: Simplify drm_dev_init error log Tvrtko Ursulin
2018-01-24 17:44   ` Russell King - ARM Linux
2018-01-24 16:18 ` [RFC 2/6] drm: Introduce unexported DRM_LOG_NAME define for logging Tvrtko Ursulin
2018-01-24 16:18 ` [RFC 3/6] drm/i915: Give our log messages our name Tvrtko Ursulin
2018-01-26 13:10   ` [Intel-gfx] " Michal Wajdeczko
2018-01-30 10:53     ` Tvrtko Ursulin
2018-01-24 16:18 ` [RFC 4/6] drm: Respect driver set DRM_LOG_NAME in drm_printk Tvrtko Ursulin
2018-01-24 16:18 ` [RFC 5/6] drm: Respect driver set DRM_LOG_NAME in drm_dev_printk Tvrtko Ursulin
2018-01-24 16:18 ` [RFC 6/6] drm: Respect driver set DRM_LOG_NAME in drm_info_printer Tvrtko Ursulin
2018-01-24 16:23 ` [Intel-gfx] [RFC v2 0/6] DRM logging tidy Chris Wilson
2018-01-24 16:48   ` Tvrtko Ursulin
2018-01-25 11:32     ` Jani Nikula [this message]
2018-01-25 13:38       ` [Intel-gfx] " Tvrtko Ursulin
2018-01-24 16:42 ` ✓ Fi.CI.BAT: success for DRM logging tidy (rev2) Patchwork
2018-01-24 20:12 ` ✗ Fi.CI.IGT: warning " 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=87mv12dvhc.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tursulin@ursulin.net \
    --cc=tvrtko.ursulin@linux.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