From: Keith Busch Date: Sun, 18 Dec 2016 03:03:47 +0000 (-0800) Subject: NVMe: Set affinity after allocating request queues X-Git-Tag: v4.1.12-102.0.20170601_1400~202 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=28a8ed941d58d06f88f9fe9a05ca2c96d6d8dd8e;p=users%2Fjedix%2Flinux-maple.git NVMe: Set affinity after allocating request queues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The asynchronous namespace scanning caused affinity hints to be set before its tagset initialized, so there was no cpu mask to set the hint. This patch moves the affinity hint setting to after namespaces are scanned. Reported-by: 김경산 Signed-off-by: Keith Busch Signed-off-by: Jens Axboe (cherry picked from commit bda4e0fb3126aca15586d165b5a15a37edc0a984) Orabug: 25130845 Conflicts: Manually patched the commit. drivers/block/nvme-core.c Signed-off-by: Ashok Vairavan Reviewed-by: Martin K. Petersen --- diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 360526b195692..bc4bfeccede6e 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -894,7 +894,7 @@ static int nvme_queue_rq(struct blk_mq_hw_ctx *hctx, */ if (ns && ns->ms && !blk_integrity_rq(req)) { if (!(ns->pi_type && ns->ms == 8) && - req->cmd_type != REQ_TYPE_DRV_PRIV) { + req->cmd_type != REQ_TYPE_SPECIAL) { req->errors = -EFAULT; blk_mq_complete_request(req); return BLK_MQ_RQ_QUEUE_OK; @@ -2523,6 +2523,22 @@ done: kfree(id); } +static void nvme_set_irq_hints(struct nvme_dev *dev) +{ + struct nvme_queue *nvmeq; + int i; + + for (i = 0; i < dev->online_queues; i++) { + nvmeq = dev->queues[i]; + + if (!nvmeq->tags || !(*nvmeq->tags)) + continue; + + irq_set_affinity_hint(dev->entry[nvmeq->cq_vector].vector, + blk_mq_tags_cpumask(*nvmeq->tags)); + } +} + static void nvme_dev_scan(struct work_struct *work) { struct nvme_dev *dev = container_of(work, struct nvme_dev, scan_work); @@ -2530,6 +2546,8 @@ static void nvme_dev_scan(struct work_struct *work) if (!dev->tagset.tags) return; nvme_scan_namespaces(dev); + + nvme_set_irq_hints(dev); } /* @@ -3062,22 +3080,6 @@ static const struct file_operations nvme_dev_fops = { .compat_ioctl = nvme_dev_ioctl, }; -static void nvme_set_irq_hints(struct nvme_dev *dev) -{ - struct nvme_queue *nvmeq; - int i; - - for (i = 0; i < dev->online_queues; i++) { - nvmeq = dev->queues[i]; - - if (!nvmeq->tags || !(*nvmeq->tags)) - continue; - - irq_set_affinity_hint(dev->entry[nvmeq->cq_vector].vector, - blk_mq_tags_cpumask(*nvmeq->tags)); - } -} - static void nvme_probe_work(struct work_struct *work) { struct nvme_dev *dev = container_of(work, struct nvme_dev, probe_work); @@ -3120,8 +3122,6 @@ static void nvme_probe_work(struct work_struct *work) if (result) goto free_tags; - nvme_set_irq_hints(dev); - dev->event_limit = 1; /*