linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Mark Lord <liml@rtr.ca>
Cc: Tejun Heo <htejun@gmail.com>, Alan Cox <alan@redhat.com>,
	IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: Re: Correct use of  ap->lock  versus  ap->host->lock ?
Date: Thu, 06 Mar 2008 12:41:20 -0500	[thread overview]
Message-ID: <47D02CC0.6080609@pobox.com> (raw)
In-Reply-To: <47D028C5.9070509@rtr.ca>

Mark Lord wrote:
> Mark Lord wrote:
>> Jeff Garzik wrote:
>>> Mark Lord wrote:
>>>> Jeff / Tejun / Alan,
>>>>
>>>> I'm trying to sort out the spinlocks in sata_mv.
>>>>
>>>> In some places, the existing code uses ap->lock.
>>>> But in others, notably the interrupt handling, it uses ap->host->lock.
>>>>
>>>> This looks buggy to me, and I'm wondering how to make it bulletproof.
>>>
>>> Look closely, there is only one lock.  ata_port does not have a 
>>> spinlock, just a pointer...
>> ..
>>
>> Ahh.. in ata_port_alloc().  Thanks.
> ..
> 
> Okay.  Does the LLD even need to bother with this lock
> in the various pre/soft/hard reset routines ?
> 
> I don't think so, but sata_mv currently tries to lock there.

It depends on what needs to be locked, obviously...

(and no, that is not a sarcastic answer)

You need to perform your own LLD-specific locking analysis to see if it 
is safe to do, e.g. __mv_stop_dma() rather than mv_stop_dma().

All the msleep() calls in the reset routines should tell you that 
sleeping is OK, which means locking during EH is mostly accordingly to 
the needs of your driver.

EH makes sure various command submission machinery is shut down, thus 
creating the _possibility_ for lockless work, but your driver may need 
additional guarantees (and thus additional locking).

	Jeff




  reply	other threads:[~2008-03-06 17:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 15:48 Correct use of ap->lock versus ap->host->lock ? Mark Lord
2008-03-06 16:35 ` Jeff Garzik
2008-03-06 17:13   ` Mark Lord
2008-03-06 17:24     ` Mark Lord
2008-03-06 17:41       ` Jeff Garzik [this message]
2008-03-06 18:12         ` Jeff Garzik
2008-03-06 23:04           ` Tejun Heo
2008-03-06 17:28     ` Jeff Garzik
2008-03-06 17:36       ` Mark Lord
2008-03-06 17:57         ` Jeff Garzik
2008-03-06 18:20           ` Mark Lord
2008-03-06 18:24             ` Jeff Garzik
2008-03-07 11:47               ` Andi Kleen

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=47D02CC0.6080609@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=alan@redhat.com \
    --cc=htejun@gmail.com \
    --cc=liml@rtr.ca \
    --cc=linux-ide@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;
as well as URLs for NNTP newsgroup(s).