All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Perr Zhang <strongbox8@zoho.com>
Cc: pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de,
	stable@vger.kernel.org, mingo@redhat.com, x86@kernel.org,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: revert the order of calls in kvm_fast_pio()
Date: Tue, 30 Apr 2019 16:32:01 +0200	[thread overview]
Message-ID: <20190430143201.GH2589@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190430142423.3393-1-strongbox8@zoho.com>

On Tue, Apr 30, 2019 at 10:24:23PM +0800, Perr Zhang wrote:
> In commit 45def77ebf79, the order of function calls in kvm_fast_pio()
> was changed. This causes that the vm(XP,and also XP's iso img) failed
> to boot. This doesn't happen with win10 or ubuntu.
> 
> After revert the order, the vm(XP) succeedes to boot. In addition, the
> change of calls's order of kvm_fast_pio() in commit 45def77ebf79 has no
> obvious reason.

This Changelog fails to explain why the order is important and equally
fails to inform the future reader of that code. So this very same thing
will happen again in 6 months time or thereabout.

> Fixes: 45def77ebf79 ("KVM: x86: update %rip after emulating IO")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Perr Zhang <strongbox8@zoho.com>
> ---
>  arch/x86/kvm/x86.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index a0d1fc80ac5a..248753cb94a1 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -6610,13 +6610,12 @@ static int kvm_fast_pio_in(struct kvm_vcpu *vcpu, int size,
>  
>  int kvm_fast_pio(struct kvm_vcpu *vcpu, int size, unsigned short port, int in)
>  {
> -	int ret;
> +	int ret = kvm_skip_emulated_instruction(vcpu);
>  
>  	if (in)
> -		ret = kvm_fast_pio_in(vcpu, size, port);
> +		return kvm_fast_pio_in(vcpu, size, port) && ret;
>  	else
> -		ret = kvm_fast_pio_out(vcpu, size, port);
> -	return ret && kvm_skip_emulated_instruction(vcpu);
> +		return kvm_fast_pio_out(vcpu, size, port) && ret;
>  }
>  EXPORT_SYMBOL_GPL(kvm_fast_pio);
>  
> -- 
> 2.21.0
> 
> 
> 

  reply	other threads:[~2019-04-30 14:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30 14:24 [PATCH] KVM: x86: revert the order of calls in kvm_fast_pio() Perr Zhang
2019-04-30 14:32 ` Peter Zijlstra [this message]
2019-04-30 14:57   ` Sean Christopherson
2019-04-30 15:05     ` Peter Zijlstra
2019-04-30 14:58   ` Perr Zhang
  -- strict thread matches above, loose matches on Subject: below --
2019-04-30 14:24 Perr Zhang
2019-04-30 14:20 Perr Zhang

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=20190430143201.GH2589@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=strongbox8@zoho.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.