From: Guenter Roeck <linux@roeck-us.net>
To: Klaus Jensen <its@irrelevant.dk>
Cc: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org, qemu-block@nongnu.org,
qemu-devel@nongnu.org
Subject: Re: completion timeouts with pin-based interrupts in QEMU hw/nvme
Date: Tue, 17 Jan 2023 08:05:50 -0800 [thread overview]
Message-ID: <20230117160550.GA3091262@roeck-us.net> (raw)
In-Reply-To: <Y8W+H6T9DOZ08SoF@cormorant.local>
On Mon, Jan 16, 2023 at 10:14:07PM +0100, Klaus Jensen wrote:
[ ... ]
>
> I noticed that the Linux driver does not use the INTMS/INTMC registers
> to mask interrupts on the controller while processing CQEs. While not
> required by the spec, it is *recommended* in setups not using MSI-X to
> reduce the risk of spurious and/or missed interrupts.
>
> With the patch below, running 100 boot iterations, no timeouts were
> observed on QEMU emulated riscv64 or mips64.
>
> No changes are required in the QEMU hw/nvme interrupt logic.
>
Yes, but isn't that technically similar to dropping the
interrupt request and raising it again, or in other words
pulsing the interrupt ?
I still don't understand why the (level triggered) interrupt
pin would require pulsing in the first place.
Thanks,
Guenter
>
> diff --git i/drivers/nvme/host/pci.c w/drivers/nvme/host/pci.c
> index b13baccedb4a..75f6b87c4c3f 100644
> --- i/drivers/nvme/host/pci.c
> +++ w/drivers/nvme/host/pci.c
> @@ -1128,6 +1128,27 @@ static inline int nvme_poll_cq(struct nvme_queue *nvmeq,
> }
>
> static irqreturn_t nvme_irq(int irq, void *data)
> +{
> + struct nvme_queue *nvmeq = data;
> + struct nvme_dev *dev = nvmeq->dev;
> + u32 mask = 1 << nvmeq->cq_vector;
> + irqreturn_t ret = IRQ_NONE;
> + DEFINE_IO_COMP_BATCH(iob);
> +
> + writel(mask, dev->bar + NVME_REG_INTMS);
> +
> + if (nvme_poll_cq(nvmeq, &iob)) {
> + if (!rq_list_empty(iob.req_list))
> + nvme_pci_complete_batch(&iob);
> + ret = IRQ_HANDLED;
> + }
> +
> + writel(mask, dev->bar + NVME_REG_INTMC);
> +
> + return ret;
> +}
> +
> +static irqreturn_t nvme_irq_msix(int irq, void *data)
> {
> struct nvme_queue *nvmeq = data;
> DEFINE_IO_COMP_BATCH(iob);
> @@ -1602,12 +1623,13 @@ static int queue_request_irq(struct nvme_queue *nvmeq)
> {
> struct pci_dev *pdev = to_pci_dev(nvmeq->dev->dev);
> int nr = nvmeq->dev->ctrl.instance;
> + irq_handler_t handler = pdev->msix_enabled ? nvme_irq_msix : nvme_irq;
>
> if (use_threaded_interrupts) {
> return pci_request_irq(pdev, nvmeq->cq_vector, nvme_irq_check,
> - nvme_irq, nvmeq, "nvme%dq%d", nr, nvmeq->qid);
> + handler, nvmeq, "nvme%dq%d", nr, nvmeq->qid);
> } else {
> - return pci_request_irq(pdev, nvmeq->cq_vector, nvme_irq,
> + return pci_request_irq(pdev, nvmeq->cq_vector, handler,
> NULL, nvmeq, "nvme%dq%d", nr, nvmeq->qid);
> }
> }
>
>
next prev parent reply other threads:[~2023-01-17 16:07 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 13:10 completion timeouts with pin-based interrupts in QEMU hw/nvme Klaus Jensen
2023-01-12 14:26 ` Guenter Roeck
2023-01-12 16:34 ` Keith Busch
2023-01-12 17:45 ` Klaus Jensen
2023-01-12 17:51 ` Keith Busch
2023-01-12 19:14 ` Guenter Roeck
2023-01-12 19:27 ` Keith Busch
2023-01-13 0:27 ` Guenter Roeck
2023-01-12 23:57 ` Guenter Roeck
2023-01-13 8:54 ` Klaus Jensen
2023-01-13 12:32 ` Peter Maydell
2023-01-13 12:37 ` Klaus Jensen
2023-01-13 12:42 ` Peter Maydell
2023-01-13 12:46 ` Klaus Jensen
2023-01-13 16:52 ` Keith Busch
2023-01-16 21:14 ` Klaus Jensen
2023-01-17 4:58 ` Keith Busch
2023-01-17 16:09 ` Guenter Roeck
2023-01-17 16:18 ` Peter Maydell
2023-01-17 19:21 ` Guenter Roeck
2023-01-18 15:04 ` Peter Maydell
2023-01-18 16:33 ` Keith Busch
2023-01-18 23:06 ` Keith Busch
2023-01-19 0:41 ` Alistair Francis
2023-01-19 2:44 ` Keith Busch
2023-01-19 3:10 ` Alistair Francis
2023-01-19 4:03 ` Keith Busch
2023-01-19 7:28 ` Klaus Jensen
2023-01-19 8:02 ` Klaus Jensen
2023-01-19 14:32 ` Guenter Roeck
2023-01-19 10:35 ` Peter Maydell
2023-01-17 16:05 ` Guenter Roeck [this message]
2023-01-18 4:17 ` Keith Busch
2023-01-18 22:26 ` Keith Busch
2023-01-19 7:06 ` Klaus Jensen
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=20230117160550.GA3091262@roeck-us.net \
--to=linux@roeck-us.net \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=its@irrelevant.dk \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sagi@grimberg.me \
/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