From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81CC0606A322 for ; Fri, 4 Dec 2026 19:27:57 +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=WWLMJUvw Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 47B4B10E0FB; Fri, 4 Dec 2026 19:27:52 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4937510E603 for ; Fri, 4 Dec 2026 19:27:45 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id CA1374556E; Fri, 4 Dec 2026 19:27:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 996F41F00A10; Fri, 4 Dec 2026 19:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796412464; bh=11T4DXbYlGW9SLZOjaDcU36EjmtcxsaSxgfgMxOdk2Y=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=WWLMJUvw9VvK2wVfPu3RhCszFzfkF9mqMMeFnSzNfFd/wkOHnD4xObOKgAX8DXeeL sXBowKt/h2fnq3rd9QJKPPJyTtl0aY/yWAT0UFVygefP8uNCEar4G8ZbwY21bXlCmi vpmScmMqrfOTzAC6bU6qcmI6M7dikRHUKbqtt/+BJLmpDAMC7KV2DKmVmAlCrnv6FB fs47CmMsYbKSbxhGVs9Kennp/XjY56IJ4GzxrQOT0krBob9XMldZv7NhhYRKsJXbbA psvF1GEBEcxUVyAhATv9zZW+TdcBhdriAXyDPNjESwGNyKqZqyls22324+oERKGF4k hYcR0L8fRtPhg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/xe: Order video decode engines even physical instances first To: "Rodrigo Vivi" , intel-xe@lists.freedesktop.org In-Reply-To: <20261204190130.937235-2-rodrigo.vivi@intel.com> References: <20261204190130.937235-2-rodrigo.vivi@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 19:27:44 +0000 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] drm/xe: query_engines() returns unsorted VCS engine_instance values - [Low] drm/xe: missing Fixes trailer for VCS logical instance ordering fix -- commit 1a7463f562006324b4ed09105ea7b616a0410778 Author: Rodrigo Vivi > drm/xe: Order video decode engines even physical instances first > > Video decode engines share some units in pairs (VCS0/VCS1, VCS2/VCS3, > ...), and only engines from different pairs can decode the same frame > together. GuC requires the engines of a parallel exec queue to be > logically contiguous, but logical instances are assigned in physical > order. So on a part with VCS0, VCS1 and VCS2, the valid pair VCS0+VCS2 > can't be used, and the logically contiguous VCS0+VCS1 is not useful. > > Number the even physical instances first, then the odd ones, like i915 > does (setup_logical_ids()) and like Windows. With VCS0/1/2, logical > 0/1/2 map to physical 0/2/1, so both logical pairs are on different > units. > > This changes the logical numbering of video decode engines on some parts, > but the logical order was never part of the uAPI and already changes with > fusing. On DG2 it also restores the order i915 always used there. > > Cc: Carl Zhang > Cc: Tony Ye > Cc: Matthew Brost > Cc: Matthew Auld > Cc: Matt Roper > Cc: Gustavo Sousa > Cc: Michal Wajdeczko > Signed-off-by: Rodrigo Vivi [Severity: Low] This fixes a bug where parallel video decode exec queues could not pair valid VCS engines from different shared-unit pairs. Should this include: Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs") > diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw= _engine.c > index 959661ecb1a26..010e87cf5f4d7 100644 > --- a/drivers/gpu/drm/xe/xe_hw_engine.c > +++ b/drivers/gpu/drm/xe/xe_hw_engine.c > @@ -742,6 +742,27 @@ static int hw_engine_init(struct xe_gt *gt, struct x= e_hw_engine *hwe, > return err; > } > =20 > +/* > + * Video decode engines share some units in pairs (VCS0/VCS1, VCS2/VCS3,= ...), > + * and only engines from different pairs can work together on the same f= rame. > + * GuC requires the engines of a parallel exec queue to be logically > + * contiguous, so number the even physical instances first, then the odd= ones. > + * This way logically adjacent engines are on different pairs. > + */ > +static void hw_engine_setup_vcs_logical_order(struct xe_gt *gt) > +{ > + static const u8 order[] =3D { 0, 2, 4, 6, 1, 3, 5, 7 }; > + int logical_instance =3D 0; > + int i; > + > + for (i =3D 0; i < ARRAY_SIZE(order); i++) { > + struct xe_hw_engine *hwe =3D >->hw_engines[XE_HW_ENGINE_VCS0 + order= [i]]; > + > + if (xe_hw_engine_is_valid(hwe)) > + hwe->logical_instance =3D logical_instance++; > + } > +} [Severity: High] Does this cause DRM_XE_DEVICE_QUERY_ENGINES to return unsorted VCS engine_instance values and break parallel exec queue creation? Numbering even physical instances first leaves non-monotonic logical_instance values in gt->hw_engines[] (for example 0, 2, 1 on a 3-VCS part). query_engines() in drivers/gpu/drm/xe/xe_query.c iterates via for_each_hw_engine() and exposes hwe->logical_instance in array order. When userspace passes consecutive queried VCS entries to DRM_IOCTL_XE_EXEC_QUEUE_CREATE with width > 1 without re-sorting them, calc_validate_logical_mask() fails with -EINVAL because it requires ascending contiguous instances (current_mask !=3D prev_mask << 1). query_oa_units() in drivers/gpu/drm/xe/xe_query.c also iterates via for_each_hw_engine() and emits unsorted VCS engine_instance values when multiple VCS engines share an OA unit. Emitting engines in ascending logical_instance order per class in query_engines() and query_oa_units() would preserve the expected uAPI ordering while keeping the even-first GuC mapping. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204190130.9372= 35-2-rodrigo.vivi@intel.com?part=3D1