linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Peter Hurley <peter@hurleysoftware.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiri Slaby <jslaby@suse.cz>,
	Belisko Marek <marek.belisko@gmail.com>
Subject: Re: [PATCH tty-next] n_tty: Fix termios_rwsem lockdep false positive
Date: Mon, 12 Aug 2013 16:19:49 +0300	[thread overview]
Message-ID: <20130812131949.GA2297@swordfish> (raw)
In-Reply-To: <5208DB32.40304@hurleysoftware.com>

On (08/12/13 08:55), Peter Hurley wrote:
> >>> [..]
> >>>  drivers/tty/n_tty.c | 25 +++++++++++--------------
> >>>  1 file changed, 11 insertions(+), 14 deletions(-)
> >>>
> >
> >I hate to do this, but isn't it actually my patch posted here
> >https://lkml.org/lkml/2013/8/1/510
> >
> >which was tagged as `wrong'?
> 
> Sergey,
> 
> My apologies; I was mistaken regarding this problem being a lockdep
> regression (although it's still a false positive from lockdep). Once
> I had worked around some issues with the nouveau driver, I was able to
> reproduce the lockdep report on 3.10.
>
no problem.

> I included Artem's lockdep report in the changelog because I received
> that first, on 30 July.
>
> My patch below is not the same as your patch of 1 Aug. This patch
> preserves the protected access of termios.c_cc[VMIN] and termios.c_cc[VTIME]
> (via the MIN_CHAR() and TIME_CHAR() macros).

fair enough. v3 was protecting VMIN/VTIME (my bad, I noticed this a bit later),
but I didn't submit it since v2 did not get positive response.

> If you'd prefer, I could add to changelog:
> 
>    Patch based on original posted here https://lkml.org/lkml/2013/8/1/510
>    by Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

if you don't mind, that would be great.

thanks a lot,
	-ss

> Regards,
> Peter Hurley
> 
> 
> >>>diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
> >>>index dd8ae0c..c9a9ddd 100644
> >>>--- a/drivers/tty/n_tty.c
> >>>+++ b/drivers/tty/n_tty.c
> >>>@@ -2122,6 +2122,17 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
> >>>  	if (c < 0)
> >>>  		return c;
> >>>
> >>>+	/*
> >>>+	 *	Internal serialization of reads.
> >>>+	 */
> >>>+	if (file->f_flags & O_NONBLOCK) {
> >>>+		if (!mutex_trylock(&ldata->atomic_read_lock))
> >>>+			return -EAGAIN;
> >>>+	} else {
> >>>+		if (mutex_lock_interruptible(&ldata->atomic_read_lock))
> >>>+			return -ERESTARTSYS;
> >>>+	}
> >>>+
> >>>  	down_read(&tty->termios_rwsem);
> >>>
> >>>  	minimum = time = 0;
> >>>@@ -2141,20 +2152,6 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
> >>>  		}
> >>>  	}
> >>>
> >>>-	/*
> >>>-	 *	Internal serialization of reads.
> >>>-	 */
> >>>-	if (file->f_flags & O_NONBLOCK) {
> >>>-		if (!mutex_trylock(&ldata->atomic_read_lock)) {
> >>>-			up_read(&tty->termios_rwsem);
> >>>-			return -EAGAIN;
> >>>-		}
> >>>-	} else {
> >>>-		if (mutex_lock_interruptible(&ldata->atomic_read_lock)) {
> >>>-			up_read(&tty->termios_rwsem);
> >>>-			return -ERESTARTSYS;
> >>>-		}
> >>>-	}
> >>>  	packet = tty->packet;
> >>>
> >>>  	add_wait_queue(&tty->read_wait, &wait);
> >>>--
> >>>1.8.1.2
> >>>
> >>
> >>--
> >>Regards,
> >>     Artem
> >>
> 

  reply	other threads:[~2013-08-12 13:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130731114726.GA11570@cpv436-motbuntu.spb.ea.mot-mobility.com>
2013-08-11 12:04 ` [PATCH tty-next] n_tty: Fix termios_rwsem lockdep false positive Peter Hurley
2013-08-12  9:28   ` Artem Savkov
2013-08-12 10:50     ` Sergey Senozhatsky
2013-08-12 12:55       ` Peter Hurley
2013-08-12 13:19         ` Sergey Senozhatsky [this message]
2013-08-12 13:39           ` Peter Hurley
2013-08-12 15:53             ` Greg Kroah-Hartman

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=20130812131949.GA2297@swordfish \
    --to=sergey.senozhatsky@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=marek.belisko@gmail.com \
    --cc=peter@hurleysoftware.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;
as well as URLs for NNTP newsgroup(s).