From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (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 71BBF3E5574 for ; Mon, 27 Jul 2026 21:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785186741; cv=none; b=mscyqVYuUXdTErpRkr768dXRUVURyJI+jQKMKFlLqhAb9Vn+1VZH13xZZxafXpxxL9VBTijyT8lHdvCsvNsQ8BDsGSlG9G9bkROkc1W61MUPUymq1UMTbZe7ZuC1mDuwVujocIGyKxVXgMW8dEovveKrBW3hUY5NfSzxanyb84Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785186741; c=relaxed/simple; bh=zQ1cx8WBYwkVXux7RjyCbeIUdKgSm+vA7wogQFvWqF0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=f2gYS8ErneCWoZiMqqWxSrz42/q9J0YTbTAV0x2WeU68/0JTPqMg+aIj8s8PXoI4QDN96uKcScC6C3NqUMB+edq90ToRGcbDq4pas/xXGBU0C0N2uCqT5R6Y5pRpHJTec3IpHeXNFcKTc2xV0cSVyvd4mZO7SSvdUramlrZqkYo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ua9GM13D; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ua9GM13D" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-caf707e3a70so214695a12.1 for ; Mon, 27 Jul 2026 14:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785186740; x=1785791540; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=CvjIroWBUR46GpmdR10fQCd9PWHAMrSwKzxKCg+dB3Q=; b=Ua9GM13Da7X9XOqEOcHQ9XUy/gjvCveczeBdd6IdOmnDtSMZcctM1VfCqzrReJ0xhr y73GJg3R7eie34vYLNJ+VDM9opJ0pQcwHFkjNurShc89e7IA5/xeegUoieR8V7b1DL9/ TKMEyTiH4UUI8DQQmNVq+XdLkRsQiTmoSS9RXm9sctWc4C3QUmk+o4TP4TyrXG17QHfL bXSGjrZvLDw/i8cwsNiihsEHyt6uBwnjXxeXkO3dkALTwu95DMOy5a2tfhm2f/mahldG /4ibnp6O7NTUk474KKVe5OTIlGI/oOdngrNihLV+t/TRRxIAusPxXG1Uglct6EKg5R2/ GiZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785186740; x=1785791540; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=CvjIroWBUR46GpmdR10fQCd9PWHAMrSwKzxKCg+dB3Q=; b=hiZwdztWU6IT6NnZSwj/XTSZuy6OYFenc+qTiT51GXYCYCUOG8J+L+LOiR/XZhv/YP RVMMsEbV8k+8FSazqsBk43jp8irhPK3d8VTriyP5+eFxRqes46ZrhBGDCqHsWKOs98vK cVl35xcdU74rFf2Jpn3BuYCL3a3Vza0HnA3iPpLqMSxFhwkeC8pENM1obURCuyE2TsPb /KjMqTwzY1cm8hX4joLoMF/4KiR1uIwwTWxUjF+g7GIy3X2PcKSBsJ85VD7zUsWMfxCP 9Z/C5CPOdTJAtvbvdO0ELc2BZk8xPBOhctVJ0LCNShMG9qst2Gqzw0a3i3cC7iAVC/Ol nSTQ== X-Forwarded-Encrypted: i=1; AHgh+RoiOnVK++FXNc49mKH6tJMwRCX3HSLXWIoCe1dwr1sDShJxK3PX5cPa7dYb0FHTl05Hb8HBNgNQzRlFiaE=@vger.kernel.org X-Gm-Message-State: AOJu0YxZFkjv0Ef6H/l0DnoCqmCIFmXv3Rrr2TPdRsZyrGliI+h5WW3B ztAbGstJfvc9elj4GpeUrdNANGo6BMdcfAlBYwWyok/gaUzLkBjbSbWK X-Gm-Gg: AR+sD12d/5PAivpRphEGmzfgmAHQ+09DIMV+ToT6T4wE/9QS0YrkgACHxuHVhyefrMu 9lh/hHlp+nRFRo9U3sEnObb4zLQMmY4eo4RVKJLxXVSts8LuSWIk5PCNuA65sLkC3A+fJCePAvz BZYJI0f14FQaHPMRGYP3YKn5SSro9q7Ap1biG2OPUORFW413+qnk1Wi86CclBn2/aXgL5zP07dw UgHQrpgSFBImTyI5KkobBBk9gUYMsgKyPn1s0qowJ2XdnnrI76+7cDzWfP1uOUM6nd67mQYzuLR NiFAA2ayYl/7u5AN0F2oqukZQtyRVPXqiyflgsrfwsnr9b8PBUREDb2za7jWEDFE6T0ezJTFUaR WFJD1PA8wHAC7EaY6YaLsGZlJURxsHNPIFTBW+UeCovSZolJc0EOIXU7wyi+MaQaONNSc0+E= X-Received: by 2002:a05:6a20:7faa:b0:39b:bc11:9ec5 with SMTP id adf61e73a8af0-3c785785491mr424424637.13.1785186739724; Mon, 27 Jul 2026 14:12:19 -0700 (PDT) Received: from archd ([2601:640:8c00:a:1544:c19e:8a1c:4058]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314bc3e127asm58456645eec.2.2026.07.27.14.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2026 14:12:19 -0700 (PDT) From: Daniel Pesic To: Danilo Krummrich Cc: Matthew Brost , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Alice Ryhl , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Miguel Ojeda , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Trevor Gross , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?UTF-8?q?Onur=20=C3=96zkan?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Daniel Pesic Subject: [PATCH 0/2] drm/gpuvm: avoid deferred cleanup on GpuVmBoAlloc drop Date: Mon, 27 Jul 2026 07:11:19 -0700 Message-ID: <20260727141121.11975-1-danny.pesic@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit GpuVmBoAlloc::drop() (rust/kernel/drm/gpuvm/vm_bo.rs) currently releases its drm_gpuvm_bo via drm_gpuvm_bo_put_deferred(), which exists to handle destruction from contexts where the GEM's gpuva lock cannot be taken synchronously. However, a GpuVmBoAlloc has a refcount of one and is never added to the gem, extobj, or evict lists by construction. Therefore, a GpuVmBoAlloc that is dropped without being consumed by obtain() does not require a deferred put. drm_gpuvm_bo_obtain_prealloc() currently handles this situation internally, where it discards the losing preallocated drm_gpuvm_bo by unlocking obj->gpuva.lock and calling drm_gpuvm_bo_destroy_not_in_lists() directly, which skips the deferred path. This series lets GpuVmBoAlloc::drop() behave the same: 1/2: exports drm_gpuvm_bo_destroy_not_in_lists() so it can be called from the Rust binding, and promotes its comment to kernel-doc. 2/2: switches GpuVmBoAlloc::drop() to call it directly, and includes the safety argument for why its precondition holds. Drops the TODO left previously. Note: there is currently no in-tree caller of GpuVm::obtain(), so the drop path isn't currently exercised by an existing driver. Daniel Pesic (2): drm/gpuvm: export drm_gpuvm_bo_destroy_not_in_lists() rust: drm: gpuvm: call drm_gpuvm_bo_destroy_not_in_lists() in Drop drivers/gpu/drm/drm_gpuvm.c | 5 +++-- include/drm/drm_gpuvm.h | 2 ++ rust/kernel/drm/gpuvm/vm_bo.rs | 10 +++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) -- 2.55.0