All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <seanpaul@chromium.org>
To: "Chris Wilson" <chris@chris-wilson.co.uk>,
	"Sean Paul" <seanpaul@chromium.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	linux-rockchip@lists.infradead.org, 姚智情 <mark.yao@rock-chips.com>
Subject: Re: [PATCH v2 1/2] drm: Introduce DRM_DEV_* log messages
Date: Fri, 12 Aug 2016 15:04:37 -0400	[thread overview]
Message-ID: <CAOw6vb+J-XaKGkEVokhzch7Qi=ZHKbKOoaVn_WKW1j9O7KAGwA@mail.gmail.com> (raw)
In-Reply-To: <20160812183938.GH15011@nuc-i3427.alporthouse.com>

On Fri, Aug 12, 2016 at 2:39 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Fri, Aug 12, 2016 at 01:30:00PM -0400, Sean Paul wrote:
>> This patch consolidates all the various log functions/macros into
>> one uber function, drm_log. It also introduces some new DRM_DEV_*
>> variants that print the device name to delineate multiple devices
>> of the same type.
>>
>> Signed-off-by: Sean Paul <seanpaul@chromium.org>
>> ---
>>
>> Changes in v2:
>>       - Use dev_printk for the dev variant (Chris Wilson)
>>
>>
>>  drivers/gpu/drm/drm_drv.c |  31 +++++------
>>  include/drm/drmP.h        | 133 ++++++++++++++++++++++++----------------------
>>  2 files changed, 82 insertions(+), 82 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
>> index 57ce973..edd3291 100644
>> --- a/drivers/gpu/drm/drm_drv.c
>> +++ b/drivers/gpu/drm/drm_drv.c
>> @@ -63,37 +63,30 @@ static struct idr drm_minors_idr;
>>
>>  static struct dentry *drm_debugfs_root;
>>
>> -void drm_err(const char *format, ...)
>> +void drm_log(const struct device *dev, const char *level, unsigned int category,
>
> I would have called this drm_printk() to match the function it wraps.
>
>> +          const char *function_name, const char *prefix,
>> +          const char *format, ...)
>>  {
>>       struct va_format vaf;
>>       va_list args;
>>
>> -     va_start(args, format);
>> -
>> -     vaf.fmt = format;
>> -     vaf.va = &args;
>> -
>> -     printk(KERN_ERR "[" DRM_NAME ":%ps] *ERROR* %pV",
>> -            __builtin_return_address(0), &vaf);
>> -
>> -     va_end(args);
>> -}
>> -EXPORT_SYMBOL(drm_err);
>> -
>> -void drm_ut_debug_printk(const char *function_name, const char *format, ...)
>> -{
>> -     struct va_format vaf;
>> -     va_list args;
>> +     if (category != DRM_UT_NONE && !(drm_debug & category))
>> +             return;
>>
>>       va_start(args, format);
>>       vaf.fmt = format;
>>       vaf.va = &args;
>>
>> -     printk(KERN_DEBUG "[" DRM_NAME ":%s] %pV", function_name, &vaf);
>> +     if (dev)
>> +             dev_printk(level, dev, "[" DRM_NAME ":%s]%s %pV", function_name,
>> +                        prefix, &vaf);
>> +     else
>> +             printk("%s[" DRM_NAME ":%s]%s %pV", level, function_name,
>> +                    prefix, &vaf);
>
> lgtm.
>
>> -#define DRM_ERROR(fmt, ...)                          \
>> -     drm_err(fmt, ##__VA_ARGS__)
>> +#define DRM_DEV_ERROR(dev, fmt, ...)                                 \
>> +     drm_log(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*", fmt,  \
>> +             ##__VA_ARGS__)
>> +#define DRM_ERROR(fmt, ...) DRM_DEV_ERROR(NULL, fmt, ##__VA_ARGS__)
>
> And these look like a reasonable solution given the constraints.
>
> Out of curiosity, how much did the kernel build grow by adding a NULL
> parameter everywhere?


uncompressed vmlinux is 8286 bytes larger on my i915 build, 34832 on exynos

bzImage on i915 build is 2912 bytes larger and zImage on exynos is
6752 bytes larger

Sean

>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-08-12 19:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 17:00 [PATCH 0/2] Introduce DRM_DEV_* logging Sean Paul
2016-08-12 17:00 ` [PATCH 1/2] drm: Introduce DRM_DEV_* log messages Sean Paul
     [not found]   ` <1471021254-2563-2-git-send-email-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2016-08-12 17:13     ` Chris Wilson
2016-08-12 17:23       ` Sean Paul
2016-08-12 17:30         ` [PATCH v2 " Sean Paul
     [not found]           ` <1471023000-3820-1-git-send-email-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2016-08-12 18:39             ` Chris Wilson
2016-08-12 19:04               ` Sean Paul [this message]
2016-08-12 19:26               ` Lukas Wunner
2016-08-12 19:44                 ` Chris Wilson
2016-08-12 19:48                   ` Sean Paul
2016-08-12 19:50                   ` Lukas Wunner
2016-08-12 20:29                   ` [PATCH v3 " Sean Paul
     [not found]                     ` <1471033777-9922-1-git-send-email-seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2016-08-12 20:53                       ` Chris Wilson
2016-08-15 12:54                     ` Eric Engestrom
2016-08-15 23:18                       ` [PATCH v4] " Sean Paul
2016-08-16 12:28                         ` Eric Engestrom
2016-08-16 16:18                           ` Sean Paul
2016-08-16 16:56                             ` Eric Engestrom
2016-08-18 16:39                               ` Sean Paul
2016-08-12 17:00 ` [PATCH 2/2] drm/rockchip: Use DRM_DEV_ERROR in vop Sean Paul
2016-08-18  8:53   ` Mark yao
2016-08-18 16:38     ` Sean Paul

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='CAOw6vb+J-XaKGkEVokhzch7Qi=ZHKbKOoaVn_WKW1j9O7KAGwA@mail.gmail.com' \
    --to=seanpaul@chromium.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.yao@rock-chips.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.