Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3612754imd; Mon, 29 Oct 2018 09:39:31 -0700 (PDT) X-Google-Smtp-Source: AJdET5dgQ9ceHa1ZoXN+r825fJsB5xYhjQhyiHJhVNYQEqkjliITjAwfrBehLNGwh6DxxtBiHF// X-Received: by 2002:a65:594b:: with SMTP id g11-v6mr12451260pgu.229.1540831170988; Mon, 29 Oct 2018 09:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540831170; cv=none; d=google.com; s=arc-20160816; b=FE1+Pkjs+UMfQg8QVZrQLjgiSTktcu+tFdGIyJ91JWsnHwP62fFryXJHegHlENm+JV dV0fbJX8td0irEbEkdz9tmP1L6SP0TVmn0LMll9psEUs6F/Jjt41up4mgfwMs/zDJYWo DoQTNZtn9zpU/iXS0QLYqPaRWA+Bd0kD+mFEN8NCfB43zFWkoOIEYsyoW1JwVyt22j/+ DRCEACi2A7vDxm19KSzdYaASIQk0mgEExsFGgvdaQ6WWzhFX6w+AH3dl1bBSZWqvVEIR yG1F8cu1gjskgikl9keiPDXYBz5hPuBvuzCCdYz9Jv+4PUMt2lK+iujsa7XZuPvJ6X5l 8zuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Hu4SRygQduE3Ah39+YjJ5DfLsSb40qLLfETVJ69MQec=; b=CtS/xOx9KUoWIOLgBi/JelCUAtb+jlpKzwmYbH11RLlOcc7T80cXzG83yQLCArO+8a 8a5sD8fBalxAEzEoQ7wX41PfPjg4rfe9xPVZF5NV0qSAsre2IkJgeKKOqLjeP1UC3xsh BPIZ8hh9O+GbL19+qG9g/l6L0uixTQjGICsM4LtIsn4llFbloW4Np3U7QEP+v9R+QSf/ Dvn0ubDC5kp4njGh3PM4zkipP3Jrxb/ZOxTFel8WxVKLdxfX9PhQiqNNlv3aRb7q8GUV pttGiqY/TPAXJqxVRzgOqtC8iWmFf0odjbXNJsqd5xOctSfW5suct4FhTnQGM76N+I75 4x7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="Qne8Q/R5"; 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 140-v6si25634349pfb.41.2018.10.29.09.39.15; Mon, 29 Oct 2018 09:39:30 -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; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b="Qne8Q/R5"; 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 S1728329AbeJ3B10 (ORCPT + 99 others); Mon, 29 Oct 2018 21:27:26 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:34844 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728293AbeJ3B1Z (ORCPT ); Mon, 29 Oct 2018 21:27:25 -0400 Received: by mail-it1-f194.google.com with SMTP id p64-v6so10181381itp.0 for ; Mon, 29 Oct 2018 09:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hu4SRygQduE3Ah39+YjJ5DfLsSb40qLLfETVJ69MQec=; b=Qne8Q/R59peKayL//DkDF0zKocJo81nHGGU6Fx1JzYRYHOhZbze0azcwjFJabpP8X+ ABtnKdE1fmHihK1tir7me+SNQzUN69X46KPPXfWirjWcjAl/snCbDzghbEWBXZ0wGu6a K+KyoiV6bTtnvR5u2FBiJBc0rwRf36pbB/b3kxLW/S3egAKFjwnfqFfoQZr5ZBLnsCJj XBxrogqmOy9kcIiSb6xYhnhD8DROhBh1AchvYOctmYtdbiqxkJmn7yKfiXBRXssTD1Js m3B2mgsr7WD4VttVAHgF1XEhU/YAmAcB3H2syrBFi+7t5JKqztU7PHAgFY4nUmH4bSQ0 8wCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Hu4SRygQduE3Ah39+YjJ5DfLsSb40qLLfETVJ69MQec=; b=KDzz+vzWTqWGhec/WRy1ZMy8k9Wns/dKSMVGqzGmWwJHC0TYGi+bYK2FBa1bBBRqUG cQY+vTZyW5l5RSgGUKeY2XXxfSn6FgAbhQsMIcupweO4uMEPCiF0We3luIWmu2Y1DZF5 O8EnO67X4Lz+19k7E/21U4uYTjvW4r6+vFo7+ipaJ5rVVlsi0jK4P/DlrBdLwj/QzKPj NhJjJplySaH+V5znQHjIz8DmgI+p8bZ2ERnZp07/j8+yFSjiyDIttOkRKYFmNIsO/omx HWp3G0kd+ndOpTN+rl/8GSyhMxeMIdmVbWn19HT1dVQli77NhbUrqZhlKbMHeTH+ABcD zMsA== X-Gm-Message-State: AGRZ1gIhZp0WCFgcLQuX+CPv/wuuO15d05nzsiJLUcjYmu3MdbWrvqyi IiHKxG2iKeRp346ZxdwyHTgi3w== X-Received: by 2002:a05:660c:484:: with SMTP id a4mr3990245itk.116.1540831083626; Mon, 29 Oct 2018 09:38:03 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id q15-v6sm3367019itc.38.2018.10.29.09.38.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 09:38:02 -0700 (PDT) From: Jens Axboe To: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 10/14] blk-mq: initial support for multiple queue maps Date: Mon, 29 Oct 2018 10:37:34 -0600 Message-Id: <20181029163738.10172-11-axboe@kernel.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181029163738.10172-1-axboe@kernel.dk> References: <20181029163738.10172-1-axboe@kernel.dk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a queue offset to the tag map. This enables users to map iteratively, for each queue map type they support. Bump maximum number of supported maps to 2, we're now fully able to support more than 1 map. Reviewed-by: Hannes Reinecke Signed-off-by: Jens Axboe --- block/blk-mq-cpumap.c | 9 +++++---- block/blk-mq-pci.c | 2 +- block/blk-mq-virtio.c | 2 +- include/linux/blk-mq.h | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c index 6e6686c55984..03a534820271 100644 --- a/block/blk-mq-cpumap.c +++ b/block/blk-mq-cpumap.c @@ -14,9 +14,10 @@ #include "blk.h" #include "blk-mq.h" -static int cpu_to_queue_index(unsigned int nr_queues, const int cpu) +static int cpu_to_queue_index(struct blk_mq_queue_map *qmap, + unsigned int nr_queues, const int cpu) { - return cpu % nr_queues; + return qmap->queue_offset + (cpu % nr_queues); } static int get_first_sibling(unsigned int cpu) @@ -44,11 +45,11 @@ int blk_mq_map_queues(struct blk_mq_queue_map *qmap) * performace optimizations. */ if (cpu < nr_queues) { - map[cpu] = cpu_to_queue_index(nr_queues, cpu); + map[cpu] = cpu_to_queue_index(qmap, nr_queues, cpu); } else { first_sibling = get_first_sibling(cpu); if (first_sibling == cpu) - map[cpu] = cpu_to_queue_index(nr_queues, cpu); + map[cpu] = cpu_to_queue_index(qmap, nr_queues, cpu); else map[cpu] = map[first_sibling]; } diff --git a/block/blk-mq-pci.c b/block/blk-mq-pci.c index 40333d60a850..1dce18553984 100644 --- a/block/blk-mq-pci.c +++ b/block/blk-mq-pci.c @@ -43,7 +43,7 @@ int blk_mq_pci_map_queues(struct blk_mq_queue_map *qmap, struct pci_dev *pdev, goto fallback; for_each_cpu(cpu, mask) - qmap->mq_map[cpu] = queue; + qmap->mq_map[cpu] = qmap->queue_offset + queue; } return 0; diff --git a/block/blk-mq-virtio.c b/block/blk-mq-virtio.c index 661fbfef480f..370827163835 100644 --- a/block/blk-mq-virtio.c +++ b/block/blk-mq-virtio.c @@ -44,7 +44,7 @@ int blk_mq_virtio_map_queues(struct blk_mq_queue_map *qmap, goto fallback; for_each_cpu(cpu, mask) - qmap->mq_map[cpu] = queue; + qmap->mq_map[cpu] = qmap->queue_offset + queue; } return 0; diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 837087cf07cc..b5ae2b5677c1 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -78,10 +78,11 @@ struct blk_mq_hw_ctx { struct blk_mq_queue_map { unsigned int *mq_map; unsigned int nr_queues; + unsigned int queue_offset; }; enum { - HCTX_MAX_TYPES = 1, + HCTX_MAX_TYPES = 2, }; struct blk_mq_tag_set { -- 2.17.1