Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nadolski, Edmund" <edmund.nadolski@intel.com>
To: Keith Busch <kbusch@kernel.org>,
	linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me
Subject: Re: [PATCH] nvme/pci: Remove last_sq_tail
Date: Thu, 5 Dec 2019 13:31:20 -0700	[thread overview]
Message-ID: <149bb39b-e8ab-36a5-f319-18ef5e3567b6@intel.com> (raw)
In-Reply-To: <20191205200825.27651-1-kbusch@kernel.org>

On 12/5/2019 1:08 PM, Keith Busch wrote:
> We don't allocate enough tags to wrap the submission queue. Remove
> tracking for this condition.

Can we ensure that this presumption won't change?

> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
>   drivers/nvme/host/pci.c | 20 ++++----------------
>   1 file changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 0590640ba62c..3acd1b4d7735 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -174,7 +174,6 @@ struct nvme_queue {
>   	u16 q_depth;
>   	u16 cq_vector;
>   	u16 sq_tail;
> -	u16 last_sq_tail;
>   	u16 cq_head;
>   	u16 qid;
>   	u8 cq_phase;
> @@ -462,21 +461,11 @@ static int nvme_pci_map_queues(struct blk_mq_tag_set *set)
>   /*
>    * Write sq tail if we are asked to, or if the next command would wrap.

Comment needs to be updated.

Ed

>    */
> -static inline void nvme_write_sq_db(struct nvme_queue *nvmeq, bool write_sq)
> +static inline void nvme_write_sq_db(struct nvme_queue *nvmeq)
>   {
> -	if (!write_sq) {
> -		u16 next_tail = nvmeq->sq_tail + 1;
> -
> -		if (next_tail == nvmeq->q_depth)
> -			next_tail = 0;
> -		if (next_tail != nvmeq->last_sq_tail)
> -			return;
> -	}
> -
>   	if (nvme_dbbuf_update_and_check_event(nvmeq->sq_tail,
>   			nvmeq->dbbuf_sq_db, nvmeq->dbbuf_sq_ei))
>   		writel(nvmeq->sq_tail, nvmeq->q_db);
> -	nvmeq->last_sq_tail = nvmeq->sq_tail;
>   }
>   
>   /**
> @@ -493,7 +482,8 @@ static void nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd,
>   	       cmd, sizeof(*cmd));
>   	if (++nvmeq->sq_tail == nvmeq->q_depth)
>   		nvmeq->sq_tail = 0;
> -	nvme_write_sq_db(nvmeq, write_sq);
> +	if (write_sq)
> +		nvme_write_sq_db(nvmeq);
>   	spin_unlock(&nvmeq->sq_lock);
>   }
>   
> @@ -502,8 +492,7 @@ static void nvme_commit_rqs(struct blk_mq_hw_ctx *hctx)
>   	struct nvme_queue *nvmeq = hctx->driver_data;
>   
>   	spin_lock(&nvmeq->sq_lock);
> -	if (nvmeq->sq_tail != nvmeq->last_sq_tail)
> -		nvme_write_sq_db(nvmeq, true);
> +	nvme_write_sq_db(nvmeq);
>   	spin_unlock(&nvmeq->sq_lock);
>   }
>   
> @@ -1511,7 +1500,6 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid)
>   	struct nvme_dev *dev = nvmeq->dev;
>   
>   	nvmeq->sq_tail = 0;
> -	nvmeq->last_sq_tail = 0;
>   	nvmeq->cq_head = 0;
>   	nvmeq->cq_phase = 1;
>   	nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
> 


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

  reply	other threads:[~2019-12-05 20:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05 20:08 [PATCH] nvme/pci: Remove last_sq_tail Keith Busch
2019-12-05 20:31 ` Nadolski, Edmund [this message]
2019-12-05 20:48   ` Keith Busch
2019-12-12  9:20 ` Christoph Hellwig
2019-12-12 15:47   ` Keith Busch
2019-12-12 20:11     ` 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=149bb39b-e8ab-36a5-f319-18ef5e3567b6@intel.com \
    --to=edmund.nadolski@intel.com \
    --cc=hch@lst.de \
    --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