mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>, Will Deacon <will.deacon@arm.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] locking/lockdep: Cleanup reinit_class()
Date: Mon, 14 Feb 2022 15:08:09 -0500	[thread overview]
Message-ID: <0b497f83-3a05-623e-e336-3efc5df59fa5@redhat.com> (raw)
In-Reply-To: <Ygo8HNXGNq6X4Jov@hirez.programming.kicks-ass.net>

On 2/14/22 06:25, Peter Zijlstra wrote:
> On Thu, Feb 10, 2022 at 10:55:25PM -0500, Waiman Long wrote:
>> Replace the duplicated WARN_ON_ONCE() tests in reinit_class() with
>> BUILD_BUG_ON().
>>
>> Signed-off-by: Waiman Long <longman@redhat.com>
>> ---
>>   include/linux/lockdep_types.h | 4 ++++
>>   kernel/locking/lockdep.c      | 6 +++---
>>   2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/linux/lockdep_types.h b/include/linux/lockdep_types.h
>> index d22430840b53..446d981ae3a2 100644
>> --- a/include/linux/lockdep_types.h
>> +++ b/include/linux/lockdep_types.h
>> @@ -108,6 +108,10 @@ struct lock_class {
>>   	 */
>>   	struct list_head		locks_after, locks_before;
>>   
>> +	/*
>> +	 * All the fields that require re-initialization after being zapped
>> +	 * must be put after "key".
>> +	 */
>>   	const struct lockdep_subclass_key *key;
>>   	unsigned int			subclass;
>>   	unsigned int			dep_gen_id;
>> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
>> index d4252b5c9863..77bbe557d48b 100644
>> --- a/kernel/locking/lockdep.c
>> +++ b/kernel/locking/lockdep.c
>> @@ -6015,10 +6015,10 @@ static void reinit_class(struct lock_class *class)
>>   	WARN_ON_ONCE(!class->lock_entry.next);
>>   	WARN_ON_ONCE(!list_empty(&class->locks_after));
>>   	WARN_ON_ONCE(!list_empty(&class->locks_before));
>> +	BUILD_BUG_ON(offsetof(struct lock_class, lock_entry) > offset);
>> +	BUILD_BUG_ON(offsetof(struct lock_class, locks_after) > offset);
>> +	BUILD_BUG_ON(offsetof(struct lock_class, locks_before) > offset);
>>   	memset(p + offset, 0, sizeof(*class) - offset);
>> -	WARN_ON_ONCE(!class->lock_entry.next);
>> -	WARN_ON_ONCE(!list_empty(&class->locks_after));
>> -	WARN_ON_ONCE(!list_empty(&class->locks_before));
>>   }
>>   
>>   static inline int within(const void *addr, void *start, unsigned long size)
>> -- 
>> 2.27.0
>>
> Yeah, except that this doesn't build because it conflicts with a
> previous patch you actually Acked:
>
>   https://lore.kernel.org/all/20211213132618.105737-1-xiujianfeng@huawei.com/T/#m0e9474a9204ec29fb2135135ce3134640a3f27b5
>
Sorry, my bad. I forgot to check tip.

I have just sent out a v2 that will work on tip.

Cheers,
Longman


      reply	other threads:[~2022-02-14 20:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11  3:55 Waiman Long
2022-02-11  3:55 ` [PATCH 2/2] locking/lockdep: Iterate lock_classes directly when reading lockdep files Waiman Long
2022-02-17 18:56   ` [tip: locking/core] " tip-bot2 for Waiman Long
2022-02-14 11:25 ` [PATCH 1/2] locking/lockdep: Cleanup reinit_class() Peter Zijlstra
2022-02-14 20:08   ` Waiman Long [this message]

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=0b497f83-3a05-623e-e336-3efc5df59fa5@redhat.com \
    --to=longman@redhat.com \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=will.deacon@arm.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®