public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] svm last branch recording MSR emulation
@ 2008-01-25 12:38 Markus Rechberger
       [not found] ` <4799D852.9080606-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Rechberger @ 2008-01-25 12:38 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	avi-atKUWr5tajBWk0Htik3J/w, muli-7z/5BgaJwgfQT0dZR+AlfA

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

Hi,

this patch adds support for the lbr MSR emulation, it also enables 
support for Windows XP 64bit guests.

Signed-off-by: Joerg Roedel <Joerg.Roedel-5C7GfCeVMHo@public.gmane.org>
Signed-off-by: Markus Rechberger <Markus.Rechberger-5C7GfCeVMHo@public.gmane.org>


[-- Attachment #2: svm.diff --]
[-- Type: text/plain, Size: 1393 bytes --]

--- svm.c.orig	2008-01-23 10:04:14.000000000 +0100
+++ svm.c	2008-01-25 12:52:11.000000000 +0100
@@ -1099,6 +1100,21 @@
 	case MSR_IA32_SYSENTER_ESP:
 		*data = svm->vmcb->save.sysenter_esp;
 		break;
+	case MSR_IA32_DEBUGCTLMSR:
+		*data = svm->vmcb->save.dbgctl;
+		break;
+	case MSR_IA32_LASTBRANCHFROMIP:
+		*data = svm->vmcb->save.br_from;
+		break;
+	case MSR_IA32_LASTBRANCHTOIP:
+		*data = svm->vmcb->save.br_to;
+		break;
+	case MSR_IA32_LASTINTFROMIP:
+		*data = svm->vmcb->save.last_excp_from;
+		break;
+	case MSR_IA32_LASTINTTOIP:
+		*data = svm->vmcb->save.last_excp_to;
+		break;
 	default:
 		return kvm_get_msr_common(vcpu, ecx, data);
 	}
@@ -1171,6 +1187,19 @@
 		if (data != 0)
 			goto unhandled;
 		break;
+	case MSR_IA32_DEBUGCTLMSR:
+		svm->vmcb->save.dbgctl = data;
+		if (svm->vmcb->save.dbgctl && svm_has(SVM_FEATURE_LBRV)) {
+			void *msrpm_va;
+			svm->vmcb->control.lbr_ctl = 1;
+			msrpm_va = page_address(pfn_to_page(msrpm_base >> PAGE_SHIFT));
+			set_msr_interception(msrpm_va, MSR_IA32_DEBUGCTLMSR, 0, 0);
+			set_msr_interception(msrpm_va, MSR_IA32_LASTBRANCHFROMIP, 0, 0);
+			set_msr_interception(msrpm_va, MSR_IA32_LASTBRANCHTOIP, 0, 0);
+			set_msr_interception(msrpm_va, MSR_IA32_LASTINTFROMIP, 0, 0);
+			set_msr_interception(msrpm_va, MSR_IA32_LASTINTTOIP, 0, 0);
+		}
+		break;
 	default:
 	unhandled:
 		return kvm_set_msr_common(vcpu, ecx, data);

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] svm last branch recording MSR emulation
       [not found] ` <4799D852.9080606-5C7GfCeVMHo@public.gmane.org>
@ 2008-01-27  7:29   ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-01-27  7:29 UTC (permalink / raw)
  To: Markus Rechberger; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Markus Rechberger wrote:
> this patch adds support for the lbr MSR emulation, it also enables 
> support for Windows XP 64bit guests.
>
> Signed-off-by: Joerg Roedel <Joerg.Roedel-5C7GfCeVMHo@public.gmane.org>
> Signed-off-by: Markus Rechberger <Markus.Rechberger-5C7GfCeVMHo@public.gmane.org>
> @@ -1171,6 +1187,19 @@
>  		if (data != 0)
>  			goto unhandled;
>  		break;
> +	case MSR_IA32_DEBUGCTLMSR:
> +		svm->vmcb->save.dbgctl = data;
> +		if (svm->vmcb->save.dbgctl && svm_has(SVM_FEATURE_LBRV)) {
> +			void *msrpm_va;
>   

blank line

> +			svm->vmcb->control.lbr_ctl = 1;
> +			msrpm_va = page_address(pfn_to_page(msrpm_base >> PAGE_SHIFT));
> +			set_msr_interception(msrpm_va, MSR_IA32_DEBUGCTLMSR, 0, 0);
> +			set_msr_interception(msrpm_va, MSR_IA32_LASTBRANCHFROMIP, 0, 0);
> +			set_msr_interception(msrpm_va, MSR_IA32_LASTBRANCHTOIP, 0, 0);
> +			set_msr_interception(msrpm_va, MSR_IA32_LASTINTFROMIP, 0, 0);
> +			set_msr_interception(msrpm_va, MSR_IA32_LASTINTTOIP, 0, 0);
> +		}
> +		break;
>  	default:
>  	unhandled:

What is the performance impact (for example, on 
user/test/x86/vmexit.flat when modified to set a bit in debugctl)?

Is it not better to enable LBR virtualization only when the guest 
enables LBR (but avoid it when other bits are enabled)?

Can we disable LBR virtualization when the guest disables LBR?

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-27  7:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-25 12:38 [PATCH] svm last branch recording MSR emulation Markus Rechberger
     [not found] ` <4799D852.9080606-5C7GfCeVMHo@public.gmane.org>
2008-01-27  7:29   ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox