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 149ECC46CD2 for ; Wed, 24 Jan 2024 09:08:18 +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=3JTOwABQiB4VhiItwN85VHoHY3Zbq+ki3vk7wI5utXY=; b=C1aBOsfmouufWr 14z4EDP0IXC2AB22J5Ol0H40qHO9QX3c/fqePtWLzc7KeDTaep7hk0DCzpkAZmmwtHmxasK3K6G1M GTK7URglKLOinv4T0w4qrs1yiJ3hPo7vc7UXBm9T96WidXlQ1/AXaa/9m8mEdOfQq4MGyHZCvovkT I/kp9609CKqIekIbXCJ+67AUR/8ikWHuGuG8djCFcSVtyuozf8F3hRFEZ02qIR7fmKToI9sYVXTDH ScOPIV9aD4/M59GBVR1bj1Q75Ol4FhUkD/F147PcTjYKZEzBGhki3QOiM53VTEeibAyg0uwBrtMPJ 9f29csALg9occr7yNNtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSZEX-0027Gr-0h; Wed, 24 Jan 2024 09:07:45 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSZEU-0027Eb-30 for linux-arm-kernel@lists.infradead.org; Wed, 24 Jan 2024 09:07:44 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40e4afe9ea7so24925e9.1 for ; Wed, 24 Jan 2024 01:07:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706087256; x=1706692056; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SI39RK/rWNckwv2r4B917cux2i/pKiQn7x4kFloCx1A=; b=jgySYaGi1B70YfRvhrKvfuOwSr8vPl3KTuyzFBX+xnn/or2LanBdWfDbWqNz5pTC8o VfKXIEVJfI+o+pgcfwfqEiabrFp3mrRd6AYtXVDubDfJxgQBB81admITjGiKcm+/I76X p3G+FmVj5sZeCajetvFIMNhJB5xgUndqWr8Fg90xSVVwOTMKiMM9mIaCVBap4EwXjrpL AnESsR652J6AwGex+awNd9Xyub5EF2EjeeeGqGm2uHL6rlzRGt8rwxI+WGI+bdHRbsAc oY366vmy6GSWvKnLWkJxsMBYJquu181li1ueMPLBte7yReUZs7IRF7ROmcfb8haSBy6m 2TAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706087256; x=1706692056; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SI39RK/rWNckwv2r4B917cux2i/pKiQn7x4kFloCx1A=; b=vGdGukugmakZLnqXIHdMAUkgOxhjnIxCLARkx0LqnLizMaWQRZOYCW4u7/66MBh8qO TbxmX8TYoHn5CrxgGUfR+AmKm3NS9T4TReLqRGb+mUIrPanvtFTPPp0GGBaIiICDsnwq hQtf1AGAmv0Q+nBjy0L9PQ2XSci0yVAvYwTA+uAfUWFNgo5O6vTIjfmDuvx67E0MoD/e o80stQ1OhHOBjBoNLUczAj1N53mLlKxSLLTCU6tjj1AnJ4tbw8zNitjQVVR8q57hRXvf Z8XqmxMyc3icFmxUb+knZZib0rL/z6oeMSUN4qKT5AFE0Kzz0T3SQQyIlG+9I3c6o3rQ 261A== X-Gm-Message-State: AOJu0Yyj7iPrbU0vGrQuTkocwS0C32FGnFhILpyVfChUD3EvavI5Ec8R +CjmvcjPNGED0bv2EnUSAoOC8YptfjeKZM0mtW/ZVilimoyWaTgGXSPUiGzAWg== X-Google-Smtp-Source: AGHT+IG0lrnvSdMVJPjDEKWKykbbZOKABVazci9lTsykpHwLQImNw7JnWtDPfFCpWv5+CfrTrixLkQ== X-Received: by 2002:a05:600c:5107:b0:40e:b963:6076 with SMTP id o7-20020a05600c510700b0040eb9636076mr41367wms.5.1706087255568; Wed, 24 Jan 2024 01:07:35 -0800 (PST) Received: from google.com (185.83.140.34.bc.googleusercontent.com. [34.140.83.185]) by smtp.gmail.com with ESMTPSA id s16-20020a5d5110000000b0033763a9ea2dsm9142555wrt.63.2024.01.24.01.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 01:07:35 -0800 (PST) Date: Wed, 24 Jan 2024 09:07:33 +0000 From: Sebastian Ene To: Oliver Upton 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240124_010742_966307_009DAEFE X-CRM114-Status: GOOD ( 17.93 ) 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 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 > > Cc: stable@vger.kernel.org > > nitpicks aside, this looks fine. > > Reviewed-by: Oliver Upton > 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel