From: Jani Nikula <jani.nikula@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH] drm/i915: Use BUILD_BUG if possible in the i915 WARN_ON
Date: Thu, 11 Dec 2014 10:11:59 +0200 [thread overview]
Message-ID: <87r3w68v1s.fsf@intel.com> (raw)
In-Reply-To: <1418230056-32241-1-git-send-email-daniel.vetter@ffwll.ch>
On Wed, 10 Dec 2014, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Faster feedback to errors is always better. This is inspired by the
> addition to WARN_ONs to mask/enable helpers for registers to make sure
> callers have the arguments ordered correctly: Pretty much always the
> arguments are static.
>
> We use WARN_ON(1) a lot in default switch statements though where we
> should always handle all cases. So add a new macro specifically for
> that.
>
> The idea to use __builtin_constant_p is from Chris Wilson.
>
> v2: Use the ({}) gcc-ism to avoid the static inline, suggested by
> Dave. My first attempt used __cond as the temp var, which is the same
> used by BUILD_BUG_ON, but with inverted sense. Hilarity ensued, so
> sprinkle i915 into the name.
>
> Also use a temporary variable to only evaluate the condition once,
> suggested by Damien.
>
> v3: It's crazy but apparently 32bit gcc can't compile out the
> BUILD_BUG_ON in a lot of cases and just falls over. I have no idea
> why, but until clue grows just disable this nifty idea on 32bit
> builds. Reported by 0-day builder.
>
> v4: Got it all wrong, apparently its the gcc version. We need 4.9+.
> Now reported by Imre.
>
> v5: Chris suggested to add the case to MISSING_CASE for speedier
> debug.
Still fails here. :(
$ gcc --version
gcc (Debian 4.9.1-19) 4.9.1
$ make
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CHK kernel/config_data.h
CC [M] drivers/gpu/drm/i915/i915_drv.o
In file included from include/linux/ioport.h:12:0,
from include/linux/device.h:16,
from drivers/gpu/drm/i915/i915_drv.c:30:
drivers/gpu/drm/i915/i915_drv.c: In function ‘intel_detect_pch’:
include/linux/compiler.h:363:38: error: call to ‘__compiletime_assert_477’ declared with attribute error: BUILD_BUG_ON failed: __i915_warn_cond
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:346:4: note: in definition of macro ‘__compiletime_assert’
prefix ## suffix(); \
^
include/linux/compiler.h:363:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/bug.h:50:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:74:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
drivers/gpu/drm/i915/i915_drv.h:66:3: note: in expansion of macro ‘BUILD_BUG_ON’
BUILD_BUG_ON(__i915_warn_cond); \
^
drivers/gpu/drm/i915/i915_drv.c:477:5: note: in expansion of macro ‘WARN_ON’
WARN_ON(!IS_HSW_ULT(dev));
^
include/linux/compiler.h:363:38: error: call to ‘__compiletime_assert_456’ declared with attribute error: BUILD_BUG_ON failed: __i915_warn_cond
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:346:4: note: in definition of macro ‘__compiletime_assert’
prefix ## suffix(); \
^
include/linux/compiler.h:363:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/bug.h:50:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:74:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
drivers/gpu/drm/i915/i915_drv.h:66:3: note: in expansion of macro ‘BUILD_BUG_ON’
BUILD_BUG_ON(__i915_warn_cond); \
^
drivers/gpu/drm/i915/i915_drv.c:456:5: note: in expansion of macro ‘WARN_ON’
WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev)));
^
include/linux/compiler.h:363:38: error: call to ‘__compiletime_assert_461’ declared with attribute error: BUILD_BUG_ON failed: __i915_warn_cond
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:346:4: note: in definition of macro ‘__compiletime_assert’
prefix ## suffix(); \
^
include/linux/compiler.h:363:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/bug.h:50:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:74:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
drivers/gpu/drm/i915/i915_drv.h:66:3: note: in expansion of macro ‘BUILD_BUG_ON’
BUILD_BUG_ON(__i915_warn_cond); \
^
drivers/gpu/drm/i915/i915_drv.c:461:5: note: in expansion of macro ‘WARN_ON’
WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev)));
^
include/linux/compiler.h:363:38: error: call to ‘__compiletime_assert_466’ declared with attribute error: BUILD_BUG_ON failed: __i915_warn_cond
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/compiler.h:346:4: note: in definition of macro ‘__compiletime_assert’
prefix ## suffix(); \
^
include/linux/compiler.h:363:2: note: in expansion of macro ‘_compiletime_assert’
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^
include/linux/bug.h:50:37: note: in expansion of macro ‘compiletime_assert’
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/bug.h:74:2: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
drivers/gpu/drm/i915/i915_drv.h:66:3: note: in expansion of macro ‘BUILD_BUG_ON’
BUILD_BUG_ON(__i915_warn_cond); \
^
drivers/gpu/drm/i915/i915_drv.c:466:5: note: in expansion of macro ‘WARN_ON’
WARN_ON(IS_HSW_ULT(dev));
^
scripts/Makefile.build:257: recipe for target 'drivers/gpu/drm/i915/i915_drv.o' failed
make[4]: *** [drivers/gpu/drm/i915/i915_drv.o] Error 1
scripts/Makefile.build:402: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:402: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:402: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:937: recipe for target 'drivers' failed
make: *** [drivers] Error 2
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2014-12-11 8:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-08 16:06 [PATCH] drm/i915: Use BUILD_BUG if possible in the i915 WARN_ON Daniel Vetter
2014-12-08 16:10 ` Damien Lespiau
2014-12-08 16:20 ` Daniel Vetter
2014-12-09 18:11 ` shuang.he
2014-12-09 17:40 ` shuang.he
2014-12-10 13:49 ` Daniel Vetter
2014-12-10 13:53 ` Chris Wilson
2014-12-10 18:17 ` shuang.he
2014-12-10 14:43 ` Daniel Vetter
2014-12-10 21:18 ` shuang.he
2014-12-10 16:47 ` Daniel Vetter
2014-12-11 1:05 ` shuang.he
2014-12-11 8:11 ` Jani Nikula [this message]
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=87r3w68v1s.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=intel-gfx@lists.freedesktop.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 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.