From: Paolo Bonzini <pbonzini@redhat.com>
To: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: target-devel <target-devel@vger.kernel.org>,
linux-scsi <linux-scsi@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
James Bottomley <JBottomley@Parallels.com>,
Christoph Hellwig <hch@lst.de>,
stable@vger.kernel.org
Subject: Re: [PATCH] virtio-scsi: Fix incorrect lock release order in virtscsi_kick_cmd
Date: Sat, 10 Nov 2012 00:37:30 +0100 [thread overview]
Message-ID: <509D93BA.2090202@redhat.com> (raw)
In-Reply-To: <1352489476.29589.544.camel@haakon2.linux-iscsi.org>
Il 09/11/2012 20:31, Nicholas A. Bellinger ha scritto:
>> That's done on purpose. After you do virtqueue_add_buf, you don't need
>> the sg list anymore, nor the lock that protects it. The cover letter is
>> at https://lkml.org/lkml/2012/6/13/295 and had this text:
>>
>> This series reorganizes the locking in virtio-scsi, introducing
>> separate scatterlists for each target and "pipelining" the locks so
>> that one command can be queued while the other is prepared. This
>> improves performance when there are multiple in-flight operations.
>>
>> In fact, the patch _introduces_ wrong locking because
>> virtqueue_kick_prepare needs the vq_lock.
>>
>> Perhaps what you want is separate local_irq_save/local_irq_restore?
>
> Ahh, that makes more sense now.
>
> Just noticed this while reviewing code that using one spinlock flag's to
> release the other looks suspicious, minus the ordering bit..
>
> Using local_irq_* would probably be cleaner than swapping flags between
> different locks, and a short comment here would be helpful to explain
> the locking order context.
Well, my plan is to improve the virtio API so I can reuse the higher
layer's scatterlist, and get rid of the lock (not just of the funny
order) altogether. :) Queuing requests is really performance-sensitive,
and it can use any optimization.
But if I can't get to it quick, I'll queue a cleanup using local_irq_*.
Paolo
prev parent reply other threads:[~2012-11-09 23:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-09 6:29 [PATCH] virtio-scsi: Fix incorrect lock release order in virtscsi_kick_cmd Nicholas A. Bellinger
2012-11-09 7:09 ` Wanlong Gao
2012-11-09 8:42 ` Paolo Bonzini
2012-11-09 19:31 ` Nicholas A. Bellinger
2012-11-09 23:37 ` Paolo Bonzini [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=509D93BA.2090202@redhat.com \
--to=pbonzini@redhat.com \
--cc=JBottomley@Parallels.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=stable@vger.kernel.org \
--cc=target-devel@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).