[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [Patch] per-domain switch to disable oos shadow page tables
Hi, attached is a patch to be able to switch off OOS shadow page table optimization per domain. This enables BS2000 to run on non-hap hw with more than 4 vcpus with reasonable performance (8 vcpus are slower than 4 vcpus with OOS enabled). Specifiying oos = 0 in the domain config file will switch off OOS optimization, oos=1 is the default. The resulting performance is nearly the same as with OOS switches off at compile time. Tested on a x86_64 machine, compilation for 32 bit is okay. Juergen -- Juergen Gross Principal Developer Operating Systems TSP ES&S SWE OS6 Telephone: +49 (0) 89 636 47950 Fujitsu Technolgy Solutions e-mail: juergen.gross@xxxxxxxxxxxxxx Otto-Hahn-Ring 6 Internet: ts.fujitsu.com D-81739 Muenchen Company details: ts.fujitsu.com/imprint.html Signed-off-by: juergen.gross@xxxxxxxxxxxxxx diff -r 0705efd9c69e tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Fri Oct 16 09:04:53 2009 +0100 +++ b/tools/python/xen/xend/XendConfig.py Fri Oct 16 14:33:25 2009 +0200 @@ -178,6 +178,7 @@ 'xen_platform_pci': int, "gfx_passthru": int, 'description': str, + 'oos' : int, } # Xen API console 'other_config' keys. diff -r 0705efd9c69e tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Fri Oct 16 09:04:53 2009 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Fri Oct 16 14:33:25 2009 +0200 @@ -2419,7 +2419,11 @@ s3_integrity = 0 if self.info.has_key('s3_integrity'): s3_integrity = self.info['s3_integrity'] - flags = (int(hvm) << 0) | (int(hap) << 1) | (int(s3_integrity) << 2) + + oos = self.info['platform'].get('oos', 1) + oos_off = 1 - oos + + flags = (int(hvm) << 0) | (int(hap) << 1) | (int(s3_integrity) << 2) | (int(oos_off) << 3) try: self.domid = xc.domain_create( diff -r 0705efd9c69e tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Fri Oct 16 09:04:53 2009 +0100 +++ b/tools/python/xen/xm/create.py Fri Oct 16 14:33:25 2009 +0200 @@ -610,6 +610,11 @@ use="""Should domain memory integrity be verified during S3? (0=protection is disabled; 1=protection is enabled.""") +gopts.var('oos', val='OOS', + fn=set_int, default=1, + use="""Should out-of-sync shadow page tabled be enabled? + (0=OOS is disabled; 1=OOS is enabled.""") + gopts.var('cpuid', val="IN[,SIN]:eax=EAX,ebx=EBX,ecx=ECX,edx=EDX", fn=append_value, default=[], use="""Cpuid description.""") @@ -990,7 +995,7 @@ 'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten', 'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor', 'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet', - 'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check', + 'guest_os_type', 'hap', 'oos', 'opengl', 'cpuid', 'cpuid_check', 'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate', 'vpt_align', 'pci_power_mgmt', 'xen_platform_pci', 'gfx_passthru', 'description' ] @@ -1038,6 +1043,8 @@ config.append(['backend', ['tpmif']]) if vals.localtime: config.append(['localtime', vals.localtime]) + if vals.oos: + config.append(['oos', vals.oos]) config_image = configure_image(vals) if vals.bootloader: diff -r 0705efd9c69e tools/python/xen/xm/xenapi_create.py --- a/tools/python/xen/xm/xenapi_create.py Fri Oct 16 09:04:53 2009 +0100 +++ b/tools/python/xen/xm/xenapi_create.py Fri Oct 16 14:33:25 2009 +0200 @@ -1073,6 +1073,7 @@ 'vhpt', 'guest_os_type', 'hap', + 'oos', 'pci_msitranslate', 'pci_power_mgmt', 'xen_platform_pci', diff -r 0705efd9c69e xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Fri Oct 16 09:04:53 2009 +0100 +++ b/xen/arch/x86/domain.c Fri Oct 16 14:33:25 2009 +0200 @@ -452,7 +452,7 @@ #endif /* __x86_64__ */ - if ( (rc = paging_domain_init(d)) != 0 ) + if ( (rc = paging_domain_init(d, domcr_flags)) != 0 ) goto fail; paging_initialised = 1; diff -r 0705efd9c69e xen/arch/x86/mm/paging.c --- a/xen/arch/x86/mm/paging.c Fri Oct 16 09:04:53 2009 +0100 +++ b/xen/arch/x86/mm/paging.c Fri Oct 16 14:33:25 2009 +0200 @@ -636,7 +636,7 @@ /* CODE FOR PAGING SUPPORT */ /************************************************/ /* Domain paging struct initialization. */ -int paging_domain_init(struct domain *d) +int paging_domain_init(struct domain *d, unsigned int domcr_flags) { int rc; @@ -646,7 +646,7 @@ /* The order of the *_init calls below is important, as the later * ones may rewrite some common fields. Shadow pagetables are the * default... */ - shadow_domain_init(d); + shadow_domain_init(d, domcr_flags); /* ... but we will use hardware assistance if it's available. */ if ( hap_enabled(d) ) diff -r 0705efd9c69e xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Fri Oct 16 09:04:53 2009 +0100 +++ b/xen/arch/x86/mm/shadow/common.c Fri Oct 16 14:33:25 2009 +0200 @@ -43,7 +43,7 @@ /* Set up the shadow-specific parts of a domain struct at start of day. * Called for every domain from arch_domain_create() */ -void shadow_domain_init(struct domain *d) +void shadow_domain_init(struct domain *d, unsigned int domcr_flags) { int i; shadow_lock_init(d); @@ -58,6 +58,7 @@ #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) d->arch.paging.shadow.oos_active = 0; + d->arch.paging.shadow.oos_off = (domcr_flags & DOMCRF_oos_off) ? 1 : 0; #endif } @@ -3023,7 +3024,7 @@ #if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) /* We need to check that all the vcpus have paging enabled to * unsync PTs. */ - if ( is_hvm_domain(d) ) + if ( is_hvm_domain(d) && !d->arch.paging.shadow.oos_off ) { int pe = 1; struct vcpu *vptr; diff -r 0705efd9c69e xen/common/domctl.c --- a/xen/common/domctl.c Fri Oct 16 09:04:53 2009 +0100 +++ b/xen/common/domctl.c Fri Oct 16 14:33:25 2009 +0200 @@ -393,7 +393,7 @@ if ( supervisor_mode_kernel || (op->u.createdomain.flags & ~(XEN_DOMCTL_CDF_hvm_guest | XEN_DOMCTL_CDF_hap | - XEN_DOMCTL_CDF_s3_integrity)) ) + XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off)) ) break; dom = op->domain; @@ -427,6 +427,8 @@ domcr_flags |= DOMCRF_hap; if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_s3_integrity ) domcr_flags |= DOMCRF_s3_integrity; + if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_oos_off ) + domcr_flags |= DOMCRF_oos_off; ret = -ENOMEM; d = domain_create(dom, domcr_flags, op->u.createdomain.ssidref); diff -r 0705efd9c69e xen/include/asm-x86/domain.h --- a/xen/include/asm-x86/domain.h Fri Oct 16 09:04:53 2009 +0100 +++ b/xen/include/asm-x86/domain.h Fri Oct 16 14:33:25 2009 +0200 @@ -104,6 +104,7 @@ /* OOS */ int oos_active; + int oos_off; }; struct shadow_vcpu { diff -r 0705efd9c69e xen/include/asm-x86/paging.h --- a/xen/include/asm-x86/paging.h Fri Oct 16 09:04:53 2009 +0100 +++ b/xen/include/asm-x86/paging.h Fri Oct 16 14:33:25 2009 +0200 @@ -200,7 +200,7 @@ /* Set up the paging-assistance-specific parts of a domain struct at * start of day. Called for every domain from arch_domain_create() */ -int paging_domain_init(struct domain *d); +int paging_domain_init(struct domain *d, unsigned int domcr_flags); /* Handler for paging-control ops: operations from user-space to enable * and disable ephemeral shadow modes (test mode and log-dirty mode) and diff -r 0705efd9c69e xen/include/asm-x86/shadow.h --- a/xen/include/asm-x86/shadow.h Fri Oct 16 09:04:53 2009 +0100 +++ b/xen/include/asm-x86/shadow.h Fri Oct 16 14:33:25 2009 +0200 @@ -53,7 +53,7 @@ /* Set up the shadow-specific parts of a domain struct at start of day. * Called from paging_domain_init(). */ -void shadow_domain_init(struct domain *d); +void shadow_domain_init(struct domain *d, unsigned int domcr_flags); /* Setup the shadow-specific parts of a vcpu struct. It is called by * paging_vcpu_init() in paging.c */ diff -r 0705efd9c69e xen/include/public/domctl.h --- a/xen/include/public/domctl.h Fri Oct 16 09:04:53 2009 +0100 +++ b/xen/include/public/domctl.h Fri Oct 16 14:33:25 2009 +0200 @@ -60,6 +60,9 @@ #define _XEN_DOMCTL_CDF_s3_integrity 2 #define XEN_DOMCTL_CDF_s3_integrity (1U<<_XEN_DOMCTL_CDF_s3_integrity) uint32_t flags; + /* Disable out-of-sync shadow page tables? */ +#define _XEN_DOMCTL_CDF_oos_off 3 +#define XEN_DOMCTL_CDF_oos_off (1U<<_XEN_DOMCTL_CDF_oos_off) }; typedef struct xen_domctl_createdomain xen_domctl_createdomain_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t); diff -r 0705efd9c69e xen/include/xen/sched.h --- a/xen/include/xen/sched.h Fri Oct 16 09:04:53 2009 +0100 +++ b/xen/include/xen/sched.h Fri Oct 16 14:33:25 2009 +0200 @@ -364,6 +364,9 @@ /* DOMCRF_dummy: Create a dummy domain (not scheduled; not on domain list) */ #define _DOMCRF_dummy 3 #define DOMCRF_dummy (1U<<_DOMCRF_dummy) + /* DOMCRF_oos_off: dont use out-of-sync optimization for shadow page tables */ +#define _DOMCRF_oos_off 4 +#define DOMCRF_oos_off (1U<<_DOMCRF_oos_off) /* * rcu_lock_domain_by_id() is more efficient than get_domain_by_id(). _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |