Messages in this thread | | | Date | Sat, 10 Nov 2012 00:37:30 +0100 | From | Paolo Bonzini <> | Subject | Re: [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
| |