From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 3507924BD03 for ; Tue, 9 Jun 2026 06:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780986462; cv=none; b=Sbrorcug62myDghjYXkirgcMPgAKoIfiPMahFnUx9tlw5PEiIg81Vsf1BEQ29Ry2oVmYdewP6OZP87GbPA++gdGDInzpvAEL2C3R/bEvf8W9nNvN/fjLJRA721ixbIk6u5tM+6nbs8O4BSxaSAstEGMhwOyPH3VK6RGFKdnImV0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780986462; c=relaxed/simple; bh=STx6nBgIcjEOVH7P/qexl67KcqLFaLLXNBCxrJ53Az0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mdthWoFiK4aivBRXI5KuJXYEPVGk6ERfhuz72Dt/+8K4vpFtE7dHvTC9HCrr9Z3MFFgS1QIJA6NRx4ZK3yhgC8aBgAs0vESwsvrnAUUGDO1vZxDQwC6bgAQCG1/n0da+/pC3VeObkEtuPdsRuFbwsgqulhkVSM5k/XVW0b7tl+o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=NKWAMzkE; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="NKWAMzkE" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780986458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZrojwXEBMB/P79bsKRHj5UlAkbCjSpysFG8D760YAYc=; b=NKWAMzkED0iwSsplBCqatf8ppHySaCSLdpL/bsV2wcHhaniHEa4DrJKj5/YKEKDH5LIYJ0 YA+OmzUXKnTynxMf3ONQ9Pdo6L/MshQELjc7teUVMdQb+/NeGlb9xqhofXw4J1os8gDyE8 xGlwu4UCbTQs16gUlhpG6eFxpC8upIo= From: Kaitao Cheng To: Andy Shevchenko , Muchun Song , Philipp Reisner , Lars Ellenberg , =?UTF-8?q?Christoph=20B=C3=B6hmwalder?= , Jens Axboe , Takashi Sakamoto , Andrzej Hajda , Neil Armstrong , Robert Foss , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Christian Koenig , Huang Rui , Eddie James , Mark Brown , Maxime Coquelin , Alexandre Torgue , Laxman Dewangan , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Davidlohr Bueso , "Paul E . McKenney" , Josh Triplett , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Liam Girdwood , Jaroslav Kysela , Takashi Iwai Cc: Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Matthew Auld , Matthew Brost , Waiman Long , drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, linux1394-devel@lists.sourceforge.net, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-spi@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Morton , Randy Dunlap , Christian Brauner , David Howells , Luca Ceresoli , Kaitao Cheng , Kaitao Cheng Subject: [PATCH v2 06/14] drm/ttm: Open-code reservation list walk Date: Tue, 9 Jun 2026 14:25:18 +0800 Message-ID: <20260609062526.94907-4-kaitao.cheng@linux.dev> In-Reply-To: <20260609062526.94907-1-kaitao.cheng@linux.dev> References: <20260609061347.93688-1-kaitao.cheng@linux.dev> <20260609062526.94907-1-kaitao.cheng@linux.dev> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Kaitao Cheng A later change will make list_for_each_entry() cache the next element before entering the loop body. ttm_eu_reserve_buffers() may move the current validation buffer to the duplicates list and then rewinds the cursor before continuing. Keep the reservation walk open-coded so the loop step uses the cursor selected by that duplicate handling. This preserves the existing traversal semantics and prepares the code for the list iterator update. Signed-off-by: Kaitao Cheng --- drivers/gpu/drm/ttm/ttm_execbuf_util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c index bc7a83a9fe44..8072f07d5557 100644 --- a/drivers/gpu/drm/ttm/ttm_execbuf_util.c +++ b/drivers/gpu/drm/ttm/ttm_execbuf_util.c @@ -86,7 +86,9 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, if (ticket) ww_acquire_init(ticket, &reservation_ww_class); - list_for_each_entry(entry, list, head) { + for (entry = list_first_entry(list, typeof(*entry), head); + !list_entry_is_head(entry, list, head); + entry = list_next_entry(entry, head)) { struct ttm_buffer_object *bo = entry->bo; unsigned int num_fences; -- 2.43.0