diff options
author | Andres Lagar-Cavilla <andres@lagarcavilla.org> | 2012-01-26 13:21:27 +0000 |
---|---|---|
committer | Andres Lagar-Cavilla <andres@lagarcavilla.org> | 2012-01-26 13:21:27 +0000 |
commit | daf20794eda5d4b03d6cd6c7f59bd92d641af64d (patch) | |
tree | 31a760fa0e164c68724dd01b8346ce2a45c3464e /xen | |
parent | 860b1474eea38937bfd1007f2ea22093d1e448eb (diff) | |
download | xen-daf20794eda5d4b03d6cd6c7f59bd92d641af64d.tar.gz xen-daf20794eda5d4b03d6cd6c7f59bd92d641af64d.tar.bz2 xen-daf20794eda5d4b03d6cd6c7f59bd92d641af64d.zip |
x86/mm: Fix paging_load
When restoring a p2m entry in the paging_load path, we were not updating the
m2p entry correctly.
Also take advantage of this to act on an old suggestion: once done with the
load, promote the p2m entry to the final guest accessible type. This simplifies
logic.
Tested to work with xenpaging.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
Diffstat (limited to 'xen')
-rw-r--r-- | xen/arch/x86/mm/p2m.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 4a0ca8bb73..eb43683a03 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -975,7 +975,7 @@ void p2m_mem_paging_populate(struct domain *d, unsigned long gfn) int p2m_mem_paging_prep(struct domain *d, unsigned long gfn, uint64_t buffer) { struct page_info *page; - p2m_type_t p2mt, target_p2mt; + p2m_type_t p2mt; p2m_access_t a; mfn_t mfn; struct p2m_domain *p2m = p2m_get_hostp2m(d); @@ -1033,15 +1033,13 @@ int p2m_mem_paging_prep(struct domain *d, unsigned long gfn, uint64_t buffer) } } - target_p2mt = (p2mt == p2m_ram_paging_in_start) ? - /* If we kicked the pager with a populate event, the pager will send - * a resume event back */ - p2m_ram_paging_in : - /* If this was called asynchronously by the pager, then we can - * transition directly to the final guest-accessible type */ - (paging_mode_log_dirty(d) ? p2m_ram_logdirty : p2m_ram_rw); - /* Fix p2m mapping */ - set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, target_p2mt, a); + /* Make the page already guest-accessible. If the pager still has a + * pending resume operation, it will be idempotent p2m entry-wise, + * but will unpause the vcpu */ + set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, + paging_mode_log_dirty(d) ? p2m_ram_logdirty : + p2m_ram_rw, a); + set_gpfn_from_mfn(mfn_x(mfn), gfn); atomic_dec(&d->paged_pages); |