From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21070208987 for ; Wed, 6 Nov 2024 18:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730919596; cv=none; b=OIGamSQuj5wK1Ad/9GKuotkldgm5Dv8HMK6ALirddy11V0FrLXC5TbdvakaRnw6Oq2fPtI8C4K0GW1cmcwYaY64XkbZwUZN8MViofFt5ekctfC2J2Qk7MwFdVvFXaNAj1dGTM6M3kzIisQjI5aQ/nZm/6I5LrJduzlAkoiGbSgI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730919596; c=relaxed/simple; bh=rx0kaDsVZKaL8YeXydHw3Eqose6ARo4UL0m49ysgz1s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LxRGoIn9Jzz5eyY5X+1a/UQd1YXJyRkWzR7vB2rCAej+PyLeYav50CnKmiobi1JBtxwNujMCc0x9+CgjhI8XWpS5WxMjEg76gNOtUHgFMjYapU3l4QtCoQg5eFc3iadBUG6uXfhhicWpwnxLbQ72JNexXZLTrCZQhL7Lv0t2IG8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 561F0497 for ; Wed, 6 Nov 2024 11:00:23 -0800 (PST) Received: from e110455-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4AF7E3F528 for ; Wed, 6 Nov 2024 10:59:53 -0800 (PST) Date: Wed, 6 Nov 2024 18:59:44 +0000 From: Liviu Dudau To: Boris Brezillon Cc: Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jann Horn Subject: Re: [PATCH] drm/panthor: Lock XArray when getting entries for heap and VM Message-ID: References: <20241106120748.290697-1-liviu.dudau@arm.com> <20241106131641.47487624@collabora.com> <20241106142133.09378b5a@collabora.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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20241106142133.09378b5a@collabora.com> On Wed, Nov 06, 2024 at 02:21:33PM +0100, Boris Brezillon wrote: > On Wed, 6 Nov 2024 13:10:37 +0000 > Liviu Dudau wrote: > > > panthor_heap_pool_release() does not take the panthor_heap_pool::lock, so the protection > > is not really there. I could fix panthor_heap_pool_release() and then add a > > lockdep_assert_held() before both calls to xa_load() if you think that's a better > > solution. > > Hm, but panthor_heap_pool_release() doesn't release the heap contexts, > it just calls xa_destroy(). If we have objects remaining in the xarray, > they'll be leaked, but that's not a race. BTW, can we make this two > separate patches. I feel like the thing on the vm is an actual fix, > while the second one (adding a helper with a lockdep_assert()) is > safety net that's worth having, but not necessarily something we need > to backport. I've decided to drop the panthor_heap.c changes as Boris is right, the pool->lock should be enough. Adding a lockdep_assert() right after the down_write() call also feels a bit silly, so I did not bother with it. Best regards, Liviu -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯