From: Gianluca Guida <gianluca.guida@eu.citrix.com>
To: John Levon <levon@movementarian.org>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Christian Limpach <Christian.Limpach@eu.citrix.com>
Subject: [PATCH]: Prevent in-sync L1s to become writable (was: Re: Xen crash with latest 3.3 bits)
Date: Tue, 17 Mar 2009 12:51:19 +0000 [thread overview]
Message-ID: <49BF9CC7.2040507@eu.citrix.com> (raw)
In-Reply-To: <49B6B63A.8060906@eu.citrix.com>
[-- Attachment #1: Type: text/plain, Size: 796 bytes --]
Hi,
Gianluca Guida wrote:
>
> John Levon wrote:
>> On Tue, Mar 10, 2009 at 04:23:25PM +0000, Gianluca Guida wrote:
>>
>>>> Some time after starting an 64-bit SMP Solaris 10 domain (HVM with PV
>>>> drivers),
>>>> I get the below crash. Any ideas?
>>> This should be fixed by xen-unstable.hg's changeset 18806, named
>>> "shadow: fix race between resync and page promotion".
>>>
>>> It should be in xen-3.3.hg, can't check right now because xenbits web
>>> page seems to be dead/slow.
>> I have the patch you're referring to, but still see the problem. It's
>> pretty rare and only seems to have happened with S10 SMP so far...
>
> Ah, interesting. I'll look into it.
Meanwhile, Christian Limpach was hit by the same bug and fixed it.
Versions for Xen-3.3 and unstable attached.
Gianluca
[-- Attachment #2: prevent-insync-writable-l1 --]
[-- Type: text/plain, Size: 1737 bytes --]
diff -r b249f3e979a5 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c Mon Mar 09 10:32:24 2009 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c Tue Mar 17 12:45:56 2009 +0000
@@ -3112,6 +3112,19 @@ static int sh_page_fault(struct vcpu *v,
shadow_lock(d);
TRACE_CLEAR_PATH_FLAGS;
+
+ /* Make sure there is enough free shadow memory to build a chain of
+ * shadow tables. (We never allocate a top-level shadow on this path,
+ * only a 32b l1, pae l1, or 64b l3+2+1. Note that while
+ * SH_type_l1_shadow isn't correct in the latter case, all page
+ * tables are the same size there.)
+ *
+ * Preallocate shadow pages *before* removing writable accesses
+ * otherwhise an OOS L1 might be demoted and promoted again with
+ * writable mappings. */
+ shadow_prealloc(d,
+ SH_type_l1_shadow,
+ GUEST_PAGING_LEVELS < 4 ? 1 : GUEST_PAGING_LEVELS - 1);
rc = gw_remove_write_accesses(v, va, &gw);
@@ -3144,15 +3157,6 @@ static int sh_page_fault(struct vcpu *v,
shadow_audit_tables(v);
sh_audit_gw(v, &gw);
-
- /* Make sure there is enough free shadow memory to build a chain of
- * shadow tables. (We never allocate a top-level shadow on this path,
- * only a 32b l1, pae l1, or 64b l3+2+1. Note that while
- * SH_type_l1_shadow isn't correct in the latter case, all page
- * tables are the same size there.) */
- shadow_prealloc(d,
- SH_type_l1_shadow,
- GUEST_PAGING_LEVELS < 4 ? 1 : GUEST_PAGING_LEVELS - 1);
/* Acquire the shadow. This must happen before we figure out the rights
* for the shadow entry, since we might promote a page here. */
[-- Attachment #3: prevent-insync-writable-l1-3.3 --]
[-- Type: text/plain, Size: 1766 bytes --]
diff -r 587e81dd3540 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c Mon Mar 02 14:19:35 2009 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c Tue Mar 17 12:31:10 2009 +0000
@@ -3257,6 +3257,19 @@ static int sh_page_fault(struct vcpu *v,
shadow_lock(d);
+ /* Make sure there is enough free shadow memory to build a chain of
+ * shadow tables. (We never allocate a top-level shadow on this path,
+ * only a 32b l1, pae l1, or 64b l3+2+1. Note that while
+ * SH_type_l1_shadow isn't correct in the latter case, all page
+ * tables are the same size there.)
+ *
+ * Preallocate shadow pages *before* removing writable accesses
+ * otherwhise an OOS L1 might be demoted and promoted again with
+ * writable mappings. */
+ shadow_prealloc(d,
+ SH_type_l1_shadow,
+ GUEST_PAGING_LEVELS < 4 ? 1 : GUEST_PAGING_LEVELS - 1);
+
rc = gw_remove_write_accesses(v, va, &gw);
/* First bit set: Removed write access to a page. */
@@ -3288,15 +3301,6 @@ static int sh_page_fault(struct vcpu *v,
shadow_audit_tables(v);
sh_audit_gw(v, &gw);
-
- /* Make sure there is enough free shadow memory to build a chain of
- * shadow tables. (We never allocate a top-level shadow on this path,
- * only a 32b l1, pae l1, or 64b l3+2+1. Note that while
- * SH_type_l1_shadow isn't correct in the latter case, all page
- * tables are the same size there.) */
- shadow_prealloc(d,
- SH_type_l1_shadow,
- GUEST_PAGING_LEVELS < 4 ? 1 : GUEST_PAGING_LEVELS - 1);
/* Acquire the shadow. This must happen before we figure out the rights
* for the shadow entry, since we might promote a page here. */
[-- Attachment #4: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2009-03-17 12:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-10 15:55 Xen crash with latest 3.3 bits John Levon
2009-03-10 16:23 ` Gianluca Guida
2009-03-10 17:45 ` John Levon
2009-03-10 18:49 ` Gianluca Guida
2009-03-17 12:51 ` Gianluca Guida [this message]
2009-03-17 17:40 ` [PATCH]: Prevent in-sync L1s to become writable (was: Re: Xen crash with latest 3.3 bits) John Levon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49BF9CC7.2040507@eu.citrix.com \
--to=gianluca.guida@eu.citrix.com \
--cc=Christian.Limpach@eu.citrix.com \
--cc=levon@movementarian.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.