From: Dave Jiang <dave.jiang@intel.com>
To: Vinicius Costa Gomes <vinicius.gomes@intel.com>,
Vinod Koul <vkoul@kernel.org>,
Dan Williams <dan.j.williams@intel.com>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND v2 01/10] dmaengine: idxd: Fix lockdep warnings when calling idxd_device_config()
Date: Fri, 16 Jan 2026 13:08:16 -0700 [thread overview]
Message-ID: <71ba3d88-70b0-4554-a379-1cfd6fec36be@intel.com> (raw)
In-Reply-To: <20260115-idxd-fix-flr-on-kernel-queues-v3-v2-1-59e106115a3e@intel.com>
On 1/15/26 3:47 PM, Vinicius Costa Gomes wrote:
> Move the check for IDXD_FLAG_CONFIGURABLE and the locking to "inside"
> idxd_device_config(), as this is common to all callers, and the one
> that wasn't holding the lock was an error (that was causing the
> lockdep warning).
>
> Suggested-by: Dave Jiang <dave.jiang@intel.com>
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/dma/idxd/device.c | 17 +++++++----------
> drivers/dma/idxd/init.c | 10 ++++------
> 2 files changed, 11 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index c26128529ff4..a704475d87b3 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -1125,7 +1125,11 @@ int idxd_device_config(struct idxd_device *idxd)
> {
> int rc;
>
> - lockdep_assert_held(&idxd->dev_lock);
> + guard(spinlock)(&idxd->dev_lock);
> +
> + if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
> + return 0;
> +
> rc = idxd_wqs_setup(idxd);
> if (rc < 0)
> return rc;
> @@ -1454,11 +1458,7 @@ int idxd_drv_enable_wq(struct idxd_wq *wq)
> }
> }
>
> - rc = 0;
> - spin_lock(&idxd->dev_lock);
> - if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
> - rc = idxd_device_config(idxd);
> - spin_unlock(&idxd->dev_lock);
> + rc = idxd_device_config(idxd);
> if (rc < 0) {
> dev_dbg(dev, "Writing wq %d config failed: %d\n", wq->id, rc);
> goto err;
> @@ -1554,10 +1554,7 @@ int idxd_device_drv_probe(struct idxd_dev *idxd_dev)
> }
>
> /* Device configuration */
> - spin_lock(&idxd->dev_lock);
> - if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
> - rc = idxd_device_config(idxd);
> - spin_unlock(&idxd->dev_lock);
> + rc = idxd_device_config(idxd);
> if (rc < 0)
> return -ENXIO;
>
> diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
> index fb80803d5b57..dd32b81a3108 100644
> --- a/drivers/dma/idxd/init.c
> +++ b/drivers/dma/idxd/init.c
> @@ -1104,12 +1104,10 @@ static void idxd_reset_done(struct pci_dev *pdev)
> idxd_device_config_restore(idxd, idxd->idxd_saved);
>
> /* Re-configure IDXD device if allowed. */
> - if (test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) {
> - rc = idxd_device_config(idxd);
> - if (rc < 0) {
> - dev_err(dev, "HALT: %s config fails\n", idxd_name);
> - goto out;
> - }
> + rc = idxd_device_config(idxd);
> + if (rc < 0) {
> + dev_err(dev, "HALT: %s config fails\n", idxd_name);
> + goto out;
> }
>
> /* Bind IDXD device to driver. */
>
next prev parent reply other threads:[~2026-01-16 20:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 22:47 [PATCH RESEND v2 00/10] dmaengine: idxd: Memory leak and FLR fixes Vinicius Costa Gomes
2026-01-15 22:47 ` [PATCH RESEND v2 01/10] dmaengine: idxd: Fix lockdep warnings when calling idxd_device_config() Vinicius Costa Gomes
2026-01-16 20:08 ` Dave Jiang [this message]
2026-01-15 22:47 ` [PATCH RESEND v2 02/10] dmaengine: idxd: Fix crash when the event log is disabled Vinicius Costa Gomes
2026-01-15 22:47 ` [PATCH RESEND v2 03/10] dmaengine: idxd: Fix possible invalid memory access after FLR Vinicius Costa Gomes
2026-01-15 22:47 ` [PATCH RESEND v2 04/10] dmaengine: idxd: Flush kernel workqueues on Function Level Reset Vinicius Costa Gomes
2026-01-16 20:16 ` Dave Jiang
2026-01-17 1:18 ` Vinicius Costa Gomes
2026-01-15 22:47 ` [PATCH RESEND v2 05/10] dmaengine: idxd: Flush all pending descriptors Vinicius Costa Gomes
2026-01-16 20:22 ` Dave Jiang
2026-01-15 22:47 ` [PATCH RESEND v2 06/10] dmaengine: idxd: Wait for submitted operations on .device_synchronize() Vinicius Costa Gomes
2026-01-16 20:27 ` Dave Jiang
2026-01-15 22:47 ` [PATCH RESEND v2 07/10] dmaengine: idxd: Fix not releasing workqueue on .release() Vinicius Costa Gomes
2026-01-15 22:47 ` [PATCH RESEND v2 08/10] dmaengine: idxd: Fix memory leak when a wq is reset Vinicius Costa Gomes
2026-01-15 22:47 ` [PATCH RESEND v2 09/10] dmaengine: idxd: Fix freeing the allocated ida too late Vinicius Costa Gomes
2026-01-15 22:47 ` [PATCH RESEND v2 10/10] dmaengine: idxd: Fix leaking event log memory 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=71ba3d88-70b0-4554-a379-1cfd6fec36be@intel.com \
--to=dave.jiang@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vinicius.gomes@intel.com \
--cc=vkoul@kernel.org \
/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
Powered by JetHome