Keir Fraser writes:
> On 22/12/2008 02:34, "Kouya Shimura" <kouya@xxxxxxxxxxxxxx> wrote:
>
> > Indeed, this fix is hacky but it works well for me.
> >
> > At first, I tried setting GUEST_PENDING_DBG_EXCEPTIONS.BS
> > according to the SDM. As a result, the guest doesn't be killed
> > but never go progress after the STI instruction
> > (i.e. VM exit immediately after VM entry) as long as RFLAGS.TF=1.
> > That is inconvenient for debugging.
> >
> > Is there any other way?
>
> If you make it conditional on debugger_attached then I guess you can do what
> you like. I strongly dislike it though.
>
> -- Keir
>
I read the SDM carefully, however, I can't find any solution for this.
Although the monitor trap flag might help, my machine doesn't have such
a feature.
At least, crashing the guest should be avoided.
Attached is the updated patch. I think it might become a little better.
Thanks,
Kouya
Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
diff -r e2f36d066b7b xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Mon Dec 22 13:48:40 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c Thu Dec 25 11:50:56 2008 +0900
@@ -1314,8 +1314,29 @@
static void vmx_set_info_guest(struct vcpu *v)
{
+ unsigned long intr_shadow;
+
vmx_vmcs_enter(v);
+
__vmwrite(GUEST_DR7, v->arch.guest_context.debugreg[7]);
+
+ /*
+ * If the interruptibility-state field indicates blocking by STI,
+ * setting the TF flag in the EFLAGS may cause VM entry to fail
+ * and crash the guest. See SDM 3B 22.3.1.5.
+ * Resetting the VMX_INTR_SHADOW_STI flag looks hackish but
+ * to set the GUEST_PENDING_DBG_EXCEPTIONS.BS here incurs
+ * immediately vmexit and hence make no progress.
+ */
+ intr_shadow = __vmread(GUEST_INTERRUPTIBILITY_INFO);
+ if ( v->domain->debugger_attached &&
+ (v->arch.guest_context.user_regs.eflags & X86_EFLAGS_TF) &&
+ (intr_shadow & VMX_INTR_SHADOW_STI) )
+ {
+ intr_shadow &= ~VMX_INTR_SHADOW_STI;
+ __vmwrite(GUEST_INTERRUPTIBILITY_INFO, intr_shadow);
+ }
+
vmx_vmcs_exit(v);
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|