Out-of-sync L1 shadows: OOS base
PATCH 1/4 Out-of-sync L1 shadows: OOS base
This patch implements the basic mechanisms to get pagetables out of sync and back in sync again.
Signed-off-by Gianluca Guida <[email protected]>
Signed-off-by Tim Deegan <[email protected]>
Signed-off-by George Dunlap <[email protected]>
xen/arch/x86/mm.c +9 -3
@@ -1933,9 +1933,15 @@ int get_page_type(struct page_info *page {struct domain *d =page_get_owner (page); -/* Never allow a shadowed frame to go from type count 0 to 1 */ -if ( d &&shadow_mode_enabled (d) ) -shadow_remove_all_shadows (d->vcpu[0 ],_mfn (page_to_mfn (page))); +/* Normally we should never let a page go from type count 0 +* to type count 1 when it is shadowed. One exception: +* out-of-sync shadowed pages are allowed to become +* writeable. */ +if ( d &&shadow_mode_enabled (d) + && (page->count_info & PGC_page_table) + && !((page->shadow_flags & (1u <<29 )) + && type == PGT_writable_page) ) +shadow_remove_all_shadows (d->vcpu[0 ],_mfn (page_to_mfn (page)));ASSERT (!(x & PGT_pae_xen_l2));if ( (x & PGT_type_mask) != type )
xen/arch/x86/mm/shadow/common.c +490 -4
579 lines not on this page · raw message
xen/arch/x86/mm/shadow/multi.c +372 -35
570 lines not on this page · raw message
xen/arch/x86/mm/shadow/multi.h +10 -0
@@ -115,3 +115,13 @@ SHADOW_INTERNAL_NAME(sh_destroy_monitor_extern struct paging_mode SHADOW_INTERNAL_NAME (sh_paging_mode ,GUEST_LEVELS ); + +#if SHADOW_OPTIMIZATIONS &SHOPT_OUT_OF_SYNC +extern void +SHADOW_INTERNAL_NAME (sh_resync_l1 ,GUEST_LEVELS ) + (struct vcpu *v,mfn_t gmfn); + +extern int +SHADOW_INTERNAL_NAME (sh_safe_not_to_sync ,GUEST_LEVELS ) + (struct vcpu *v,mfn_t gmfn); +#endif
xen/arch/x86/mm/shadow/private.h +101 -1
122 lines not on this page · raw message
xen/arch/x86/mm/shadow/types.h +4 -0
@@ -438,6 +438,10 @@ struct shadow_walk_t#define sh_guess_wrmap INTERNAL_NAME(sh_guess_wrmap)#define sh_clear_shadow_entry INTERNAL_NAME(sh_clear_shadow_entry) +#if SHADOW_OPTIMIZATIONS &SHOPT_OUT_OF_SYNC +#define sh_resync_l1 INTERNAL_NAME(sh_resync_l1) +#define sh_safe_not_to_sync INTERNAL_NAME(sh_safe_not_to_sync) +#endif /* The sh_guest_(map|get)_* functions depends on Xen's paging levels */ #define sh_guest_map_l1e \
xen/include/asm-x86/domain.h +7 -0
@@ -103,6 +103,9 @@ struct shadow_domain {* emulation and remove write permission */ atomic_t gtable_dirty_version; + +/* OOS */ +int oos_active; };struct shadow_vcpu {
@@ -122,6 +125,10 @@ struct shadow_vcpu {unsigned long last_emulated_frame;/* Last MFN that we emulated a write successfully */ unsigned long last_emulated_mfn; + +/* Shadow out-of-sync: pages that this vcpu has let go out of sync */ +mfn_t oos[SHADOW_OOS_PAGES ]; +unsigned long oos_va[SHADOW_OOS_PAGES ]; };/************************************************/
xen/include/asm-x86/mm.h +3 -0
@@ -130,6 +130,9 @@ static inline u32 pickle_domptr(struct d/* The order of the largest allocation unit we use for shadow pages */ #define SHADOW_MAX_ORDER 2/* Need up to 16k allocs for 32-bit on PAE/64 */ +/* The number of out-of-sync shadows we allow per vcpu (prime, please) */ +#define SHADOW_OOS_PAGES 7 +#define page_get_owner (_p) (unpickle_domptr((_p)->u.inuse._domain))#define page_set_owner (_p,_d) ((_p)->u.inuse._domain = pickle_domptr(_d))
xen/include/asm-x86/perfc_defn.h +5 -0
@@ -80,6 +80,7 @@ PERFCOUNTER(shadow_writeable_h_3, "shad PERFCOUNTER(shadow_writeable_h_3, "shadow writeable: 64b w2k3") PERFCOUNTER(shadow_writeable_h_4, "shadow writeable: linux low/solaris") PERFCOUNTER(shadow_writeable_h_5, "shadow writeable: linux high") +PERFCOUNTER(shadow_writeable_h_6, "shadow writeable: unsync va") PERFCOUNTER(shadow_writeable_bf, "shadow writeable brute-force") PERFCOUNTER(shadow_mappings, "shadow removes all mappings")PERFCOUNTER (shadow_mappings_bf,"shadow rm-mappings brute-force" )
@@ -101,4 +102,8 @@ PERFCOUNTER(shadow_em_ex_non_pt, "shad PERFCOUNTER(shadow_em_ex_non_pt, "shadow extra non-pt-write op") PERFCOUNTER(shadow_em_ex_fail, "shadow extra emulation failed") +PERFCOUNTER(shadow_unsync, "shadow OOS unsyncs") +PERFCOUNTER(shadow_unsync_evict, "shadow OOS evictions") +PERFCOUNTER (shadow_resync,"shadow OOS resyncs" ) +/*#endif*/ /* __XEN_PERFC_DEFN_H__ */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel