linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Ingo Molnar <mingo@kernel.org>, linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org,
	kernel test robot <lkp@intel.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	x86@kernel.org
Subject: Re: [tip: locking/core] locking/qspinlock: Fix 'wait_early' set but not used warning
Date: Mon, 11 Mar 2024 09:45:55 -0400	[thread overview]
Message-ID: <2e6c684b-bfbf-4850-b484-a1ace58a4c69@redhat.com> (raw)
In-Reply-To: <Ze7jhCaWwAd3U0di@gmail.com>

On 3/11/24 06:57, Ingo Molnar wrote:
> * tip-bot2 for Waiman Long <tip-bot2@linutronix.de> wrote:
>
>> The following commit has been merged into the locking/core branch of tip:
>>
>> Commit-ID:     ca4bc2e07b716509fd279d2b449bb42f4263a9c8
>> Gitweb:        https://git.kernel.org/tip/ca4bc2e07b716509fd279d2b449bb42f4263a9c8
>> Author:        Waiman Long <longman@redhat.com>
>> AuthorDate:    Thu, 22 Feb 2024 10:05:37 -05:00
>> Committer:     Ingo Molnar <mingo@kernel.org>
>> CommitterDate: Wed, 28 Feb 2024 13:08:37 +01:00
>>
>> locking/qspinlock: Fix 'wait_early' set but not used warning
>>
>> When CONFIG_LOCK_EVENT_COUNTS is off, the wait_early variable will be
>> set but not used. This is expected. Recent compilers will not generate
>> wait_early code in this case.
>>
>> Add the __maybe_unused attribute to wait_early for suppressing this
>> W=1 warning.
>>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Waiman Long <longman@redhat.com>
>> Signed-off-by: Ingo Molnar <mingo@kernel.org>
>> Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
>> Cc: Linus Torvalds <torvalds@linux-foundation.org>
>> Link: https://lore.kernel.org/r/20240222150540.79981-2-longman@redhat.com
>>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202312260422.f4pK3f9m-lkp@intel.com/
>> ---
>>   kernel/locking/qspinlock_paravirt.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h
>> index 6a0184e..ae2b12f 100644
>> --- a/kernel/locking/qspinlock_paravirt.h
>> +++ b/kernel/locking/qspinlock_paravirt.h
>> @@ -294,8 +294,8 @@ static void pv_wait_node(struct mcs_spinlock *node, struct mcs_spinlock *prev)
>>   {
>>   	struct pv_node *pn = (struct pv_node *)node;
>>   	struct pv_node *pp = (struct pv_node *)prev;
>> +	bool __maybe_unused wait_early;
>>   	int loop;
>> -	bool wait_early;
> On a second thought, shouldn't this be solved via lockevent_cond_inc()'s
> !CONFIG_LOCK_EVENT_COUNTS stub explicitly marking the variable as used, via
> !something like:
>
>     #define lockevent_cond_inc(ev, c)		do { (void)(c); } while (0)
>
> or so, instead of uglifying the usage site?

Right, that should work too. Thanks for the suggestion. I will post 
another to do that.

Cheers,
Longman


  reply	other threads:[~2024-03-11 13:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 15:05 [PATCH v2 0/4] locking: Some locking code cleanups Waiman Long
2024-02-22 15:05 ` [PATCH v2 1/4] locking/qspinlock: Fix 'wait_early' set but not used warning Waiman Long
2024-02-28 12:53   ` [tip: locking/core] " tip-bot2 for Waiman Long
2024-03-11 10:57     ` Ingo Molnar
2024-03-11 13:45       ` Waiman Long [this message]
2024-02-22 15:05 ` [PATCH v2 2/4] locking/mutex: Clean up mutex.h Waiman Long
2024-02-28 12:53   ` [tip: locking/core] locking/mutex: Simplify <linux/mutex.h> tip-bot2 for Waiman Long
2024-02-22 15:05 ` [PATCH v2 3/4] locking/rwsem: Clarify that RWSEM_READER_OWNED is just a hint Waiman Long
2024-02-28 12:53   ` [tip: locking/core] " tip-bot2 for Waiman Long
2024-02-22 15:05 ` [PATCH v2 4/4] locking/rwsem: Make DEBUG_RWSEMS and PREEMPT_RT mutually exclusive Waiman Long
2024-02-28 12:53   ` [tip: locking/core] " tip-bot2 for Waiman Long

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=2e6c684b-bfbf-4850-b484-a1ace58a4c69@redhat.com \
    --to=longman@redhat.com \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mingo@kernel.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).