Remove physmap page upon granttab xfer
PATCH 1/1 Remove physmap page upon granttab xfer
Mapping should be removed from current domain's p2m table when doing a grant table transfer.
================================================================
xen/common/grant_table.c +2 -0
@@ -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 ) )
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
Quoted 26 lines · Espen Skoglund
Mapping should be removed from current domain's p2m table when doing a grant table transfer.
Signed-off-by Espen Skoglund <[email protected]>================================================================
diff -r2e6a51378451xen/common/grant_table.cxen/common/grant_table.c +2
-0@@ -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
[email protected]
http://lists.xensource.com/xen-devel
Signature · 1 line
yamahata
Quoted 7 lines · Isaku Yamahata
Although I know that grant table page transfer is obsoleted, what is the expected exact semantics of
GNTTABOP_transferwith the p2m/m2p table?I suppose the right fix would be
- revert this patch and
- put the iommu opration of pv domain intoMMU_MACHPHYS_UPDATE.
After the grant transfer operation completes the page no longer belongs to the backend domain. Thus, for absolute safety and isolation, the page must be removed from the backend domain's IOMMU mappings before completion of the grant transfer operation. Actually we should be flushing host CPU TLBs too.
-- Keir
Quoted 6 lines · Keir Fraser
Quoted 4 lines · Isaku Yamahata
Although I know that grant table page transfer is obsoleted, what is the expected exact semantics of
GNTTABOP_transferwith the p2m/m2p table?
Quoted 8 lines
Quoted 3 lines
I suppose the right fix would be
- revert this patch and
- put the iommu opration of pv domain intoMMU_MACHPHYS_UPDATE.After the grant transfer operation completes the page no longer belongs to the backend domain. Thus, for absolute safety and isolation, the page must be removed from the backend domain's IOMMU mappings before completion of the grant transfer operation. Actually we should be flushing host CPU TLBs too.
Thank you for explanation.
The patch breaks ia64 granttab xfer breakage so that it have to be fixed. However the operation is now obsoleted one, so I don't want to make big effort to fix.
What do you think about the following patch?
grant_table.c-if 2008-05-29 18:27:05.000000000 +0900 renamed from grant_table.c 2008-05-28 18:47:40.000000000 +0900 +2 -1
@@ -1112,7 +1112,8 @@ gnttab_transfer( goto copyback; } - guest_physmap_remove_page(d, gop.mfn, mfn, 0); + if (!paging_mode_translate(d)) + guest_physmap_remove_page(d, gop.mfn, mfn, 0); /* Find the target domain. */ if ( unlikely((e = rcu_lock_domain_by_id(gop.domid)) == NULL)
)
or #ifndef __ia64__
Signature · 1 line
yamahata
Quoted 10 lines · Isaku Yamahata
Quoted 4 lines
After the grant transfer operation completes the page no longer belongs to the backend domain. Thus, for absolute safety and isolation, the page must be removed from the backend domain's IOMMU mappings before completion of the grant transfer operation. Actually we should be flushing host CPU TLBs too.
Thank you for explanation.
The patch breaks ia64 granttab xfer breakage so that it have to be fixed. However the operation is now obsoleted one, so I don't want to make big effort to fix.
What do you think about the following patch?
How does grant transfer work on ia64? Looking at netback I don't even see how the 'hole' left by transfer of the old page gets filled by mapping in a new page.
-- Keir
Quoted 9 lines · Keir Fraser
Quoted 5 lines
Thank you for explanation.
The patch breaks ia64 granttab xfer breakage so that it have to be fixed. However the operation is now obsoleted one, so I don't want to make big effort to fix.
What do you think about the following patch?How does grant transfer work on ia64? Looking at netback I don't even see how the 'hole' left by transfer of the old page gets filled by mapping in a new page.
Oh, I see you do it steal_page(). Okay, I think best to make the remove_page() call ifndef ia64 then.
-- Keir
Quoted 11 lines · Keir Fraser
Quoted 6 lines · Keir Fraser
Quoted 5 lines
Thank you for explanation.
The patch breaks ia64 granttab xfer breakage so that it have to be fixed. However the operation is now obsoleted one, so I don't want to make big effort to fix.
What do you think about the following patch?
Quoted 6 lines
Quoted 3 lines
How does grant transfer work on ia64? Looking at netback I don't even see how the 'hole' left by transfer of the old page gets filled by mapping in a new page.
Oh, I see you do it
steal_page(). Okay, I think best to make theremove_page()call ifndef ia64 then.
Thanks, here is the patch.
[IA64] fix ia64 granttab xfer.
On ia64 steal_page() also update the p2m table so that guest_physmap_remove_page() call isn't necessary. #ifndef out the call.
xen/common/grant_table.c +2 -0
@@ -1112,7 +1112,9 @@ goto copyback; } +#ifndef __ia64__/* on ia64 steal_page() also does remove_page() */ guest_physmap_remove_page (d, gop.mfn, mfn,0 ); +#endif /* Find the target domain. */ if (unlikely ((e =rcu_lock_domain_by_id (gop.domid)) ==NULL ) )
Signature · 1 line
yamahata
[IA64] fix ia64 granttab xfer.
On ia64 steal_page() also update the p2m table so that guest_physmap_remove_page() call isn't necessary. #ifndef out the call.
xen/common/grant_table.c +2 -0
@@ -1112,7 +1112,9 @@ goto copyback; } +#ifndef __ia64__/* on ia64 steal_page() also does remove_page() */ guest_physmap_remove_page (d, gop.mfn, mfn,0 ); +#endif /* Find the target domain. */ if (unlikely ((e =rcu_lock_domain_by_id (gop.domid)) ==NULL ) )
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel