Received: by 10.223.185.116 with SMTP id b49csp4708527wrg; Tue, 27 Feb 2018 00:56:31 -0800 (PST) X-Google-Smtp-Source: AH8x226MTTy0bDqvTIv3U2MEtTa8QlEvwUdpX1I9nHc5Qjofzr28aIJkkVZJS96qF4p2E9RqairP X-Received: by 2002:a17:902:9a8a:: with SMTP id w10-v6mr13426402plp.201.1519721791568; Tue, 27 Feb 2018 00:56:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519721791; cv=none; d=google.com; s=arc-20160816; b=AY2Ged/H4WhVbQHJHkatWKszAGX4oG/dBX5BVz1cl8ID8ZjVorBu42eo8wQXtcbyMm fiTPdgPBvk7B/zgAbEBEkW9SlzIhqyMkfaK8iZTFFEIU9iHHOnlO0j94d/KksA2JEe6l P0bBgsmvVDdjSV9mfv0YlQhWhyN0Bb7IVM0wLiMFDzZZLhsLjZIf1kfzWlT0NYncOuk9 VRSnjwTlLyhWNxutSKAFuctrkrEcKl4Y+5xsYykd/hRyx3xtQWPWN+T42o5ug7vDnHDY 1Vp5y6eFzVPtCWEyuRhegCS1+M4cyHq7+SHZsP2+ja9jjHyqS1tX5LtZ5OQddMVhxH6D Kizw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=OHWn+ZJTtuQIubDzhQsEkc1VvME/LEEfUbgoeVTfIaE=; b=SuHjnrrGdlmcoO1vVcOkuWYwYnfBO3GF/bfNS7Tjv4BG0FaYqTH37N1FDqBn+v9q4z cF0N6ZzH28uc560feDgq2SSiRjcEmheuU8iDfxRRMSHM2PT6CxUjMw8QTAxBwl0DB33M 62Af9b37Fs8/1zkq2FfhP8E2hjRxR6uNPAGEgL50yShSKKYKW82/6vhyBJZotB3SR9yC 43XY3CvAYaWP5vTQkzRNkP7ksPvTpUlf+NAlhvjPqyWE2qZMXIebLPqO3qKmWsSxynZd +g/956pdSRCbw3FVuWH0nF5pFrVmLgzPdqGj+LjNeCSLlUbcB4V2R+hsyrVJQ7aRwIsw iU3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=E68KbfQO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r16si6788377pgu.449.2018.02.27.00.56.16; Tue, 27 Feb 2018 00:56:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=E68KbfQO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752349AbeB0IrV (ORCPT + 99 others); Tue, 27 Feb 2018 03:47:21 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:55296 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752140AbeB0IrU (ORCPT ); Tue, 27 Feb 2018 03:47:20 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1R8kgTE007979; Tue, 27 Feb 2018 08:46:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=OHWn+ZJTtuQIubDzhQsEkc1VvME/LEEfUbgoeVTfIaE=; b=E68KbfQOfnZ6rs260C1f90I4cN4DzrznyCbY9u9+nR1e1HZQCGHY58jweajeBuxHHNgY BlCMeQnotG5KfqNhd35Ax1MBT9gBQww+0wvTY9M1oo1dshcVTOsTEgfqL2aH60CrWYd1 NsFRLi+flJ9bfHiZKEEeyCP76w+lRdv3YIpF3Ob9MBxPkjdVvicbzL6jPgP6BIxFcMM5 NOLjZ+1aKOQmmRf205tBFNMTSq8dpEfltA3D4E+5irAA3NgRttfEe4Rjw3pqU/3j3Rna DGsteWlnPCYOlV1YQrmLht8xvKZsH6FyUqXsGzgpDGOTlTAlBMboYqaSlUPd07WDL37n Jw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2gd3xv01s2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Feb 2018 08:46:48 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1R8k3Z8010358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Feb 2018 08:46:04 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1R8k2EN031226; Tue, 27 Feb 2018 08:46:02 GMT Received: from will-ThinkCentre-M910s.cn.oracle.com (/10.182.70.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 27 Feb 2018 00:46:02 -0800 From: Jianchao Wang To: keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] nvme-pci: assign separate irq vectors for adminq and ioq0 Date: Tue, 27 Feb 2018 16:46:17 +0800 Message-Id: <1519721177-2099-1-git-send-email-jianchao.w.wang@oracle.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8816 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=855 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802270107 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, adminq and ioq0 share the same irq vector. This is unfair for both amdinq and ioq0. - For adminq, its completion irq has to be bound on cpu0. - For ioq0, when the irq fires for io completion, the adminq irq action has to be checked also. To improve this, allocate separate irq vectors for adminq and ioq0, and not set irq affinity for adminq one. Signed-off-by: Jianchao Wang --- drivers/nvme/host/pci.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 73036d2..7f421b7 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -1456,7 +1456,7 @@ static int nvme_create_queue(struct nvme_queue *nvmeq, int qid) nvmeq->sq_cmds_io = dev->cmb + offset; } - nvmeq->cq_vector = qid - 1; + nvmeq->cq_vector = qid; result = adapter_alloc_cq(dev, qid, nvmeq); if (result < 0) return result; @@ -1909,6 +1909,8 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) struct pci_dev *pdev = to_pci_dev(dev->dev); int result, nr_io_queues; unsigned long size; + struct irq_affinity affd = {.pre_vectors = 1}; + int ret; nr_io_queues = num_present_cpus(); result = nvme_set_queue_count(&dev->ctrl, &nr_io_queues); @@ -1945,11 +1947,11 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) * setting up the full range we need. */ pci_free_irq_vectors(pdev); - nr_io_queues = pci_alloc_irq_vectors(pdev, 1, nr_io_queues, - PCI_IRQ_ALL_TYPES | PCI_IRQ_AFFINITY); - if (nr_io_queues <= 0) + ret = pci_alloc_irq_vectors_affinity(pdev, 1, (nr_io_queues + 1), + PCI_IRQ_ALL_TYPES | PCI_IRQ_AFFINITY, &affd); + if (ret <= 0) return -EIO; - dev->max_qid = nr_io_queues; + dev->max_qid = ret - 1; /* * Should investigate if there's a performance win from allocating -- 2.7.4