* [PATCH] KVM: SVM: Cleanup NMI singlestep
@ 2009-10-18 11:24 Jan Kiszka
2009-10-18 11:52 ` Gleb Natapov
2009-10-19 18:52 ` Marcelo Tosatti
0 siblings, 2 replies; 3+ messages in thread
From: Jan Kiszka @ 2009-10-18 11:24 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm-devel
[-- Attachment #1: Type: text/plain, Size: 2346 bytes --]
Push the NMI-related singlestep variable into vcpu_svm. It's dealing
with an AMD-specific deficit, nothing generic for x86.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/include/asm/kvm_host.h | 1 -
arch/x86/kvm/svm.c | 12 +++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index c6094f1..097a492 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -354,7 +354,6 @@ struct kvm_vcpu_arch {
unsigned int time_offset;
struct page *time_page;
- bool singlestep; /* guest is single stepped by KVM */
bool nmi_pending;
bool nmi_injected;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 170b2d9..ffa6ad2 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -107,6 +107,8 @@ struct vcpu_svm {
u32 *msrpm;
struct nested_state nested;
+
+ bool nmi_singlestep;
};
/* enable NPT for AMD64 and X86 with PAE */
@@ -1050,7 +1052,7 @@ static void update_db_intercept(struct kvm_vcpu *vcpu)
svm->vmcb->control.intercept_exceptions &=
~((1 << DB_VECTOR) | (1 << BP_VECTOR));
- if (vcpu->arch.singlestep)
+ if (svm->nmi_singlestep)
svm->vmcb->control.intercept_exceptions |= (1 << DB_VECTOR);
if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) {
@@ -1195,13 +1197,13 @@ static int db_interception(struct vcpu_svm *svm)
if (!(svm->vcpu.guest_debug &
(KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) &&
- !svm->vcpu.arch.singlestep) {
+ !svm->nmi_singlestep) {
kvm_queue_exception(&svm->vcpu, DB_VECTOR);
return 1;
}
- if (svm->vcpu.arch.singlestep) {
- svm->vcpu.arch.singlestep = false;
+ if (svm->nmi_singlestep) {
+ svm->nmi_singlestep = false;
if (!(svm->vcpu.guest_debug & KVM_GUESTDBG_SINGLESTEP))
svm->vmcb->save.rflags &=
~(X86_EFLAGS_TF | X86_EFLAGS_RF);
@@ -2543,7 +2545,7 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu)
/* Something prevents NMI from been injected. Single step over
possible problem (IRET or exception injection or interrupt
shadow) */
- vcpu->arch.singlestep = true;
+ svm->nmi_singlestep = true;
svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF);
update_db_intercept(vcpu);
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: SVM: Cleanup NMI singlestep
2009-10-18 11:24 [PATCH] KVM: SVM: Cleanup NMI singlestep Jan Kiszka
@ 2009-10-18 11:52 ` Gleb Natapov
2009-10-19 18:52 ` Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Gleb Natapov @ 2009-10-18 11:52 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, Marcelo Tosatti, kvm-devel
On Sun, Oct 18, 2009 at 01:24:54PM +0200, Jan Kiszka wrote:
> Push the NMI-related singlestep variable into vcpu_svm. It's dealing
> with an AMD-specific deficit, nothing generic for x86.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
> ---
>
> arch/x86/include/asm/kvm_host.h | 1 -
> arch/x86/kvm/svm.c | 12 +++++++-----
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index c6094f1..097a492 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -354,7 +354,6 @@ struct kvm_vcpu_arch {
> unsigned int time_offset;
> struct page *time_page;
>
> - bool singlestep; /* guest is single stepped by KVM */
> bool nmi_pending;
> bool nmi_injected;
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 170b2d9..ffa6ad2 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -107,6 +107,8 @@ struct vcpu_svm {
> u32 *msrpm;
>
> struct nested_state nested;
> +
> + bool nmi_singlestep;
> };
>
> /* enable NPT for AMD64 and X86 with PAE */
> @@ -1050,7 +1052,7 @@ static void update_db_intercept(struct kvm_vcpu *vcpu)
> svm->vmcb->control.intercept_exceptions &=
> ~((1 << DB_VECTOR) | (1 << BP_VECTOR));
>
> - if (vcpu->arch.singlestep)
> + if (svm->nmi_singlestep)
> svm->vmcb->control.intercept_exceptions |= (1 << DB_VECTOR);
>
> if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) {
> @@ -1195,13 +1197,13 @@ static int db_interception(struct vcpu_svm *svm)
>
> if (!(svm->vcpu.guest_debug &
> (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) &&
> - !svm->vcpu.arch.singlestep) {
> + !svm->nmi_singlestep) {
> kvm_queue_exception(&svm->vcpu, DB_VECTOR);
> return 1;
> }
>
> - if (svm->vcpu.arch.singlestep) {
> - svm->vcpu.arch.singlestep = false;
> + if (svm->nmi_singlestep) {
> + svm->nmi_singlestep = false;
> if (!(svm->vcpu.guest_debug & KVM_GUESTDBG_SINGLESTEP))
> svm->vmcb->save.rflags &=
> ~(X86_EFLAGS_TF | X86_EFLAGS_RF);
> @@ -2543,7 +2545,7 @@ static void enable_nmi_window(struct kvm_vcpu *vcpu)
> /* Something prevents NMI from been injected. Single step over
> possible problem (IRET or exception injection or interrupt
> shadow) */
> - vcpu->arch.singlestep = true;
> + svm->nmi_singlestep = true;
> svm->vmcb->save.rflags |= (X86_EFLAGS_TF | X86_EFLAGS_RF);
> update_db_intercept(vcpu);
> }
>
--
Gleb.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: SVM: Cleanup NMI singlestep
2009-10-18 11:24 [PATCH] KVM: SVM: Cleanup NMI singlestep Jan Kiszka
2009-10-18 11:52 ` Gleb Natapov
@ 2009-10-19 18:52 ` Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2009-10-19 18:52 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, kvm-devel
On Sun, Oct 18, 2009 at 01:24:54PM +0200, Jan Kiszka wrote:
> Push the NMI-related singlestep variable into vcpu_svm. It's dealing
> with an AMD-specific deficit, nothing generic for x86.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-19 18:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-18 11:24 [PATCH] KVM: SVM: Cleanup NMI singlestep Jan Kiszka
2009-10-18 11:52 ` Gleb Natapov
2009-10-19 18:52 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).