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 12/17] xenpaging: handle HVMCOPY_gfn_paged_out in

To: "Olaf Hering" <olaf@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 12/17] xenpaging: handle HVMCOPY_gfn_paged_out in copy_from/to_user
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Tue, 07 Dec 2010 09:27:05 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 07 Dec 2010 01:27:48 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20101206205912.343173055@xxxxxxxxx>
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: <20101206205907.848643876@xxxxxxxxx> <20101206205912.343173055@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> On 06.12.10 at 21:59, Olaf Hering <olaf@xxxxxxxxx> wrote:
> --- xen-unstable.hg-4.1.22459.orig/xen/arch/x86/mm/guest_walk.c
> +++ xen-unstable.hg-4.1.22459/xen/arch/x86/mm/guest_walk.c
> @@ -93,11 +93,12 @@ static inline void *map_domain_gfn(struc
>                                     uint32_t *rc) 
>  {
>      /* Translate the gfn, unsharing if shared */
> +retry:
>      *mfn = gfn_to_mfn_unshare(p2m, gfn_x(gfn), p2mt, 0);
>      if ( p2m_is_paging(*p2mt) )
>      {
> -        p2m_mem_paging_populate(p2m, gfn_x(gfn));
> -
> +        if ( p2m_mem_paging_populate(p2m, gfn_x(gfn)) )
> +            goto retry;
>          *rc = _PAGE_PAGED;
>          return NULL;
>      }

Is this retry loop (and similar ones later in the patch) guaranteed
to be bounded in some way?

> --- xen-unstable.hg-4.1.22459.orig/xen/arch/x86/mm/p2m.c
> +++ xen-unstable.hg-4.1.22459/xen/arch/x86/mm/p2m.c
> @@ -2805,13 +2806,13 @@ void p2m_mem_paging_populate(struct p2m_
>      /* Pause domain */
>      if ( v->domain->domain_id == d->domain_id )
>      {
> -        vcpu_pause_nosync(v);
>          req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;
> +        ret = 1;
>      }
>      else if ( p2mt != p2m_ram_paging_out && p2mt != p2m_ram_paged )
>      {
>          /* gfn is already on its way back and vcpu is not paused */
> -        return;
> +        goto populate_out;

Do you really need a goto here (i.e. are you foreseeing to get stuff
added between the label and the return below)?

>      }
>  
>      /* Send request to pager */
> @@ -2820,6 +2821,14 @@ void p2m_mem_paging_populate(struct p2m_
>      req.vcpu_id = v->vcpu_id;
>  
>      mem_event_put_request(d, &req);
> +
> +    if ( req.flags & MEM_EVENT_FLAG_VCPU_PAUSED )
> +    {
> +        wait_event(d->wq, mfn_valid(gfn_to_mfn(p2m, gfn, &p2mt)) && 
> !p2m_is_paging(p2mt));
> +    }
> +
> +populate_out:
> +    return ret;
>  }
>  
>  int p2m_mem_paging_prep(struct p2m_domain *p2m, unsigned long gfn)
> --- xen-unstable.hg-4.1.22459.orig/xen/include/asm-x86/p2m.h
> +++ xen-unstable.hg-4.1.22459/xen/include/asm-x86/p2m.h
> @@ -474,7 +474,8 @@ int p2m_mem_paging_evict(struct p2m_doma
>  /* Tell xenpaging to drop a paged out frame */
>  void p2m_mem_paging_drop_page(struct p2m_domain *p2m, unsigned long gfn);
>  /* Start populating a paged out frame */
> -void p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn);
> +/* retval 1 means the page is present on return */
> +int p2m_mem_paging_populate(struct p2m_domain *p2m, unsigned long gfn);

Isn't this a case where you absolutely need the return value checked?
If so, you will want to add __must_check here.

Jan


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

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