Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5077090imd; Tue, 30 Oct 2018 11:35:30 -0700 (PDT) X-Google-Smtp-Source: AJdET5eCbPDz/czdsZSpJ7YkT7lbx6kt2zzjc+UhAdw1e9jFvW1+VMw/ajTRh/jGHm21hbI7znBn X-Received: by 2002:a63:6150:: with SMTP id v77mr21338pgb.266.1540924530778; Tue, 30 Oct 2018 11:35:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540924530; cv=none; d=google.com; s=arc-20160816; b=pYRrbxn76gYPIhaldDVs0nIHdeFA0PFjBPWACE+LRbl2vdGT9kPoqB2M9Rn7z7PhvN u+dIx01opHTMpo64Ta1iEGXlFdINA71xOpt1//6wkfjU/f9gw/YYPrwbLuhCxjWrA5A5 J6+p1SXcb4VAbyeAppJMYfnExM+iO94ht8n5/f5QUCqXYzv9JUbVhIty47KpRxw/0ukE vTnAvwouhkW960F1y3PZsDYtboAbiSmuOHAmtZ7jnkWOnJppn8rh9LdqHWwB7y9bI0LM +z3ZQ6aBv3T4fBhoSd94crMb22q0dSOINO1O9at6a4nSQCxYoug1DYkKjq4puyIs6FAM dCYw== 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=y5BsDQmc5dLZKcxCUwh1dtXo4oyHvmazmNAUSxG7ysA=; b=xqiaMuvz5tRrYhFJBGxqLa8UMgNHfclRFPTQX13Yxuq8g8dgPHI5DYR/pbKzsuhjnr VxTHGF5AOV3khRNiCobb+GWnb1RSSamcFSTrYcKs0ycCJEZ8Cz4V0Vru3x/bIhp5LcUQ w0lcMyR+hW5QBNJJOJ7LBrCZXZcs2VYb5NDX6JVOrt5s0Hb/UlUHhwrI8ZGC6L7592JC 5aHsx3/T7kpB9+ZMYQ4mf4B9jh2rgmGzzl9yieFgjwCjHYbVcXg55qL+AVENOhSl7pBN /I+f7EAz75g3UH7DUdVPdqQGj4b1wwcfoW6ig6gXpDlisqSOY2c7sVxcoAblfpBVaou4 u7/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=wQ4plRSc; 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 w9-v6si23077210pll.138.2018.10.30.11.35.07; Tue, 30 Oct 2018 11:35: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=wQ4plRSc; 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 S1728311AbeJaD15 (ORCPT + 99 others); Tue, 30 Oct 2018 23:27:57 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:55430 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728244AbeJaD14 (ORCPT ); Tue, 30 Oct 2018 23:27:56 -0400 Received: by mail-it1-f194.google.com with SMTP id e17so13336151itk.5 for ; Tue, 30 Oct 2018 11:33:20 -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=y5BsDQmc5dLZKcxCUwh1dtXo4oyHvmazmNAUSxG7ysA=; b=wQ4plRSc/xR6AA0ydQd7opC1U4kC0qs2liAeermPEOb8+9FYYztWC+edXPYCcVBBQs ghkpkpY+uCHavWvq4vMR3IIdMfnY73VrgCHYdfEK72RnLnakf5ZC9GkLSx7zRA/LSiIR oFOuHwcbdtMaycKYRlFUFpd87dPgdyFhYBvsMc0oauR8vHA6gqBVIKk6URLZqaYT0Iv+ zOuMYhnqMLIUdQcXYf6Sx6R5XmmMRuBQ9eVXmwZKZ8uk4TgG/jNLMTu2xxLh2PjWYom6 XeQd5ljRVH3uxDC+CIFBYxrfJiyGLeMEbKRdJLZnLIGlHLeiGGW+prwrYvgLOQOF3G7N fmhQ== 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=y5BsDQmc5dLZKcxCUwh1dtXo4oyHvmazmNAUSxG7ysA=; b=QlJLbvurNoCo0qGXrKHOh6cjkuIIzLEgnHcw2ig0f0knBIHhBhRM/Rfq5rxKQVDLGw nrrMNg/ZPexMj5uyFYp1jnItesVvkXYkiedIUrvBTWwqgBTEnkIz+3zS4ZcoY0r4/5X7 wg4NO7KfhkfUPA59cUux64CFzatWmQ/b2pRQU2bx0j6EX9I9AoSWSq2HXKu4Hf1AYWs2 SgxVa0ItoB8Ur7pK++MtMSx9UrSkZg97mINkD1NOgR/5Jwnz43bKk0ClCU2FZSQrbg9t 5ALb311bYAppEov96mnydAHJJey5GS0ECKvooX7Y8UHwA7QBzW/gDqDdK0vLrcxsZV0o sDyA== X-Gm-Message-State: AGRZ1gKhtbm/Wv9+dPnOddy7A6YsxbJCXvhmIpCjs06xoW4tqi7yEhWl YoFmFxwcHWfSBhZ7PUJ7EPlbmnHcwZY= X-Received: by 2002:a24:ed0c:: with SMTP id r12-v6mr629ith.53.1540924400045; Tue, 30 Oct 2018 11:33:20 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id o20-v6sm4895739itc.34.2018.10.30.11.33.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 11:33:18 -0700 (PDT) From: Jens Axboe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 12/16] blk-mq: initial support for multiple queue maps Date: Tue, 30 Oct 2018 12:32:48 -0600 Message-Id: <20181030183252.17857-13-axboe@kernel.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181030183252.17857-1-axboe@kernel.dk> References: <20181030183252.17857-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 26768c8f5af5..8e80d5043079 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