Messages in this thread | | | Date | Fri, 22 Oct 2021 15:33:49 +0200 | Subject | Re: [PATCH 0/8] KVM: SEV-ES: fixes for string I/O emulation | From | Paolo Bonzini <> |
| |
On 22/10/21 01:49, Sean Christopherson wrote: > On Wed, Oct 13, 2021, Paolo Bonzini wrote: >> Patches 2 to 7 are a bunch of cleanups to emulator_pio_in and >> emulator_pio_in_out, so that the final SEV code is a little easier >> to reason on. Just a little, no big promises. > IMO, this series goes in the wrong direction and doesn't make the mess any better, > just different. > > The underlying issue is that kernel_pio() does the completely horrendous thing > of consuming vcpu->arch.pio. That leads to the juggling that this series tries > to clean up, but it's essentially an impossible problem to solve because the > approach itself is broken.
I agree on this, but I disagree that the series does not make the mess any better. At the very least, the new signatures for __emulator_pio_in, complete_emulator_pio_in and emulator_pio_in_out are improvements regarding the _role_ of vcpu->arch.pio*:
- complete_emulator_pio_in clearly takes the values from vcpu->arch.pio, which _is_ the right thing to do for a complete_userspace_io function. This is not clear of emulator_pio_in before the patch
- __emulator_pio_in and emulator_pio_in_out do not take anymore the buffer argument, making it clear that they operate on the internal pio_data buffer and only complete_emulator_pio_in copies out of it. Which yes is horrible, but at least it is clearly visible in the code now.
I managed to clean things up quite satisfactorily with just 6 patches on top of these eight, so I'll post the full series as soon as I finish testing them. 5.15 can then include these to fix the bug at hand.
Paolo
| |