From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27FA0C47258 for ; Tue, 23 Jan 2024 17:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lyMvtA3936dnLSCnKLHdiKZVtn43/dD2GgGZFRukQJY=; b=b06SDPoFssZH+X WQKga+MVbXu1YFV/+9O6QRkSNbZUMwp8n7SAZ8qfCXw3OPikbYnjdoNKb+25uieLjO4t7b0cTawzD BsKeN/117O6hUhQ8W5h+yH42oqgep0CaDhytn7uqu0mw6ds/h8YkXeqD0Kidl3b6gRtX9tJKUOo5R Uzoo3OgJC2yBvlUfsvDOjZ9qeY8YtF8dZuNiMUp3Ea4TaLz4oqDafdrWEBeq1l/dYB8HeBfGnFO3U IVKMfMqi9fA5OG7I1R8r9Ib2JXhd4T1XSef3vfT86SJG/ILzvLYN0lRM8ILu1IaNPkIaPTmmipd+J +8K7nkFevWZx+mLPbA6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSKgb-00HX0s-01; Tue, 23 Jan 2024 17:35:45 +0000 Received: from out-186.mta1.migadu.com ([2001:41d0:203:375::ba]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSKgW-00HWzS-2q for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 17:35:43 +0000 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240123164818.1306122-2-sebastianene@google.com> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240123_093542_194602_3F79377F X-CRM114-Status: UNSURE ( 9.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel