All of lore.kernel.org
 help / color / mirror / Atom feed
From: Naman Jain <namjain@linux.microsoft.com>
To: Keith Busch <kbusch@kernel.org>
Cc: linux-nvme@lists.infradead.org, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Michael Kelley <mhklinux@outlook.com>,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 3/3] nvme-pci: defer completions when rescheduling is needed
Date: Mon, 12 Oct 2026 12:17:38 +0530	[thread overview]
Message-ID: <8aba4809-6655-4bfd-a83a-25c5ab816645@linux.microsoft.com> (raw)
In-Reply-To: <askIoNon8UVyNJiJ@kbusch-mbp>



On 10/9/2026 9:00 PM, Keith Busch wrote:
> On Fri, Oct 09, 2026 at 05:05:56AM +0000, Naman Jain wrote:
>>   static irqreturn_t nvme_irq(int irq, void *data)
>>   {
>>   	struct nvme_queue *nvmeq = data;
>>   	DEFINE_IO_COMP_BATCH(iob);
>>   
>> +	if (unlikely(test_and_clear_bit(NVMEQ_IRQ_POLL_HANDOFF,
>> +					&nvmeq->flags))) {
>> +		if (!nvme_cqe_pending(nvmeq))
>> +			return IRQ_HANDLED;
>> +	}
>> +	if (unlikely(test_bit(NVMEQ_IRQ_POLL_PAUSED, &nvmeq->flags) &&
>> +		     (!test_bit(NVMEQ_IRQ_POLL_INIT, &nvmeq->flags) ||
>> +		      test_bit(NVMEQ_IRQ_POLL_MASKED, &nvmeq->flags) ||
>> +		      READ_ONCE(to_pci_dev(nvmeq->dev->dev)->error_state) !=
>> +				pci_channel_io_normal)))
>> +		return IRQ_HANDLED;
>> +
>> +	if (unlikely(in_hardirq() &&
>> +		     test_bit(NVMEQ_IRQ_POLL_INIT, &nvmeq->flags) &&
>> +		     !test_bit(NVMEQ_IRQ_POLL_PAUSED, &nvmeq->flags) &&
>> +		     need_resched() && nvme_cqe_pending(nvmeq) &&
>> +		     !test_and_set_bit_lock(NVMEQ_IRQ_POLL, &nvmeq->flags))) {
>> +		set_bit(NVMEQ_IRQ_POLL_MASKED, &nvmeq->flags);
>> +		disable_irq_nosync(irq);
>> +		irq_poll_sched(&nvmeq->iopoll);
>> +		return IRQ_HANDLED;
>> +	}
> 
> The disable_irq_nosync still does non-posted transactions for msi and
> msi-x. NVMe has a shortcut for msi, but there's currently nothing for
> msi-x. For that case, I have a prep patch I consulted with Thomas, and
> the result is below. I'm delayed sending it out while catching up from
> travel, but I think this will be even more efficient.
> 

Thanks for sharing. I'll give it a try. IIUC, after your patch goes in, 
I should be using disable_irq_nowait() in above and see better 
performance. Please correct me if I am wrong. I'll monitor your patch in 
LKML for future versions.

Regards,
Naman

  reply	other threads:[~2026-10-12  6:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  5:05 [RFC PATCH 0/3] nvme-pci: yield completions under scheduler pressure Naman Jain
2026-10-09  5:05 ` [RFC PATCH 1/3] nvme-pci: select IRQ_POLL Naman Jain
2026-10-09  5:05 ` [RFC PATCH 2/3] nvme-pci: make completion queue polling softirq-safe Naman Jain
2026-10-09  5:05 ` [RFC PATCH 3/3] nvme-pci: defer completions when rescheduling is needed Naman Jain
2026-10-09 15:30   ` Keith Busch
2026-10-12  6:47     ` Naman Jain [this message]
2026-10-12 14:28       ` Keith Busch
2026-10-12 16:24         ` Naman Jain
2026-10-09  5:54 ` [RFC PATCH 0/3] nvme-pci: yield completions under scheduler pressure Michael Kelley
2026-10-09  6:51   ` Naman Jain
2026-10-09 10:16     ` Naman Jain
2026-10-09 11:27       ` Luigi Rizzo
2026-10-09 14:58         ` Luigi Rizzo
2026-10-12  8:19           ` Naman Jain
2026-10-12  9:17             ` Luigi Rizzo
2026-10-13  6:21               ` Naman Jain
2026-10-09 11:36       ` Fengnan
2026-10-12  6:48         ` Naman Jain
2026-10-12  7:00           ` Fengnan
2026-10-12  8:51             ` Naman Jain

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=8aba4809-6655-4bfd-a83a-25c5ab816645@linux.microsoft.com \
    --to=namjain@linux.microsoft.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mhklinux@outlook.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.