mbox series

[v2,0/2] KVM: arm64: Fixup PC updates on exit to userspace

Message ID 20210514104042.1929168-1-maz@kernel.org (mailing list archive)
Headers show
Series KVM: arm64: Fixup PC updates on exit to userspace | expand

Message

Marc Zyngier May 14, 2021, 10:40 a.m. UTC
We recently moved anything related to PC updates into the guest entry
code to help with the protected KVM effort. However, I missed a
critical point: userspace needs to be able to observe state changes
when the vcpu exits. Otherwise, live migration is a bit broken and
vcpu reset can fail (as reported by Zenghui). Not good.

These two patches aim at fixing the above, and carry a Cc stable.

* From v1:
  - Sanitized flag checking
  - Added comment about relying on __kvm_adjust_pc() being preempt-safe
  - Dropped superfluous includes

Marc Zyngier (2):
  KVM: arm64: Move __adjust_pc out of line
  KVM: arm64: Commit pending PC adjustemnts before returning to
    userspace

 arch/arm64/include/asm/kvm_asm.h           |  3 +++
 arch/arm64/kvm/arm.c                       | 10 ++++++++++
 arch/arm64/kvm/hyp/exception.c             | 18 +++++++++++++++++-
 arch/arm64/kvm/hyp/include/hyp/adjust_pc.h | 18 ------------------
 arch/arm64/kvm/hyp/nvhe/hyp-main.c         |  8 ++++++++
 arch/arm64/kvm/hyp/nvhe/switch.c           |  3 +--
 arch/arm64/kvm/hyp/vhe/switch.c            |  3 +--
 7 files changed, 40 insertions(+), 23 deletions(-)

Comments

Zenghui Yu May 14, 2021, 12:32 p.m. UTC | #1
Hi Marc,

On 2021/5/14 18:40, Marc Zyngier wrote:
> We recently moved anything related to PC updates into the guest entry
> code to help with the protected KVM effort. However, I missed a
> critical point: userspace needs to be able to observe state changes
> when the vcpu exits. Otherwise, live migration is a bit broken and
> vcpu reset can fail (as reported by Zenghui). Not good.
> 
> These two patches aim at fixing the above, and carry a Cc stable.
> 
> * From v1:
>   - Sanitized flag checking
>   - Added comment about relying on __kvm_adjust_pc() being preempt-safe

I had a try but failed to find the added comment ;-). Regardless,

Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
Tested-by: Zenghui Yu <yuzenghui@huawei.com>