From: "Ling, Xiaofeng" <xiaofeng.ling@intel.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] clear shadow caches when vmx guest return to real mode
Date: Thu, 15 Dec 2005 15:30:28 +0800 [thread overview]
Message-ID: <43A11B94.7010308@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
clear all shadow caches when return to real mode from protect mode.
So that, if OS modify some page tables in real mode and then
return to protect mode, no outdated shadow table be used because
out of sync machanism do not work in real mode.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
[-- Attachment #2: shadowclear.patch --]
[-- Type: text/x-patch, Size: 2972 bytes --]
# HG changeset patch
# User Xiaofeng Ling <xiaofeng.ling@intel.com>
# Node ID aadb771248f677c4a957731a59b22c90a747646f
# Parent b4d615464054390c88e4b62dc2f26d3adeb86443
clear all shadow caches when return to real mode from protect mode.
So that, if OS modify some page tables in real mode and then
return to protect mode, no outdated shadow table be used.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
diff -r b4d615464054 -r aadb771248f6 xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c Thu Dec 8 15:09:46 2005 +0800
+++ b/xen/arch/x86/shadow32.c Thu Dec 8 15:09:49 2005 +0800
@@ -2982,6 +2982,23 @@
}
}
+void clear_all_shadow_status(struct domain *d)
+{
+ shadow_lock(d);
+ free_shadow_pages(d);
+ free_shadow_ht_entries(d);
+ d->arch.shadow_ht =
+ xmalloc_array(struct shadow_status, shadow_ht_buckets);
+ if ( d->arch.shadow_ht == NULL ) {
+ printk("clear all shadow status:xmalloc fail\n");
+ domain_crash_synchronous();
+ }
+ memset(d->arch.shadow_ht, 0,
+ shadow_ht_buckets * sizeof(struct shadow_status));
+
+ free_out_of_sync_entries(d);
+ shadow_unlock(d);
+}
/************************************************************************/
/************************************************************************/
diff -r b4d615464054 -r aadb771248f6 xen/arch/x86/shadow_public.c
--- a/xen/arch/x86/shadow_public.c Thu Dec 8 15:09:46 2005 +0800
+++ b/xen/arch/x86/shadow_public.c Thu Dec 8 15:09:49 2005 +0800
@@ -1748,6 +1750,24 @@
shadow_unlock(d);
}
+void clear_all_shadow_status(struct domain *d)
+{
+ shadow_lock(d);
+ free_shadow_pages(d);
+ free_shadow_ht_entries(d);
+ d->arch.shadow_ht =
+ xmalloc_array(struct shadow_status, shadow_ht_buckets);
+ if ( d->arch.shadow_ht == NULL ) {
+ printk("clear all shadow status:xmalloc fail\n");
+ domain_crash_synchronous();
+ }
+ memset(d->arch.shadow_ht, 0,
+ shadow_ht_buckets * sizeof(struct shadow_status));
+
+ free_out_of_sync_entries(d);
+ shadow_unlock(d);
+}
+
/*
* Local variables:
* mode: C
diff -r b4d615464054 -r aadb771248f6 xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c Thu Dec 8 15:09:46 2005 +0800
+++ b/xen/arch/x86/vmx.c Thu Dec 8 15:09:49 2005 +0800
@@ -1210,6 +1210,7 @@
}
}
+ clear_all_shadow_status(v->domain);
if (vmx_assist(v, VMX_ASSIST_INVOKE)) {
set_bit(VMX_CPU_STATE_ASSIST_ENABLED, &v->arch.arch_vmx.cpu_state);
__vmread(GUEST_RIP, &eip);
diff -r b4d615464054 -r aadb771248f6 xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h Thu Dec 8 15:09:46 2005 +0800
+++ b/xen/include/asm-x86/shadow.h Thu Dec 8 15:09:49 2005 +0800
@@ -1707,6 +1707,8 @@
}
}
+void clear_all_shadow_status(struct domain *d);
+
#if SHADOW_DEBUG
extern int _check_pagetable(struct vcpu *v, char *s);
extern int _check_all_pagetables(struct vcpu *v, char *s);
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2005-12-15 7:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=43A11B94.7010308@intel.com \
--to=xiaofeng.ling@intel.com \
--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.