Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796144609; b=b1BQu1CEi7Nk/aC8olaNc96Ow9v3LvtQbA8G7MYE1XPXaU+egkpeiXvzhYaF4XkgLjkD POufMfYsPAw44QHtum/kclhWuPEp9pST9PcP8mJIe42AnG4daVk+u7SfcBsBipGcW7fvm hxbyNadgHEmzBhTGECqg7zS5pKDEHYJNBP9e721LzBOEVOzoWuR5rCHM0FtYIeMfDCr/S IpuUTzVA1w9Ccy8fizhfkLrBrv1WEAjC4RXVr5z3ATq0Cm3Pb8wyQJgjp/NNg/VuMtRbT oOTTl5+RrCex0Wnw3oqSFQtkfgdPba8qnsraPaolDbkudq6ANC3sCv3gZBffB3aYwAA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796144609; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=QR5jdpH2xCuBXQ279x4bjdFwwBbmmUpMklmvKEFRXMI=; b=k7rSe0L5oKbMKmNaeDlnbiv/cfKDanUI8ohjduF50m2RVgqncv0nmACxe5Huan/XTqQw yiXfyqHq1rdmNhvHXtBt31R5O7KADnaVENx4MLJC3RGAhzhveDKSUk3HcaOMkTDoSJqQD bLWLNlss0rIBQIFxX6fnfujgR51HRrTz+X0GJPTTqrmRSBGqWokcmBBZs8PywXvUtnp5K D8ukwJ0vcbbtpsXDas9Gz+zHkcr0aV18NwdnlVR5jOW8wC5SvzOiCCFc8JJCT+JAQ4ZnP wl8Pv1FyxC2Bb21/xTlYOUWBb7J91uR5NVyq5Oy7k4X471ZL5Po/X3JaoK7rB0/cO3g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q2onsw6r; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F865606A322 for ; Tue, 1 Dec 2026 17:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Q2onsw6r Received: by smtp.kernel.org (Postfix) with ESMTPSA id 011B71F000C1; Tue, 1 Dec 2026 17:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796144609; bh=QR5jdpH2xCuBXQ279x4bjdFwwBbmmUpMklmvKEFRXMI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Q2onsw6rW7ptvalKhTW+oswUNZFZ38JYv2IzwW46kT08gt6j4jYBgXHgj4JHhZRpK 0iUbJiH33YtdogUHDfZjCy+FhYk1vTop8WMkx/VeOASFWvgV+T5pUm8zoWyIVg0aEe pBozfcQrqNvesQidSvYMkY6l35SYH83+8vIeqXunl+7JRxnMFdQXfJA+I0iyZbpdqP Aeontu3lfH52HRm/mkhCKOkqqwUpCdCeHY+6G6dSu3nSYdf7RqGCdMvFuaz6xc/KG0 ijOnTtpJ2y1B6IRLxGaEdvD1ADqtZxsUQEmFa9LpoFo4jFaJeBLh74deQ4WV6dQE8s aAdBcNb0k6t9Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] dma-buf: improve robustness of dma_fence_unwrap_for_each Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?Q2hyaXN0aWFuIEvDtm5pZw==?= Cc: dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261201165600.9415-1-christian.koenig@amd.com> References: <20261201165600.9415-1-christian.koenig@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 17:03:28 +0000 X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] dma-buf: build failure in xe_sync_entry_add_deps() after unwrap macro change -- commit aec8a67605f7a8aa3f0d24386ca64c094e746176 Author: Christian K=C3=B6nig dma-buf: improve robustness of dma_fence_unwrap_for_each This commit adds a cleanup function for struct dma_fence_unwrap, embeds the cursor inside dma_fence_unwrap_for_each() with __cleanup(), and updates callers to pass two arguments instead of three. > diff --git a/include/linux/dma-fence-unwrap.h b/include/linux/dma-fence-u= nwrap.h > index 7bfacdf79de21..1829e2a655b95 100644 > --- a/include/linux/dma-fence-unwrap.h > +++ b/include/linux/dma-fence-unwrap.h > @@ -32,27 +32,33 @@ struct dma_fence_unwrap { > unsigned int index; > }; > =20 > -struct dma_fence *dma_fence_unwrap_first(struct dma_fence *head, > - struct dma_fence_unwrap *cursor); > -struct dma_fence *dma_fence_unwrap_next(struct dma_fence_unwrap *cursor); > +struct dma_fence_unwrap dma_fence_unwrap_first(struct dma_fence *head, > + struct dma_fence **fence); > +void dma_fence_unwrap_next(struct dma_fence_unwrap *cursor, > + struct dma_fence **fence); > +void dma_fence_unwrap_cleanup(struct dma_fence_unwrap *cursor); > + > +/* Helper for dma_fence_unwrap_for_each(). Internal use only. */ > +#define __dma_fence_unwrap_for_each(fence, cursor, head) \ > + for (struct dma_fence_unwrap cursor \ > + __cleanup(dma_fence_unwrap_cleanup) \ > + =3D dma_fence_unwrap_first(head, &(fence)); fence; \ > + dma_fence_unwrap_next(&cursor, &(fence))) > =20 > /** > * dma_fence_unwrap_for_each - iterate over all fences in containers > * @fence: current fence > - * @cursor: current position inside the containers > * @head: starting point for the iterator > * > * Unwrap dma_fence_chain and dma_fence_array containers and deep dive i= nto all > * potential fences in them. If @head is just a normal fence only that o= ne is > * returned. > */ > -#define dma_fence_unwrap_for_each(fence, cursor, head) \ > - for (fence =3D dma_fence_unwrap_first(head, cursor); fence; \ > - fence =3D dma_fence_unwrap_next(cursor)) > +#define dma_fence_unwrap_for_each(fence, head) \ > + __dma_fence_unwrap_for_each(fence, __UNIQUE_ID(cursor), head) [Severity: High] Does changing dma_fence_unwrap_for_each() to take two arguments break the build in xe_sync_entry_add_deps() when CONFIG_DRM_XE is enabled? drivers/gpu/drm/xe/xe_sync.c:xe_sync_entry_add_deps() { struct dma_fence_unwrap iter; ... dma_fence_unwrap_for_each(fence, &iter, sync->fence) { /* * There is no dma_fence_unwrap_stop() helper to drop the * reference the iterator holds, so keep iterating without * doing anything once an error has occurred. */ if (err || dma_fence_is_signaled(fence)) continue; err =3D drm_sched_job_add_dependency(&job->drm, dma_fence_get(fence)); } ... } xe_sync_entry_add_deps() still passes three arguments to dma_fence_unwrap_for_each() and retains the manual error-continuation workaround. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201165600.9415= -1-christian.koenig@amd.com?part=3D1