From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796023422; b=KM3GvwvCeCpItf15jUe/WnG5uyZX0YSHvpilfngFMMRSGjqmKekSho10rDqNV96osVfO cJAQSWnjOged9hl8RdIzqysEShWWoPLEf7DU6/1jS3CXiRoIDs6KMiza/6dsFelGKR47N 7L3la5cGElO68RDncXYXF0vhcokgazgjjnsT7Gw53dWGuE6hgoZBiGAf+b0ZQ9vGaHIYX 0/I4dk4GJ655Cqh5cP2jr665xaE4vfJoQR6xNLd9mgtqXcXYdCc+DCOyfXZwABC5IwMqr pQEWQS2d0bmtFE8GJm1y2oWUSZeF7TFeBIisPoasTgHzyGqhSVAwYHlb5oBsTEU5L6w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796023422; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=9jvUiEnkcV+KoHGzUFyvTMn20HalMBUTIKaOsv0E1I8=; b=HaGCYkNuC0VsQ/2N2ScRPyOFIWAz/HWDiiJPfDyIiCmIQr5EQ9N7NFvYyYHKzeGABZ2e 8BZiktwhcpUOJA32EmVbLKIFA8eFHfC8hNj4fvmtaokQC7hZJeCi2th8Bkw0WApviE8cd 00l96uD/De6uF8I9TFvLG2thVU/muCe/DEyWlxEaSeTHPMbNGFbbGOBSN76a3He2BT4La Dxv/4ZQ3bSTtGhtaoRmdQ5val4E/Asp8E2ycMdIx9F5ReBzYoXPHX7mcqB3Kt/JEiE8Sp o1Qh2+aqBE73TQ0cHUa0EV7ZDI70h6zEUQbRukXiesDjan7g8UtbgGz9FWuId4s85tw== 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=j6SD8tnf; 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 F27FD606A31C for ; Mon, 30 Nov 2026 07:23:41 +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=j6SD8tnf Received: by smtp.kernel.org (Postfix) with ESMTPSA id 983ED1F000C1; Mon, 30 Nov 2026 07:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796023421; bh=9jvUiEnkcV+KoHGzUFyvTMn20HalMBUTIKaOsv0E1I8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=j6SD8tnfqI6Zpnma2pymFjzdklULQbhJYibiKvn7dbt0E8uKMgBlo1aiUJlnG8e6H tXKLHUPMJ8hRd1enxoAM7kCW/OyhhmWoN7xfPPbpTmVLj3D5vgx9dTe77Pid64j6Qh syDUW1240/lH5q3Tv4eZkrcQlBU5t6ltUcDJ3JI8dhVPJL4jFG4884xw5QfbjImP33 mYXkajK73uwvItp/rlELa3bowZ0utvunKY0/vldGZIPS7Q79/p9INnosEn1BTiE1Sy vZV74rZEMBHr+ZVlIz0cy7V+AcTytWctiwgXHtlnWt4j6riGW/ck1z4BAs/CLM96FI 2Wx+qcdmAez2A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/2] dmaengine: idxd: Keep wqs dedicated without shared wq support Reply-To: sashiko-reviews@lists.linux.dev To: "Fei Yu" , dmaengine@vger.kernel.org Cc: vkoul@kernel.org, Frank.Li@kernel.org In-Reply-To: <20261130071338.3120264-2-fei.yu@intel.com> References: <20261130071338.3120264-1-fei.yu@intel.com> <20261130071338.3120264-2-fei.yu@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 07:23:41 +0000 X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] dmaengine: idxd: disabled wq still fails idxd_wqs_setup() when shared supported - [Medium] dmaengine: idxd: device_shared_wq_supported() ignores disabled device PASID -- commit 78fa6a3a91a335286fae219516810f795a72cd14 Author: Fei Yu dmaengine: idxd: Keep wqs dedicated without shared wq support This commit introduces device_shared_wq_supported() and keeps workqueues in dedicated mode during initial setup and after workqueue disable on devices that do not support shared workqueues. > diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c > index 131138483b877..e641793f2ce5b 100644 > --- a/drivers/dma/idxd/device.c > +++ b/drivers/dma/idxd/device.c > @@ -387,6 +387,15 @@ static void idxd_wq_disable_cleanup(struct idxd_wq *= wq) > wq->priority =3D 0; > wq->enqcmds_retries =3D IDXD_ENQCMDS_RETRIES; > wq->flags =3D 0; > + /* > + * The wq keeps its size and group (see idxd_wq_device_reset_cleanup()), > + * so it stays part of the device configuration. Without shared wq > + * support, keep it dedicated: a shared wq would make the configuration > + * invalid, and the device would fail to be configured again, e.g. after > + * an FLR. > + */ > + if (!device_shared_wq_supported(idxd)) > + set_bit(WQ_FLAG_DEDICATED, &wq->flags); [Severity: High] Does disabling a workqueue on a device where device_shared_wq_supported() is true still cause the next idxd_wqs_setup() to fail with -EINVAL? When device_shared_wq_supported(idxd) is true, idxd_wq_disable_cleanup() leaves wq->flags cleared (shared) while keeping wq->group set. Right afterward, idxd_wq_free_resources() (or idxd_user_drv_remove() for user workqueues) resets wq->type to IDXD_WQT_NONE. Because wq_pasid_enabled() requires wq->type to be IDXD_WQT_KERNEL or IDXD_WQT_USER, wq_shared_supported(wq) returns false for any disabled workqueue: drivers/dma/idxd/idxd.h:wq_pasid_enabled() { return (is_idxd_wq_kernel(wq) && device_pasid_enabled(wq->idxd)) || (is_idxd_wq_user(wq) && device_user_pasid_enabled(wq->idxd)); } On the next idxd_device_config() -> idxd_wqs_setup() (for example after an FLR or when enabling another workqueue on the device), the disabled workqueue still has wq->group !=3D NULL, wq_shared(wq) =3D=3D true, and wq_shared_supported(wq) =3D=3D false, so idxd_wqs_setup() rejects the configuration with IDXD_SCMD_WQ_NO_SWQ_SUPPORT and halts the device. > diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h > index ce78b9a7c641c..f5fe7442f2169 100644 > --- a/drivers/dma/idxd/idxd.h > +++ b/drivers/dma/idxd/idxd.h > @@ -607,6 +607,19 @@ static inline bool wq_shared_supported(struct idxd_w= q *wq) > return (support_enqcmd && wq_pasid_enabled(wq)); > } > =20 > +/* > + * Can any wq of the device, kernel or user, be a shared wq? Unlike > + * wq_shared_supported(), this does not depend on the wq type, so it also > + * answers for a wq whose type is not set yet. > + */ > +static inline bool device_shared_wq_supported(struct idxd_device *idxd) > +{ > + if (!(device_pasid_enabled(idxd) || device_user_pasid_enabled(idxd))) > + return false; > + > + return support_enqcmd; > +} [Severity: Medium] Does device_shared_wq_supported() return true on ENQCMD-capable CPUs even when PASID is not enabled on the device? In idxd_probe(), IDXD_FLAG_USER_PASID_ENABLED is set unconditionally whenever CONFIG_INTEL_IDXD_SVM and sva are enabled, regardless of whether PASID is actually enabled on the device: drivers/dma/idxd/init.c:idxd_probe() { ... if (IS_ENABLED(CONFIG_INTEL_IDXD_SVM) && sva) { set_bit(IDXD_FLAG_USER_PASID_ENABLED, &idxd->flags); rc =3D idxd_enable_system_pasid(idxd); if (rc) dev_warn(dev, "No in-kernel DMA with PASID. %d\n", rc); else set_bit(IDXD_FLAG_PASID_ENABLED, &idxd->flags); } ... } As a result, device_user_pasid_enabled(idxd) is true even when PASID is disabled in the IOMMU or PCIe endpoint, so idxd_setup_wqs() and idxd_wq_disable_cleanup() will not set WQ_FLAG_DEDICATED on ENQCMD systems without PASID enabled. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130071338.3120= 264-1-fei.yu@intel.com?part=3D1