public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] KVM: x86: rename EMULATE_DO_MMIO
Date: Wed, 31 Jul 2013 12:40:30 +0300	[thread overview]
Message-ID: <20130731094030.GD7484@redhat.com> (raw)
In-Reply-To: <1375197096-2454-2-git-send-email-pbonzini@redhat.com>

On Tue, Jul 30, 2013 at 05:11:34PM +0200, Paolo Bonzini wrote:
> The next patch will reuse it for other userspace exits than MMIO,
> namely debug events.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  arch/x86/include/asm/kvm_host.h | 4 ++--
>  arch/x86/kvm/mmu.c              | 2 +-
>  arch/x86/kvm/vmx.c              | 2 +-
>  arch/x86/kvm/x86.c              | 4 ++--
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 1f98c1b..b33e9dc 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -795,8 +795,8 @@ extern u32  kvm_min_guest_tsc_khz;
>  extern u32  kvm_max_guest_tsc_khz;
>  
>  enum emulation_result {
> -	EMULATE_DONE,       /* no further processing */
> -	EMULATE_DO_MMIO,      /* kvm_run filled with mmio request */
> +	EMULATE_DONE,         /* no further processing */
> +	EMULATE_USER_EXIT,    /* kvm_run ready for userspace exit */
>  	EMULATE_FAIL,         /* can't emulate this instruction */
>  };
>  
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 6941fa7..7ee30d4 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -4096,7 +4096,7 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u32 error_code,
>  	switch (er) {
>  	case EMULATE_DONE:
>  		return 1;
> -	case EMULATE_DO_MMIO:
> +	case EMULATE_USER_EXIT:
>  		++vcpu->stat.mmio_exits;
>  		/* fall through */
>  	case EMULATE_FAIL:
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 260a919..0c87015 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -5422,7 +5422,7 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
>  
>  		err = emulate_instruction(vcpu, EMULTYPE_NO_REEXECUTE);
>  
> -		if (err == EMULATE_DO_MMIO) {
> +		if (err == EMULATE_USER_EXIT) {
Not related to the patch, but here we need ++vcpu->stat.mmio_exits too.
And mmio_exits is not really about mmios any more, oh well.

The patch itself looks good.
>  			ret = 0;
>  			goto out;
>  		}
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 737c804..c2a0674 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -5038,11 +5038,11 @@ restart:
>  			writeback = false;
>  			vcpu->arch.complete_userspace_io = complete_emulated_pio;
>  		}
> -		r = EMULATE_DO_MMIO;
> +		r = EMULATE_USER_EXIT;
>  	} else if (vcpu->mmio_needed) {
>  		if (!vcpu->mmio_is_write)
>  			writeback = false;
> -		r = EMULATE_DO_MMIO;
> +		r = EMULATE_USER_EXIT;
>  		vcpu->arch.complete_userspace_io = complete_emulated_mmio;
>  	} else if (r == EMULATION_RESTART)
>  		goto restart;
> -- 
> 1.8.1.4
> 

--
			Gleb.

  reply	other threads:[~2013-07-31  9:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 15:11 [PATCH 0/2] KVM: x86: minimal debugging support during emulation Paolo Bonzini
2013-07-30 15:11 ` [PATCH 1/3] KVM: x86: rename EMULATE_DO_MMIO Paolo Bonzini
2013-07-31  9:40   ` Gleb Natapov [this message]
2013-07-30 15:11 ` [PATCH 2/3] KVM: x86: handle hardware breakpoints during emulation Paolo Bonzini
2013-07-31 10:00   ` Gleb Natapov
2013-07-30 15:11 ` [PATCH 3/3] KVM: x86: handle singlestep " Paolo Bonzini
2013-07-31  9:46   ` Gleb Natapov
2013-07-31 10:30     ` Paolo Bonzini
2013-07-31 10:40       ` 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=20130731094030.GD7484@redhat.com \
    --to=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@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