From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: spin_unlock_wait() in ata_scsi_cmd_error_handler()?
Date: Thu, 29 Jun 2017 13:48:00 -0700 [thread overview]
Message-ID: <20170629204800.GF2393@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170629201754.GC9745@htj.duckdns.org>
On Thu, Jun 29, 2017 at 04:17:54PM -0400, Tejun Heo wrote:
> Hello,
>
> On Thu, Jun 29, 2017 at 01:14:43PM -0700, Paul E. McKenney wrote:
> > On Thu, Jun 29, 2017 at 03:53:22PM -0400, Tejun Heo wrote:
> > > Hello, Paul.
> > >
> > > On Thu, Jun 29, 2017 at 11:10:57AM -0700, Paul E. McKenney wrote:
> > > > If this code fragment doesn't deadlock, then CPU 0's spin_unlock_wait()
> > > > must have executed before CPU 1's spin_lock(). However, even on x86,
> > > > CPU 0's prior writes can be reordered with its subsequent reads, which
> > > > means that r1 == 0 is possible, which means that the above condition
> > > > could hold, even on x86.
> > >
> > > I see. Ah, that's a mind bender.
> >
> > It has indeed been providing at least its share of entertainment over
> > the past little while. ;-)
>
> lol :)
>
> > > That part of the code should be dead now. I don't think we no longer
> > > have any driver which doesn't have error handler set. I should rip
> > > out that if/else. Also, ACQUIRE semantics should be enough there.
> > > Nothing changes from the EH side there.
> >
> > It looks like we actually might get rid of spin_unlock_wait entirely.
> > But how about if I just pull the spin_lock_irqsave() before the "if"
> > and the spin_lock_irqrestore() after the "if"? Same effect, only
> > difference is that the "if" and the "ap->eh_tries = ATA_EH_MAX_TRIES"
> > end up under the lock, and I bet that you won't be able to measure
> > the difference. (Please see below.)
> >
> > I will do this because I just now happened to be editing that file on
> > my "eradicate spin_unlock_wait()" quest, but can easily rework the
> > patch as desired. If you want something different, just let me know!
>
> Sounds good to me. That path isn't hot at all. No change made at
> this level is gonna have any actual impact. Please go for whatever is
> the simplest. For moving out the lock/unlock outside if/else,
>
> Acked-by: Tejun Heo <tj@kernel.org>
Applied, and thank you!
Thanx, Paul
prev parent reply other threads:[~2017-06-29 20:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 18:10 spin_unlock_wait() in ata_scsi_cmd_error_handler()? Paul E. McKenney
2017-06-29 19:53 ` Tejun Heo
2017-06-29 20:14 ` Paul E. McKenney
2017-06-29 20:17 ` Tejun Heo
2017-06-29 20:48 ` Paul E. McKenney [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=20170629204800.GF2393@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@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).