intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, swboyd@chromium.org,
	ndesaulniers@google.com
Subject: Re: [PATCH 1/2] drm/i915: Ensure _print_param() builds with Clang
Date: Tue, 16 Oct 2018 08:10:23 -0700	[thread overview]
Message-ID: <20181016151023.GA22841@flashbox> (raw)
In-Reply-To: <20181016122938.18757-1-jani.nikula@intel.com>

On Tue, Oct 16, 2018 at 03:29:37PM +0300, Jani Nikula wrote:
> When building the kernel with Clang with defconfig and CONFIG_64BIT
> disabled, vmlinux fails to link because of the BUILD_BUG in
> _print_param.
> 
> ld: drivers/gpu/drm/i915/i915_params.o: in function `i915_params_dump':
> i915_params.c:(.text+0x56): undefined reference to
> `__compiletime_assert_191'
> 
> This function is semantically invalid unless the code is first inlined
> then constant folded, which doesn't work for Clang because semantic
> analysis happens before optimization/inlining.
> 
> [The above written by Nathan Chancellor <natechancellor@gmail.com>]
> 
> Use WARN_ONCE() instead of BUILD_BUG() to avoid the problem. The
> WARN_ONCE() should get optimized away unless there's a type that's not
> handled by _print_param().
> 
> References: https://github.com/ClangBuiltLinux/linux/issues/191
> References: http://mid.mail-archive.com/20181009171401.14980-1-natechancellor@gmail.com
> Cc: Nick Desaulniers <ndesaulniers@google.com>
> Cc: Nathan Chancellor <natechancellor@gmail.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Tested-by: Nathan Chancellor <natechancellor@gmail.com>

Thanks for the quick turnaround and help getting this fixed, Jani!

> ---
>  drivers/gpu/drm/i915/i915_params.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
> index bd6bd8879cab..8d71886b5f03 100644
> --- a/drivers/gpu/drm/i915/i915_params.c
> +++ b/drivers/gpu/drm/i915/i915_params.c
> @@ -184,7 +184,8 @@ static __always_inline void _print_param(struct drm_printer *p,
>  	else if (!__builtin_strcmp(type, "char *"))
>  		drm_printf(p, "i915.%s=%s\n", name, *(const char **)x);
>  	else
> -		BUILD_BUG();
> +		WARN_ONCE(1, "no printer defined for param type %s (i915.%s)\n",
> +			  type, name);
>  }
>  
>  /**
> -- 
> 2.11.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-10-16 15:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 12:29 [PATCH 1/2] drm/i915: Ensure _print_param() builds with Clang Jani Nikula
2018-10-16 12:29 ` [PATCH 2/2] drm/i915: Ensure intel_engine_init_execlist() " Jani Nikula
2018-10-16 15:11   ` Nathan Chancellor
2018-10-16 15:18   ` Chris Wilson
2018-10-16 15:35   ` Stephen Boyd
2018-10-16 18:33     ` Nick Desaulniers
2018-10-17  7:24       ` Jani Nikula
2018-10-22 21:10         ` Nick Desaulniers
2018-10-22 21:19           ` Nick Desaulniers
2018-10-16 12:35 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915: Ensure _print_param() " Patchwork
2018-10-16 13:00 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-16 14:14 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-10-16 15:10 ` Nathan Chancellor [this message]
2018-10-16 15:16 ` [PATCH 1/2] " Chris Wilson
2018-10-16 18:38   ` Nick Desaulniers

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=20181016151023.GA22841@flashbox \
    --to=natechancellor@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=ndesaulniers@google.com \
    --cc=swboyd@chromium.org \
    /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;
as well as URLs for NNTP newsgroup(s).