KVM: x86/xen: Fix lockdep warning on "recursive" gpc locking
authorDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 11 Jan 2023 18:06:48 +0000 (18:06 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 11 Jan 2023 18:32:21 +0000 (13:32 -0500)
commit23e60258aeafb04e5dd813f03cb0c8ab7b01462a
tree65a89b3df863d272ce0d6677862e6c558b6a5f0c
parent71d0393576e9e1ef536c3bc3cf11f661c58dded9
KVM: x86/xen: Fix lockdep warning on "recursive" gpc locking

In commit 5ec3289b31 ("KVM: x86/xen: Compatibility fixes for shared runstate
area") we declared it safe to obtain two gfn_to_pfn_cache locks at the same
time:
/*
 * The guest's runstate_info is split across two pages and we
 * need to hold and validate both GPCs simultaneously. We can
 * declare a lock ordering GPC1 > GPC2 because nothing else
 * takes them more than one at a time.
 */

However, we forgot to tell lockdep. Do so, by setting a subclass on the
first lock before taking the second.

Fixes: 5ec3289b31 ("KVM: x86/xen: Compatibility fixes for shared runstate area")
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Message-Id: <20230111180651.14394-1-dwmw2@infradead.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/xen.c