Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1570782

Re: Q: lockdep_assert_held_read() after downgrade_write()

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: Q: lockdep_assert_held_read() after downgrade_write()
Date 2017-01-31 15:30 +0100
Message-ID <t5HBw-1Ll-19@gated-at.bofh.it> (permalink)
References <t5rGq-Ac-35@gated-at.bofh.it> <t5EtZ-8qc-37@gated-at.bofh.it> <t5EtZ-8qc-35@gated-at.bofh.it> <t5H8u-1mq-3@gated-at.bofh.it> <t5HBw-1Ll-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jan 31, 2017 at 09:23:08AM -0500, Waiman Long wrote:
> On 01/31/2017 06:25 AM, Peter Zijlstra wrote:
> > @@ -40,8 +40,10 @@ static inline void rwsem_set_reader_owned(struct rw_semaphore *sem)
> >  	 * do a write to the rwsem cacheline when it is really necessary
> >  	 * to minimize cacheline contention.
> >  	 */
> > -	if (sem->owner != RWSEM_READER_OWNED)
> > +	if (sem->owner != RWSEM_READER_OWNED) {
> > +		WARN_ON_ONCE(sem->owner != current);
> >  		WRITE_ONCE(sem->owner, RWSEM_READER_OWNED);
> > +	}
> >  }
> >  
> >  static inline bool rwsem_owner_is_writer(struct task_struct *owner)
> 
> I don't think you can do a WARN_ON_ONCE() check for sem->owner !=
> current here. If the rwsem starts from an unlock state, sem->owner will
> be NULL and an incorrect warning message will be printed.

Argh, I only looked at the downgrade_write() user and forgot to look if
it was used elsewhere.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Q: lockdep_assert_held_read() after downgrade_write() "J. R. Okajima" <hooanon05g@gmail.com> - 2017-01-30 22:30 +0100
  Re: Q: lockdep_assert_held_read() after downgrade_write() Peter Zijlstra <peterz@infradead.org> - 2017-01-31 12:10 +0100
    Re: Q: lockdep_assert_held_read() after downgrade_write() Peter Zijlstra <peterz@infradead.org> - 2017-01-31 15:00 +0100
      Re: Q: lockdep_assert_held_read() after downgrade_write() Waiman Long <longman@redhat.com> - 2017-01-31 15:30 +0100
        Re: Q: lockdep_assert_held_read() after downgrade_write() Peter Zijlstra <peterz@infradead.org> - 2017-01-31 15:30 +0100
  Re: Q: lockdep_assert_held_read() after downgrade_write() "J. R. Okajima" <hooanon05g@gmail.com> - 2017-01-31 16:50 +0100
    Re: Q: lockdep_assert_held_read() after downgrade_write() Peter Zijlstra <peterz@infradead.org> - 2017-01-31 18:00 +0100
      Re: Q: lockdep_assert_held_read() after downgrade_write() "J. R. Okajima" <hooanon05g@gmail.com> - 2017-02-02 17:40 +0100
      [PATCH 1/3] lockdep: consolidate by new find_held_lock() "J. R. Okajima" <hooanon05g@gmail.com> - 2017-02-02 17:50 +0100
        [PATCH 3/3] lockdep: new annotation lock_downgrade() "J. R. Okajima" <hooanon05g@gmail.com> - 2017-02-02 17:50 +0100
          Re: [PATCH 3/3] lockdep: new annotation lock_downgrade() kbuild test robot <lkp@intel.com> - 2017-02-02 19:10 +0100
            Re: [PATCH 3/3] lockdep: new annotation lock_downgrade() Peter Zijlstra <peterz@infradead.org> - 2017-02-02 19:50 +0100
              Re: [PATCH 3/3] lockdep: new annotation lock_downgrade() "J. R. Okajima" <hooanon05g@gmail.com> - 2017-02-02 22:10 +0100
        [PATCH 2/3] lockdep: consolidate by new validate_held_lock() "J. R. Okajima" <hooanon05g@gmail.com> - 2017-02-02 17:50 +0100

csiph-web