mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vineet Gupta <vineet.gupta@linux.dev>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Thomas Gleixner" <tglx@kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	x86@kernel.org, "Juri Lelli" <juri.lelli@redhat.com>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Joerg Roedel (AMD)" <joro@8bytes.org>,
	"Will Deacon" <will@kernel.org>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Tvrtko Ursulin" <tursulin@ursulin.net>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Ben Segall" <bsegall@google.com>, "Mel Gorman" <mgorman@suse.de>,
	"Valentin Schneider" <vschneid@redhat.com>,
	"K Prateek Nayak" <kprateek.nayak@amd.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] wait: Make ___wait_is_interruptible() return 0 or 1
Date: Thu, 5 Nov 2026 09:43:41 -0800	[thread overview]
Message-ID: <4cb71e7d-8cf9-4584-8c97-e30bfaa4211c@linux.dev> (raw)
In-Reply-To: <20261105090342.GS2668804@noisy.programming.kicks-ass.net>

On 11/5/26 1:03 AM, Peter Zijlstra wrote:
> On Wed, Nov 04, 2026 at 08:07:19AM -0800, Vineet Gupta wrote:
>> GCC 17 adds -Wconstant-logical-operand to -Wall. It warns when an operand
>> of && or || folds to a constant other than 0 or 1. With a constant state
>> such as TASK_KILLABLE, ___wait_is_interruptible() breaks the build with
>> CONFIG_WERROR=y:
>>
>>    include/linux/wait.h:285:39: error: use of logical '||' with constant operand '256' [-Werror=constant-logical-operand]
>>
>> clang has the same warning, but it does not check an operator that comes
>> from a macro expansion.
>>
>> Compare the masked state against 0. All callers test the result as a
>> truth value, so the behaviour does not change.
>>
>> Signed-off-by: Vineet Gupta <vineet.gupta@linux.dev>
>> ---
>>   include/linux/wait.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/wait.h b/include/linux/wait.h
>> index c2af98b0074d..ebabdfb5b30c 100644
>> --- a/include/linux/wait.h
>> +++ b/include/linux/wait.h
>> @@ -283,7 +283,7 @@ static inline void wake_up_pollfree(struct wait_queue_head *wq_head)
>>   
>>   #define ___wait_is_interruptible(state)						\
>>   	(!__builtin_constant_p(state) ||					\
>> -	 (state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
>> +	 (state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)) != 0)
>>   
>>   extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags);
> What is the actual purpose of this warning? This doesn't seem to serve
> any value. Any non-zero value is a true, why is this a problem?

I think the intent of the toggle was to catch && vs. & mixups in source 
(and it only catches that in 1 direction). Clearly that is not 
applicable here and it seems it has never caught this in the kernel anyway.

> GCC doing this, don't mean we can't turn if off again.

I will send a v2 which turns the GCC version off.

Thx,
-Vineet

  reply	other threads:[~2026-11-05 17:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 16:07 [PATCH 0/4] Fix the x86 defconfig build with GCC 17 Vineet Gupta
2026-11-04 16:07 ` [PATCH 1/4] x86/cpufeatures: Make {REQUIRED,DISABLED}_MASK_BIT_SET() return 0 or 1 Vineet Gupta
2026-11-04 16:07 ` [PATCH 2/4] wait: Make ___wait_is_interruptible() " Vineet Gupta
2026-11-05  9:03   ` Peter Zijlstra
2026-11-05 17:43     ` Vineet Gupta [this message]
2026-11-04 16:07 ` [PATCH 3/4] iommupt: Make PT_SUPPORTED_FEATURE() " Vineet Gupta
2026-11-04 16:07 ` [PATCH 4/4] drm/i915: Avoid -Wconstant-logical-operand with GCC 17 Vineet Gupta
2026-11-04 16:27 ` [PATCH 0/4] Fix the x86 defconfig build " Borislav Petkov
2026-11-04 18:05   ` Vineet Gupta
2026-11-04 21:18     ` Borislav Petkov
2026-11-05  9:04   ` Peter Zijlstra

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=4cb71e7d-8cf9-4584-8c97-e30bfaa4211c@linux.dev \
    --to=vineet.gupta@linux.dev \
    --cc=airlied@gmail.com \
    --cc=bp@alien8.de \
    --cc=bsegall@google.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=joro@8bytes.org \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.brost@intel.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=simona@ffwll.ch \
    --cc=tglx@kernel.org \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tursulin@ursulin.net \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®