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

Re: [Xen-devel] [PATCH 1/6] xen-gntdev: Fix circular locking dependency

To: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 1/6] xen-gntdev: Fix circular locking dependency
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Tue, 14 Dec 2010 13:11:18 -0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Ian.Campbell@xxxxxxxxxx
Delivery-date: Tue, 14 Dec 2010 13:12:27 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1292338553-20575-2-git-send-email-dgdegra@xxxxxxxxxxxxx>
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>
References: <1292338553-20575-1-git-send-email-dgdegra@xxxxxxxxxxxxx> <1292338553-20575-2-git-send-email-dgdegra@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.7
On 12/14/2010 06:55 AM, Daniel De Graaf wrote:
> apply_to_page_range will acquire PTE lock while priv->lock is held, and
> mn_invl_range_start tries to acquire priv->lock with PTE already held.
> Fix by not holding priv->lock during the entire map operation.

Is priv->lock needed to protect the contents of map?

    J

> Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
> ---
>  drivers/xen/gntdev.c |   19 +++++++++----------
>  1 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
> index a33e443..c582804 100644
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -581,23 +581,22 @@ static int gntdev_mmap(struct file *flip, struct 
> vm_area_struct *vma)
>       if (!(vma->vm_flags & VM_WRITE))
>               map->flags |= GNTMAP_readonly;
>  
> +     spin_unlock(&priv->lock);
> +
>       err = apply_to_page_range(vma->vm_mm, vma->vm_start,
>                                 vma->vm_end - vma->vm_start,
>                                 find_grant_ptes, map);
> -     if (err) {
> -             goto unlock_out;
> -             if (debug)
> -                     printk("%s: find_grant_ptes() failure.\n", 
> __FUNCTION__);
> -     }
> +     if (err)
> +             return err;
>  
>       err = map_grant_pages(map);
> -     if (err) {
> -             goto unlock_out;
> -             if (debug)
> -                     printk("%s: map_grant_pages() failure.\n", 
> __FUNCTION__);
> -     }
> +     if (err)
> +             return err;
> +
>       map->is_mapped = 1;
>  
> +     return 0;
> +
>  unlock_out:
>       spin_unlock(&priv->lock);
>       return err;


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

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