public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jack Wang <jack_wang@usish.com>
Cc: lindar_liu@usish.com, linux-scsi@vger.kernel.org
Subject: Re: pm8001: locking in mpi_sata_completion() is broken
Date: Thu, 15 Dec 2011 09:15:01 +0300	[thread overview]
Message-ID: <20111215061501.GF26939@mwanda> (raw)
In-Reply-To: <05B890C6DE854627B79801C1B3B16BBE@usish.com.cn>

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

On Thu, Dec 15, 2011 at 09:26:46AM +0800, Jack Wang wrote:
> >   2018                          mb();/*in order to force CPU ordering*/
> >   2019                          spin_unlock_irqrestore(&pm8001_ha->lock,
> > flags);
> > 
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > Calling irqrestore before we've done an irqsave.  What are we trying to
> > restore?
> [Jack Wang] 
> We hold spin_lock_irqsave when we process interrupt, so here we need restore
> it to do task done clean.


You're not restoring a previous saved state, flags is set to zero
here.  You're calling:
				spin_unlock_irqrestore(&pm8001_ha->lock, 0);

The whole function is badly broken.  mpi_sata_event() has similar
problems.

With spin_lock_irqsave() and spin_unlock_irqrestore() you first have
to save the state to "flags" before you can restore it.  Doing it
the other way round doesn't make any sort sense.

regards,
dan carpenter

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2011-12-15  6:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14  9:29 pm8001: locking in mpi_sata_completion() is broken Dan Carpenter
2011-12-15  1:26 ` Jack Wang
2011-12-15  6:15   ` Dan Carpenter [this message]
2011-12-15  9:03     ` Jack Wang

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=20111215061501.GF26939@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=jack_wang@usish.com \
    --cc=lindar_liu@usish.com \
    --cc=linux-scsi@vger.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