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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 9FDC3CD4840 for ; Mon, 11 May 2026 16:27:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 11F4D10E815; Mon, 11 May 2026 16:27:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="hBTFhxz6"; dkim-atps=neutral Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id B2E0810E808; Mon, 11 May 2026 16:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1778516820; bh=o/nruX8ocP49ocj+MJGaWE8H3U7n4bIxuduRAQlimDk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hBTFhxz64qsvOcHN7XP5q5gZ6kjAVpZ5UHS95KbcsH58nbl3Gcqeq/IkpL6tg0xVO LnZtqAzfErhoKjegNRaiRlUAHt3QI693n0x3AgEf+nxWTtWP/K9/zU/lhjHkmAmTow dm9xwHEeZKlZ4kGEGAhhxbXOpLnkpyIcISPr1zhyBEHk/HuZ39sPtj6OV+LvpvE6gS KKICNIZCMgUuO4qHkc2uRMxv8H+wzDGTWl2GuB6QxtZq6z9wynQfW6/iBdejMSdxIe eLwm8stfaOqpotqGytkJjG/8/3sUaaA406c3PkIpaZdr/Z69rNq1gc8wqV6m5uYHLS xMKpXapI5FClw== Received: from fedora (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 72DB817E1004; Mon, 11 May 2026 18:26:59 +0200 (CEST) Date: Mon, 11 May 2026 18:26:53 +0200 From: Boris Brezillon To: Rob Clark Cc: Steven Price , Liviu Dudau , 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: <20260511182653.5a9c99fb@fedora> In-Reply-To: References: <20260508-panthor-shrinker-fixes-v2-0-39cdb7d577c9@collabora.com> <20260508-panthor-shrinker-fixes-v2-4-39cdb7d577c9@collabora.com> <20260511174429.35afcdee@fedora> Organization: Collabora X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, 11 May 2026 09:16:49 -0700 Rob Clark wrote: > On Mon, May 11, 2026 at 8:44=E2=80=AFAM Boris Brezillon > wrote: > > > > On Mon, 11 May 2026 06:18:44 -0700 > > Rob Clark wrote: > > =20 > > > On Fri, May 8, 2026 at 3:41=E2=80=AFAM Boris Brezillon > > > wrote: =20 > > > > > > > > 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 l= ock > > > > through and finally take the lock and do the expected operation. > > > > > > > > Currently, the two drivers making use of this API declare device-wi= de > > > > locks, and there's no clue that we will ever have a driver that wan= ts > > > > 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 thro= ugh > > > > dev->gem_lru_mutex. > > > > > > > > If anyone ever needs more fine-grained locking, this can be revisit= ed > > > > to pass some drm_gem_lru_pool object represent the pool of LRUs und= er > > > > a specific lock, but for now, the per-device lock seems to be enoug= h. > > > > > > > > Signed-off-by: Boris Brezillon =20 > > > > > > Reviewed-by: Rob Clark =20 > > > > 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? =20 >=20 > 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 fine with that too (the panthor resolution should be fairly straightforward anyway). I'll post a v3 with just patch 4 then.