From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 5/6] KVM: x86: Preserve injected TF across emulation Date: Tue, 23 Feb 2010 11:13:13 +0100 Message-ID: <4B83AA39.30403@siemens.com> References: <20100223100022.GD29041@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , kvm To: Gleb Natapov Return-path: Received: from thoth.sbs.de ([192.35.17.2]:21921 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444Ab0BWKNc (ORCPT ); Tue, 23 Feb 2010 05:13:32 -0500 In-Reply-To: <20100223100022.GD29041@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Gleb Natapov wrote: > On Mon, Feb 22, 2010 at 06:51:22PM +0100, Jan Kiszka wrote: >> Call directly into the vendor services for getting/setting rflags in >> emulate_instruction to ensure injected TF survives the emulation. >> >> Signed-off-by: Jan Kiszka >> --- >> arch/x86/kvm/x86.c | 4 ++-- >> 1 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index e2e03a4..19e8b28 100644 >> --- a/arch/x86/kvm/x86.c >> +++ b/arch/x86/kvm/x86.c >> @@ -3468,7 +3468,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu, >> kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); >> >> vcpu->arch.emulate_ctxt.vcpu = vcpu; >> - vcpu->arch.emulate_ctxt.eflags = kvm_get_rflags(vcpu); >> + vcpu->arch.emulate_ctxt.eflags = kvm_x86_ops->get_rflags(vcpu); > So now emulator runs with injected TF? Hmm, then may be emulator should > inject DB when appropriate and caller of emulate_instruction() should > emulate DB intercept if external debugging is going on? That is what patch 6 aims at, both for external as well as guest-internal debugging. > >> vcpu->arch.emulate_ctxt.mode = >> (!is_protmode(vcpu)) ? X86EMUL_MODE_REAL : >> (vcpu->arch.emulate_ctxt.eflags & X86_EFLAGS_VM) >> @@ -3547,7 +3547,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu, >> return EMULATE_DO_MMIO; >> } >> >> - kvm_set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags); >> + kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags); >> >> if (vcpu->mmio_is_write) { >> vcpu->mmio_needed = 0; >> -- >> 1.6.0.2 Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux