lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANq1E4Rz9REGPj=Wga61h13yMfgUdB4K3UTmLFYWnRpYf+iTSA@mail.gmail.com>
Date:	Mon, 13 Oct 2014 17:46:54 +0200
From:	David Herrmann <dh.herrmann@...il.com>
To:	Joe Perches <joe@...ches.com>, Dave Airlie <airlied@...il.com>
Cc:	Daniel Vetter <daniel@...ll.ch>,
	dri-devel <dri-devel@...ts.freedesktop.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm: drm_err: Remove unnecessary __func__ argument

Hi

On Sun, Oct 12, 2014 at 7:08 AM, Joe Perches <joe@...ches.com> wrote:
> Removing the unnecessary drm_err __func__ argument by using
> the equivalent %pf and __builtin_return_address(0) makes the
> code smaller for every use of the DRM_ERROR macro.
>
> For instance: (allmodconfig)
>
> $ size drivers/gpu/drm/i915/i915.o*
>    text    data     bss     dec     hex filename
>  922447  193257  296736 1412440  158d58 drivers/gpu/drm/i915/i915.o.new
>  928111  193257  296736 1418104  15a378 drivers/gpu/drm/i915/i915.o.old

You might want to mention that this requires a binary-search through
kallsyms on each call. I guess that's the reason you didn't use it for
drm_ut_debug_printk()? I'm fine with doing this on drm_err(). Looks
good.

Thanks
David

> Signed-off-by: Joe Perches <joe@...ches.com>
> ---
>  drivers/gpu/drm/drm_drv.c | 5 +++--
>  include/drm/drmP.h        | 8 ++++----
>  2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 9f0e1b9..e9263d9 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -68,7 +68,7 @@ static struct idr drm_minors_idr;
>  struct class *drm_class;
>  static struct dentry *drm_debugfs_root;
>
> -void drm_err(const char *func, const char *format, ...)
> +void drm_err(const char *format, ...)
>  {
>         struct va_format vaf;
>         va_list args;
> @@ -78,7 +78,8 @@ void drm_err(const char *func, const char *format, ...)
>         vaf.fmt = format;
>         vaf.va = &args;
>
> -       printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* %pV", func, &vaf);
> +       printk(KERN_ERR "[" DRM_NAME ":%pf] *ERROR* %pV",
> +              __builtin_return_address(0), &vaf);
>
>         va_end(args);
>  }
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index ca374ac..5e9ff52 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -125,8 +125,8 @@ struct reservation_object;
>  extern __printf(2, 3)
>  void drm_ut_debug_printk(const char *function_name,
>                          const char *format, ...);
> -extern __printf(2, 3)
> -void drm_err(const char *func, const char *format, ...);
> +extern __printf(1, 2)
> +void drm_err(const char *format, ...);
>
>  /***********************************************************************/
>  /** \name DRM template customization defaults */
> @@ -168,7 +168,7 @@ void drm_err(const char *func, const char *format, ...);
>   * \param arg arguments
>   */
>  #define DRM_ERROR(fmt, ...)                            \
> -       drm_err(__func__, fmt, ##__VA_ARGS__)
> +       drm_err(fmt, ##__VA_ARGS__)
>
>  /**
>   * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> @@ -183,7 +183,7 @@ void drm_err(const char *func, const char *format, ...);
>                                       DEFAULT_RATELIMIT_BURST);         \
>                                                                         \
>         if (__ratelimit(&_rs))                                          \
> -               drm_err(__func__, fmt, ##__VA_ARGS__);                  \
> +               drm_err(fmt, ##__VA_ARGS__);                            \
>  })
>
>  #define DRM_INFO(fmt, ...)                             \
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ