From: Keith Busch <kbusch@kernel.org>
To: Tong Zhang <ztong0001@gmail.com>
Cc: Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>,
Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
t.zhang2@samsung.com
Subject: Re: [PATCH] nvme-pci: free irq properly when cannot create adminq
Date: Thu, 29 Dec 2022 11:04:33 -0700 [thread overview]
Message-ID: <Y63WsX8Hvxep/dtN@kbusch-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <20221229060549.3976570-1-ztong0001@gmail.com>
On Wed, Dec 28, 2022 at 10:05:49PM -0800, Tong Zhang wrote:
> nvme_pci_configure_admin_queue could return -ENODEV, in this case, we
> will need to free IRQ properly. Otherwise following warning could be
> triggered
>
> [ 5.286752] WARNING: CPU: 0 PID: 33 at kernel/irq/irqdomain.c:253 irq_domain_remove+0x12d/0x140
> [ 5.290547] Call Trace:
> [ 5.290626] <TASK>
> [ 5.290695] msi_remove_device_irq_domain+0xc9/0xf0
> [ 5.290843] msi_device_data_release+0x15/0x80
> [ 5.290978] release_nodes+0x58/0x90
> [ 5.293788] WARNING: CPU: 0 PID: 33 at kernel/irq/msi.c:276 msi_device_data_release+0x76/0x80
> [ 5.297573] Call Trace:
> [ 5.297651] <TASK>
> [ 5.297719] release_nodes+0x58/0x90
> [ 5.297831] devres_release_all+0xef/0x140
> [ 5.298339] device_unbind_cleanup+0x11/0xc0
> [ 5.298479] really_probe+0x296/0x320
>
> Fixes: a6ee7f19ebfd ("nvme-pci: call nvme_pci_configure_admin_queue from nvme_pci_enable")
Right. It's really only needed when called from probe as the reset_work
handles the cleanup when called from there, but this is safe for both
cases.
> @@ -2584,8 +2584,13 @@ static int nvme_pci_enable(struct nvme_dev *dev)
> pci_enable_pcie_error_reporting(pdev);
> pci_save_state(pdev);
>
> - return nvme_pci_configure_admin_queue(dev);
> + result = nvme_pci_configure_admin_queue(dev);
> + if (result)
> + goto free_irq;
> + return result;
Since you're already in this function, you should also add a "goto
disable" if pci_alloc_irq_vectors() fails. Right now it just returns
with the pci device still enabled, and it won't get disabled from probe.
> + free_irq:
> + pci_free_irq_vectors(pdev);
> disable:
> pci_disable_device(pdev);
> return result;
> --
next prev parent reply other threads:[~2022-12-29 18:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-29 6:05 Tong Zhang
2022-12-29 18:04 ` Keith Busch [this message]
2022-12-29 18:37 ` [PATCH v2] nvme-pci: fix error handling in nvme_pci_enable() Tong Zhang
2022-12-29 18:43 ` Keith Busch
2023-01-08 18:15 ` Christoph Hellwig
2022-12-29 18:39 ` [PATCH] nvme-pci: free irq properly when cannot create adminq Tong Zhang
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=Y63WsX8Hvxep/dtN@kbusch-mbp.dhcp.thefacebook.com \
--to=kbusch@kernel.org \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=kch@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
--cc=t.zhang2@samsung.com \
--cc=ztong0001@gmail.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®