public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: rostedt@goodmis.org, mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC] seqlock,lockdep: Add lock primitives to read_seqbegin().
Date: Tue, 29 Mar 2011 15:39:44 +0200	[thread overview]
Message-ID: <1301405984.2250.402.camel@laptop> (raw)
In-Reply-To: <201103290430.p2T4UhLA081016@www262.sakura.ne.jp>

On Tue, 2011-03-29 at 13:30 +0900, Tetsuo Handa wrote:

> static int locktest_open1(struct inode *inode, struct file *file)
> {
> 	write_seqlock(&seqlock1);
> 	msleep(1000); /* Open /proc/locktest2 while sleeping here. */
> 	br_read_lock(brlock1);
> 	br_read_unlock(brlock1);
> 	write_sequnlock(&seqlock1);
> 	return -EINVAL;
> }
> 
> static int locktest_open2(struct inode *inode, struct file *file)
> {
> 	br_write_lock(brlock1);
> 	read_seqbegin2(&seqlock1);
> 	br_write_unlock(brlock1);
> 	return -EINVAL;
> }
> 
> static int locktest_open3(struct inode *inode, struct file *file)
> {
> 	static DEFINE_MUTEX(mutex1);
> 	mutex_lock(&mutex1);
> 	locktest_open1(inode, file);
> 	mutex_unlock(&mutex1);
> 	return -EINVAL;
> }


That's quite horrid as far as test-cases go, why bother with the
userspace part at all?

In order to hit your inversion you need to do something like:

cat /proc/locktest1 & cat /proc/locktest2

if you do them serialized you'll never hit that inversion.


That said, there are some out-standing issues with rw_locks and lockdep,
Gautham and I worked on that for a while but we never persevered and
finished it..

  http://lkml.org/lkml/2009/5/11/203

And I think you're hitting that case.


  parent reply	other threads:[~2011-03-29 13:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-26  4:12 [RFC] seqlock,lockdep: Add lock primitives to read_seqbegin() Tetsuo Handa
2011-03-28 17:12 ` Steven Rostedt
2011-03-28 21:57   ` Tetsuo Handa
2011-03-29  4:30   ` Tetsuo Handa
2011-03-29 12:49     ` Steven Rostedt
2011-03-29 13:39     ` Peter Zijlstra [this message]
2011-03-29 17:50       ` Peter Zijlstra
2011-03-30  8:12         ` Tetsuo Handa
2011-03-30  9:50           ` Peter Zijlstra
2011-03-30 12:17             ` Tetsuo Handa
2011-03-31 13:59               ` Peter Zijlstra
2011-03-29 13:11 ` Peter Zijlstra
2011-03-29 13:14 ` 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=1301405984.2250.402.camel@laptop \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=rostedt@goodmis.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