[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240801105032.2533-1-hdanton@sina.com>
Date: Thu, 1 Aug 2024 18:50:32 +0800
From: Hillf Danton <hdanton@...a.com>
To: Liju-clr Chen <liju-clr.chen@...iatek.com>
Cc: Will Deacon <will@...nel.org>,
Yingshiuan Pan <Yingshiuan.Pan@...iatek.com>,
linux-kernel@...r.kernel.org,
Ze-yu Wang <Ze-yu.Wang@...iatek.com>
Subject: Re: [PATCH v12 05/24] virt: geniezone: Add vm support
On Tue, 30 Jul 2024 16:24:17 +0800 Liju-clr Chen <liju-clr.chen@...iatek.com>
> +
> +static void gzvm_destroy_vm(struct gzvm *gzvm)
> +{
> + pr_debug("VM-%u is going to be destroyed\n", gzvm->vm_id);
> +
> + mutex_lock(&gzvm->lock);
> +
> + gzvm_arch_destroy_vm(gzvm->vm_id);
> +
> + mutex_lock(&gzvm_list_lock);
> + list_del(&gzvm->vm_list);
> + mutex_unlock(&gzvm_list_lock);
> +
> + mutex_unlock(&gzvm->lock);
> +
> + kfree(gzvm);
> +}
...
> +
> +void gzvm_destroy_all_vms(void)
> +{
> + struct gzvm *gzvm, *tmp;
> +
> + mutex_lock(&gzvm_list_lock);
> + if (list_empty(&gzvm_list))
> + goto out;
> +
> + list_for_each_entry_safe(gzvm, tmp, &gzvm_list, vm_list)
> + gzvm_destroy_vm(gzvm);
> +
You add a fking deadlock by invoking gzvm_destroy_vm() with gzvm_list_lock held.
> +out:
> + mutex_unlock(&gzvm_list_lock);
> +}
Powered by blists - more mailing lists