Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3836143imd; Mon, 29 Oct 2018 13:10:01 -0700 (PDT) X-Google-Smtp-Source: AJdET5c/BkaJx5EvJXalSAfgO46oW7XZApF+R4S+1ggqRYewxGMCr1SjZaV7NfJnEGSVZCcWT0T6 X-Received: by 2002:a63:c14a:: with SMTP id p10-v6mr15161914pgi.424.1540843801208; Mon, 29 Oct 2018 13:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540843801; cv=none; d=google.com; s=arc-20160816; b=Sy98YmDLsMRkNAtdR91F7IxPwqEMP7xhTVymbQqx2v358tuEqk062Byqg/6/xZRJ63 E/hgbdrOxxw57eZVBJn4NZ1prDcIoFB5hSxEpQX1Xe8o3lXJ2gxGlPTq47+aW4+n+oLu xVT0herAt3RobRbvzb0eU5LA7EQwWYs4r+Tacvmnn81N52/bW+R+mY2YKZC1HTDsbbwK bcKTKnny0qmrECTR/SCtYUSdad/qVXmsfqLvgdNTkI+7Yxb/5fuBpd+Qsu7zi86ehcr3 ImXQDpj9KNHONtCF/uWsuM/ZntQPih28aCeJXiRZXNiKbjdXfVPE+rAVezJs0byl/qkF wovg== 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:dkim-signature; bh=DCZH+xuj1XZH/fQLMSI0SyANiPPPCCy5TacoxsAHWaU=; b=DznHi43M5G1xOskNdpi8gUjHlPKvO2Dr+bhQzBObmekbvo4fMprEeswJN+LN/XElN3 /yzyQ1ZTTM8NFfLwcIABrzcUTrgDK5oU5rCnD87hoFpcA4kQfeM8GIzWAyxX9Lsv5N6J KTTljpkiJrHP9rKBkWs7zoeqy8gN4qVM5kCzY5LU/dyCvC3ya6QPvcY5P5Wd6SvZiclY VxCTMMgcfT6NoJuuSEV4QobDm0z8cnIT//RT9epHUMVbHUIoj3SWIUoWT+kz1kTYzEWM 8tjFvL09ML+XNCsGVY39YIyLyRYNjtUp28mVktXocz7LOmjBD7+3V1M8/SXl2kTtEYva wKMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=vF9MlsNA; 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 g24-v6si22119029pgh.188.2018.10.29.13.09.44; Mon, 29 Oct 2018 13:10:01 -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=vF9MlsNA; 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 S1729621AbeJ3E72 (ORCPT + 99 others); Tue, 30 Oct 2018 00:59:28 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42146 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729587AbeJ3E72 (ORCPT ); Tue, 30 Oct 2018 00:59:28 -0400 Received: by mail-pg1-f193.google.com with SMTP id i4-v6so4429315pgq.9 for ; Mon, 29 Oct 2018 13:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=DCZH+xuj1XZH/fQLMSI0SyANiPPPCCy5TacoxsAHWaU=; b=vF9MlsNABIUSnQJdUzH80+TheDT38qBXxlFtv5VaTiTz8S8HpCMS4xPyHqa6Xe8Ayx nxSP6mHX1dSFoEzbB+bVimSH16yOc50QR1JYjIhXoNXoRTwpXUmhluRccXfCFJ7/aKHx Y+NC8bI8NKZc/LXkz7Wng71XuTBQ3lOSNLoqr1cYrLHjSYCaG0WqN6ymUFN7/ADEUXfS mRboqeoBIkj6AVcBkLUUmTUa+v2udYoRr20HjdW0W9R06626Wo0P4naUHZwAPlbrPD1x IRCdV3ynQ0HfnYe2ehvtZwc01mnBAA501M1HyhfMdWR1x6cjo1rQwSKRNkcAi9Lt5+lE 996Q== 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=DCZH+xuj1XZH/fQLMSI0SyANiPPPCCy5TacoxsAHWaU=; b=UTojaGM7t8prPffLNkqGfYc6rFB5NR2pKXT66ptIztMrT/zZzoHV04sxp00R0y3TQH 6wjhTdP3NFSU0wdrdLMcs4TV4U3+bRPDXeK9tC82x+li1G3TT7IbEcPKSlHIAEA75t9c b0mfNkfW4Ianh6u85mErI/G106l8Fgyit+3xwPwB5ZXXgQs6kP6+B0RONRQepk8hjckO dOAeNj1VG/cy3QjzmLJcPkoGbWtpIAjOozL8qjfPFIqKbhcSSa3AMyEDdHfLL6Ebulyq +pIgJRop7dl3PD1NkXTBWfdOnHV7EAkPeNm+J28mZMU38Aq7U+fQiKCZ5JFQmKZrcgB0 aogA== X-Gm-Message-State: AGRZ1gIIrYDUecPYlOcZO619GB5ujoWdn3FPtHMz3wN1nIsOdZXYbw9x 4QuTH0+OI62uK2TYARnQ6ewAqfcr5zo= X-Received: by 2002:a65:4b85:: with SMTP id t5-v6mr15302413pgq.189.1540843754632; Mon, 29 Oct 2018 13:09:14 -0700 (PDT) Received: from [192.168.1.121] (66.29.188.166.static.utbb.net. [66.29.188.166]) by smtp.gmail.com with ESMTPSA id b139-v6sm22254372pfb.3.2018.10.29.13.09.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 13:09:13 -0700 (PDT) Subject: Re: [PATCH 10/14] blk-mq: initial support for multiple queue maps To: Bart Van Assche , linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20181029163738.10172-1-axboe@kernel.dk> <20181029163738.10172-11-axboe@kernel.dk> <1540842034.196084.89.camel@acm.org> <1540843250.196084.93.camel@acm.org> From: Jens Axboe Message-ID: <867d3e60-3edf-39e7-2bcb-02d7f1092f82@kernel.dk> Date: Mon, 29 Oct 2018 14:09:11 -0600 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: <1540843250.196084.93.camel@acm.org> Content-Type: text/plain; charset=UTF-8 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 On 10/29/18 2:00 PM, Bart Van Assche wrote: > On Mon, 2018-10-29 at 13:53 -0600, Jens Axboe wrote: >> On 10/29/18 1:40 PM, Bart Van Assche wrote: >>> On Mon, 2018-10-29 at 10:37 -0600, Jens Axboe wrote: >>>> -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); >>>> } >>>> >>>> [ ... ] >>>> >>>> --- 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; >>>> }; >>> >>> I think it's unfortunate that the blk-mq core uses the .queue_offset member but >>> that mapping functions in block drivers are responsible for setting that member. >>> Since the block driver mapping functions have to set blk_mq_queue_map.nr_queues, >>> how about adding a loop in blk_mq_update_queue_map() that derives .queue_offset >>> from .nr_queues from previous array entries? >> >> It's not a simple increment, so the driver has to be the one setting it. If >> we end up sharing queues, for instance, then the driver will need to set >> it to the start offset of that set. If you go two patches forward you >> can see that exact construct. >> >> IOW, it's the driver that controls the offset, not the core. > > If sharing of hardware queues between hardware queue types is supported, > what should hctx->type be set to? Additionally, patch 5 adds code that uses > hctx->type as an array index. How can that code work if a single hardware > queue can be shared by multiple hardware queue types? hctx->type will be set to the value of the first type. This is all driver private, blk-mq could not care less what the value of the type means. As to the other question, it works just fine since that is the queue that is being accessed. There's no confusion there. I think you're misunderstanding how it's seutp. To use nvme as the example, type 0 would be reads, 1 writes, and 2 pollable queues. If reads and writes share the same set of hardware queues, then type 1 simply doesn't exist in terms of ->flags_to_type() return value. This is purely driven by the driver. That hook is the only decider of where something will go. If we share hctx sets, we share the same hardware queue as well. There is just the one set for that case. -- Jens Axboe