From: "Arnd Bergmann" <arnd@arndb.de>
To: "Andrzej Hajda" <andrzej.hajda@intel.com>,
"Arnd Bergmann" <arnd@kernel.org>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
"Dave Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Matthew Brost" <matthew.brost@intel.com>,
"John Harrison" <John.C.Harrison@Intel.com>,
"Michal Wajdeczko" <michal.wajdeczko@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/guc: avoid FIELD_PREP warning
Date: Fri, 17 Feb 2023 17:15:14 +0100 [thread overview]
Message-ID: <a4c599b3-8dd5-4799-8565-cf07c7e07227@app.fastmail.com> (raw)
In-Reply-To: <c830e0c7-a483-aaf6-cd46-e26c8c414b6b@intel.com>
On Fri, Feb 17, 2023, at 16:38, Andrzej Hajda wrote:
> On 17.02.2023 13:46, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> With gcc-7 and earlier, there are lots of warnings like
>>
>> In file included from <command-line>:0:0:
>> In function '__guc_context_policy_add_priority.isra.66',
>> inlined from '__guc_context_set_prio.isra.67' at drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:3292:3,
>> inlined from 'guc_context_set_prio' at drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:3320:2:
>> include/linux/compiler_types.h:399:38: error: call to '__compiletime_assert_631' declared with attribute error: FIELD_PREP: mask is not constant
>> _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>> ^
>> ...
>> drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2422:3: note: in expansion of macro 'FIELD_PREP'
>> FIELD_PREP(GUC_KLV_0_KEY, GUC_CONTEXT_POLICIES_KLV_ID_##id) | \
>> ^~~~~~~~~~
>>
>> Make sure that GUC_KLV_0_KEY is an unsigned value to avoid the warning.
>
> Does it mean __builtin_constant_p in gcc7 returns 0 on signed constants?
> I guess there should be more similar errors.
No, it's not as simple as that, I'm not really sure what the underlying
problem is with the compiler, and this is the only file that triggered
this particular warning.
There are other cases where old compilers had the reverse problem,
where they sometimes report a variable to be __builtin_constant_p()==true
if there is a branch that assigns a constant to it.
I think here it happens because GUC_KLV_0_KEY and GUC_KLV_n_VALUE are
negative.
Arnd
next prev parent reply other threads:[~2023-02-17 16:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 12:46 Arnd Bergmann
2023-02-17 15:38 ` [Intel-gfx] " Andrzej Hajda
2023-02-17 16:15 ` Arnd Bergmann [this message]
2023-02-17 16:07 ` Rodrigo Vivi
2023-02-20 12:51 ` Michal Wajdeczko
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=a4c599b3-8dd5-4799-8565-cf07c7e07227@app.fastmail.com \
--to=arnd@arndb.de \
--cc=John.C.Harrison@Intel.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=arnd@kernel.org \
--cc=daniel@ffwll.ch \
--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=linux-kernel@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@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
all inboxes | Powered by JetHome®