The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Nick Piggin <piggin@cyberone.com.au>
To: Jens Axboe <axboe@suse.de>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@osdl.org>
Subject: Re: AS spin lock bugs
Date: Thu, 13 Nov 2003 22:16:51 +1100	[thread overview]
Message-ID: <3FB36823.7000806@cyberone.com.au> (raw)
In-Reply-To: <20031113111042.GG4441@suse.de>



Jens Axboe wrote:

>On Thu, Nov 13 2003, Jens Axboe wrote:
>
>>On Thu, Nov 13 2003, Nick Piggin wrote:
>>
>>>
>>>Jens Axboe wrote:
>>>
>>>
>>>>On Thu, Nov 13 2003, Jens Axboe wrote:
>>>>
>>>>
>>>>>@@ -959,12 +960,12 @@
>>>>>	if (!aic)
>>>>>		return;
>>>>>
>>>>>-	spin_lock(&aic->lock);
>>>>>+	spin_lock_irqsave(&aic->lock, flags);
>>>>>	if (arq->is_sync == REQ_SYNC) {
>>>>>		set_bit(AS_TASK_IORUNNING, &aic->state);
>>>>>		aic->last_end_request = jiffies;
>>>>>	}
>>>>>-	spin_unlock(&aic->lock);
>>>>>+	spin_unlock_irqrestore(&aic->lock, flags);
>>>>>
>>>>>	put_io_context(arq->io_context);
>>>>>}
>>>>>
>>>>>
>>>>BTW, this looks bogus. Why do you need any locking there?
>>>>
>>>>
>>>To prevent a request completion on another queue on another CPU from
>>>racing with request insertion: last_end_request is undefined if the
>>>flag is not set. I guess you could flip the statements and put a
>>>smp_mb between them. Probably not worth the trouble though.
>>>
>>No better to make it explicit, probably doesn't matter much in
>>real-life. Thanks for the clarifications.
>>
>
>Ah, it would be clearer as:
>
>	if (arq->is_sync == REQ_SYNC) {
>		spin_lock(&aic->lock);
>		set_bit(AS_TASK_IORUNNING, &aic->state);
>		aic->last_end_request = jiffies;
>		spin_unlock(&aic->lock);
>	}
>
>Then it doesn't need comments :)
>

Yeah thats was a bit silly of me I see why you got confused. I
have actually fixed this up in mm3. So it should get through to
Linus sometime after 2.6.0.



      reply	other threads:[~2003-11-13 11:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-13 10:38 AS spin lock bugs Jens Axboe
2003-11-13 10:52 ` Nick Piggin
2003-11-13 10:59   ` Jens Axboe
2003-11-13 10:52 ` Jens Axboe
2003-11-13 10:59   ` Nick Piggin
2003-11-13 11:01     ` Jens Axboe
2003-11-13 11:10       ` Jens Axboe
2003-11-13 11:16         ` Nick Piggin [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=3FB36823.7000806@cyberone.com.au \
    --to=piggin@cyberone.com.au \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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