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 D11183FFAB2 for ; Mon, 11 May 2026 16:27:35 +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=1778516857; cv=none; b=LS/JPiHC/wazY6iou11nSUvNCFvTdTGUe9uU60ToAvbNKcvVJBBNhqAzpfVcyJCHN6axr+SluvyCNBke/TFwrXxECFtjSo94QE4TmRd5zVc0vJBavOfTRNvWl0mlovP14fpOBBfP+i2+L1bmXonMUnQpQi8wXA0ljHgUC/HoN1A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778516857; c=relaxed/simple; bh=YonN8VL2BLEr4Q2OyxUKcgv3XivnvGDz2zoMI7+3kf0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qLhJwIs7oXZ0Cd0iBNuXOI5OfJSnjYYAxqAk9sGbgc00tylwm66ACaj+7oTYTKH9GPOiEUUuvqdVpPNmCzkvJ9jLH0mwDzwjIX+V6sd7nI/hd43jtHALSheD8AE9RZvVp103ElWuQD0+u5Gf8PzH4NqwaYjIdbthO1I6TF4cav0= 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; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=OoglJHs6; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="OoglJHs6" 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 D92041688 for ; Mon, 11 May 2026 09:27:29 -0700 (PDT) Received: from [192.168.0.1] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EE3FB3F85F for ; Mon, 11 May 2026 09:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778516855; bh=YonN8VL2BLEr4Q2OyxUKcgv3XivnvGDz2zoMI7+3kf0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OoglJHs6hXq4XzZQYuzZxCU4fCmLf0nRzEOzZUKVbbDptr9UGSJS4QkNHcwjaOG+o fjW3gVUgT89XLE6bZMgLBqs9C3X9Y/PSQiLw5U3ZRRriKqArDSIMdu9H/lEVNd8jlP xQfJEBxo3wFIHJ+3fI6ijZi352I/RzYQ9yEcUqio= Date: Mon, 11 May 2026 17:27:13 +0100 From: Liviu Dudau To: Rob Clark Cc: Boris Brezillon , Steven Price , Dmitry Osipenko , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Akash Goel , Chia-I Wu , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/4] drm/gem: Make the GEM LRU lock part of drm_device Message-ID: References: <20260508-panthor-shrinker-fixes-v2-0-39cdb7d577c9@collabora.com> <20260508-panthor-shrinker-fixes-v2-4-39cdb7d577c9@collabora.com> <20260511174429.35afcdee@fedora> 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: On Mon, May 11, 2026 at 09:16:49AM -0700, Rob Clark wrote: > On Mon, May 11, 2026 at 8:44 AM Boris Brezillon > wrote: > > > > On Mon, 11 May 2026 06:18:44 -0700 > > Rob Clark wrote: > > > > > On Fri, May 8, 2026 at 3:41 AM Boris Brezillon > > > wrote: > > > > > > > > Recently, a few races have been discovered in the GEM LRU logic, all > > > > of them caused by the fact the LRU lock is accessed through > > > > gem->lru->lock, and that lock itself also protects changes to > > > > gem->lru, leading to situations where gem->lru needs to first be > > > > accessed without the lock held, to then get the lru to access the lock > > > > through and finally take the lock and do the expected operation. > > > > > > > > Currently, the two drivers making use of this API declare device-wide > > > > locks, and there's no clue that we will ever have a driver that wants > > > > different pools of LRUs protected by different locks under the same > > > > drm_device. So we're better off moving this lock to drm_device and > > > > always locking it through obj->dev->gem_lru_mutex, or directly through > > > > dev->gem_lru_mutex. > > > > > > > > If anyone ever needs more fine-grained locking, this can be revisited > > > > to pass some drm_gem_lru_pool object represent the pool of LRUs under > > > > a specific lock, but for now, the per-device lock seems to be enough. > > > > > > > > Signed-off-by: Boris Brezillon > > > > > > Reviewed-by: Rob Clark > > > > If every one is happy with patch 4, I'm tempted to drop patch 1 and 3, > > since they are irrelevant if the locking is fixed the way it is in this > > patch. Question is, do we care about patch 2 being backported to stable > > kernels then? > > Or backport patch 4? It's a bit bigger, but mostly mechanical.. with > only issue being backporting across addition of panthor shrinker, I > guess? I'm agreeing with Rob here, but it makes a mess of the backport. Maybe split patch 4 into the drm_gem.c and msm changes and make another one for panthor, as that is still in linux-next? Best regards, Liviu > > BR, > -R -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯