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] Minor synchronisation quibble in scsifront

To: kama@xxxxxxxxxxxxxx
Subject: [Xen-devel] Minor synchronisation quibble in scsifront
From: Steven Smith <steven.smith@xxxxxxxxxx>
Date: Thu, 10 Jul 2008 16:26:56 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 10 Jul 2008 08:27:25 -0700
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
I've been having a look through scsifront again, and I saw this bit:

        ring_req->timeout_per_command = (sc->timeout_per_command / HZ);
        ring_req->nr_segments         = 0;

        spin_unlock_irq(host->host_lock);
        scsifront_do_request(info);     
        wait_event_interruptible(info->shadow[ring_req->rqid].wq_reset,
                         info->shadow[ring_req->rqid].wait_reset);

in scsifront_dev_reset_handler().  Looking at scsifront_do_request():

static void scsifront_do_request(struct vscsifrnt_info *info)
{
        struct vscsiif_front_ring *ring = &(info->ring);
        unsigned int irq = info->irq;
        int notify;

        RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(ring, notify);
        if (notify)
                notify_remote_via_irq(irq);
}

scsifront_do_request() is also called from scsifront_queuecommand(),
where it's under the host lock.  I can't see any other relevant
synchronisation, so I think that you might be able to end up with
several processors pushing requests at the same time.  I'm not sure
what'll happen then, but I doubt it's a good idea.

The issue could be avoided if you just swapped two lines in
scsifront_dev_reset_handler():

        ring_req->timeout_per_command = (sc->timeout_per_command / HZ);
        ring_req->nr_segments         = 0;

        scsifront_do_request(info);     
        spin_unlock_irq(host->host_lock);
        wait_event_interruptible(info->shadow[ring_req->rqid].wq_reset,
                         info->shadow[ring_req->rqid].wait_reset);

Does that sound sane?

On the plus side, that's the only strange bit I could see in current
scsifront. :)

Steven.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>