linux/Documentation/virt
David Woodhouse 310bc39546 KVM: x86/xen: Avoid deadlock by adding kvm->arch.xen.xen_lock leaf node lock
In commit 14243b3871 ("KVM: x86/xen: Add KVM_IRQ_ROUTING_XEN_EVTCHN
and event channel delivery") the clever version of me left some helpful
notes for those who would come after him:

       /*
        * For the irqfd workqueue, using the main kvm->lock mutex is
        * fine since this function is invoked from kvm_set_irq() with
        * no other lock held, no srcu. In future if it will be called
        * directly from a vCPU thread (e.g. on hypercall for an IPI)
        * then it may need to switch to using a leaf-node mutex for
        * serializing the shared_info mapping.
        */
       mutex_lock(&kvm->lock);

In commit 2fd6df2f2b ("KVM: x86/xen: intercept EVTCHNOP_send from guests")
the other version of me ran straight past that comment without reading it,
and introduced a potential deadlock by taking vcpu->mutex and kvm->lock
in the wrong order.

Solve this as originally suggested, by adding a leaf-node lock in the Xen
state rather than using kvm->lock for it.

Fixes: 2fd6df2f2b ("KVM: x86/xen: intercept EVTCHNOP_send from guests")
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Message-Id: <20230111180651.14394-4-dwmw2@infradead.org>
[Rebase, add docs. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-01-11 17:45:58 -05:00
..
acrn docs: acrn: Introduce ACRN 2021-02-09 10:58:18 +01:00
coco virt: Add TDX guest driver 2022-11-17 11:04:23 -08:00
hyperv Documentation: hyperv: Add overview of clocks and timers 2022-07-13 14:04:48 -06:00
kvm KVM: x86/xen: Avoid deadlock by adding kvm->arch.xen.xen_lock leaf node lock 2023-01-11 17:45:58 -05:00
uml docs: UML: fix typo 2022-06-24 13:18:21 -06:00
guest-halt-polling.rst docs: virt: guest-halt-polling.txt convert to ReST 2020-02-12 20:10:08 +01:00
index.rst virt: Add TDX guest driver 2022-11-17 11:04:23 -08:00
ne_overview.rst nitro_enclaves: Update documentation for Arm64 support 2021-09-14 11:11:20 +02:00
paravirt_ops.rst