Re: [PATCH v3 6/6] nvme-apple: Add initial Apple SoC NVMe driver

From: Keith Busch
Date: Tue Apr 26 2022 - 17:00:18 EST


On Tue, Apr 26, 2022 at 10:15:39PM +0200, Sven Peter wrote:
> +static enum blk_eh_timer_return apple_nvme_timeout(struct request *req,
> + bool reserved)
> +{
> + struct apple_nvme_iod *iod = blk_mq_rq_to_pdu(req);
> + struct apple_nvme_queue *q = iod->q;
> + struct apple_nvme *anv = queue_to_apple_nvme(q);
> + unsigned long flags;
> + u32 csts = readl(anv->mmio_nvme + NVME_REG_CSTS);
> +
> + if (anv->ctrl.state != NVME_CTRL_LIVE) {
> + /*
> + * From rdma.c:
> + * If we are resetting, connecting or deleting we should
> + * complete immediately because we may block controller
> + * teardown or setup sequence
> + * - ctrl disable/shutdown fabrics requests
> + * - connect requests
> + * - initialization admin requests
> + * - I/O requests that entered after unquiescing and
> + * the controller stopped responding
> + *
> + * All other requests should be cancelled by the error
> + * recovery work, so it's fine that we fail it here.
> + */
> + dev_warn(anv->dev,
> + "I/O %d(aq:%d) timeout while not in live state\n",
> + req->tag, q->is_adminq);
> + if (blk_mq_request_started(req) &&
> + !blk_mq_request_completed(req)) {
> + nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD;
> + blk_mq_complete_request(req);

I think you need a 'nvme_req(req)->flags |= NVME_REQ_CANCELLED' here to get the
expected -EINTR for any admin command timeouts during a reset. Without it, the
resetting task is going to think it got a real response from the controller.

Other than that, this looks good.