* [PATCH] KVM: SEV: Add lock subtyping in sev_lock_two_vms so lockdep doesn't report false dependencies
@ 2022-01-05 6:41 Wanpeng Li
2022-01-07 17:01 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Wanpeng Li @ 2022-01-05 6:41 UTC (permalink / raw)
To: linux-kernel, kvm
Cc: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
Jim Mattson, Joerg Roedel
From: Wanpeng Li <wanpengli@tencent.com>
Both source and dest vms' kvm->locks are held in sev_lock_two_vms,
we should mark one with different subtype to avoid false positives
from lockdep.
Fixes: c9d61dcb0bc26 (KVM: SEV: accept signals in sev_lock_two_vms)
Reported-by: Yiru Xu <xyru1999@gmail.com>
Tested-by: Jinrong Liang <cloudliang@tencent.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
---
arch/x86/kvm/svm/sev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 7656a2c..be28831 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -1565,7 +1565,7 @@ static int sev_lock_two_vms(struct kvm *dst_kvm, struct kvm *src_kvm)
r = -EINTR;
if (mutex_lock_killable(&dst_kvm->lock))
goto release_src;
- if (mutex_lock_killable(&src_kvm->lock))
+ if (mutex_lock_killable_nested(&src_kvm->lock, SINGLE_DEPTH_NESTING))
goto unlock_dst;
return 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: SEV: Add lock subtyping in sev_lock_two_vms so lockdep doesn't report false dependencies
2022-01-05 6:41 [PATCH] KVM: SEV: Add lock subtyping in sev_lock_two_vms so lockdep doesn't report false dependencies Wanpeng Li
@ 2022-01-07 17:01 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-01-07 17:01 UTC (permalink / raw)
To: Wanpeng Li, linux-kernel, kvm
Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
Joerg Roedel
On 1/5/22 07:41, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
>
> Both source and dest vms' kvm->locks are held in sev_lock_two_vms,
> we should mark one with different subtype to avoid false positives
> from lockdep.
>
> Fixes: c9d61dcb0bc26 (KVM: SEV: accept signals in sev_lock_two_vms)
> Reported-by: Yiru Xu <xyru1999@gmail.com>
> Tested-by: Jinrong Liang <cloudliang@tencent.com>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
> arch/x86/kvm/svm/sev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 7656a2c..be28831 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -1565,7 +1565,7 @@ static int sev_lock_two_vms(struct kvm *dst_kvm, struct kvm *src_kvm)
> r = -EINTR;
> if (mutex_lock_killable(&dst_kvm->lock))
> goto release_src;
> - if (mutex_lock_killable(&src_kvm->lock))
> + if (mutex_lock_killable_nested(&src_kvm->lock, SINGLE_DEPTH_NESTING))
> goto unlock_dst;
> return 0;
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-07 17:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 6:41 [PATCH] KVM: SEV: Add lock subtyping in sev_lock_two_vms so lockdep doesn't report false dependencies Wanpeng Li
2022-01-07 17:01 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).