mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Dave Jiang <dave.jiang@intel.com>, Vinod Koul <vkoul@kernel.org>,
	 Frank Li <Frank.Li@kernel.org>, Fenghua Yu <fenghuay@nvidia.com>,
	 Shuai Xue <xueshuai@linux.alibaba.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	 Steve Wahl <steve.wahl@hpe.com>,
	stable@vger.kernel.org,  Jingyi Li <jinli@purestorage.com>,
	 Bogdan Codres <bogdan.codres@windriver.com>,
	 Zhenzhong Duan <zhenzhong.duan@intel.com>
Subject: [PATCH v2 0/8] dmaengine: idxd: More error handling fixes
Date: Wed, 25 Nov 2026 15:48:58 -0800	[thread overview]
Message-ID: <20261125-wt-idxd-fixes-v2-0-25a4691dfb9e@intel.com> (raw)

This series fixes error handling in the idxd driver.

1/8 and 3/8 fix crashes seen in a kdump kernel, where the device reset
fails during probe. 2/8 fixes the same kind of double free for failures
after idxd_setup_internals(). Jingyi Li tested them on 10 systems with
DSA. 1/8 to 3/8 should be backported together: with only 1/8, a probe
failure after idxd_setup_internals() still destroys the workqueue
twice, and a failed device reset still double frees in idxd_free().

4/8 to 6/8 fix the device registration, idxd_cdev_open() and WQ setup
error paths.

7/8 and 8/8 fix terminate_all(). Since v7.0 it releases the WQ's
interrupt handle, so later transfers on the channel fail with "Device
error 0x19". It also sleeps, and frees descriptors the device may still
use.

7/8 and 8/8 overlap with two patches of Daniel Byrne's series, "dmaengine:
idxd: keep the interrupt handle across terminate_all" and "dmaengine:
idxd: quarantine terminate_all's descriptor slots until the device has
drained":
https://lore.kernel.org/r/20261019150630.4026341-7-daniel1.byrne@intel.com
https://lore.kernel.org/r/20261019150630.4026341-10-daniel1.byrne@intel.com

Left for a separate series: currently, on a shared WQ, two opens by
the same mm share one PASID entry, and closing the first one removes
it, so the completion records of the other's page faults are
dropped (pointed out by Sashiko on v1 5/6). Proper support will be
added on a later series.

An AI coding assistant was used to triage the v1 review comments, to
help write and review the v2 changes to 4/8 and 5/8, to help write 6/8,
8/8 and the INVALID_INT_HANDLE check in 7/8, and with the testing.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
Changes in v2:
- 1/8, 3/8: use () after function names (Frank); add my Signed-off-by
  instead of the Acked-by (Dave)
- 1/8, 2/8, 3/8: add Cc: stable and Jingyi's Tested-by
- Move "Fix potential double free on probe error path" (v1 3/6) to 2/8,
  next to 1/8, as they need to be backported together
- 2/8: keep flushing the device workqueue in idxd_cleanup_internals(),
  before the registers are unmapped (added after Jingyi's Tested-by and
  Dave's Reviewed-by)
- 4/8: also stop the registration error paths from dropping the
  device references that idxd_cleanup() drops again (Sashiko)
- 5/8: fail the open on xa_insert() errors other than -EBUSY (Sashiko),
  and disable the PASID of a dedicated WQ when ida_alloc() fails
  (Sashiko)
- New 6/8: initialize the WQ XArray before the WQ can be released
- 7/8 (v1 6/6): don't release an interrupt handle that is already
  invalid (Sashiko); add Cc: stable
- New 8/8: don't sleep or free descriptors in terminate_all(), leave
  that to synchronize(), after the drain (Sashiko)
- Link to v1: https://patch.msgid.link/20261012-wt-idxd-fixes-v1-0-30a35a445077@intel.com

---
Steve Wahl (2):
      dmaengine: idxd: Do not call destroy_workqueue() with null idxd->wq
      dmaengine: idxd: fix duplicate memory frees on initialization error path

Vinicius Costa Gomes (6):
      dmaengine: idxd: Fix potential double free on probe error path
      dmaengine: idxd: Fix the device registration error paths
      dmaengine: idxd: Fix error handling in idxd_cdev_open()
      dmaengine: idxd: Initialize the WQ XArray before the WQ can be released
      dmaengine: idxd: Do not release interrupt handles on terminate_all()
      dmaengine: idxd: Don't flush the descriptors on terminate_all()

 drivers/dma/idxd/cdev.c   | 12 ++++++++++--
 drivers/dma/idxd/device.c | 24 ++++++++++++++++++------
 drivers/dma/idxd/dma.c    | 47 ++++++++++++++++++++++++++++++++++++++---------
 drivers/dma/idxd/idxd.h   |  4 ++++
 drivers/dma/idxd/init.c   | 27 ++++++++++-----------------
 drivers/dma/idxd/irq.c    |  1 +
 drivers/dma/idxd/sysfs.c  | 43 +++++++++++++------------------------------
 7 files changed, 94 insertions(+), 64 deletions(-)
---
base-commit: d460a02aa0ac6ba9e5d87f8462f75d78be83146e
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git fixes
change-id: 20260803-wt-idxd-fixes-1a06bb69b1e0

Best regards,
--  
Vinicius


             reply	other threads:[~2026-11-25 23:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 23:48 Vinicius Costa Gomes [this message]
2026-11-25 23:48 ` [PATCH v2 1/8] dmaengine: idxd: Do not call destroy_workqueue() with null idxd->wq Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 2/8] dmaengine: idxd: Fix potential double free on probe error path Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 3/8] dmaengine: idxd: fix duplicate memory frees on initialization " Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 4/8] dmaengine: idxd: Fix the device registration error paths Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 5/8] dmaengine: idxd: Fix error handling in idxd_cdev_open() Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 6/8] dmaengine: idxd: Initialize the WQ XArray before the WQ can be released Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 7/8] dmaengine: idxd: Do not release interrupt handles on terminate_all() Vinicius Costa Gomes
2026-11-25 23:49 ` [PATCH v2 8/8] dmaengine: idxd: Don't flush the descriptors " Vinicius Costa Gomes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125-wt-idxd-fixes-v2-0-25a4691dfb9e@intel.com \
    --to=vinicius.gomes@intel.com \
    --cc=Frank.Li@kernel.org \
    --cc=bogdan.codres@windriver.com \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=fenghuay@nvidia.com \
    --cc=jinli@purestorage.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=steve.wahl@hpe.com \
    --cc=vkoul@kernel.org \
    --cc=xueshuai@linux.alibaba.com \
    --cc=zhenzhong.duan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®