From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 4/6] KVM: x86: wean fast IN from emulator_pio_in
Date: Thu, 9 Jun 2022 22:37:26 +0000 [thread overview]
Message-ID: <YqJ2JgVxZ44VzRe1@google.com> (raw)
In-Reply-To: <20220608121253.867333-5-pbonzini@redhat.com>
On Wed, Jun 08, 2022, Paolo Bonzini wrote:
> Now that __emulator_pio_in already fills "val" for in-kernel PIO, it
For some reason the "already" confused the heck out of me. I thought it was
referring to a previous patch, which it kind of is, but then I couldn't figure
out the relevance to this patch.
Ah, I know why I got confused, the in-kernel PIO case has nothing to do with the
usage in complete_fast_pio_in(), e.g. complete_fast_pio_in() could be modified to
call complete_emulator_pio_in() directly even without the previous cleanup in
this series.
Can you split this patch in two? It's comically trivial, but it makes the
changelogs much easier to understand.
Use __emulator_pio_in() directly for fast PIO instead of bouncing through
emulator_pio_in() now that __emulator_pio_in() fills "val" when handling
in-kernel PIO. vcpu->arch.pio.count is guaranteed to be '0', so this a
pure nop.
No functional change intended.
and
Use complete_emulator_pio_in() directly when completing fast PIO, there's
no need to bounce through emulator_pio_in() as the comment about ECX
changing doesn't apply to fast PIO, which isn't used for string I/O.
No functional change intended.
> is both simpler and clearer not to use emulator_pio_in.
> Use the appropriate function in kvm_fast_pio_in and complete_fast_pio_in,
> respectively __emulator_pio_in and complete_emulator_pio_in.
>
> emulator_pio_in_emulated is now the last caller of emulator_pio_in.
>
> No functional change intended.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> arch/x86/kvm/x86.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 3b641cd2ff6f..aefcc71a7040 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -8692,11 +8692,7 @@ static int complete_fast_pio_in(struct kvm_vcpu *vcpu)
> /* For size less than 4 we merge, else we zero extend */
> val = (vcpu->arch.pio.size < 4) ? kvm_rax_read(vcpu) : 0;
>
> - /*
> - * Since vcpu->arch.pio.count == 1 let emulator_pio_in perform
> - * the copy and tracing
> - */
> - emulator_pio_in(vcpu, vcpu->arch.pio.size, vcpu->arch.pio.port, &val, 1);
> + complete_emulator_pio_in(vcpu, &val);
> kvm_rax_write(vcpu, val);
>
> return kvm_skip_emulated_instruction(vcpu);
> @@ -8711,7 +8707,7 @@ static int kvm_fast_pio_in(struct kvm_vcpu *vcpu, int size,
> /* For size less than 4 we merge, else we zero extend */
> val = (size < 4) ? kvm_rax_read(vcpu) : 0;
>
> - ret = emulator_pio_in(vcpu, size, port, &val, 1);
> + ret = __emulator_pio_in(vcpu, size, port, &val, 1);
> if (ret) {
> kvm_rax_write(vcpu, val);
> return ret;
> --
> 2.31.1
>
>
next prev parent reply other threads:[~2022-06-09 22:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 12:12 [PATCH 0/6] KVM: x86: vcpu->arch.pio* cleanups Paolo Bonzini
2022-06-08 12:12 ` [PATCH 1/6] KVM: x86: inline kernel_pio into its sole caller Paolo Bonzini
2022-06-09 21:33 ` Sean Christopherson
2022-06-08 12:12 ` [PATCH 2/6] KVM: x86: move all vcpu->arch.pio* setup in emulator_pio_in_out Paolo Bonzini
2022-06-09 22:03 ` Sean Christopherson
2022-06-08 12:12 ` [PATCH 3/6] KVM: x86: wean in-kernel PIO from vcpu->arch.pio* Paolo Bonzini
2022-06-09 22:19 ` Sean Christopherson
2022-06-08 12:12 ` [PATCH 4/6] KVM: x86: wean fast IN from emulator_pio_in Paolo Bonzini
2022-06-09 22:37 ` Sean Christopherson [this message]
2022-06-08 12:12 ` [PATCH 5/6] KVM: x86: de-underscorify __emulator_pio_in Paolo Bonzini
2022-06-09 22:42 ` Sean Christopherson
2022-06-08 12:12 ` [PATCH 6/6] KVM: SEV-ES: reuse advance_sev_es_emulated_ins for OUT too Paolo Bonzini
2022-06-09 22:50 ` Sean Christopherson
2022-06-15 14:41 ` Paolo Bonzini
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=YqJ2JgVxZ44VzRe1@google.com \
--to=seanjc@google.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 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.