Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5470456imd; Tue, 30 Oct 2018 18:58:21 -0700 (PDT) X-Google-Smtp-Source: AJdET5cbnTEbVw7mrJlEzIXLlmUebd3HpRhvRWyHn9tGaoWxTE2y/KzVjwkKVMlSKhCqT177nvfl X-Received: by 2002:a63:c508:: with SMTP id f8-v6mr1181759pgd.412.1540951101312; Tue, 30 Oct 2018 18:58:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540951101; cv=none; d=google.com; s=arc-20160816; b=mtjSJy6XrKpOYfZ9l07bv552c38oh3kIUVR9SgGbbBfTXIvfT4SyNTCddEdRAtXRNf ePrArTH4ifiotcDDNlZgFCZYX1n7T3YueK/2YVz47TDYPM5dL+bgIow2sLBQKvZUfMNk NVOBw2xEyVZDdYqyI0XuGYocsOprAQKwArtwWYCWRx+f+72dbw3CaGYmhSFh/Mhm3rfo SDVe0ckZs9Gfs1Kk9CmKOyF2Cat7JxyhjfpjyTJaUY407VRo1NSivhwenNrSWwhO+zCi qPesFJTeWh2EvXXduZpFMiqmEPG1qCJh8ssVYf9uQuGYuviEpVD3TCwpLBLDhbrdWDx0 Hd3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=PY89FeHeNVtuwMMW0RIlywAgg9wBFVTKbaxJ/wRV2YE=; b=udSlR2lWmNK+RxQnrFAnj5L/9maCiUNnJz8iu37uNF9XLnsnugnbHetvfAECfU0xJy EZJu6KY13R0k+0WSMi7XwaeFBcIi11C9fHF3pyohx64PCJMrz3kGwVOxi8Q/Ea0SBL6o Hs2asgbaummzxMGOK1KXnU349whzuWi5XcXR0eeAYJUN3g2RPLpTaJx7eKuvTeeq6Lep IfolkXyElNH+6A7FBtcBkECCV9K4uyMIqhmBSj3/Y56U3/rWDuHeV4KRdqSpMh3Cw8Ty FIt+pXw9pWRkUMa7ErIz0GYiwWAEHJvshW9gxtUPdEQPnu8HJe3N9xEATmFP87YRUW8w 97tQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n81-v6si17346890pfj.30.2018.10.30.18.58.06; Tue, 30 Oct 2018 18:58:21 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728785AbeJaKxD (ORCPT + 99 others); Wed, 31 Oct 2018 06:53:03 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:45164 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728471AbeJaKxC (ORCPT ); Wed, 31 Oct 2018 06:53:02 -0400 Received: by mail-pl1-f194.google.com with SMTP id o19-v6so6442841pll.12; Tue, 30 Oct 2018 18:57:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PY89FeHeNVtuwMMW0RIlywAgg9wBFVTKbaxJ/wRV2YE=; b=T7/Uk3bhUSmcRHJhGS33yJdOAZGgDo5bQcK0TbYye6jSTA7tSQwonM8tYkoigUqhXU Xz2Si/tjKC9WLcq0ArYW8VeUuXQEcPTgkZl6m83e5UQRPXoiilzuFpZGl25fvKJ+cwqI wi35TUTHQAo5EbxyFQRhP67c2Ay+JHvu5H1hopfJ6rigApqy6Cg6GwSnt3268caS8jEt rGuNSRXFAWLvIOXizXfuQLYtFZtEPrJOk57RbHXPfSC46Ra7+GerbVo8DzFS00J06A1h a8BVbjtrNOVR+ImtBFVXe/EhqWZyfpQ6VAUm56jc5wgyNHs/Kh/tz+PvDr65ah0IOUZ2 rDhQ== X-Gm-Message-State: AGRZ1gLcCqACb3wuZfQfMP9THEdOwoxipo7FrV1jwffi8iBawNux42gB mQgXsLcZPkAOVfuuSLgHWLFfkuG3 X-Received: by 2002:a17:902:aa45:: with SMTP id c5-v6mr1271371plr.100.1540951027617; Tue, 30 Oct 2018 18:57:07 -0700 (PDT) Received: from ?IPv6:2601:647:4800:973f:e9fd:d0f6:3e3:43a5? ([2601:647:4800:973f:e9fd:d0f6:3e3:43a5]) by smtp.gmail.com with ESMTPSA id g72-v6sm27480675pfd.181.2018.10.30.18.57.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 18:57:06 -0700 (PDT) Subject: Re: [PATCH 14/16] nvme: utilize two queue maps, one for reads and one for writes To: Jens Axboe , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <20181030183252.17857-1-axboe@kernel.dk> <20181030183252.17857-15-axboe@kernel.dk> From: Sagi Grimberg Message-ID: <193a50fe-0c02-9f01-f110-5cfa1cec9283@grimberg.me> Date: Tue, 30 Oct 2018 18:57:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181030183252.17857-15-axboe@kernel.dk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static int queue_irq_offset(struct nvme_dev *dev) > +{ > + /* if we have more than 1 vec, admin queue offsets us 1 */ offsets us by 1? > + if (dev->num_vecs > 1) > + return 1; > + > + return 0; > +} > + ... > @@ -1934,13 +2048,48 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) > * setting up the full range we need. > */ > pci_free_irq_vectors(pdev); > - result = pci_alloc_irq_vectors_affinity(pdev, 1, nr_io_queues + 1, > - PCI_IRQ_ALL_TYPES | PCI_IRQ_AFFINITY, &affd); > - if (result <= 0) > - return -EIO; > + > + /* > + * For irq sets, we have to ask for minvec == maxvec. This passes > + * any reduction back to us, so we can adjust our queue counts and > + * IRQ vector needs. > + */ > + do { > + nvme_calc_io_queues(dev, nr_io_queues); > + irq_sets[0] = dev->io_queues[NVMEQ_TYPE_READ]; > + irq_sets[1] = dev->io_queues[NVMEQ_TYPE_WRITE]; > + if (!irq_sets[1]) > + affd.nr_sets = 1; > + > + /* > + * Need IRQs for read+write queues, and one for the admin queue > + */ > + nr_io_queues = irq_sets[0] + irq_sets[1] + 1; > + > + result = pci_alloc_irq_vectors_affinity(pdev, nr_io_queues, > + nr_io_queues, > + PCI_IRQ_ALL_TYPES | PCI_IRQ_AFFINITY, &affd); > + > + /* > + * Need to reduce our vec counts > + */ > + if (result == -ENOSPC) { > + nr_io_queues--; > + if (!nr_io_queues) > + return result; > + continue; > + } else if (result <= 0) > + return -EIO; > + break; > + } while (1); > + > dev->num_vecs = result; > dev->max_qid = max(result - 1, 1); > > + dev_info(dev->ctrl.device, "%d/%d/%d read/write queues\n", > + dev->io_queues[NVMEQ_TYPE_READ], > + dev->io_queues[NVMEQ_TYPE_WRITE]); > + Perhaps it would be better if we move this code into a function.