lkml.org 
[lkml]   [2024]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KVM: arm64: Fix circular locking dependency
On Tue, Jan 23, 2024 at 05:35:26PM +0000, Oliver Upton wrote:
> On Tue, Jan 23, 2024 at 04:48:19PM +0000, Sebastian Ene wrote:
> > The rule inside kvm enforces that the vcpu->mutex is taken *inside*
> > kvm->lock. The rule is violated by the pkvm_create_hyp_vm which acquires

Hi Oliver,

> ^~~~~~~~~~~~~~~~~~
>
> nit: always suffix function names with '()'
>
> > the kvm->lock while already holding the vcpu->mutex lock from
> > kvm_vcpu_ioctl. Follow the rule by taking the config lock while getting the
> > VM handle and make sure that this is cleaned on VM destroy under the
> > same lock.
>
> It is always better to describe a lock in terms of what data it
> protects, the critical section(s) are rather obvious here.
>
> Avoid the circular locking dependency altogether by protecting the hyp
> vm handle with the config_lock, much like we already do for other
> forms of VM-scoped data.
>
> > Signed-off-by: Sebastian Ene <sebastianene@google.com>
> > Cc: stable@vger.kernel.org
>
> nitpicks aside, this looks fine.
>
> Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
>

Thanks for the suggestions, I updated the comit message and I will push
a V2 of the patch with the above and the Reviewed-by tag.

Thanks,
Seb

> --
> Thanks,
> Oliver

\
 
 \ /
  Last update: 2024-05-27 14:31    [W:0.157 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site