Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] Remove physmap page upon granttab xfer

To: Espen Skoglund <espen.skoglund@xxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Remove physmap page upon granttab xfer
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Wed, 28 May 2008 19:28:21 +0900
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 28 May 2008 03:28:46 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <18486.47320.917421.120949@xxxxxxxxxxxxxxxxxx>
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: <18486.47320.917421.120949@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6i
Hi Espen.

I think the issues exist in all functions in linux kernel
which uses MMU_MACHPHYS_UPDATE. gnttab_copy_grant_page(),
netbk_gop_frag(), xennet_get_responses() and netif_release_rx_bufs_flip()
The p2m/m2p table manipulation is done by MMU_MACHPHYS_UPDATE on x86.
(More exactly the p2m operation is done in linux kernel on x86.)
So at the line after steal_page(), the p2m/m2p table is supposed to be
already updated. It implys that iommu is also supposed to be 
updated already.
Although I know that grant table page transfer is obsoleted,
what is the expected exact semantics of GNTTABOP_transfer with
the p2m/m2p table?

I suppose the right fix would be 
- revert this patch and
- put the iommu opration of pv domain into MMU_MACHPHYS_UPDATE.

Some comments on xen/ia64 side:
This patch breaks xen/ia64 grant table page transfer.
When I made netback/netfront work on ia64, I thought the tranfer
operation shouldn't change the m2p/p2m table.
On the other hand, I didn't want to add new hypecall to manipulate
the m2p/p2m table for auto translated mode that corresponds
to MMU_MACHPHYS_UPDATE and set_phys_to_machine().
So I worked around it such that xen/ia64 steal_page() does
the p2m/m2p manipulation and fill new page after page owner change.
(There is a risk to fail to allocate a new page during page tranfer,
though.)

thanks

On Fri, May 23, 2008 at 01:30:16PM +0100, Espen Skoglund wrote:
> Mapping should be removed from current domain's p2m table when doing a
> grant table transfer.
> 
> Signed-off-by: Espen Skoglund <espen.skoglund@xxxxxxxxxxxxx>
> 
> 
> ================================================================
> diff -r 2e6a51378451 xen/common/grant_table.c
> --- a/xen/common/grant_table.c        Thu May 22 15:11:06 2008 +0100
> +++ b/xen/common/grant_table.c        Fri May 23 13:23:56 2008 +0100
> @@ -1073,6 +1073,8 @@
>              gop.status = GNTST_bad_page;
>              goto copyback;
>          }
> +
> +        guest_physmap_remove_page(d, gop.mfn, mfn, 0);
>  
>          /* Find the target domain. */
>          if ( unlikely((e = rcu_lock_domain_by_id(gop.domid)) == NULL) )
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
> 

-- 
yamahata

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