intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: "Jani Nikula" <jani.nikula@linux.intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Tvrtko Ursulin" <tursulin@ursulin.net>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Tzung-Bi Shih" <tzungbi@kernel.org>,
	"Ashutosh Dixit" <ashutosh.dixit@intel.com>,
	"Umesh Nerlige Ramappa" <umesh.nerlige.ramappa@intel.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Matt Roper" <matthew.d.roper@intel.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Nam Cao" <namcao@linutronix.de>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] i915: fix build error some more
Date: Tue, 24 Jun 2025 17:11:50 -0400	[thread overview]
Message-ID: <aFsUllcRshBtV9xc@intel.com> (raw)
In-Reply-To: <20250620111824.3395007-1-arnd@kernel.org>

On Fri, Jun 20, 2025 at 01:18:18PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> An earlier patch fixed a build failure with clang, but I still see the
> same problem with some configurations using gcc:
> 
> drivers/gpu/drm/i915/i915_pmu.c: In function 'config_mask':
> include/linux/compiler_types.h:568:38: error: call to '__compiletime_assert_462' declared with attribute error: BUILD_BUG_ON failed: bit > BITS_PER_TYPE(typeof_member(struct i915_pmu, enable)) - 1
> drivers/gpu/drm/i915/i915_pmu.c:116:3: note: in expansion of macro 'BUILD_BUG_ON'
>   116 |   BUILD_BUG_ON(bit >
> 
> As I understand it, the problem is that the function is not always fully
> inlined, but the __builtin_constant_p() can still evaluate the argument
> as being constant.
> 
> Marking it as __always_inline so far works for me in all configurations.
> 
> Fixes: a7137b1825b5 ("drm/i915/pmu: Fix build error with GCOV and AutoFDO enabled")
> Fixes: a644fde77ff7 ("drm/i915/pmu: Change bitmask of enabled events to u32")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/i915/i915_pmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 990bfaba3ce4..5bc696bfbb0f 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -108,7 +108,7 @@ static unsigned int config_bit(const u64 config)
>  		return other_bit(config);
>  }
>  
> -static u32 config_mask(const u64 config)
> +static __always_inline u32 config_mask(const u64 config)

hmm, it looks like the __builtin_constant_p() with BUILD_BUG_ON is a bit fragile
design down here. But this always_inline will enforce deterministic behavior
indeed.

So,
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

pushing to drm-intel-next right now as well...

>  {
>  	unsigned int bit = config_bit(config);
>  
> -- 
> 2.39.5
> 

  parent reply	other threads:[~2025-06-24 21:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20 11:18 [PATCH] i915: fix build error some more Arnd Bergmann
2025-06-20 12:13 ` ✓ i915.CI.BAT: success for " Patchwork
2025-06-20 13:43 ` ✗ i915.CI.Full: failure " Patchwork
2025-06-24 21:11 ` Rodrigo Vivi [this message]
2025-06-24 21:24   ` [PATCH] " Rodrigo Vivi

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=aFsUllcRshBtV9xc@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=airlied@gmail.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=ashutosh.dixit@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=morbo@google.com \
    --cc=namcao@linutronix.de \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=tursulin@ursulin.net \
    --cc=tzungbi@kernel.org \
    --cc=umesh.nerlige.ramappa@intel.com \
    --cc=ville.syrjala@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;
as well as URLs for NNTP newsgroup(s).