public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH 5/6] KVM: x86: Preserve injected TF across emulation
Date: Tue, 23 Feb 2010 11:13:13 +0100	[thread overview]
Message-ID: <4B83AA39.30403@siemens.com> (raw)
In-Reply-To: <20100223100022.GD29041@redhat.com>

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 <jan.kiszka@siemens.com>
>> ---
>>  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

  reply	other threads:[~2010-02-23 10:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-22 17:51 [PATCH 0/6] KVM: Enhancements and fixes around guest debugging Jan Kiszka
2010-02-22 17:51 ` [PATCH 1/6] KVM: VMX: Update instruction length on intercepted BP Jan Kiszka
2010-02-22 17:51 ` [PATCH 2/6] KVM: SVM: Emulate nRIP feature when reinjecting INT3 Jan Kiszka
2010-02-23 10:13   ` Gleb Natapov
2010-02-23 10:17     ` Jan Kiszka
2010-02-23 10:23       ` Avi Kivity
2010-02-22 17:51 ` [PATCH 3/6] KVM: x86: Add KVM_CAP_X86_ROBUST_SINGLESTEP Jan Kiszka
2010-02-22 17:51 ` [PATCH 4/6] KVM: x86: Drop RF manipulation for guest single-stepping Jan Kiszka
2010-02-22 17:51 ` [PATCH 5/6] KVM: x86: Preserve injected TF across emulation Jan Kiszka
2010-02-23 10:00   ` Gleb Natapov
2010-02-23 10:13     ` Jan Kiszka [this message]
2010-02-23 10:31       ` Gleb Natapov
2010-02-23 10:40         ` Jan Kiszka
2010-02-23 11:03           ` Gleb Natapov
2010-02-22 17:51 ` [PATCH 6/6] KVM: x86: Emulator support for TF Jan Kiszka
2010-02-23  9:55   ` Gleb Natapov
2010-02-23 10:10     ` Jan Kiszka
2010-02-23 10:26       ` Gleb Natapov
2010-02-23 10:29         ` Avi Kivity
2010-02-23 10:32           ` Gleb Natapov
2010-02-23 10:34             ` Avi Kivity
2010-02-23 10:37         ` Jan Kiszka
2010-02-23 11:00           ` Gleb Natapov
2010-02-23 11:04             ` Avi Kivity
2010-02-23 11:30             ` Jan Kiszka
2010-02-23 11:41               ` Avi Kivity
2010-02-23 12:03                 ` Jan Kiszka
2010-02-23 12:05                 ` Gleb Natapov
2010-02-23 12:02               ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B83AA39.30403@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox