Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp626641rdb; Tue, 23 Jan 2024 09:35:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHxPXacm/zHku5t+6pDlPNd4hymb+5FBJVSRkcTyFen88/UXUFy7g9JxfX7vOiZXydlW/d X-Received: by 2002:a05:6a00:894:b0:6db:624e:93cd with SMTP id q20-20020a056a00089400b006db624e93cdmr3797614pfj.23.1706031353846; Tue, 23 Jan 2024 09:35:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706031353; cv=pass; d=google.com; s=arc-20160816; b=MiE07ymgXE9h0a4L3FJTSIh5WZzacmIQWxmHvKPc6A1gQ6Jtp9tr+KL+VpncN1aJ3Z WguYg1Oc0qT9A+eQtiNpOMzWxkxpHiMO5HHHbJEPYP8m/d7rFVZzYzeKhBlOL3xwd+XV OY7Ef8RAKrkGsVmUA8Ed2kRbSTkOxhFzBKC6A/IZClf3GCrobcJ1ycKuJo/Xypc/wivJ TUFaqkaIgfTr+Vj2zAT7krTBPMZQZ1o6jEINRilV4EiaSjXugb+UJOIIVFM0MyYGlEkw twd7M+8O13Gh9QkEWUsRlhorjNpGzyo0QyAn9UtchobFTWlmr31ga6/gRq1G9UPSC4zE o+ZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=UwviwEcY1cghsMNJvI1Ple+2zXBuNHw/5USyAIIn4xk=; fh=rxWnga6iRccZwUHKFJ/sakfKpzbxdjkOsitofWfbm7E=; b=s+WGqpRNi06EKxYjaXaX6G7jhaszniPOV3KJVvXpjx4ThhZiTh0308+ZjtB3rcQJGX F+g4YSFqJfwdXMELpDHyfJqOUn8mbRW/XFUnkdq/yzz6a5XPATtXUZ98EhhQQQvbKRe+ rJyAaGVYNl2uNIHv2ec3pIUxQkV8lYJb80kPZ4mfda4c3gfCtAF+bDlLy3uGaXdEsN4Y 6uNBs6qECyDTmjyvi7mhO1vDBEKHLm4VLkNtIJXjPUof8Zz3tK3PxZe0ZzzTu0NQQk7w Tuxf8brX7V/g6hLdIk4BbZy2ZYhix88/5wYAzuzvEkHCxk4R7baUqbllAIrYTBEjMjXx R5Ww== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=i7TJuyqG; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-35788-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35788-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h14-20020a63120e000000b005cdba90861fsi10140879pgl.137.2024.01.23.09.35.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 09:35:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35788-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=i7TJuyqG; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-35788-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35788-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7C029291E3B for ; Tue, 23 Jan 2024 17:35:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EF0A811E5; Tue, 23 Jan 2024 17:35:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="i7TJuyqG" Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 745A47FBDC for ; Tue, 23 Jan 2024 17:35:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706031335; cv=none; b=mNt3WCcsr71F7PnTHEFy9DYxoCTJGnOq3Qzdw0zyZJTRbHUkLHRZ4VHttbwidPWL+JKJBApAged0vp2JQCWm1cdU50Yi4qBbC3AOcX3uII8AiXQhuaVagdP/HYP/OCXPzs2DAvHYuP1Fml9R7564JY7eBccfP101BsxTFYp8euc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706031335; c=relaxed/simple; bh=VQ9Gn56B0UNrOuJsLhXK6Sa7vlzzG5qg1k0KFEwnyoU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Q+LXXZ4A2m2E+BmyUMDRkz4WfYPbdYvrCD20sSLgREWp5Vwn8GrEnAz1vM5jAXI7ADZ/uMwh2PWZ03NvSzcFY8DD1Q+yn/QmPo7O3mfzDg8qRcrSK8FnCYLQphULFR1VJ+gPpD33rRcd9IWLu9twMyw50M0GbQrKhiKVtqAw1q8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=i7TJuyqG; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Tue, 23 Jan 2024 17:35:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1706031331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UwviwEcY1cghsMNJvI1Ple+2zXBuNHw/5USyAIIn4xk=; b=i7TJuyqGANrL1hkBQsvtx8m9oVlfgkFOaC8sBUxH59Fzw4I0A0HdausJEmDONdFGmQlTkA WzWVwKUwWBamk2r8MUlCfOMXRIeGbbd6PX0cQ6Y9bMZreJBOCWH8PiiowscZXIVCxE32Ep f66j0y5KfrkoWxyv8wPI9wrYQ1Co0PQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Sebastian Ene Cc: Marc Zyngier , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-team@android.com, stable@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: Fix circular locking dependency Message-ID: References: <20240123164818.1306122-2-sebastianene@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240123164818.1306122-2-sebastianene@google.com> X-Migadu-Flow: FLOW_OUT 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 ^~~~~~~~~~~~~~~~~~ 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 > Cc: stable@vger.kernel.org nitpicks aside, this looks fine. Reviewed-by: Oliver Upton -- Thanks, Oliver