Re: [PATCH v3 08/12] KVM: Propagate vcpu explicitly to mark_page_dirty_in_slot()

2021-11-19 Thread David Woodhouse
On Thu, 2021-11-18 at 19:46 +, Sean Christopherson wrote: > It is sufficient for the current physical CPU to have an active vCPU, which is > generally guaranteed in the MMU code because, with a few exceptions, > populating > SPTEs is done in vCPU context. > > mmap() will never directly trigge

Re: [PATCH v3 08/12] KVM: Propagate vcpu explicitly to mark_page_dirty_in_slot()

2021-11-18 Thread David Woodhouse
On 18 November 2021 18:50:55 GMT, Sean Christopherson wrote: >On Thu, Nov 18, 2021, Sean Christopherson wrote: >> On Thu, Nov 18, 2021, David Woodhouse wrote: >> > That leaves the one in TDP MMU handle_changed_spte_dirty_log() which >> > AFAICT can trigger the same crash seen by butt3rflyh4ck —

Re: [PATCH v3 08/12] KVM: Propagate vcpu explicitly to mark_page_dirty_in_slot()

2021-11-18 Thread David Woodhouse
On Thu, 2021-11-18 at 13:04 +0100, Paolo Bonzini wrote: > On 11/17/21 22:09, David Woodhouse wrote: > > > { > > > - struct kvm_vcpu *vcpu = kvm_get_running_vcpu(); > > > + struct kvm_vcpu *running_vcpu = kvm_get_running_vcpu(); > > > > > > + WARN_ON_ONCE(vcpu && vcpu != running_vcpu); > > >

Re: [PATCH v3 08/12] KVM: Propagate vcpu explicitly to mark_page_dirty_in_slot()

2021-11-18 Thread Paolo Bonzini
On 11/17/21 22:09, David Woodhouse wrote: { - struct kvm_vcpu *vcpu = kvm_get_running_vcpu(); + struct kvm_vcpu *running_vcpu = kvm_get_running_vcpu(); + WARN_ON_ONCE(vcpu && vcpu != running_vcpu); WARN_ON_ONCE(vcpu->kvm != kvm); Ah, that one needs to be changed to c

Re: [PATCH v3 08/12] KVM: Propagate vcpu explicitly to mark_page_dirty_in_slot()

2021-11-17 Thread David Woodhouse
> From: David Woodhouse > > The kvm_dirty_ring_get() function uses kvm_get_running_vcpu() to work out > which dirty ring to use, but there are some use cases where that doesn't > work. > > There's one in setting the Xen shared info page, introduced in commit > 629b5348841a ("KVM: x86/xen: updat

Re: [PATCH v3 08/12] KVM: Propagate vcpu explicitly to mark_page_dirty_in_slot()

2021-11-17 Thread David Woodhouse
On Wed, 2021-11-17 at 18:13 +, Marc Zyngier wrote: > What's the base for this series? This patch fails to compile for me > (at least on arm64), and the following patch doesn't apply on -rc1. It's on top of kvm/master, and it's also at https://git.infradead.org/users/dwmw2/linux.git/shortlog/re

Re: [PATCH v3 08/12] KVM: Propagate vcpu explicitly to mark_page_dirty_in_slot()

2021-11-17 Thread David Woodhouse
On 17 November 2021 18:13:37 GMT, Marc Zyngier wrote: >On Wed, 17 Nov 2021 17:39:59 +, >David Woodhouse wrote: >> >> From: David Woodhouse >> >> The kvm_dirty_ring_get() function uses kvm_get_running_vcpu() to work out >> which dirty ring to use, but there are some use cases where that

Re: [PATCH v3 08/12] KVM: Propagate vcpu explicitly to mark_page_dirty_in_slot()

2021-11-17 Thread Marc Zyngier
On Wed, 17 Nov 2021 17:39:59 +, David Woodhouse wrote: > > From: David Woodhouse > > The kvm_dirty_ring_get() function uses kvm_get_running_vcpu() to work out > which dirty ring to use, but there are some use cases where that doesn't > work. > > There's one in setting the Xen shared info p

[PATCH v3 08/12] KVM: Propagate vcpu explicitly to mark_page_dirty_in_slot()

2021-11-17 Thread David Woodhouse
From: David Woodhouse The kvm_dirty_ring_get() function uses kvm_get_running_vcpu() to work out which dirty ring to use, but there are some use cases where that doesn't work. There's one in setting the Xen shared info page, introduced in commit 629b5348841a ("KVM: x86/xen: update wallclock regio