kunmap_atomic() must zap the PTE to avoid dangling references
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Xen patchbot-unstable
# HG changeset patch
# User [email protected]
# Node ID4260eb8c08740de0000081c61a6237ffcb95b2d5# Parent5fa6c1723e08d6395fecc427f372d008006b2b4ckunmap_atomic()must zap the PTE to avoid dangling references when attempting to free memory back to Xen. We can implement something more efficient in future.Also add debug print message if guest tries to free 'in use' memory. We'll make it a real guest-visible error in future.
...
Quoted 8 lines
diff -r
5fa6c1723e08-r4260eb8c0874xen/common/memory.cxen/common/memory.c +1
-0@@ -169,6 +169,15 @@ guest_remove_page(if (test_and_clear_bit (_PGC_allocated, &page->count_info) )put_page (page); +
xen/common/memory.c guest_remove_page( · line 182
Quoted 10 lines
xen/common/memory.c +8
-0+if (unlikely ((page->count_info & PGC_count_mask) !=1 ) ) + { +/* We'll make this a guest-visible error in future, so take heed! */ +DPRINTK ("Dom%d freeing in-use page %lx (pseudophys %lx):" +" count=%x type=%lx\n" , + d->domain_id, mfn,get_gpfn_from_mfn (mfn), + page->count_info, page->u.inuse.type_info); + }guest_physmap_remove_page (d, gmfn, mfn);
The above check results in false positive on Xen/IA64 because a page 'in use' has reference count 2 on Xen/IA64.
- a page is assigned to guest domain's psudo physical address space. This is decremented by guest_physmap_remove_page()
- a page is allocated for a domain.
This is decremented by the following put_page()
Work around is needed.
I think the option B. is better, but I'm not sure. Which option is better?
A. just #ifdef.
poor solution.
B. define an arch-specific constant like PGC_removable
C. define an arch-specific checking macro or function like
is_page_removable().
D. move the check under guest_physical_remove_page().
Probably this option isn't good because we may want to detect an error before doing complex thing by guest_physimap_remove_page().
E. others.
Signature · 1 line
yamahata