Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp928032lqp; Thu, 23 May 2024 04:33:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwAEngW368s85CFhd093otlTtU3lUsRbA8cbeNYB823nmOya4uMua/J0TfoOfrQtownGYpCiKnn0BNW1rg0mVMxFTWJ0cLnubDJtAwlQ== X-Google-Smtp-Source: AGHT+IEj1mKZJqPnPOqKp5Eq1ASXUXT8hTwbwl3ib0Y/VEmx4+sTyc8bqAvsBAuNLy4MXS/DLZMX X-Received: by 2002:a17:902:900a:b0:1e2:82fc:bf71 with SMTP id d9443c01a7336-1f31c97a1f2mr41480645ad.22.1716464001306; Thu, 23 May 2024 04:33:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716464001; cv=pass; d=google.com; s=arc-20160816; b=GLsDtk1UwkmsiSW4VbIfpDOWUeaQfsdSAebOrM5shvNzulXli72kBeasQKo164/IPX uRx+RhCnng2oojCDfr9SxlsUI4HPuhKlyGGSiSzkMVBgfCpF3LfqwCFgAhx1niiUFSq3 26z9zwEVwCao5qVgcEdOSLsrorU2pwdOtZyc1yMhJ2K1/fUEySYdTkjJS44ls2IC0zC6 hL0ygi2xlO9B0UBPyXgHnyD5QRRx/BL9H6oV2Y0bJMSiMroFBuE1xK6RCPeu1Tlnru6c GQzTGhTBrMTpKi2sByrCeRtQb5LfyUhof20P4ZiDXkfEGnfXpH32LEGDcppi8hF65ljM +I3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hYVP2zgKI1t3B+ZOJ+A2p4ynkyp+9H02H66RqJXHpxQ=; fh=Ghx6tcIzyVO5WF7aoLQ8kSAUDZ5XrKLfQq3Zu5A2d+E=; b=nsP2GpmJMfTTl8LUzlf0uWK3dxTGKXLTdZs8EPPR6QJ+QI9MAog66nWn3nBRMFJqdC 8Z1GlEkVwmZkr/Sp2lPg0vLvE0D0xB2NUHxxvNFT6mnvsClvKH/vE9EpMlrtuoAvBR3P x5wr+48RHFeM/9fga7Lsel949b05Zziq26kclUJnoIlpXCxWzw0XkEogZf7Df9+9rlao gguE4lVM2WI819lUMaw7qQ7pzapyJt1uIU/ZXEr93bIzHP8OF5Gvmgs2JUOhwr3SWab4 K9iOgUskQeu/nFKrQyXpwQKsN8BHfbGii5J+Zu+gwz9cvSOAUrOmApsYdJBFUJlkv9vc bi1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GDELOgMH; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-187402-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187402-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f3434aca34si8172015ad.110.2024.05.23.04.33.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 04:33:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187402-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GDELOgMH; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-187402-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187402-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3B7492835C3 for ; Thu, 23 May 2024 11:33:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2507148FEA; Thu, 23 May 2024 11:32:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="GDELOgMH" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6069413E3F2; Thu, 23 May 2024 11:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716463972; cv=none; b=kzkVOfDpkB9vt01dnD2fGOBG2lkaixi+OXOqY1V+fxZ29qsFqULj39Um4ayUVMEYbNKVhl56tG9WAEnK5AYetrOLZaH3nBtL1XrlaNQ1b3OokxcURAoQ9dFVCuqfxqCoan4Igu9BSre7gs9ccmK2O0YiiRPbhoIhgl8jrTI9u1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716463972; c=relaxed/simple; bh=15Ht+l9+EOGuqFC/0CeadvzXopOVjXhks3pRPKtgKio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LJJRTtt+7QLePIHq6IQoKnIAweko09aomp2Kh80Os2dRMwkmVcB0ixPUfAiVQZQiaNPtAdkcsEVpNEUPPpXTHCnvBZatKq9MNokXRK8X1L1wXihI/nH3ru2rAcIU6ibvhY82Xte/up2pf+1ry/c7SVCVRvtj3ZzjhYihM42TtMU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=GDELOgMH; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1716463969; bh=15Ht+l9+EOGuqFC/0CeadvzXopOVjXhks3pRPKtgKio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GDELOgMHXjO1A3trk3dCPadzusoGvdmhgUTU/OqvtCktVeBeW1P7klGIngmIoOo/N nF2I7ZobogyVcirQOc76/Mu3HxTz5++xNdsKquylcBTU/2WGcyUfurrhhOwp6GIQYR t/UBTcuklaFxfiDKglidCEZKi28y+dXbzsO0oLLLNLNnz6NMPbVk9yR3NQLipoCw8B hDkwg6ewWpBb0UN388ck+syjCxq0Uw20s1YZm2o1oz8G6us/fKQXItRhWICtpH74+a 2uyNiQySg2rKl/j1RUAXX3MQyWdYCNRKkyqlokEiYp9/QROKcf3aJq3k2RkFpF9qVh u54ZpLl5o0bQg== Received: from localhost.localdomain (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: alarumbe) by madrid.collaboradmins.com (Postfix) with ESMTPSA id CE03C37821BB; Thu, 23 May 2024 11:32:48 +0000 (UTC) From: =?UTF-8?q?Adri=C3=A1n=20Larumbe?= To: Boris Brezillon , Rob Herring , Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , Dmitry Osipenko , Zack Rusin Cc: kernel@collabora.com, =?UTF-8?q?Adri=C3=A1n=20Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v4 2/3] drm/lima: Fix dma_resv deadlock at drm object pin time Date: Thu, 23 May 2024 12:32:18 +0100 Message-ID: <20240523113236.432585-3-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240523113236.432585-1-adrian.larumbe@collabora.com> References: <20240523113236.432585-1-adrian.larumbe@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-Transfer-Encoding: 8bit Commit a78027847226 ("drm/gem: Acquire reservation lock in drm_gem_{pin/unpin}()") moved locking the DRM object's dma reservation to drm_gem_pin(), but Lima's pin callback kept calling drm_gem_shmem_pin, which also tries to lock the same dma_resv, leading to a double lock situation. As was already done for Panfrost in the previous commit, fix it by replacing drm_gem_shmem_pin() with its locked variant. Cc: Thomas Zimmermann Cc: Dmitry Osipenko Cc: Boris Brezillon Cc: Steven Price Fixes: a78027847226 ("drm/gem: Acquire reservation lock in drm_gem_{pin/unpin}()") Signed-off-by: Adrián Larumbe --- drivers/gpu/drm/lima/lima_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_gem.c index 7ea244d876ca..9bb997dbb4b9 100644 --- a/drivers/gpu/drm/lima/lima_gem.c +++ b/drivers/gpu/drm/lima/lima_gem.c @@ -185,7 +185,7 @@ static int lima_gem_pin(struct drm_gem_object *obj) if (bo->heap_size) return -EINVAL; - return drm_gem_shmem_pin(&bo->base); + return drm_gem_shmem_pin_locked(&bo->base); } static int lima_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map) -- 2.45.1