From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) (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 828DA33D6F0 for ; Tue, 9 Jun 2026 06:27:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780986440; cv=none; b=SbOcXPZ+47DL68fXdLU7fM6s79uksBRWuW/roq2LmrvStTcpXRth6/GfS36RZz0Ial5PLwoaChqHrCV6u68gN+riXnkwN6WMAmcUezgtYTGp3QZLTwIAjkYquYXePZl/Ksy+BuH3WTGkVI4AEzcLjTIaH4F43nLoO1HJuFhKl+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780986440; c=relaxed/simple; bh=lRensNt2qIH2jQU0UaI5dLEk8Ul+weL86uyzgwUnKDM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xt6LqA7bxL8VkFx4SIQXjO+DW2FqvkjmnSdG46UApUG/ldeZa8t0YwEr9uip2XZdrZEED+CZv54LKqdmpWYTKmKS3zLGcrWnGTvNL0eWmWc2hLAS2mei+R6Qx8uYXziwreV+KybqcQermhyk9b7XnADgstzlTQuHnYlw9hdU8to= 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=UtZFil2Q; arc=none smtp.client-ip=95.215.58.170 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="UtZFil2Q" 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=1780986436; 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=ImZshMJ6+rspWDeU8PSyvvgq3b/Nfm8OW56yaLbG3dc=; b=UtZFil2Qiyf1bDjOVvq/sutmRnZDzRBz0mxmZmocH7V7GJ3JZLqhNR8l1YcXQOvn7aT91+ 3CdWLOMklrI+61UeG3BWmhHLYUDDgSi0l5QZOgmd5IAalJcZZgGNxEgjE6g9mU5olbJqo8 QJQ9UeAjc0f/P6GAuyrqcyNXuq5/3yk= 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 05/14] drm/i915: Open-code DFS dependency list walk Date: Tue, 9 Jun 2026 14:25:17 +0800 Message-ID: <20260609062526.94907-3-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-tegra@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. __i915_schedule() builds its DFS work list while walking it by moving newly discovered dependencies to the tail. Keep the DFS walk open-coded so the next dependency is resolved after any tail moves performed by the body. This preserves the existing traversal semantics and prepares the code for the list iterator update. Signed-off-by: Kaitao Cheng --- drivers/gpu/drm/i915/i915_scheduler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c index aec1342402ca..da1f60282df8 100644 --- a/drivers/gpu/drm/i915/i915_scheduler.c +++ b/drivers/gpu/drm/i915/i915_scheduler.c @@ -190,7 +190,9 @@ static void __i915_schedule(struct i915_sched_node *node, * end result is a topological list of requests in reverse order, the * last element in the list is the request we must execute first. */ - list_for_each_entry(dep, &dfs, dfs_link) { + for (dep = list_first_entry(&dfs, typeof(*dep), dfs_link); + !list_entry_is_head(dep, &dfs, dfs_link); + dep = list_next_entry(dep, dfs_link)) { struct i915_sched_node *node = dep->signaler; /* If we are already flying, we know we have no signalers */ -- 2.43.0