WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] linux-2.6.18/blktap2: fix synchronization in blktap_

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux-2.6.18/blktap2: fix synchronization in blktap_device_run_queue()
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Thu, 18 Nov 2010 12:28:39 +0000
Cc: jake.wires@xxxxxxxxxx
Delivery-date: Thu, 18 Nov 2010 04:29:32 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
c/s 896 (use of blk_rq_map_sg()) made the problem worse, but from what
I can tell there had been races (ring and stats updates) before. If
that's not a correct observation, a perhaps better solution might be
to move the struct scatterlist array out of struct blktap (and make it
e.g. an on-stack variable, the problem being that
blktap_device_process_request() has a pretty large stack frame
already - shrinking this might be possible by moving e.g. the
struct blktap_grant_table and struct blkif_request blkif_req instances
the other way if the locking change here is the right thing to do).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- a/drivers/xen/blktap2/device.c
+++ b/drivers/xen/blktap2/device.c
@@ -887,7 +887,7 @@ blktap_device_run_queue(struct blktap *t
                blkdev_dequeue_request(req);
 
                spin_unlock_irq(&dev->lock);
-               down_read(&tap->tap_sem);
+               down_write(&tap->tap_sem);
 
                err = blktap_device_process_request(tap, request, req);
                if (!err)
@@ -897,7 +897,7 @@ blktap_device_run_queue(struct blktap *t
                        blktap_request_free(tap, request);
                }
 
-               up_read(&tap->tap_sem);
+               up_write(&tap->tap_sem);
                spin_lock_irq(&dev->lock);
        }
 



Attachment: xen-blktap2-run-queue-sem.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux-2.6.18/blktap2: fix synchronization in blktap_device_run_queue(), Jan Beulich <=