xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Don't take the domain lock for p2m operations.
@ 2013-07-29 14:06 Tim Deegan
  2013-07-29 14:08 ` Andres Lagar-Cavilla
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tim Deegan @ 2013-07-29 14:06 UTC (permalink / raw)
  To: xen-devel; +Cc: stefano.stabellini, keir, ian.campbell, jbeulich, andres

P2M ops are covered by their own locks, and these uses of the domain
lock are relics of shadow-v1 code.

Signed-off-by: Tim Deegan <tim@xen.org>
---
v2: also drop a domain_lock() from ARM mm code.
---
 xen/arch/arm/mm.c   |    4 ----
 xen/arch/x86/mm.c   |    9 +++------
 xen/common/memory.c |    4 ----
 3 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index d1290cd..f301e65 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -875,13 +875,9 @@ static int xenmem_add_to_physmap_one(
         return -ENOSYS;
     }
 
-    domain_lock(d);
-
     /* Map at new location. */
     rc = guest_physmap_add_page(d, gpfn, mfn, 0);
 
-    domain_unlock(d);
-
     return rc;
 }
 
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index c00841c..e7f0e13 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4596,11 +4596,6 @@ static int xenmem_add_to_physmap_once(
         return -EINVAL;
     }
 
-    domain_lock(d);
-
-    if ( page )
-        put_page(page);
-
     /* Remove previously mapped page if it was present. */
     prev_mfn = mfn_x(get_gfn(d, xatp->gpfn, &p2mt));
     if ( mfn_valid(prev_mfn) )
@@ -4631,7 +4626,9 @@ static int xenmem_add_to_physmap_once(
     if ( xatp->space == XENMAPSPACE_gmfn ||
          xatp->space == XENMAPSPACE_gmfn_range )
         put_gfn(d, gfn);
-    domain_unlock(d);
+
+    if ( page )
+        put_page(page);
 
     return rc;
 }
diff --git a/xen/common/memory.c b/xen/common/memory.c
index 06a0d0a..50b740f 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -693,8 +693,6 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             return rc;
         }
 
-        domain_lock(d);
-
         page = get_page_from_gfn(d, xrfp.gpfn, NULL, P2M_ALLOC);
         if ( page )
         {
@@ -704,8 +702,6 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         else
             rc = -ENOENT;
 
-        domain_unlock(d);
-
         rcu_unlock_domain(d);
 
         break;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Don't take the domain lock for p2m operations.
  2013-07-29 14:06 [PATCH v2] Don't take the domain lock for p2m operations Tim Deegan
@ 2013-07-29 14:08 ` Andres Lagar-Cavilla
  2013-07-29 14:08 ` Ian Campbell
  2013-07-29 15:10 ` Keir Fraser
  2 siblings, 0 replies; 4+ messages in thread
From: Andres Lagar-Cavilla @ 2013-07-29 14:08 UTC (permalink / raw)
  To: Tim Deegan
  Cc: keir, ian.campbell, xen-devel, stefano.stabellini, andres,
	jbeulich

On Jul 29, 2013, at 10:06 AM, Tim Deegan <tim@xen.org> wrote:

> P2M ops are covered by their own locks, and these uses of the domain
> lock are relics of shadow-v1 code.
> 
> Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
> ---
> v2: also drop a domain_lock() from ARM mm code.
> ---
> xen/arch/arm/mm.c   |    4 ----
> xen/arch/x86/mm.c   |    9 +++------
> xen/common/memory.c |    4 ----
> 3 files changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index d1290cd..f301e65 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -875,13 +875,9 @@ static int xenmem_add_to_physmap_one(
>         return -ENOSYS;
>     }
> 
> -    domain_lock(d);
> -
>     /* Map at new location. */
>     rc = guest_physmap_add_page(d, gpfn, mfn, 0);
> 
> -    domain_unlock(d);
> -
>     return rc;
> }
> 
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index c00841c..e7f0e13 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -4596,11 +4596,6 @@ static int xenmem_add_to_physmap_once(
>         return -EINVAL;
>     }
> 
> -    domain_lock(d);
> -
> -    if ( page )
> -        put_page(page);
> -
>     /* Remove previously mapped page if it was present. */
>     prev_mfn = mfn_x(get_gfn(d, xatp->gpfn, &p2mt));
>     if ( mfn_valid(prev_mfn) )
> @@ -4631,7 +4626,9 @@ static int xenmem_add_to_physmap_once(
>     if ( xatp->space == XENMAPSPACE_gmfn ||
>          xatp->space == XENMAPSPACE_gmfn_range )
>         put_gfn(d, gfn);
> -    domain_unlock(d);
> +
> +    if ( page )
> +        put_page(page);
> 
>     return rc;
> }
> diff --git a/xen/common/memory.c b/xen/common/memory.c
> index 06a0d0a..50b740f 100644
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -693,8 +693,6 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>             return rc;
>         }
> 
> -        domain_lock(d);
> -
>         page = get_page_from_gfn(d, xrfp.gpfn, NULL, P2M_ALLOC);
>         if ( page )
>         {
> @@ -704,8 +702,6 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>         else
>             rc = -ENOENT;
> 
> -        domain_unlock(d);
> -
>         rcu_unlock_domain(d);
> 
>         break;
> -- 
> 1.7.10.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Don't take the domain lock for p2m operations.
  2013-07-29 14:06 [PATCH v2] Don't take the domain lock for p2m operations Tim Deegan
  2013-07-29 14:08 ` Andres Lagar-Cavilla
@ 2013-07-29 14:08 ` Ian Campbell
  2013-07-29 15:10 ` Keir Fraser
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2013-07-29 14:08 UTC (permalink / raw)
  To: Tim Deegan; +Cc: stefano.stabellini, keir, andres, jbeulich, xen-devel

On Mon, 2013-07-29 at 15:06 +0100, Tim Deegan wrote:
> P2M ops are covered by their own locks, and these uses of the domain
> lock are relics of shadow-v1 code.
> 
> Signed-off-by: Tim Deegan <tim@xen.org>
> ---
> v2: also drop a domain_lock() from ARM mm code.

Acked-by: Ian Campbell <ian.campbell@citrix.com>

> ---
>  xen/arch/arm/mm.c   |    4 ----
>  xen/arch/x86/mm.c   |    9 +++------
>  xen/common/memory.c |    4 ----
>  3 files changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index d1290cd..f301e65 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -875,13 +875,9 @@ static int xenmem_add_to_physmap_one(
>          return -ENOSYS;
>      }
>  
> -    domain_lock(d);
> -
>      /* Map at new location. */
>      rc = guest_physmap_add_page(d, gpfn, mfn, 0);
>  
> -    domain_unlock(d);
> -
>      return rc;
>  }
>  
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index c00841c..e7f0e13 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -4596,11 +4596,6 @@ static int xenmem_add_to_physmap_once(
>          return -EINVAL;
>      }
>  
> -    domain_lock(d);
> -
> -    if ( page )
> -        put_page(page);
> -
>      /* Remove previously mapped page if it was present. */
>      prev_mfn = mfn_x(get_gfn(d, xatp->gpfn, &p2mt));
>      if ( mfn_valid(prev_mfn) )
> @@ -4631,7 +4626,9 @@ static int xenmem_add_to_physmap_once(
>      if ( xatp->space == XENMAPSPACE_gmfn ||
>           xatp->space == XENMAPSPACE_gmfn_range )
>          put_gfn(d, gfn);
> -    domain_unlock(d);
> +
> +    if ( page )
> +        put_page(page);
>  
>      return rc;
>  }
> diff --git a/xen/common/memory.c b/xen/common/memory.c
> index 06a0d0a..50b740f 100644
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -693,8 +693,6 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>              return rc;
>          }
>  
> -        domain_lock(d);
> -
>          page = get_page_from_gfn(d, xrfp.gpfn, NULL, P2M_ALLOC);
>          if ( page )
>          {
> @@ -704,8 +702,6 @@ long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>          else
>              rc = -ENOENT;
>  
> -        domain_unlock(d);
> -
>          rcu_unlock_domain(d);
>  
>          break;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] Don't take the domain lock for p2m operations.
  2013-07-29 14:06 [PATCH v2] Don't take the domain lock for p2m operations Tim Deegan
  2013-07-29 14:08 ` Andres Lagar-Cavilla
  2013-07-29 14:08 ` Ian Campbell
@ 2013-07-29 15:10 ` Keir Fraser
  2 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2013-07-29 15:10 UTC (permalink / raw)
  To: Tim Deegan, xen-devel; +Cc: stefano.stabellini, ian.campbell, jbeulich, andres

On 29/07/2013 15:06, "Tim Deegan" <tim@xen.org> wrote:

> P2M ops are covered by their own locks, and these uses of the domain
> lock are relics of shadow-v1 code.
> 
> Signed-off-by: Tim Deegan <tim@xen.org>
> ---
> v2: also drop a domain_lock() from ARM mm code.

Acked-by: Keir Fraser <keir@xen.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-29 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-29 14:06 [PATCH v2] Don't take the domain lock for p2m operations Tim Deegan
2013-07-29 14:08 ` Andres Lagar-Cavilla
2013-07-29 14:08 ` Ian Campbell
2013-07-29 15:10 ` Keir Fraser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).