mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Byrne <daniel1.byrne@intel.com>
To: Frank Li <Frank.li@oss.nxp.com>
Cc: Daniel Byrne <daniel1.byrne@intel.com>,
	Vinod Koul <vkoul@kernel.org>,
	dmaengine@vger.kernel.org,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Dave Jiang <dave.jiang@intel.com>, Frank Li <Frank.Li@kernel.org>,
	Fenghua Yu <fenghuay@nvidia.com>, Dan Williams <djbw@kernel.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 09/10] dmaengine: idxd: free the queue interrupt when the percpu_ref setup fails
Date: Fri,  4 Dec 2026 12:44:01 -0800	[thread overview]
Message-ID: <20261204204401.3137997-1-daniel1.byrne@intel.com> (raw)
In-Reply-To: <axGqYUCn5uH856aH@SMW015318>

On Thu, 3 Dec 2026 17:44:01 +0000, Frank Li wrote:
> > +	idxd_wq_free_irq(wq);
> >  	idxd_wq_free_resources(wq);
> > +	goto err_irq;
>
> why need go to here. avoid goto again at error path.

Hi Frank,

Thanks for the review.

The goto was there because the interrupt has to be freed before the
resources on this path. idxd_wq_free_resources() clears the queue's
type, and idxd_wq_free_irq() returns right away for a queue that is not
a kernel queue. So I could not just let it fall through to the label
below, which frees the interrupt after the resources.

I will fix this in v3. I think a better way is to allocate the resources
before the interrupt is requested. Then the unwind frees the interrupt
first and falls straight through to err_irq label (and below):

err_ref:
	idxd_wq_free_irq(wq);
err_irq:
	idxd_wq_free_resources(wq);
err_res_alloc:
	idxd_wq_unmap_portal(wq);

idxd_drv_disable_wq() also frees the interrupt before the resources. I
tested it and it leaves no interrupt or allocation behind.

Thanks,
Daniel

  reply	other threads:[~2026-12-04 20:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 19:47 [PATCH v2 00/10] dmaengine: idxd: event log, cdev and prep fixes Daniel Byrne
2026-11-30 19:47 ` [PATCH v2 01/10] dmaengine: idxd: don't queue EVL fault work for kernel WQs Daniel Byrne
2026-12-03 17:47   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 02/10] dmaengine: idxd: detach the user fault workqueue under the event log lock Daniel Byrne
2026-12-03 17:47   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 03/10] dmaengine: idxd: free the event log fault item when no record is copied Daniel Byrne
2026-12-03 17:47   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 04/10] dmaengine: idxd: refuse a memcpy longer than the WQ max transfer size Daniel Byrne
2026-12-03 17:48   ` Frank Li
2026-12-04 20:43     ` Daniel Byrne
2026-11-30 19:47 ` [PATCH v2 05/10] dmaengine: idxd: take an mm_users reference for the completion record copy Daniel Byrne
2026-12-03 17:49   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 06/10] dmaengine: idxd: read GENCFG before clearing the event log enable Daniel Byrne
2026-12-03 17:49   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 07/10] dmaengine: idxd: don't sleep for a descriptor in the prep callbacks Daniel Byrne
2026-12-03 17:49   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 08/10] dmaengine: idxd: read the event log size under its lock in the setup Daniel Byrne
2026-12-03 17:50   ` Frank Li
2026-11-30 19:47 ` [PATCH v2 09/10] dmaengine: idxd: free the queue interrupt when the percpu_ref setup fails Daniel Byrne
2026-12-03 17:44   ` Frank Li
2026-12-04 20:44     ` Daniel Byrne [this message]
2026-11-30 19:47 ` [PATCH v2 10/10] dmaengine: idxd: test a queue under its lock before quiescing it Daniel Byrne

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=20261204204401.3137997-1-daniel1.byrne@intel.com \
    --to=daniel1.byrne@intel.com \
    --cc=Frank.Li@kernel.org \
    --cc=Frank.li@oss.nxp.com \
    --cc=dave.jiang@intel.com \
    --cc=djbw@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=fenghuay@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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

all inboxes | Powered by JetHome®