lkml.org 
[lkml]   [2012]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] virtio-scsi: Fix incorrect lock release order in virtscsi_kick_cmd
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


\
 
 \ /
  Last update: 2012-11-10 01:01    [W:4.853 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site