From mboxrd@z Thu Jan 1 00:00:00 1970 From: keith.busch@linux.intel.com (Keith Busch) Date: Wed, 16 May 2018 20:09:20 -0600 Subject: nvme: batch completions and do them outside of the queue lock In-Reply-To: <909fe3ae-fe5a-fce6-20ea-a7f440799a06@kernel.dk> References: <528cf765-16ae-5499-8843-9a62b4fd8326@kernel.dk> <20180516212757.GD20223@localhost.localdomain> <20180516223538.GE20223@localhost.localdomain> <5e2e6da5-70ca-5b32-d02a-04baf2df1e9a@kernel.dk> <06c7d9f3-f936-cead-6f6a-9ebae47c31c4@kernel.dk> <909fe3ae-fe5a-fce6-20ea-a7f440799a06@kernel.dk> Message-ID: <20180517020920.GA21959@localhost.localdomain> On Wed, May 16, 2018@05:39:02PM -0600, Jens Axboe wrote: > static int __nvme_poll(struct nvme_queue *nvmeq, unsigned int tag) > { > - struct nvme_completion cqe; > - int found = 0, consumed = 0; > + u16 start, end; > > if (!nvme_cqe_valid(nvmeq, nvmeq->cq_head, nvmeq->cq_phase)) > return 0; > > spin_lock_irq(&nvmeq->q_lock); > - while (nvme_read_cqe(nvmeq, &cqe)) { > - nvme_handle_cqe(nvmeq, &cqe); > - consumed++; > - > - if (tag == cqe.command_id) { > - found = 1; > - break; > - } > - } > - > - if (consumed) > - nvme_ring_cq_doorbell(nvmeq); > - spin_unlock_irq(&nvmeq->q_lock); > + nvme_process_cq(nvmeq, &start, &end); > + spin_unlock(&nvmeq->q_lock); You'll need to use the spin_unlock_irq() here, otherwise looks good.