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 0414BD116F8 for ; Mon, 1 Dec 2025 09:55:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9042310E368; Mon, 1 Dec 2025 09:55:04 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="DgaehzF0"; dkim-atps=neutral Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7897010E366 for ; Mon, 1 Dec 2025 09:55:03 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-477cabba65dso25139215e9.2 for ; Mon, 01 Dec 2025 01:55:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764582902; x=1765187702; darn=lists.freedesktop.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=72s8cxP8m32nLOQlBnrTppnRNNSnWx6bZ8vmeua9AuM=; b=DgaehzF0NZWlB5rV+2Zs/z4QLmoK+HwRQ2n2zgGo7b36o3hdCi0CLJ8WxxXqvQsfeQ P/gP5GwEXfrzljGtLL8jsocM5FdZ5EQbPyGVjWJrx97C3HRG4xl5FMwmc9DWnDYeRqST wAeCqXUxmOBxp8us4KizBI3UtXQygGdDV/79ilJ8C/ig8f1G5Fm1IixSZCcxMzshbej0 FPPElt5uQIVE8K3hALNamir9/JKOf/7feP2Sh9E+T9zNy7wYYrw34KBgo8NtBu5QVldu eTM5QXYrDSoOBSMJeFq4tQkr1pOyECUNdZ/oLfgSQ1g09arFK+/iHSc8Sm5xtBAvqucW 1OEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764582902; x=1765187702; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=72s8cxP8m32nLOQlBnrTppnRNNSnWx6bZ8vmeua9AuM=; b=Ys9AiUkUEQKcoq7I9imgeKLwcExoISk8hyXM/iDyM82I1xTx+3SB395IYZBjDxDZJt FPWZ0nOPdI27XwGKBaGlQPw5SIgJnon9sJsCe8x/EcYAXU9cPt5iCLnZXx0ULIjzuuJV pOsuyd6pt9uxGuFeIXot20ES/UWuUADXKhA/r92b5S91lEsvS1Fhwgp5Rw7ac86+gisd g3V06WJRT9jfhB5zdATiToeSI6ftouSFeU6UVVJBzfUwkns5p1qihIHtSKMjK/370sbr t+09+WZrqiECWFr5bPDaR7owq4kd65qlnuRtQtP6X4jqsEfDCpUbK9NHI3U0YDSpvN3N sNOg== X-Forwarded-Encrypted: i=1; AJvYcCUIikird1BIje97HpGSVUqQ9VNYNyGHYkbookAYl8cdrMG08DSatTx1ycpdFTrhce3H7N4/FsHAkQ==@lists.freedesktop.org X-Gm-Message-State: AOJu0YyudJl5Oz8KD790Ww66J7rAQxat+2Yqw+drpmKaKKXQ3Jl7VC6x whG/DFDjtm75lOTbX1b6XLmodPnCIcDz+NVkOskN6bL18/OHXvutK82ZZ7l5HNfle4NBGBvfdh7 OsTGavJfwnok8cxInbw== X-Google-Smtp-Source: AGHT+IHR/gzeFh7+KeD1MsGLOFVqoY8R7VwUnjkirrmR28Kdsu+0Qy8DFoIl1J3N86VCTwEGoZO2EDfdb0ODTEY= X-Received: from wmba22.prod.google.com ([2002:a05:600c:6dd6:b0:477:7ad9:2aa]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4f4c:b0:475:da1a:53f9 with SMTP id 5b1f17b1804b1-477c0184b1emr414720285e9.14.1764582901820; Mon, 01 Dec 2025 01:55:01 -0800 (PST) Date: Mon, 1 Dec 2025 09:55:00 +0000 In-Reply-To: <20251128152403.72aedafa@fedora> Mime-Version: 1.0 References: <20251128-gpuvm-rust-v1-0-ebf66bf234e0@google.com> <20251128-gpuvm-rust-v1-1-ebf66bf234e0@google.com> <20251128152403.72aedafa@fedora> Message-ID: Subject: Re: [PATCH 1/4] drm/gpuvm: take GEM lock inside drm_gpuvm_bo_obtain_prealloc() From: Alice Ryhl To: Boris Brezillon Cc: Danilo Krummrich , Daniel Almeida , Matthew Brost , "Thomas =?utf-8?Q?Hellstr=C3=B6m?=" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Steven Price , Liviu Dudau , Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?B?QmrDtnJu?= Roy Baron" , Benno Lossin , Andreas Hindborg , Trevor Gross , Frank Binns , Matt Coster , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , Lyude Paul , Lucas De Marchi , Rodrigo Vivi , Sumit Semwal , "Christian =?utf-8?B?S8O2bmln?=" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Content-Type: text/plain; charset="utf-8" X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Fri, Nov 28, 2025 at 03:24:03PM +0100, Boris Brezillon wrote: > On Fri, 28 Nov 2025 14:14:15 +0000 > Alice Ryhl wrote: > > > When calling drm_gpuvm_bo_obtain_prealloc() and using immediate mode, > > this may result in a call to ops->vm_bo_free(vm_bo) while holding the > > GEMs gpuva mutex. This is a problem if ops->vm_bo_free(vm_bo) performs > > any operations that are not safe in the fence signalling critical path, > > and it turns out that Panthor (the only current user of the method) > > calls drm_gem_shmem_unpin() which takes a resv lock internally. > > > > This constitutes both a violation of signalling safety and lock > > inversion. To fix this, we modify the method to internally take the GEMs > > gpuva mutex so that the mutex can be unlocked before freeing the > > preallocated vm_bo. > > > > Note that this modification introduces a requirement that the driver > > uses immediate mode to call drm_gpuvm_bo_obtain_prealloc() as it would > > otherwise take the wrong lock. > > > > Signed-off-by: Alice Ryhl > > Reviewed-by: Boris Brezillon > > Should we add a Fixes tag? Yeah, let's add: Fixes: 63e919a31625 ("panthor: use drm_gpuva_unlink_defer()") Alice