Skip to content

Commit

Permalink
xen/p2m: Allocate p2m tracking pages on override
Browse files Browse the repository at this point in the history
It is possible to add a p2m override on pages that are currently mapped
to INVALID_P2M_ENTRY; in particular, this will happen when using
ballooned pages in gntdev. This means that set_phys_to_machine must be
used instead of __set_phys_to_machine.

Signed-off-by: Daniel De Graaf <[email protected]>
Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
  • Loading branch information
dgdegraaf authored and konradwilk committed Mar 24, 2011
1 parent a93e20a commit b254244
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/x86/xen/p2m.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,9 @@ int m2p_add_override(unsigned long mfn, struct page *page)
page->private = mfn;
page->index = pfn_to_mfn(pfn);

__set_phys_to_machine(pfn, FOREIGN_FRAME(mfn));
if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
return -ENOMEM;

if (!PageHighMem(page))
/* Just zap old mapping for now */
pte_clear(&init_mm, address, ptep);
Expand Down Expand Up @@ -709,7 +711,7 @@ int m2p_remove_override(struct page *page)
spin_lock_irqsave(&m2p_override_lock, flags);
list_del(&page->lru);
spin_unlock_irqrestore(&m2p_override_lock, flags);
__set_phys_to_machine(pfn, page->index);
set_phys_to_machine(pfn, page->index);

if (!PageHighMem(page))
set_pte_at(&init_mm, address, ptep,
Expand Down

0 comments on commit b254244

Please sign in to comment.