From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CD01301018 for ; Mon, 1 Dec 2025 09:55:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764582905; cv=none; b=hPDRpP1AdywEXyep/17SGlnTjaA5dgX/2rUCxiI2E8HGdAjLuUVg/XImEVD00cDzh/CA+x42vAxJsCx108VBsq61ovE7bwB+OzMxDFhcZ6fOeTMSjwTK//ooQBhISoxioHLy+EgsFBeX3RBc49GkGiBpK8qnEuAcY8AIuGYHf3k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764582905; c=relaxed/simple; bh=qQliQQ50xmA8nSOzImbhq3Vz4boRpMYBIDIh6ji/bLQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=TTV5r/6wN3RUbLBnhOoTSG+EPfeccz2tRK46dTOZzXYLLj8UMLoKzsG4v1nQ28jmMbM+QNI5EZ6nXJrbYAMjCOczzU4UZGYi8GgRk+HJeFnbED4g8I7RO15Rt6i9xUQc4tc+lrtX1KNm9pDuSLyZLUhxCEgax7BW7/6Ndf1l5ww= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ahXOM0cQ; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ahXOM0cQ" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-477bf8c1413so24835005e9.1 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=vger.kernel.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=ahXOM0cQBjRw3muTL6UFcCsTa8oh+L5YBJRK1MXdw1G74secpZ+F34f6W2eDPXb/42 2FiHc5vvQRzGFh6Bdh4T3R+cnk7yy4agX2huQRfv9BYbCfpm/ySfFKBauVmZA8m43veM YWR5NPoqn4Up0MGGqeleFcBk1veENSPl0ZkBPjh5kuqW6wkNVWt1tAjFnc4GBIZmBuU4 5c2B+Xnmu3lIevTsQVtkXFe8+QkO/gN/JnEYGJUTdlmpsau0+yNaP8nPw7bAUJBXr0aw HiPwqCsGSqnYcdqlJ5H7bxEI1I7ydSkvB+/r720ljCRWr+iO4ekkPaVLR/hCMK/JstBN jDXQ== 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=PgkTjbwFzLxY94RLPZ/SZZQ6/od+upitQ3gL+PXZzQ+B8NcZgUIQ6pQPLHJxVs1isb 8P3Habs4ZMlr4kf3hza3CYSKUwlZagVJSYou2c38rawSdNZ7SymlwF/DuHBjOBh/cFBI 7reDfUMAXVbv3Eb79frTEPRhAzrH+NmsvBW+7QOWvDR2sXUuNnmULekBjUIzzlcWCIzW ZOp3HoFNM/6TTCjkXiRcIOoxz4VOfVQPsYGUzCPLIUuN2JTxp7idgf2U81I/hnu52d4q 1RxuEB+wjXfZM5QNnNfMWnqKiaQCyn7kGQBX+5nUbmUb9cQ60AQcxdtluI2nmNfog2Tq 4gmg== X-Forwarded-Encrypted: i=1; AJvYcCV/dq4Wyht7zaOoeIoopHmXGeteyqoNEQ6ZX4MVO+IPoNjc7oh29xdOcMLKZ3EUPnSv4wOcxbBbCsHnw4CTlA==@vger.kernel.org X-Gm-Message-State: AOJu0YybsR6B3uxi69gLKPlg/VHyJQ8ngkckhkiSGn1bVeqxli83peu/ ADXbl//1G2wzJryOTw9/h6RyXVE2K2j2dOeC93GO6O/HUWkL0JyvbutQmiYn0pVgLsEPXhXWkdR p1AgazrTlcKrbIWhrkQ== 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> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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" 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