diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-09-23 17:36:07 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-09-23 22:22:33 -0400 |
commit | 0f4b49eaf25e661fbe63a5370b7781166b34d616 (patch) | |
tree | 6cb3f57d06e26c80d7ea19b6dba5add060b2f5c1 /arch/x86/xen | |
parent | a867db10e89e12a3d97dedafdd411aa1527a6540 (diff) | |
download | blackbird-op-linux-0f4b49eaf25e661fbe63a5370b7781166b34d616.tar.gz blackbird-op-linux-0f4b49eaf25e661fbe63a5370b7781166b34d616.zip |
xen/p2m: Use SetPagePrivate and its friends for M2P overrides.
We use the page->private field and hence should use the proper
macros and set proper bits. Also WARN_ON in case somebody
tries to overwrite our data.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86/xen')
-rw-r--r-- | arch/x86/xen/p2m.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index cc2f8dcf8dda..6e56b65edafb 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c @@ -692,8 +692,9 @@ int m2p_add_override(unsigned long mfn, struct page *page, bool clear_pte) "m2p_add_override: pfn %lx not mapped", pfn)) return -EINVAL; } - - page->private = mfn; + WARN_ON(PagePrivate(page)); + SetPagePrivate(page); + set_page_private(page, mfn); page->index = pfn_to_mfn(pfn); if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) @@ -736,7 +737,8 @@ int m2p_remove_override(struct page *page, bool clear_pte) list_del(&page->lru); spin_unlock_irqrestore(&m2p_override_lock, flags); set_phys_to_machine(pfn, page->index); - + WARN_ON(!PagePrivate(page)); + ClearPagePrivate(page); if (clear_pte && !PageHighMem(page)) set_pte_at(&init_mm, address, ptep, pfn_pte(pfn, PAGE_KERNEL)); @@ -758,7 +760,7 @@ struct page *m2p_find_override(unsigned long mfn) spin_lock_irqsave(&m2p_override_lock, flags); list_for_each_entry(p, bucket, lru) { - if (p->private == mfn) { + if (page_private(p) == mfn) { ret = p; break; } |