Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@kernel.org>
Cc: bijan.mottahedeh@oracle.com, hch@lst.de,
	linux-nvme@lists.infradead.org, sagi@grimberg.me
Subject: Re: [PATCH 2/2] nvme-pci: Remove two-pass completions
Date: Wed, 4 Mar 2020 17:08:59 +0100	[thread overview]
Message-ID: <20200304160859.GB11029@lst.de> (raw)
In-Reply-To: <20200302194616.2432-3-kbusch@kernel.org>

> +static inline int nvme_process_cq(struct nvme_queue *nvmeq)
>  {
>  	int found = 0;
>  
>  	while (nvme_cqe_pending(nvmeq)) {
>  		++found;
> +		nvme_handle_cqe(nvmeq, nvmeq->cq_head);
>  		nvme_update_cq_head(nvmeq);
>  	}
>  
> +	if (found)
>  		nvme_ring_cq_doorbell(nvmeq);
>  	return found;
>  }
> @@ -1011,21 +1000,16 @@ static irqreturn_t nvme_irq(int irq, void *data)
>  {
>  	struct nvme_queue *nvmeq = data;
>  	irqreturn_t ret = IRQ_NONE;
> -	u16 start, end;
>  
>  	/*
>  	 * The rmb/wmb pair ensures we see all updates from a previous run of
>  	 * the irq handler, even if that was on another CPU.
>  	 */
>  	rmb();
> -	nvme_process_cq(nvmeq, &start, &end);
> +	if (nvme_process_cq(nvmeq))
> +		ret = IRQ_HANDLED;
>  	wmb();
>  
> -	if (start != end) {
> -		nvme_complete_cqes(nvmeq, start, end);
> -		return IRQ_HANDLED;
> -	}
> -
>  	return ret;
>  }
>  
> @@ -1044,7 +1028,6 @@ static irqreturn_t nvme_irq_check(int irq, void *data)
>  static int nvme_poll_irqdisable(struct nvme_queue *nvmeq)
>  {
>  	struct pci_dev *pdev = to_pci_dev(nvmeq->dev->dev);
> -	u16 start, end;
>  	int found;
>  
>  	/*
> @@ -1054,32 +1037,29 @@ static int nvme_poll_irqdisable(struct nvme_queue *nvmeq)
>  	 */
>  	if (test_bit(NVMEQ_POLLED, &nvmeq->flags)) {
>  		spin_lock(&nvmeq->cq_poll_lock);
> -		found = nvme_process_cq(nvmeq, &start, &end);
> +		found = nvme_process_cq(nvmeq);
>  		spin_unlock(&nvmeq->cq_poll_lock);
>  	} else {
>  		disable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
> -		found = nvme_process_cq(nvmeq, &start, &end);
> +		found = nvme_process_cq(nvmeq);
>  		enable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
>  	}
>  
> -	nvme_complete_cqes(nvmeq, start, end);
>  	return found;

I think we can just make nvme_timeout call nvme_poll for the
polled case, and just handle the irq driven case in this function
(should probably be another patch on top of this one).

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2020-03-04 16:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02 19:46 [PATCH 0/2] nvme-pci: Simpler completions Keith Busch
2020-03-02 19:46 ` [PATCH 1/2] nvme-pci: Remove tag from process cq Keith Busch
2020-03-04 16:05   ` Christoph Hellwig
2020-03-04 16:45     ` Keith Busch
2020-03-02 19:46 ` [PATCH 2/2] nvme-pci: Remove two-pass completions Keith Busch
2020-03-04 16:08   ` Christoph Hellwig [this message]
2020-03-05 20:52   ` Sagi Grimberg

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=20200304160859.GB11029@lst.de \
    --to=hch@lst.de \
    --cc=bijan.mottahedeh@oracle.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.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