kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm-devel <kvm@vger.kernel.org>
Subject: Re: [PATCH 2/2] KVM: x86: Preserve guest single-stepping on register
Date: Mon, 05 Oct 2009 12:44:10 +0200	[thread overview]
Message-ID: <4AC9CDFA.1000501@redhat.com> (raw)
In-Reply-To: <4AC8F145.4000204@web.de>

On 10/04/2009 09:02 PM, Jan Kiszka wrote:
>
> Hmmmm, good point. Mind reverting 2/2 and applying this one instead?
>
> Jan
>
> --------->
>
> KVM: x86: Rework guest single-step flag injection and filtering
>
> Push TF and RF injection and filtering on guest single-stepping into the
> vender get/set_rflags callbacks. This makes the whole mechanism more
> robust /wrt user space IOTCTL order and instruction emulations.
>
> Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com>
> ---
>
>   arch/x86/kvm/svm.c |    8 +++++++-
>   arch/x86/kvm/vmx.c |    4 ++++
>   arch/x86/kvm/x86.c |   24 +++++++++---------------
>   3 files changed, 20 insertions(+), 16 deletions(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 279a2ae..407e1a7 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -797,11 +797,17 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu)
>
>   static unsigned long svm_get_rflags(struct kvm_vcpu *vcpu)
>   {
> -	return to_svm(vcpu)->vmcb->save.rflags;
> +	unsigned long rflags = to_svm(vcpu)->vmcb->save.rflags;
> +
> +	if (vcpu->guest_debug&  KVM_GUESTDBG_SINGLESTEP)
> +		rflags&= ~(unsigned long)(X86_EFLAGS_TF | X86_EFLAGS_RF);
> +	return rflags;
>   }
>
>   static void svm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
>   {
> +	if (vcpu->guest_debug&  KVM_GUESTDBG_SINGLESTEP)
> +		rflags |= X86_EFLAGS_TF | X86_EFLAGS_RF;
>   	to_svm(vcpu)->vmcb->save.rflags = rflags;
>   }
>    

This code is duplicated in vmx.  How about kvm_[gs]et_rflags to contain it?

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


  reply	other threads:[~2009-10-05 10:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4AC67D94.6090406@web.de>
2009-10-02 22:31 ` [PATCH 2/2] KVM: x86: Preserve guest single-stepping on register Jan Kiszka
     [not found]   ` <4AC8B63B.8060602@redhat.com>
2009-10-04 19:02     ` Jan Kiszka
2009-10-05 10:44       ` Avi Kivity [this message]
2009-10-05 11:07         ` [PATCH v2 2/2] KVM: x86: Rework guest single-step flag injection and filtering Jan Kiszka
2009-10-05 12:49           ` Avi Kivity

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=4AC9CDFA.1000501@redhat.com \
    --to=avi@redhat.com \
    --cc=jan.kiszka@web.de \
    --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;
as well as URLs for NNTP newsgroup(s).