linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Tomas Henzl <thenzl@redhat.com>
Cc: Jack Wang <xjtuwjp@gmail.com>,
	Jason Seba <jason.seba42@gmail.com>,
	Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>,
	Viswas G <Viswas.G@pmcs.com>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"JBottomley@parallels.com" <JBottomley@parallels.com>,
	Vasanthalakshmi Tharmarajan
	<Vasanthalakshmi.Tharmarajan@pmcs.com>
Subject: Re: [PATCH] pm80xx: Spinlock fix
Date: Mon, 23 Dec 2013 16:38:51 +0100	[thread overview]
Message-ID: <20131223153851.GA27812@redhat.com> (raw)
In-Reply-To: <52B8569D.4050101@redhat.com>

On 12/23, Tomas Henzl wrote:
>
> On 12/23/2013 04:06 PM, Jack Wang wrote:
> > On 12/23/2013 03:55 PM, Jason Seba wrote:
> >> Why is this considered dangerous?  I put some thought into it and
> >> couldn't find any obvious reason why it wouldn't work, but I also
> >> couldn't find any other drivers that work this way.  Is there a
> >> particular reason to avoid doing it this way?
> >>
> > If you use global flags, you may change interrupt state depends on context.
>
> The problem could show up when different threads try to store different content to the flags.

Agreed. I have no idea if the patch is right or not, but at least
the changelog should clearly explain that only one thread can do
spin_lock_irqsave(&x->lock, x->lock_flags) at any time, otherwise
the patch (and the code) _looks_ wrong even if it is correct.

And if we can't use a local "unsigned long flags" because _unlock
can happen in another function, imho this should be mentioned in
the changelog as well.

Oleg.


      parent reply	other threads:[~2013-12-23 15:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18 11:28 [PATCH] pm80xx: Spinlock fix Viswas G
2013-12-23 13:07 ` Tomas Henzl
2013-12-23 13:32   ` Jack Wang
2013-12-23 13:45     ` Suresh Thiagarajan
2013-12-23 14:55       ` Jason Seba
2013-12-23 15:06         ` Jack Wang
2013-12-23 15:28           ` Tomas Henzl
2013-12-23 15:33             ` Jason Seba
2013-12-23 15:36               ` Tomas Henzl
2013-12-23 16:34               ` Oleg Nesterov
2013-12-23 17:27                 ` spinlock_irqsave() && flags (Was: pm80xx: Spinlock fix) Oleg Nesterov
2013-12-23 18:12                   ` Linus Torvalds
2013-12-23 18:24                     ` Oleg Nesterov
2013-12-23 18:43                       ` Linus Torvalds
2013-12-23 18:23                   ` Ingo Molnar
2013-12-23 18:33                     ` Oleg Nesterov
2013-12-24  8:29                       ` Ingo Molnar
2013-12-24  9:13                         ` Suresh Thiagarajan
2013-12-24 17:29                           ` James Bottomley
2013-12-27 16:18                           ` Oleg Nesterov
2014-01-02 10:31                             ` Suresh Thiagarajan
2014-01-03 20:02                               ` Dan Williams
2013-12-23 15:38             ` Oleg Nesterov [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=20131223153851.GA27812@redhat.com \
    --to=oleg@redhat.com \
    --cc=JBottomley@parallels.com \
    --cc=Suresh.Thiagarajan@pmcs.com \
    --cc=Vasanthalakshmi.Tharmarajan@pmcs.com \
    --cc=Viswas.G@pmcs.com \
    --cc=jason.seba42@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=thenzl@redhat.com \
    --cc=xjtuwjp@gmail.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).