From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 A14DD3822AB for ; Fri, 10 Jul 2026 19:08:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783710489; cv=none; b=RjH7ghnd4cqfNIh+15lKh96x7pzhsykr2TS/VU07nQYHuUYhlm53W37BAQ7aaYZuAN3stcXZWPsoX3o1rxfXqJflILXbdZEa7w9OpujBW752Jw7gFDe8DnD3cM2EKYwuppGC4X4o4Ihso5vRlz0/pF4QgW5cfnzxjUVSJ4AJpBs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783710489; c=relaxed/simple; bh=o7Z3PJ/UjWB6npitXooCNlRs0iCC+vFKzC0EUHmcwXM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N72DJmapt4eCNfT5FjG3uus8u4xT/NNGa4JGFbTJSmjy7N3P1AjWX4B0+KOhwkojW4HP/cgr5A6lfs3mmWBvj97fWqkghKeH/7zoR+EIOKuaAZg2yKglKTFSLtKs6fQUzhcKlz8ZXzA4HNwPq8oXX9aRS7WdwC5KiMqQc6ELDdQ= 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=TtmG0TZg; arc=none smtp.client-ip=209.85.128.49 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="TtmG0TZg" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-493c52cde9eso10886885e9.3 for ; Fri, 10 Jul 2026 12:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783710481; x=1784315281; darn=vger.kernel.org; h=content-transfer-encoding:reply-to:content-type:mime-version :references:in-reply-to:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to:content-type; bh=yfqzx7NPmSYUt62vyH3N9Lvh263fPR148WybLR6D9i4=; b=TtmG0TZgDUsRvOvZqAo7ijP09DjKGDK+Py7+FhjdjlOSmXW1RmXghhUPcF/hyYq37R 0vxHpQIe5FaiR1TtfkuuilDQ77jSrMAUupQtaZVBv33UZu+oiUN8FcM4uS4pWUhPcqTR haRLt1SuM2xZshlGUeLqDfFBndRK67oHKNvmb8w7sP8YQKONjvEJyctYw8HRQmOp4Kjw bO0kS4TEg2GefDZ0OvkAQGtGZthWhqhcfcXis/hBD3XgtT75FNewwt211xd5n1E/4ZnE uJjXr1GB5NjYslwG7NQq8uMyMXFkhpy/PerdUF8bWrpM6wCDMG0k6BWu6/+r9G6PFTce 8QzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783710481; x=1784315281; h=content-transfer-encoding:reply-to:content-type:mime-version :references:in-reply-to:message-id:date:subject:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=yfqzx7NPmSYUt62vyH3N9Lvh263fPR148WybLR6D9i4=; b=tCcnDLYCfL9g4rjmCA3GcNKm9vp9lEDQPeoKG2VhMpYl5vT+UH40iQJVF2qLYjSWOW rd5rIvMOoIMczhyKhBn945MvnwrzXWdSoJEoOZ6nEooC2rE0pDhDgAKe7g+ffQZiGoTf vlzAqICPjKx7vA6UZpOIE+hcr/a6jjcRrxVFDVlXeRqCpD7cj1jLjaTGMsiG8oycf6c2 YdVd0P65VmAe/i+LP+7FjpDJPuqBy8Utx8VeuutINDhJFKRRsRL8qy67EUq2uXJWlAXC v4DWWppg3a7pEa8JU6LaOzfMdloJjWpeZD7r/q9oh5VewNzVExOgLLCKxPVWk0HnJ6M2 R39w== X-Forwarded-Encrypted: i=1; AHgh+RoxWFl/9rqo0fJaVifN9Q55TjRXSvHq1vhl9ZZqQ7nWyRSnUmpr+PK5z7zNEcUMameuNBbtxdIWh1pgdTM=@vger.kernel.org X-Gm-Message-State: AOJu0YwyZf5lwcCXsfIGYfE2n1vB88AKgr7CpBDbeYo806naePMboiLo ywr7smItQ4N0YDB0o2MCo9bPRQLGarC4fjNcvSgyTU80eLWEzcfmshMq X-Gm-Gg: AfdE7cljYDH95wwNyeQQ4k0H5sewLFREAMUl4E+mg1VdAWjJBl70bLP3kkdbyzOzPEI 9V/0+sbPejRNEruFOBUlxI5BmXHQCfWRfwZ6chMnp5WZmNissiQMHjQKpQt14YNuyn4ad3Sky0M ZpTf0V5DpRCp7W+l9XSOEYg3WYhocWnXWP4wO+x8M/bbSAzPGSUF6vtPwnnJLufvreNvd+qnuzm buJbuGbNwas8hDQP7FndR6IeqdawCYd+fS99w9Nm2IHde9JbeePNON9EAE6jc/TbuZVSkx8H4a9 IXwvCUVFhvki2mFXBaV+BG4GRl+IgFfkparNYKXa9vwrNOha07CiZ9lbEz09x2xFSh6wNdKN8lA +6+2RB4Ei18ZcKZc8VlxEkITQMQVWrY13SSfbDy5w96Si+2+j3tb4duRRzrdgpksU41dfZ5NX6T xOJKYqEek9Iuudr40S+ZSsUw1oyg== X-Received: by 2002:a05:600c:3b07:b0:493:f807:1a79 with SMTP id 5b1f17b1804b1-493f882b042mr996745e9.27.1783710480841; Fri, 10 Jul 2026 12:08:00 -0700 (PDT) Received: from able.fritz.box ([2a00:e180:154f:ec00:aa08:de24:db33:4496]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-493f567eadfsm55000755e9.6.2026.07.10.12.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 12:08:00 -0700 (PDT) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: thomas.hellstrom@linux.intel.com, dakr@kernel.org, ecourtney@nvidia.com, simona@ffwll.ch, matthew.brost@intel.com, nat@pixelcluster.dev, airlied@gmail.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH 06/12] drm/ttm: move delete handling into ttm_bo_evict Date: Fri, 10 Jul 2026 20:52:46 +0200 Message-ID: <20260710190752.2355-7-christian.koenig@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260710190752.2355-1-christian.koenig@amd.com> References: <20260710190752.2355-1-christian.koenig@amd.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 Reply-To: christian.koenig@amd.com Content-Transfer-Encoding: 8bit Both callers do the same thing, so we can trivially unify that. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index db72fb2fde9ff..e28e11c06ef48 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -363,6 +363,13 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, struct ttm_place hop; int ret = 0; + if (bo->deleted) { + ret = ttm_bo_wait_ctx(bo, ctx); + if (!ret) + ttm_bo_cleanup_memtype_use(bo); + return ret; + } + memset(&hop, 0, sizeof(hop)); dma_resv_assert_held(bo->base.resv); @@ -470,13 +477,7 @@ int ttm_bo_evict_first(struct ttm_device *bdev, struct ttm_resource_manager *man if (!bo->resource || bo->resource->mem_type != mem_type) goto out_bo_moved; - if (bo->deleted) { - ret = ttm_bo_wait_ctx(bo, ctx); - if (!ret) - ttm_bo_cleanup_memtype_use(bo); - } else { - ret = ttm_bo_evict(bo, ctx); - } + ret = ttm_bo_evict(bo, ctx); out_bo_moved: dma_resv_unlock(bo->base.resv); out_no_lock: @@ -524,14 +525,7 @@ static s64 ttm_bo_evict_cb(struct ttm_lru_walk *walk, struct ttm_buffer_object * if (bo->pin_count || !bo->bdev->funcs->eviction_valuable(bo, evict_walk->place)) return 0; - if (bo->deleted) { - lret = ttm_bo_wait_ctx(bo, walk->arg.ctx); - if (!lret) - ttm_bo_cleanup_memtype_use(bo); - } else { - lret = ttm_bo_evict(bo, walk->arg.ctx); - } - + lret = ttm_bo_evict(bo, walk->arg.ctx); if (lret) goto out; -- 2.43.0