Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp952003lqp; Thu, 23 May 2024 05:14:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVN37/UiXI7QZB8/qKUCGzfC6P6uCZCpePldjPNEGzTqixDHLJNyiL74nOpRoa9JkwDydq7bV8NoZUb+XBeu4PcaTybKEs6auGMUlG6tA== X-Google-Smtp-Source: AGHT+IEOSKJY0ksXt2I7FkvdCzqWeZX74w5CmgivjBiFTB713pCuM836bM+KZ7mcfZw4ooZ64NEL X-Received: by 2002:a05:6902:2307:b0:de6:3c4:c3a with SMTP id 3f1490d57ef6-df4e0a6e8b6mr5452533276.10.1716466489197; Thu, 23 May 2024 05:14:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716466489; cv=pass; d=google.com; s=arc-20160816; b=d8L7JTVLejte02JhA7ThOcpZrht9s10wknxMlp7szON6I4Q4KqRVmk5bDZC0s0La7J MqpMGhS4uKLF4Be7iE7pPqQoeSBh2iv4KQN+0IdRCD/UlP4ZJfpOUzl7+C6pIv1Hws9c zwPpCyHkCbtKeWsRqwDdbFa1WJo8Ee+6iyLVDw5mOjMC2dSStf0bNC8zgwGq3ErrGSRq 5hcDWJBwIrdf/4ojy0Cf+FteibQ0H4GtUAUO0/bqhAI6Qw4Qc8HSD18D81vMXhhf3wkN gVDofidon284E6zUADDD+QI2TMZgCJOqoRRURf2lREWlsxQJjwg40aObh/Dlo53q0WXH c3IQ== 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:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=4JFZbvBecq2wnw6jChxndTWffmRCYy7YawUcvl27hcE=; fh=PUgK/+R5zKTCmY4zd/8A6YXkla42L9Z29s0jfB5hlew=; b=nrAsKPS9yePNXN5GwnkRdUhQqgxHxOybeR5bs3zQl3IM08xoNwXeq96fWnIzZT4mR7 cQ4Iapaa0H7vyJUIJPRWp5g7OhkiIcSlo5ygPwL2O+qYf4vgKG57e7h1D0t5mFoLB2In 6NOKuSnIp+RAxMUCIYeNpkDrf7Uc0s9zGfQifgThnWuJjkcj9l0NXZoqBEawDjOaeDpS j/RFMkEl/Vu2x13lk5/ZW/RIugHYuxetxCkLl8fOmmsPayVb6eQuUKtKT9hUl2SiDyFt kUBMSEDJtab43cYt8l5HjexYKpKGSJW9L5n3masECefXqfeC+o0x57QNyrckPEVRdMrG iMog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=qxj091ez; 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-187448-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187448-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a1e0cc1a2514c-7f9000e342csi5419443241.162.2024.05.23.05.14.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 05:14:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187448-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=qxj091ez; 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-187448-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187448-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E16A71C20A9F for ; Thu, 23 May 2024 12:14:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C1BC13E032; Thu, 23 May 2024 12:13:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="qxj091ez" 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 F1A0314A0B8; Thu, 23 May 2024 12:13:24 +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=1716466406; cv=none; b=bYviHdv4+ekUouWb0edIbLlidt/zYGKh0KLTZmIhHh2/g0k+dkCifIwSrqhpUWDmb4uz5OO5I11xCCsrsFZfzuYCgkxwjO6/iNQwLVSLwyvo0j7/8uHvQTXZmfxAnTQ/jahuza/9sKY9+Yj88LrWeQe7QRKHbbhAXMUps/Zuuag= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716466406; c=relaxed/simple; bh=+CYaVxTzq0ceeLUfwVvZ2nYbnTRs9uaqpHkH+8hVsI0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YWOOgyz5opu9D/V8uf+jBT2RZbnd3Vwg/ssIUDjlo99egOJQypBhk7UCxGvMEeetTT+i7UVvwq1fzraCCRgqIUTYaRj+VAuryawTdiI/01/rkrOkOO9uSSS/2apci8SVTD2ZG2IIVu8ohGyloCdcyrcQXvRT4+DHJx5Xa3RDWSM= 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=qxj091ez; 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=1716466403; bh=+CYaVxTzq0ceeLUfwVvZ2nYbnTRs9uaqpHkH+8hVsI0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qxj091ezU6J4Fi5axDKhXEY+6AH4RF97BlNBObMD0d/Ay46uRPApd+bV4Lr1KjFHX Li3b/WIjk7MOYGGrAdiDyXsUGz+UBC3PzkQXaLSJnQA/Sf9HxeF+zLa2guF3Z+jZni 8pVnuArxpFyYW/fD5SVpinh4yknPtWU0z08URfYJIDvmSacZLL6jWEP4NB/AjIzieD XyLvj59Eu175MLhJSTLZQ/9dgSG3SEYmNBte/u+rd/QfHeCaBwmNNnB5ZMk6Gd4sNp HTf+ikygIrjujcfXwy7BW3xmlOjL0Mdmx+xSWfQ5/wBn4jy00OP+mU3oAiWttWr5o+ 3QS9nFpM729XA== Received: from localhost (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: bbrezillon) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 5EC473782039; Thu, 23 May 2024 12:13:22 +0000 (UTC) Date: Thu, 23 May 2024 14:13:21 +0200 From: Boris Brezillon To: =?UTF-8?B?QWRyacOhbg==?= Larumbe Cc: Rob Herring , Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , Christian =?UTF-8?B?S8O2bmln?= , Dmitry Osipenko , Zack Rusin , kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: Re: [PATCH v4 2/3] drm/lima: Fix dma_resv deadlock at drm object pin time Message-ID: <20240523141321.52ea7224@collabora.com> In-Reply-To: <20240523113236.432585-3-adrian.larumbe@collabora.com> References: <20240523113236.432585-1-adrian.larumbe@collabora.com> <20240523113236.432585-3-adrian.larumbe@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) 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: quoted-printable On Thu, 23 May 2024 12:32:18 +0100 Adri=C3=A1n Larumbe wrote: > 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. >=20 > As was already done for Panfrost in the previous commit, fix it by > replacing drm_gem_shmem_pin() with its locked variant. >=20 > Cc: Thomas Zimmermann > Cc: Dmitry Osipenko > Cc: Boris Brezillon > Cc: Steven Price > Fixes: a78027847226 ("drm/gem: Acquire reservation lock in drm_gem_{pin/u= npin}()") > Signed-off-by: Adri=C3=A1n Larumbe Reviewed-by: Boris Brezillon > --- > drivers/gpu/drm/lima/lima_gem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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; > =20 > - return drm_gem_shmem_pin(&bo->base); > + return drm_gem_shmem_pin_locked(&bo->base); > } > =20 > static int lima_gem_vmap(struct drm_gem_object *obj, struct iosys_map *m= ap)