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] Re: [Patch] Fix SMP debugging assert failures in blktap

To: "Stephen C. Tweedie" <sct@xxxxxxxxxx>
Subject: [Xen-devel] Re: [Patch] Fix SMP debugging assert failures in blktap
From: "Andrew Warfield" <andrew.warfield@xxxxxxxxxxxx>
Date: Thu, 28 Sep 2006 12:04:36 -0700
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Julian Chesterfield <jac90@xxxxxxxxx>
Delivery-date: Thu, 28 Sep 2006 12:05:08 -0700
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=XML7CDpjmduSNhE/d0bt9SuURvvsWMOcn1Ci+9pq2f4PRtXMg+27EL1fucoV/4cIEisUudvZcOCitkYolRjzLloBcmmZ7wy39T3P2ZvhO7qrCwZfx3j6GDlK5bratLlb17tf4O5+/A/TOpqx0VrnmL1GAH/aJEjJQdpbADgpAgI=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1159459841.8884.16.camel@xxxxxxxxxxxxxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1159459841.8884.16.camel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Applied, thank you.

a.

On 9/28/06, Stephen C. Tweedie <sct@xxxxxxxxxx> wrote:
blktap is calling non-atomic kernel functions with irqs disabled, which
hits various kernel debug traps if those are enabled.  The problem is
req_increase(), which takes the pending_free_lock.

This function is currently only ever called from module initialiation,
where it is impossible for it to race against anything else.  Its
companion, req_decrease(), is not called at all.

Fix by removing the offending locking from req_increase() and, while
we're at it, remove req_decrease() entirely.

Signed-off-by: Stephen Tweedie <sct@xxxxxxxxxx>

diff -r ed51caee4fe6 -r 94df5bd84195 
linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c  Thu Sep 28 15:38:25 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c  Thu Sep 28 17:09:09 
2006 +0100
@@ -716,8 +716,6 @@ static int req_increase(void)
        unsigned long flags;
        int ret;

-       spin_lock_irqsave(&pending_free_lock, flags);
-
        ret = -EINVAL;
        if (mmap_alloc >= MAX_PENDING_REQS || mmap_lock)
                goto done;
@@ -782,8 +780,7 @@ static int req_increase(void)

        mmap_alloc++;
        DPRINTK("# MMAPs increased to %d\n",mmap_alloc);
- done:
-       spin_unlock_irqrestore(&pending_free_lock, flags);
+done:
        return ret;
 }

@@ -811,36 +808,6 @@ static void mmap_req_del(int mmap)
        mmap_lock = 0;
        DPRINTK("# MMAPs decreased to %d\n",mmap_alloc);
        mmap_alloc--;
-}
-
-/*N.B. Currently unused - will be accessed via sysfs*/
-static void req_decrease(void)
-{
-       pending_req_t *req;
-       int i;
-       unsigned long flags;
-
-       spin_lock_irqsave(&pending_free_lock, flags);
-
-       DPRINTK("Req decrease called.\n");
-       if (mmap_lock || mmap_alloc == 1)
-               goto done;
-
-       mmap_lock = 1;
-       mmap_inuse = MAX_PENDING_REQS;
-
-        /*Go through reqs and remove any that aren't in use*/
-       for (i = 0; i < MAX_PENDING_REQS ; i++) {
-               req = &pending_reqs[mmap_alloc-1][i];
-               if (req->inuse == 0) {
-                       list_del(&req->free_list);
-                       mmap_inuse--;
-               }
-       }
-       if (mmap_inuse == 0) mmap_req_del(mmap_alloc-1);
- done:
-       spin_unlock_irqrestore(&pending_free_lock, flags);
-       return;
 }

 static pending_req_t* alloc_req(void)




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>