* [PATCH] shadow: fix the fix for promotion/resync race.
@ 2008-11-27 19:07 Gianluca Guida
0 siblings, 0 replies; only message in thread
From: Gianluca Guida @ 2008-11-27 19:07 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- Attachment #1: Type: text/plain, Size: 388 bytes --]
Hello,
I've just realized that part of the fix sent to avoid the race between
page promotion and resync contained a mistake.
This patch fixes it, and fixes also performance on 64bit guests by
resyncing on validation only when needed.
Like the previous patch, this should be applied to Xen-3.3 as well.
Thanks,
Gianluca
Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
[-- Attachment #2: fix-the-fix.patch --]
[-- Type: text/x-patch, Size: 2025 bytes --]
diff -r ab0c1bdede53 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c Wed Nov 26 11:14:26 2008 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c Thu Nov 27 19:00:50 2008 +0000
@@ -1886,13 +1886,6 @@ static shadow_l1e_t * shadow_get_and_cre
if ( r & SHADOW_SET_ERROR )
return NULL;
-#if (SHADOW_OPTIMIZATIONS && SHOPT_OUT_OF_SYNC )
- /* All pages walked are now pagetables. Safe to resync pages
- in case level 4 or 3 shadows were set. */
- if ( resync )
- shadow_resync_all(v, 0);
-#endif
-
/* This next line is important: in 32-on-PAE and 32-on-64 modes,
* the guest l1 table has an 8k shadow, and we need to return
* the right mfn of the pair. This call will set it for us as a
@@ -1900,6 +1893,14 @@ static shadow_l1e_t * shadow_get_and_cre
* compiled out.) */
(void) shadow_l1_index(sl1mfn, guest_l1_table_offset(gw->va));
}
+
+#if (SHADOW_OPTIMIZATIONS && SHOPT_OUT_OF_SYNC )
+ /* All pages walked are now pagetables. Safe to resync pages
+ in case level 4 or 3 shadows were set. */
+ if ( resync )
+ shadow_resync_all(v, 0);
+#endif
+
/* Now follow it down a level. Guaranteed to succeed. */
return sh_linear_l1_table(v) + shadow_l1_linear_offset(gw->va);
}
@@ -2176,7 +2177,8 @@ static int validate_gl4e(struct vcpu *v,
result |= SHADOW_SET_ERROR;
#if (SHADOW_OPTIMIZATIONS && SHOPT_OUT_OF_SYNC )
- shadow_resync_all(v, 0);
+ if ( mfn_valid(sl3mfn) )
+ shadow_resync_all(v, 0);
#endif
}
l4e_propagate_from_guest(v, new_gl4e, sl3mfn, &new_sl4e, ft_prefetch);
@@ -2232,7 +2234,8 @@ static int validate_gl3e(struct vcpu *v,
result |= SHADOW_SET_ERROR;
#if (SHADOW_OPTIMIZATIONS && SHOPT_OUT_OF_SYNC )
- shadow_resync_all(v, 0);
+ if ( mfn_valid(sl2mfn) )
+ shadow_resync_all(v, 0);
#endif
}
l3e_propagate_from_guest(v, new_gl3e, sl2mfn, &new_sl3e, ft_prefetch);
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-11-27 19:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-27 19:07 [PATCH] shadow: fix the fix for promotion/resync race Gianluca Guida
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.