[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [V7 PATCH 5/7] pvh: change xsm_add_to_physmap



>>> On 28.01.14 at 02:55, Mukesh Rathor <mukesh.rathor@xxxxxxxxxx> wrote:
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -838,7 +838,7 @@ long do_memory_op(unsigned long cmd, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>          if ( d == NULL )
>              return -ESRCH;
>  
> -        rc = xsm_add_to_physmap(XSM_TARGET, current->domain, d);
> +        rc = xsm_add_to_physmap(XSM_TARGET, current->domain, d, NULL);
>          if ( rc )
>          {
>              rcu_unlock_domain(d);
> @@ -860,7 +860,7 @@ long do_memory_op(unsigned long cmd, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>      case XENMEM_add_to_physmap_batch:
>      {
>          struct xen_add_to_physmap_batch xatpb;
> -        struct domain *d;
> +        struct domain *d, *fd = NULL;
>  
>          BUILD_BUG_ON((typeof(xatpb.size))-1 >
>                       (UINT_MAX >> MEMOP_EXTENT_SHIFT));
> @@ -883,7 +883,17 @@ long do_memory_op(unsigned long cmd, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>          if ( d == NULL )
>              return -ESRCH;
>  
> -        rc = xsm_add_to_physmap(XSM_TARGET, current->domain, d);
> +#ifdef CONFIG_X86
> +        if ( xatpb.space == XENMAPSPACE_gmfn_foreign )
> +        {
> +            if ( (fd = get_pg_owner(xatpb.foreign_domid)) == NULL )
> +            {
> +                rcu_unlock_domain(d);
> +                return -ESRCH;
> +            }
> +        }
> +#endif
> +        rc = xsm_add_to_physmap(XSM_TARGET, current->domain, d, fd);
>          if ( rc )
>          {
>              rcu_unlock_domain(d);
> @@ -893,6 +903,10 @@ long do_memory_op(unsigned long cmd, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>          rc = xenmem_add_to_physmap_batch(d, &xatpb, start_extent);
>  
>          rcu_unlock_domain(d);
> +#ifdef CONFIG_X86
> +        if ( fd )
> +            put_pg_owner(fd);
> +#endif
>  
>          if ( rc > 0 )
>              rc = hypercall_create_continuation(

The only think x86-specific here is that {get,put}_pg_owner() may
not exist on ARM. But the general operation isn't x86-specific, so
there shouldn't be any CONFIG_X86 dependency here. Instead
you ought to work out with the ARM maintainers whether to stub
out those two functions, or whether the functionality is useful
there too (and hence proper implementations would be needed).

In the latter case I would then also wonder whether the x86
implementation shouldn't be moved into common code.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.