Supporting Enlightened Windows 2008 Server
I am attaching updated versions of the patches that I posted a couple of weeks ago. These have been merged up to the current unstable tip: changeset 17186:854b0704962b
These patches have been tested on the unstable tip.
Kier, what are your thoughts on accepting these patches.
Signed-off by K. Y. Srinivasan ([email protected])
Regards,
K. Y
tools/python/xen/lowlevel/xc/xc.c +5 -4
@@ -622,14 +622,14 @@ static PyObject *pyxc_hvm_build(XcObjectint i;#endif char *image; -int memsize, vcpus =1 , acpi =0 , apic =1 ; +int memsize, vcpus =1 , acpi =0 , apic =1 , extid =0 ;static char *kwd_list[] = {"domid" , -"memsize" ,"image" ,"vcpus" ,"acpi" , +"memsize" ,"image" ,"vcpus" ,"extid" ,"acpi" ,"apic" ,NULL }; -if ( !PyArg_ParseTupleAndKeywords (args, kwds,"iis|iii" , kwd_list, +if ( !PyArg_ParseTupleAndKeywords (args, kwds,"iis|iiii" , kwd_list, &dom, &memsize, - &image, &vcpus, &acpi, &apic) ) + &image, &vcpus, &extid, &acpi, &apic) )return NULL ;if (xc_hvm_build (self->xc_handle, dom, memsize, image) !=0 )
@@ -654,6 +654,7 @@ static PyObject *pyxc_hvm_build(XcObject va_hvm->checksum = -sum;munmap (va_map,XC_PAGE_SIZE );#endif +xc_set_hvm_param (self->xc_handle, dom,HVM_PARAM_EXTEND_HYPERVISOR , extid);return Py_BuildValue ("{}" ); }
tools/python/xen/xend/XendConfig.py +1 -1
@@ -126,7 +126,7 @@ LEGACY_CFG_TO_XENAPI_CFG = reverse_dict( # Platform configuration keys. XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'boot', 'device_model', 'loader', 'display', 'fda', 'fdb', 'keymap', 'isa', 'localtime', 'monitor', - 'nographic', 'pae', 'rtc_timeoffset', 'serial', 'sdl', + 'nographic', 'pae', 'extid', 'rtc_timeoffset', 'serial', 'sdl', 'soundhw','stdvga', 'usb', 'usbdevice', 'hpet', 'vnc', 'vncconsole', 'vncdisplay', 'vnclisten', 'timer_mode', 'vncpasswd', 'vncunused', 'xauthority', 'pci', 'vhpt',
tools/python/xen/xend/image.py +3 -0
@@ -504,6 +504,7 @@ class HVMImageHandler(ImageHandler): self.apic = int(vmConfig['platform'].get('apic', 0)) self.acpi = int(vmConfig['platform'].get('acpi', 0)) + self.extid = int(vmConfig['platform'].get('extid', 0)) self.guest_os_type = vmConfig['platform'].get('guest_os_type') # Return a list of cmd line args to the device models based on the
@@ -602,6 +603,7 @@ class HVMImageHandler(ImageHandler): log.debug("store_evtchn = %d", store_evtchn) log.debug("memsize = %d", mem_mb) log.debug("vcpus = %d", self.vm.getVCpuCount()) + log.debug("extid = %d", self.extid) log.debug("acpi = %d", self.acpi) log.debug("apic = %d", self.apic)
@@ -609,6 +611,7 @@ class HVMImageHandler(ImageHandler): image = self.loader, memsize = mem_mb, vcpus = self.vm.getVCpuCount(), + extid = self.extid, acpi = self.acpi, apic = self.apic) rc['notes'] = { 'SUSPEND_CANCEL': 1 }
tools/python/xen/xm/create.py +5 -1
@@ -207,6 +207,10 @@ gopts.var('timer_mode', val='TIMER_MODE' use="""Timer mode (0=delay virtual time when ticks are missed; 1=virtual time is always wallclock time.""") +gopts.var('extid', val='EXTID', + fn=set_int, default=0, + use="Specify extention ID for a HVM domain.") + gopts.var('acpi', val='ACPI', fn=set_int, default=1, use="Disable or enable ACPI of HVM domain.")
@@ -740,7 +744,7 @@ def configure_vifs(config_devs, vals): def configure_hvm(config_image, vals): """Create the config for HVM devices. """ - args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb', 'timer_mode', + args = [ 'device_model', 'pae', 'extid', 'vcpus', 'boot', 'fda', 'fdb', 'timer_mode', 'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw', 'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten', 'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',
%patch
xen/arch/x86/hvm/svm/svm.c +13 -2
@@ -50,6 +50,7 @@#include <asm/hvm/vpt.h> #include <asm/hvm/trace.h> #include <asm/hap.h> +#include <asm/hvm/hvm_extensions.h> u32 svm_feature_flags;
@@ -941,12 +942,13 @@static void svm_vmexit_do_cpuid (struct cpu_user_regs *regs) { -unsigned int eax, ebx, ecx, edx, inst_len; +unsigned int input, eax, ebx, ecx, edx, inst_len; eax = regs->eax; ebx = regs->ebx; ecx = regs->ecx; edx = regs->edx; + input = eax;svm_cpuid_intercept (&eax, &ebx, &ecx, &edx);
@@ -955,6 +957,7 @@ regs->ecx = ecx; regs->edx = edx; +ext_intercept_do_cpuid (input, regs); inst_len =__get_instruction_length (current,INSTR_CPUID ,NULL );__update_guest_eip (regs, inst_len); }
@@ -972,6 +975,10 @@struct vcpu *v = current;struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; +if (ext_intercept_do_msr_read (ecx, regs)) + { + goto done; + }switch ( ecx ) {case MSR_IA32_TSC :
@@ -1073,6 +1080,10 @@ msr_content = (u32 )regs->eax | ((u64 )regs->edx <<32 );hvmtrace_msr_write (v, ecx, msr_content); +if (ext_intercept_do_msr_write (ecx, regs)) + { + goto done_msr_write; + }switch ( ecx ) {
@@ -1129,7 +1140,7 @@ }break ; } - +done_msr_write:return X86EMUL_OKAY ; gpf:
xen/arch/x86/hvm/vmx/vmx.c +10 -1
@@ -49,6 +49,7 @@#include <asm/hvm/vpt.h> #include <public/hvm/save.h> #include <asm/hvm/trace.h> +#include <asm/hvm/hvm_extensions.h> enum handler_return { HNDL_done, HNDL_unhandled, HNDL_exception_raised };
@@ -1169,12 +1170,13 @@static void vmx_do_cpuid (struct cpu_user_regs *regs) { -unsigned int eax, ebx, ecx, edx; +unsigned int eax, ebx, ecx, edx, input; eax = regs->eax; ebx = regs->ebx; ecx = regs->ecx; edx = regs->edx; + input = eax;vmx_cpuid_intercept (&eax, &ebx, &ecx, &edx);
@@ -1182,6 +1184,7 @@ regs->ebx = ebx; regs->ecx = ecx; regs->edx = edx; +ext_intercept_do_cpuid (input, regs); }#define CASE_GET_REG_P (REG , reg) \
@@ -1468,6 +1471,9 @@HVM_DBG_LOG (DBG_LEVEL_1 ,"ecx=%x" , ecx); +if (ext_intercept_do_msr_read (ecx, regs)) + goto done; +switch ( ecx ) {case MSR_IA32_TSC :
@@ -1659,6 +1665,9 @@HVM_DBG_LOG (DBG_LEVEL_1 ,"ecx=%x, eax=%x, edx=%x" , ecx, (u32 )regs->eax, (u32 )regs->edx); +if (ext_intercept_do_msr_write (ecx, regs)) +return X86EMUL_OKAY ; + msr_content = (u32 )regs->eax | ((u64 )regs->edx <<32 );hvmtrace_msr_write (v, ecx, msr_content);
xen/include/asm-x86/hvm/domain.h +2 -0
@@ -79,6 +79,8 @@#endif bool_t hap_enabled;bool_t qemu_mapcache_invalidate; +void *ext_handle;/* will be NULL on creation (memset)*/ + struct extension_intercept_vector *ext_vector; };#endif /* __ASM_X86_HVM_DOMAIN_H__ */
xen/include/public/hvm/params.h +9 -6
@@ -50,10 +50,12 @@#define HVM_PARAM_BUFIOREQ_PFN 6 +#define HVM_PARAM_EXTEND_HYPERVISOR 7 +#ifdef __ia64__ -#define HVM_PARAM_NVRAM_FD 7 -#define HVM_PARAM_VHPT_SIZE 8 -#define HVM_PARAM_BUFPIOREQ_PFN 9 +#define HVM_PARAM_NVRAM_FD 8 +#define HVM_PARAM_VHPT_SIZE 9 +#define HVM_PARAM_BUFPIOREQ_PFN 10#endif /*
@@ -75,15 +77,16 @@* Missed interrupts are collapsed together and delivered as one 'late tick'. * Guest time always tracks wallclock (i.e., real) time. */ -#define HVM_PARAM_TIMER_MODE 10 +//KYS Check the modifications done to this file +#define HVM_PARAM_TIMER_MODE 11#define HVMPTM_delay_for_missed_ticks 0#define HVMPTM_no_delay_for_missed_ticks 1#define HVMPTM_no_missed_ticks_pending 2#define HVMPTM_one_missed_tick_pending 3/* Boolean: Enable virtual HPET (high-precision event timer)? (x86-only) */ -#define HVM_PARAM_HPET_ENABLED 11 +#define HVM_PARAM_HPET_ENABLED 12 -#define HVM_NR_PARAMS 12 +#define HVM_NR_PARAMS 13#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
xen/arch/x86/hvm/Makefile +1 -0
@@ -1,5 +1,6 @@ subdir-y += svm subdir-y += vmx +subdir-y += hvm_ext obj-y += emulate.o obj-y += hvm.o
xen/arch/x86/hvm/hvm.c +19 -0
@@ -43,6 +43,7 @@#include <asm/mc146818rtc.h> #include <asm/spinlock.h> #include <asm/hvm/hvm.h> +#include <asm/hvm/hvm_extensions.h> #include <asm/hvm/vpt.h> #include <asm/hvm/support.h> #include <asm/hvm/cacheattr.h>
@@ -119,6 +120,7 @@rtc_migrate_timers (v);hpet_migrate_timers (v);pt_migrate (v); +ext_intercept_do_migrate_timers (v); }void hvm_do_resume (struct vcpu *v)
@@ -279,6 +281,7 @@void hvm_domain_destroy (struct domain *d) { +ext_intercept_domain_destroy (d); hvm_funcs.domain_destroy (d);vioapic_deinit (d);hvm_destroy_cacheattr_region_list (d);
@@ -562,8 +565,14 @@ {int rc; +if ((rc =ext_intercept_vcpu_initialize (v)) !=0 ) + goto fail1; +if ( (rc =vlapic_init (v)) !=0 ) + { +ext_intercept_vcpu_destroy (v); goto fail1; + }if ( (rc = hvm_funcs.vcpu_initialise (v)) !=0 ) goto fail2;
@@ -611,12 +620,14 @@ hvm_funcs.vcpu_destroy (v); fail2:vlapic_destroy (v); +ext_intercept_vcpu_destroy (v); fail1:return rc; }void hvm_vcpu_destroy (struct vcpu *v) { +ext_intercept_vcpu_destroy (v);vlapic_destroy (v); hvm_funcs.vcpu_destroy (v);
@@ -1787,6 +1798,10 @@case 0 :break ; } +if (ext_intercept_do_hypercall (regs)) + { +return HVM_HCALL_completed; + }if ( (eax >= NR_hypercalls) || !hvm_hypercall32_table[eax] ) {
@@ -1928,6 +1943,7 @@vcpu_wake (v);gdprintk (XENLOG_INFO ,"AP %d bringup succeeded.\n" , vcpuid); +ext_intercept_vcpu_up (v);return 0 ; }
@@ -2171,6 +2187,9 @@if ( a.value > HVMPTM_one_missed_tick_pending ) goto param_fail;break ; +case HVM_PARAM_EXTEND_HYPERVISOR : +if (hvm_ext_bind (d, (int )a.value)) + goto param_fail; } d->arch.hvm_domain.params[a.index] = a.value; rc =0 ;
xen/arch/x86/x86_64/asm-offsets.c +3 -0
@@ -146,4 +146,7 @@BLANK (); OFFSET(CPUINFO_ext_features, struct cpuinfo_x86, x86_capability[1]); +BLANK (); + + OFFSET(DOM_ext_vector, struct domain, arch.hvm_domain.ext_vector); }
xen/arch/x86/hvm/vmx/x86_64/exits.S +8 -0
@@ -112,6 +112,14 @@ ALIGN ENTRY(vmx_asm_do_vmentry) GET_CURRENT(%rbx) + mov VCPU_domain(%rbx),%rax + mov DOM_ext_vector(%rax),%rdx + test %rdx,%rdx + je vmx_no_ext_vector + sti + callq *(%rdx) +vmx_no_ext_vector: + cli # tests must not race interrupts movl VCPU_processor(%rbx),%eax
xen/arch/x86/hvm/svm/x86_64/exits.S +8 -0
@@ -37,6 +37,14 @@ ENTRY(svm_asm_do_resume) GET_CURRENT(%rbx) + mov VCPU_domain(%rbx),%rax + mov DOM_ext_vector(%rax),%rdx + test %rdx,%rdx + je svm_no_ext_vector + sti + callq *(%rdx) +svm_no_ext_vector: + CLGI movl VCPU_processor(%rbx),%eax
xen/arch/x86/hvm/save.c +6 -2
@@ -23,6 +23,8 @@#include <asm/hvm/support.h> #include <public/hvm/save.h> +#include <public/hvm/params.h> +#include <asm/hvm/hvm_extensions.h> void arch_hvm_save (struct domain *d,struct hvm_save_header *hdr) {
@@ -31,8 +33,7 @@/* Save some CPUID bits */ cpuid (1 , &eax, &ebx, &ecx, &edx); hdr->cpuid = eax; - - hdr->pad0 =0 ; + hdr->ext_id = d->arch.hvm_domain.params[HVM_PARAM_EXTEND_HYPERVISOR ]; }int arch_hvm_load (struct domain *d,struct hvm_save_header *hdr)
@@ -61,6 +62,9 @@/* VGA state is not saved/restored, so we nobble the cache. */ d->arch.hvm_domain.stdvga.cache =0 ; + d->arch.hvm_domain.params[HVM_PARAM_EXTEND_HYPERVISOR ] = hdr->ext_id; +if (hvm_ext_bind (d, hdr->ext_id)) +return -1 ;return 0 ; }
xen/include/public/arch-x86/hvm/save.h +23 -2
@@ -38,7 +38,7 @@uint32_t version;/* File format version */ uint64_t changeset;/* Version of Xen that saved this file */ uint32_t cpuid;/* CPUID[0x01][%eax] on the saving machine */ -uint32_t pad0; +uint32_t ext_id;/* extension ID */ }; DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header);
@@ -422,9 +422,30 @@ DECLARE_HVM_SAVE_TYPE(MTRR, 14, struct hvm_hw_mtrr); +struct hvm_ns_veridian_dom { +uint64_t guestid_msr; +uint64_t hypercall_msr; +uint32_t long_mode; +uint32_t pad0; +}; +DECLARE_HVM_SAVE_TYPE(NS_VERIDIAN_DOM, 15, struct hvm_ns_veridian_dom); + +struct hvm_ns_veridian_cpu { +uint64_t control_msr; +uint64_t version_msr; +uint64_t sief_msr; +uint64_t simp_msr; +uint64_t eom_msr; +uint64_t int_msr[16 ]; +struct { +uint64_t config; +uint64_t count; + } timers[4 ]; +}; +DECLARE_HVM_SAVE_TYPE(NS_VERIDIAN_CPU, 16, struct hvm_ns_veridian_cpu);/* * Largest type-code in use */ -#define HVM_SAVE_CODE_MAX 14 +#define HVM_SAVE_CODE_MAX 16#endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */
%patch
xen/arch/x86/hvm/hvm_ext/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +subdir-y += novell + +obj-y += hvm_ext.o
xen/include/asm-x86/hvm/hvm_extensions.h new file +252 -0
252 lines not on this page · raw message
xen/arch/x86/hvm/hvm_ext/hvm_ext.c new file +350 -0
350 lines not on this page · raw message
xen/arch/x86/hvm/hvm_ext/novell/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-y += nsintercept.o +obj-y += nshypercall.o
xen/arch/x86/hvm/hvm_ext/novell/ns_errno.h new file +62 -0
62 lines not on this page · raw message
xen/arch/x86/hvm/hvm_ext/novell/ns_shim.h new file +480 -0
480 lines not on this page · raw message
xen/arch/x86/hvm/hvm_ext/novell/nshypercall.c new file +1229 -0
1,229 lines not on this page · raw message
xen/arch/x86/hvm/hvm_ext/novell/nshypercall.h new file +125 -0
125 lines not on this page · raw message
xen/arch/x86/hvm/hvm_ext/novell/nsintercept.c new file +2094 -0
100 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Part of the diff is not shown here. View the raw message.
Quoted 5 lines · Ky Srinivasan
I am attaching updated versions of the patches that I posted a couple of weeks ago. These have been merged up to the current unstable tip:
changeset 17186:854b0704962bThese patches have been tested on the unstable tip.
I'm not expert enough to comment on the HV extension implementation itself, but in terms of the userspace side, the user visible configuration file option 'extid=1' is pretty unpleasant. It is akin to a 'magic constant' in C code - no understandable meaning at all.
I'd like to see it accept a named extension type - if its possible to have multiple extensions per guest, then using a list instead of a scalar would be better. So how about something closer to
extensions = [ "win2k8" ]
tools/python/xen/xm/create.py gopts.var('timer_mode', val='TIMER_MODE' · line 213
Quoted 4 lines
tools/python/xen/xm/create.py +4
-0+gopts.var('extid', val='EXTID', + fn=set_int, default=0, + use="Specify extention ID for a HVM domain.") +
And this help message could list the valid extension names
Regards,
Dan.
Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
Quoted 12 lines · Daniel P. Berrange
Quoted 5 lines · Ky Srinivasan
I am attaching updated versions of the patches that I posted a couple of weeks ago. These have been merged up to the current unstable tip:
changeset 17186:854b0704962bThese patches have been tested on the unstable tip.
I'm not expert enough to comment on the HV extension implementation itself, but in terms of the userspace side, the user visible configuration file option 'extid=1' is pretty unpleasant. It is akin to a 'magic constant' in C code - no understandable meaning at all.
Quoted 5 lines
I'd like to see it accept a named extension type - if its possible to have multiple extensions per guest, then using a list instead of a scalar would be better. So how about something closer to
extensions = [ "win2k8" ]
Or is there some way you can have some super light weight trap / hook always loaded, so when Win2k8 makes it first paravirt call, you can then automatically enable the full extension ? That could let Xen just 'do the right thing' without needing a config param, and without having to fully enable the full extension for non-Win2k8 guests.
Quoted 1 line
Dan.
Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On Wed, Mar 5, 2008 at 5:38 PM, in message
<[email protected]>, "Daniel P. Berrange" <[email protected]>
Quoted 17 lines · wrote:
Quoted 16 lines · Daniel P. Berrange
Quoted 5 lines · Ky Srinivasan
I am attaching updated versions of the patches that I posted a couple of weeks ago. These have been merged up to the current unstable tip:
changeset 17186:854b0704962bThese patches have been tested on the unstable tip.
I'm not expert enough to comment on the HV extension implementation itself, but in terms of the userspace side, the user visible configuration file option 'extid=1' is pretty unpleasant. It is akin to a 'magic constant' in C code - no understandable meaning at all.
I'd like to see it accept a named extension type - if its possible to have multiple extensions per guest, then using a list instead of a scalar would be better. So how about something closer to
Quoted 7 lines
Quoted 1 line
extensions = [ "win2k8" ]
Or is there some way you can have some super light weight trap / hook always loaded, so when Win2k8 makes it first paravirt call, you can then automatically enable the full extension ? That could let Xen just 'do the right thing' without needing a config param, and without having to fully enable the full extension for non-Win2k8 guests.
I considered this. Unfortunately, we have no control on the mechanisms used by windows to discover the hypervisor. Furthermore, CPUID leaves used by longhorn collide with CPUID leaves used by Xen for supporting hypervisor discovery for PV drivers. Since we have no control on what Microsoft may do here, I felt the best way might be to tag the guest so that we can interpret the hypercalls, CPUID calls and MSR (read/write) calls within the guest namespace.
Regards,
K. Y
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On Wed, Mar 5, 2008 at 5:28 PM, in message
<[email protected]>, "Daniel P. Berrange" <[email protected]>
Quoted 11 lines · wrote:
Quoted 5 lines · Ky Srinivasan
I am attaching updated versions of the patches that I posted a couple of weeks ago. These have been merged up to the current unstable tip:
changeset 17186:854b0704962bThese patches have been tested on the unstable tip.
I'm not expert enough to comment on the HV extension implementation itself, but in terms of the userspace side, the user visible configuration file option 'extid=1' is pretty unpleasant. It is akin to a 'magic constant' in C code - no understandable meaning at all.
Agreed; I could make the extension tag more descriptive.
Regards,
K. Y
Quoted 17 lines
I'd like to see it accept a named extension type - if its possible to have multiple extensions per guest, then using a list instead of a scalar would be better. So how about something closer to
extensions = [ "win2k8" ]
tools/python/xen/xm/create.py gopts.var('timer_mode', val='TIMER_MODE' · line 213
Quoted 4 lines
tools/python/xen/xm/create.py +4
-0+gopts.var('extid', val='EXTID', + fn=set_int, default=0, + use="Specify extention ID for a HVM domain.") +And this help message could list the valid extension names
Regards,
Dan.
Personally I think the approach is ugly, and also you have not yet presented evidence that supporting the Viridian paravirtualisations improves performance. If it doesn't then it's a waste of time; if it does then it raises the question of which hypercalls provide the benefit, and do we get a smaller neater patch by supporting just those? One final comment is that the TLB management code that this slaps on top of the core hypervisor looks a bit scary to me. Tim Deegan may care to comment more on that.
-- Keir
Quoted 24 lines · Ky Srinivasan
I am attaching updated versions of the patches that I posted a couple of weeks ago. These have been merged up to the current unstable tip: changeset 17186:854b0704962b
These patches have been tested on the unstable tip.
Kier, what are your thoughts on accepting these patches.
Signed-off by K. Y. Srinivasan ([email protected])
Regards,
K. Y
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 7 lines · Keir Fraser
Personally I think the approach is ugly, and also you have not yet presented evidence that supporting the Viridian paravirtualisations improves performance. If it doesn't then it's a waste of time; if it does then it raises the question of which hypercalls provide the benefit, and do we get a smaller neater patch by supporting just those? One final comment is that the TLB management code that this slaps on top of the core hypervisor looks a bit scary to me. Tim Deegan may care to comment more on that.
Some blame lies with the mismatch between the Viridian interface and Xen's; there needs to be a way for the TLB flush hypercall to block indefinitely. But I can't see how that turns into more than an atomic_t for TlbFlushInhibit and a block-and-schedule operation. In the current patches, there's quite a lot of locking and ownership going on as well. I'm confused by the use of wait_on_xen_event_channel(0, xyz); event channels don't seem to come into it.
I'll mention now, since I have the patch in front of me, that I dislike the addition of an "ext_id" field to the HVM save format header and associated special treatment in the save/restore code; you should be able to figure out that this is a w2k8 domain from the presence of your other records in the save file.
More generally, I agree that the approach is very heavyweight. I don't see the need for a framework here, since there's no other proposed user of it that would want the same interface. It seems to duplicate a lot of things (does it really need its own spinlock implementation?)
It's certainly not in Xen coding style, even in the framework implementation. (The MS habit of encoding scope and type information in variable names annoys the heck out of me. Why does a lock field in an nsPartition_t need to be called "nsLock"?)
The naming in general could do with a kicking -- calling everything "Novell Shim" is understandable for historical reasons but not really
descriptive of its function. But maybe that can wait.
Tim
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
Re: [PATCH][RFC] Supporting Enlightened Windows 2008Server
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On Thu, Mar 6, 2008 at 5:15 AM, in message
<[email protected]>, Tim Deegan
Quoted 9 lines · <[email protected]> wrote:
Quoted 7 lines · Keir Fraser
Personally I think the approach is ugly, and also you have not yet presented evidence that supporting the Viridian paravirtualisations improves performance. If it doesn't then it's a waste of time; if it does then it raises the question of which hypercalls provide the benefit, and do we get a smaller neater patch by supporting just those? One final comment is that the TLB management code that this slaps on top of the core hypervisor looks a bit scary to me. Tim Deegan may care to comment more on that.
Quoted 7 lines
Some blame lies with the mismatch between the Viridian interface and Xen's; there needs to be a way for the TLB flush hypercall to block indefinitely. But I can't see how that turns into more than an
atomic_tfor TlbFlushInhibit and a block-and-schedule operation. In the current patches, there's quite a lot of locking and ownership going on as well. I'm confused by the use ofwait_on_xen_event_channel(0, xyz); event channels don't seem to come into it.
The Veridian API allows the guest to pass in a variable list of arguments to the TLB flush call ( HvFlushVirtualAddressList). Furthermore, both forms of the flush APIs (HvFlushVirtualAddressSpace and HvFlushVirtualAdressList) can specify a list of vcpus that should be involved in the flush process. So, as you have noted we will need a mechanism to co-ordinate the flush operation amongst the set of vcpus involved which means we need to be able give up the physical CPU in the hypervisor waiting for the flush to complete. I have used wait_on_xen_event_channel() to implement this synchronization. Since we don't preserve the stack state when we block in the hypervisor, I have used a seperate per-vcpu page for dealing with hypercall input parameters for calls that can potentially block in the hypervisor. From what I have seen, win2k8 server mostly specifies all the processors in ProcessorMask. So, I chose to implement TLB flush operations using a single serialization object that keeps track of both the set of vcpus involved in the flush operation as well as the list of pages to be flushed.
Quoted 6 lines
I'll mention now, since I have the patch in front of me, that I dislike the addition of an "
ext_id" field to the HVM save format header and associated special treatment in the save/restore code; you should be able to figure out that this is a w2k8 domain from the presence of your other records in the save file.
I can fix this.
Quoted 6 lines
More generally, I agree that the approach is very heavyweight. I don't see the need for a framework here, since there's no other proposed user of it that would want the same interface.
I agree that there is no need to isolate the shim's dependence on the base Xen code (xen_call_vector_t). I implemented this shim a year ago and at that point it was not clear what Microsoft might do with the Veridian specification. So, clearly some of the design choices that I made a year ago may not be the right choice today. However, I still think that having an intercept framework where one can implement Veridian specific functionality without cluttering up the base Xen code is still the right approach.
Quoted 2 lines
It seems to duplicate a lot
of things (does it really need its own spinlock implementation?)
Clearly not! As I noted in an earlier email to Kier, I will be the first to admit that these patches require significant cleanup and I am willing to clean them up. A lot of what you see has historical baggage and I wanted to get some feedback before I invested the time to clean things up.
Quoted 5 lines
It's certainly not in Xen coding style, even in the framework implementation. (The MS habit of encoding scope and type information in variable names annoys the heck out of me. Why does a lock field in an
nsPartition_tneed to be called "nsLock"?)
Agreed.
Quoted 4 lines
The naming in general could do with a kicking -- calling everything "Novell Shim" is understandable for historical reasons but not really
descriptive of its function. But maybe that can wait.
Agreed.
Regards,
K. Y
Quoted 2 lines
Tim
Re: [PATCH][RFC] Supporting Enlightened Windows 2008Server
Quoted 5 lines · Ky Srinivasan
The Veridian API allows the guest to pass in a variable list of arguments to the TLB flush call (HvFlushVirtualAddressList). Furthermore, both forms of the flush APIs (HvFlushVirtualAddressSpace and HvFlushVirtualAdressList) can specify a list of vcpus that should be involved in the flush process.
I expect that the best way to implement the list-of-addresses feature on Xen is to do a full TLB flush if there's more than one entry in the list (that's different from the Hyper-V shadow pagetable design, where explicit lists of addresses to flush make much more sense).
Then all you need are the existing Xen TLB flush operations, and some means of gating them. If you use a generation counter with each vcpu's inhibit bit, you can probably do that without the need for any locks.
Quoted 6 lines
So, as
you have noted we will need a mechanism to co-ordinate the flush operation amongst the set of vcpus involved which means we need to be able give up the physical CPU in the hypervisor waiting for the flush to complete. I have usedwait_on_xen_event_channel()to implement this synchronization.
wait_on_xen_event_channel is more than you need, since you're not going to wake on events.
Quoted 4 lines
Since we don't preserve the stack state when we block
in the hypervisor, I have used a seperate per-vcpu page for dealing with hypercall input parameters for calls that can potentially block in the hypervisor.
Xen already has a system of hypercall continuations that might help here.
Cheers,
Tim
Signature · 3 lines
Tim Deegan <[email protected]> Principal Software Engineer, Citrix Systems (R&D) Ltd. [Company #02300071, SL9 0DZ, UK.]
Re: [PATCH][RFC] Supporting Enlightened Windows 2008Server
In reply to Ky SrinivasanQuoted 7 lines · Ky Srinivasan
The Veridian API allows the guest to pass in a variable list of arguments to the TLB flush call ( HvFlushVirtualAddressList). Furthermore, both forms of the flush APIs (HvFlushVirtualAddressSpace and HvFlushVirtualAdressList) can specify a list of vcpus that should be involved in the flush process. So, as you have noted we will need a mechanism to co-ordinate the flush operation amongst the set of vcpus involved which means we need to be able give up the physical CPU in the hypervisor waiting for the flush to complete. I have used
Quoted 8 lines
wait_on_xen_event_channel()to implement this synchronization. Since we don't preserve the stack state when we block in the hypervisor, I have used a seperate per-vcpu page for dealing with hypercall input parameters for calls that can potentially block in the hypervisor. From what I have seen, win2k8 server mostly specifies all the processors in ProcessorMask. So, I chose to implement TLB flush operations using a single serialization object that keeps track of both the set of vcpus involved in the flush operation as well as the list of pages to be flushed.
Clearly avoiding emulating IPI-to-all-CPUs is rather likely to be a win. But is the very selective subset-of-CPUs and subset-of-addresses really that useful? Do you get any significant win over just calling hvmop_flush_tlb_all()?
Also we need to weigh up the likely penetration of NPT and EPT capable processors by the time w2k8 is shipping in any volume. But even ignoring that, I bet 95% of the benefit of this patch can be got with a much smaller patch.
-- Keir
Re: [PATCH][RFC] Supporting Enlightened Windows 2008Server
In reply to Ky SrinivasanQuoted 7 lines · Ky Srinivasan
I agree that there is no need to isolate the shim's dependence on the base Xen code (
xen_call_vector_t). I implemented this shim a year ago and at that point it was not clear what Microsoft might do with the Veridian specification. So, clearly some of the design choices that I made a year ago may not be the right choice today. However, I still think that having an intercept framework where one can implement Veridian specific functionality without cluttering up the base Xen code is still the right approach.
Clearly putting the Viridian hypercall shims in a different file/directory makes sense. But I think the shims would need to go on a diet. The TLB flushing implementation is a good example -- the useful extra features of the Viridian flush hypercall (if there are any, when partnered with Xen's shadow code) should be pushed into core Xen HVM TLB-flush handling code. Otherwise it sits out on the periphery with a correspndingly greater tendency to rot, and for no benefit (certainly I would strongly argue it is not cleaner!).
-- Keir
Re: [PATCH][RFC] Supporting Enlightened Windows 2008Server
In reply to Keir FraserQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
On Thu, Mar 6, 2008 at 2:28 AM, in message
<C3F54D9B.14C64%[email protected]>, Keir Fraser
Quoted 3 lines · <[email protected]> wrote:
Personally I think the approach is ugly, and also you have not yet presented evidence that supporting the Viridian paravirtualisations improves performance.
When I first implemented this (about a year ago), it was not clear if Microsoft would be open sourcing the Veridian specification. Given that, I wanted to have a narrow set of interfaces both to the adapter as well as from the adapter. I take it that you don't care much for this exercise in attempting to isolate the adapter. Now that Veridian specification has been open sourced, I agree there is no need to isolate the adapter from the base hypervisor the way it is currently done. However, given that:
(a) Veridian specification is evolving and Microsoft may define additional functionality to improve guest performance
(b) CPUID namespace, MSR namespace and hypercall namespace collisions between Xen and Veridian. This is the case today and it can only get worse over time.
I feel having a framework that allows you to implement these kinds of mapping layers in complete isolation from the base hypervisor may in fact be cleaner than trying to implement the mapping code inline in the base Xen code.
With regards to performance, we have only run NetBench and on NetBench we have seen a 10% improvement (on a uniprocessor system). We have had some issues with SMP PV drivers and that is the reason I don't have SMP numbers (the adapter has been tested on SMP machines though). We are currently in the process of running a range of benchmarks and I will keep you posted on what we see. Our goal here is clearly to be competitive (as far as performance goes) with Veridian hosting an enlightened windows guest.
Quoted 3 lines
If it doesn't then it's a waste of time; if it does then it raises the question of which hypercalls provide the benefit, and do we get a smaller neater patch by supporting just those?
I think the only assumption we can make here is that the enlightenments will improve the guest performance. This has been confirmed with the minimal performance testing we have already done. I am also going to assume that Microsoft will continue to evolve Veridian and the set of enlightenments visible to their guests to improve performance. The question that we need to answer, I think is how are we going to support these enlightenments and not if we are going to support Microsoft specific enlightenments. I will be the first one to admit the patches I submitted need to be cleaned up:
1) Fix coding style
2) Get rid of code that is not being exercised. Based on the Veridian specification I identified a set of functionality that I thought an enlightened guest may depend on. It looks like the current shipping windows server 2008 does not use all the functionality that is currently supported. I am somewhat hesitant to get rid of unused functionality since I don't know what the next release of windows will use. In fact, the current shipping windows server 2008 (32 bit version) is already using an undocumented hypercall!
I do think however that having an environment in which we can implement and evolve the support for windows enlightenments without constantly churning the base Xen code is the right approach.
Regards,
K. Y