From: Gianluca Guida <gianluca.guida@eu.citrix.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH] Add FreeBSD mappings guest heuristics.
Date: Fri, 26 Sep 2008 14:36:00 +0100 [thread overview]
Message-ID: <48DCE540.4010502@eu.citrix.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 310 bytes --]
Hello,
This patch adds FreeBSD mappings heuristics to allow faster page promotion.
Also, remove code for unsync va heuristic, not needed anymore.
I admit the guest heuristic are getting too long, but this can be fixed
in the future.
Gianluca
Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
[-- Attachment #2: freebsd-guess-heuristic.patch --]
[-- Type: text/x-patch, Size: 3723 bytes --]
diff -r 5274aa966231 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c Fri Sep 26 11:12:29 2008 +0100
+++ b/xen/arch/x86/mm/shadow/common.c Fri Sep 26 14:27:11 2008 +0100
@@ -2343,9 +2343,6 @@ int sh_remove_write_access(struct vcpu *
return 1; \
} \
} while (0)
-
- if ( level == 0 && fault_addr )
- GUESS(fault_addr, 6);
if ( v->arch.paging.mode->guest_levels == 2 )
{
@@ -2357,6 +2354,10 @@ int sh_remove_write_access(struct vcpu *
if ((gfn = mfn_to_gfn(v->domain, gmfn)) < 0x38000 )
GUESS(0xC0000000UL + (gfn << PAGE_SHIFT), 4);
+ /* FreeBSD: Linear map at 0xBFC00000 */
+ if ( level == 1 )
+ GUESS(0xBFC00000UL
+ + ((fault_addr & VADDR_MASK) >> 10), 6);
}
else if ( v->arch.paging.mode->guest_levels == 3 )
{
@@ -2370,6 +2371,15 @@ int sh_remove_write_access(struct vcpu *
/* Linux lowmem: first 896MB is mapped 1-to-1 above 0xC0000000 */
if ((gfn = mfn_to_gfn(v->domain, gmfn)) < 0x38000 )
GUESS(0xC0000000UL + (gfn << PAGE_SHIFT), 4);
+
+ /* FreeBSD PAE: Linear map at 0xBF800000 */
+ switch ( level )
+ {
+ case 1: GUESS(0xBF800000UL
+ + ((fault_addr & VADDR_MASK) >> 9), 6); break;
+ case 2: GUESS(0xBFDFC000UL
+ + ((fault_addr & VADDR_MASK) >> 18), 6); break;
+ }
}
#if CONFIG_PAGING_LEVELS >= 4
else if ( v->arch.paging.mode->guest_levels == 4 )
@@ -2392,11 +2402,25 @@ int sh_remove_write_access(struct vcpu *
GUESS(0xffff880000000000UL + (gfn << PAGE_SHIFT), 4);
GUESS(0xffff810000000000UL + (gfn << PAGE_SHIFT), 4);
GUESS(0x0000010000000000UL + (gfn << PAGE_SHIFT), 4);
+
/*
* 64bit Solaris kernel page map at
* kpm_vbase; 0xfffffe0000000000UL
*/
GUESS(0xfffffe0000000000UL + (gfn << PAGE_SHIFT), 4);
+
+ /* FreeBSD 64bit: linear map 0xffff800000000000 */
+ switch ( level )
+ {
+ case 1: GUESS(0xffff800000000000
+ + ((fault_addr & VADDR_MASK) >> 9), 6); break;
+ case 2: GUESS(0xffff804000000000UL
+ + ((fault_addr & VADDR_MASK) >> 18), 6); break;
+ case 3: GUESS(0xffff804020000000UL
+ + ((fault_addr & VADDR_MASK) >> 27), 6); break;
+ }
+ /* FreeBSD 64bit: direct map at 0xffffff0000000000 */
+ GUESS(0xffffff0000000000 + (gfn << PAGE_SHIFT), 6);
}
#endif /* CONFIG_PAGING_LEVELS >= 4 */
diff -r 5274aa966231 xen/include/asm-x86/perfc_defn.h
--- a/xen/include/asm-x86/perfc_defn.h Fri Sep 26 11:12:29 2008 +0100
+++ b/xen/include/asm-x86/perfc_defn.h Fri Sep 26 14:27:11 2008 +0100
@@ -80,7 +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_h_6, "shadow writeable: FreeBSD")
PERFCOUNTER(shadow_writeable_h_7, "shadow writeable: sl1p")
PERFCOUNTER(shadow_writeable_h_8, "shadow writeable: sl1p failed")
PERFCOUNTER(shadow_writeable_bf, "shadow writeable brute-force")
[-- 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:[~2008-09-26 13:36 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=48DCE540.4010502@eu.citrix.com \
--to=gianluca.guida@eu.citrix.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.