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: <aFsUllcRshBtV9xc@intel.com>
Date: Tue, 24 Jun 2025 17:11:50 -0400
From: Rodrigo Vivi <rodrigo.vivi@...el.com>
To: Arnd Bergmann <arnd@...nel.org>
CC: Jani Nikula <jani.nikula@...ux.intel.com>, Joonas Lahtinen
	<joonas.lahtinen@...ux.intel.com>, Tvrtko Ursulin <tursulin@...ulin.net>,
	David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, "Nathan
 Chancellor" <nathan@...nel.org>, Tzung-Bi Shih <tzungbi@...nel.org>,
	"Ashutosh Dixit" <ashutosh.dixit@...el.com>, Umesh Nerlige Ramappa
	<umesh.nerlige.ramappa@...el.com>, Arnd Bergmann <arnd@...db.de>, "Nick
 Desaulniers" <nick.desaulniers+lkml@...il.com>, Bill Wendling
	<morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>, Lucas De Marchi
	<lucas.demarchi@...el.com>, Matt Roper <matthew.d.roper@...el.com>, Ville
 Syrjälä <ville.syrjala@...ux.intel.com>, Nam Cao
	<namcao@...utronix.de>, <intel-gfx@...ts.freedesktop.org>,
	<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
	<llvm@...ts.linux.dev>
Subject: Re: [PATCH] i915: fix build error some more

On Fri, Jun 20, 2025 at 01:18:18PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.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@...db.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@...el.com>

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ