Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1624713rwi; Wed, 26 Oct 2022 18:43:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mNMSO7sdLwImE3oJAgU0/Lfx81dZjFdIj6KbxmqzHrfNgzbYpnUasjic7fPS871a4qgGU X-Received: by 2002:a65:6e8c:0:b0:435:144e:445e with SMTP id bm12-20020a656e8c000000b00435144e445emr41385881pgb.96.1666834987639; Wed, 26 Oct 2022 18:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666834987; cv=none; d=google.com; s=arc-20160816; b=wRWAkzFNTgQQaSgbpPj9fGIIhkRGDs+wUp9Dfm4q4VSal/om1JQ/lMtXuIHJmnxoQ7 ymDHr9quSyF+xnLtTw60I3x2UaPaU71nV42ItZWfPxnfOVciCoRhJC5022vVUzGGjcrN owPliRhljZjUU04MHOgXLWg6mlB8DNLaRFsDHf4VV7u9bgoq2VfEHGvKEZdWfSFVaAHe KtNiqjFKEIxN0P8GrAVqCTQMmDo2z4PbV9134SHP9bqTqHAP0kPmY0BWk23XhVRSDc0K hTzu+VvtevQsoGg/ZVmYMHHxrB+JAZvDdH5iJmDQbu2SHsgJEFWmCRLXiI/no2z23mB5 YO2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature :wdcironportexception:ironport-sdr:ironport-sdr:dkim-signature; bh=elvmn5N9UnpYs6l1kly5kq+OHJJUs+AqBvZWKRp+fxQ=; b=TBZLzuj32+tnUmxKQ+26VQElOLmSsBpYmyaQTHhznJqX6rP+UrGLHuit0JDOFH6ROe pPlnI2TIRxmQgaMlMFFRW20lv+h8YzaD5S92gvQPf3UaMMnh3ceaN7W8BOuKnbluWoWb IHASl76SqeXS0ibdA7aDx9IllJX5t8rHCBLXTtUPLvFPoxOaxN5LU7dZtUWhSL2oHj5b T4WzJbbomsAZaKy1DRBAWBvnryZxtlQdvWF4mhSkuK7I8aPfLVu5JY0FwN7KElHRzkaD 2g04yYya5bkjkqG2oLwWmN2QjsF+sdSbgC+xVGWIAAdien8TSMv+EPtuM/kvIygr3LFS 8QTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=FHohDeUk; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=AlLTfLAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902e74200b0017db9b9d54asi10653473plf.300.2022.10.26.18.42.52; Wed, 26 Oct 2022 18:43:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=FHohDeUk; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=AlLTfLAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233785AbiJ0BSb (ORCPT + 99 others); Wed, 26 Oct 2022 21:18:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiJ0BS1 (ORCPT ); Wed, 26 Oct 2022 21:18:27 -0400 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4413C543E1 for ; Wed, 26 Oct 2022 18:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1666833507; x=1698369507; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=j4VTz3xAsPX1ykQZALKZMRU5knt+b8ZaK/+epWQA9oU=; b=FHohDeUkUzPmDv3W0InYd7UIkTv5IVIAyt6FgB8TDECQm8An6559NG20 G0gh9DloaeER+6hmxrtjjs/cvoAHRGSRuU++I7/AbenXqOP5g6iiB7V+C FDPzX0ToLTdxkV+g31J0KaIjMHsCQ/pGEeH5wGaQjRv0/zsbd/U1QGrck ShZjkfPmlIYlrhNP9INb/lz40KCBPBu8AbGxAtI2uKQL3npD4M+TS0nev eBfw/2mUR8EfLCmTWj5bC2x8DYvaas8n4NHO4ZgnQniwekKPG8u2bDfmh 1fAwJ6gPtv9rNL8SQlOCKagOvIOeFAUKEzaBRm7XpT8Fs+dJTYucgvKWV g==; X-IronPort-AV: E=Sophos;i="5.95,215,1661788800"; d="scan'208";a="214828250" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 27 Oct 2022 09:18:25 +0800 IronPort-SDR: qlcQ8QodG1tTKnO22mI4+fL5AcQHO5rTOo+94bAOzXINgxQMwz8G7Xj1Coz8Q/qPmOPVLCNwWi gTXCSpcBU5wZkqid0t+4lf+1rDnfHBGGqYVKZaNM8Roo5YFXFaE4/spvlyKxIBN4hD6VlhvqD8 0oRYqQdzXBRA/1fWgaR/4B6jWoOu98whtx+TSXR7Gu4VVWnoxbWjVMPyLq8fup4BjLnD8PE8c/ 11iIux4ruac93EweaKBBHV3YSy7El42sxRrB4DH89UvegKQGz039v5skVfhC9ZGJR4jlk61nY7 9svBuD71YNHvxFG4jTji+m9i Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 26 Oct 2022 17:32:05 -0700 IronPort-SDR: iSr94aw5ansyUO+LOq40Z45nHhMjKAMoDR9LN5FZdKO9M227f8vgUwE1lOuaQzbiNYnm16rp71 HIlJYd43owHRU9tlvudZncZPjci9jCNfXCPxXl9XgCDTcXFEz/mlZo/ZNwh6ttq5kEg84fpvn+ o1kQ/Rf7FsGtAWHlihY1i/Ba/9bEhiIxj+bzPIPtpB91G6LCR+V8lOQYVyJETaLO8of5HqU0NE D3HmHUPdA5eRoW8cYit7n4p2hJToJIxYmXAcSBixvQ3javJ+xW1s5MtuiMSXT78i4n6WACXKcr BSA= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 26 Oct 2022 18:18:25 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4MySVT0VTmz1RwvT for ; Wed, 26 Oct 2022 18:18:25 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1666833503; x=1669425504; bh=j4VTz3xAsPX1ykQZALKZMRU5knt+b8ZaK/+ epWQA9oU=; b=AlLTfLAZlMQuunUsaVrTOL6ArW6Bwtsjjj/dCIowQnsGO3Ny7IX 8fETeWSg45iCdJ8qBnD5z9SzZ/rORSWbNt/6k6fIGNFSbPAqFXciPJsr2KkDWTYs 4CAskUPPRb9upJ55xdDt6x1lGglffoeITJ/e0Hhgpz7w6fETMh1tf5n9pmIgVc8v 0F2yXafbOJQOQydVy9vvvCtlzJyv7BxaoC6XYzj+DV/1MRedMmNCBjwu4SNfv/es lH9AOj8pyGJ0iSrnx/dhludNfuMK6I+54MpHK7PJNM8/QKrcsZxy+6vbMoml8zi+ +BodTY/qmKOETxc9ZWmNtOvXjEpqOvOLMfA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7TK-8tE4eath for ; Wed, 26 Oct 2022 18:18:23 -0700 (PDT) Received: from [10.149.53.254] (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4MySVP4qbZz1RvLy; Wed, 26 Oct 2022 18:18:21 -0700 (PDT) Message-ID: Date: Thu, 27 Oct 2022 10:18:20 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH RFC v3 03/22] scsi: core: Implement reserved command handling Content-Language: en-US To: John Garry , axboe@kernel.dk, jejb@linux.ibm.com, martin.petersen@oracle.com, jinpu.wang@cloud.ionos.com, hare@suse.de, bvanassche@acm.org, hch@lst.de, ming.lei@redhat.com, niklas.cassel@wdc.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linuxarm@huawei.com References: <1666693096-180008-1-git-send-email-john.garry@huawei.com> <1666693096-180008-4-git-send-email-john.garry@huawei.com> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <1666693096-180008-4-git-send-email-john.garry@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/25/22 19:17, John Garry wrote: > From: Hannes Reinecke > > Quite some drivers are using management commands internally, which > typically use the same hardware tag pool (ie they are being allocated > from the same hardware resources) as the 'normal' I/O commands. > These commands are set aside before allocating the block-mq tag bitmap, > so they'll never show up as busy in the tag map. > The block-layer, OTOH, already has 'reserved_tags' to handle precisely > this situation. > So this patch adds a new field 'nr_reserved_cmds' to the SCSI host > template to instruct the block layer to set aside a tag space for these > management commands by using reserved tags. > > Signed-off-by: Hannes Reinecke > #jpg: Set tag_set->queue_depth = shost->can_queue, and not > = shost->can_queue + shost->nr_reserved_cmds; > Signed-off-by: John Garry > --- > drivers/scsi/hosts.c | 3 +++ > drivers/scsi/scsi_lib.c | 2 ++ > include/scsi/scsi_host.h | 15 ++++++++++++++- > 3 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c > index 12346e2297fd..db89afc37bc9 100644 > --- a/drivers/scsi/hosts.c > +++ b/drivers/scsi/hosts.c > @@ -489,6 +489,9 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) > if (sht->virt_boundary_mask) > shost->virt_boundary_mask = sht->virt_boundary_mask; > > + if (sht->nr_reserved_cmds) > + shost->nr_reserved_cmds = sht->nr_reserved_cmds; > + Nit: the if is not really necessary I think. But it does not hurt. > device_initialize(&shost->shost_gendev); > dev_set_name(&shost->shost_gendev, "host%d", shost->host_no); > shost->shost_gendev.bus = &scsi_bus_type; > diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c > index 39d4fd124375..a8c4e7c037ae 100644 > --- a/drivers/scsi/scsi_lib.c > +++ b/drivers/scsi/scsi_lib.c > @@ -1978,6 +1978,8 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) > tag_set->nr_hw_queues = shost->nr_hw_queues ? : 1; > tag_set->nr_maps = shost->nr_maps ? : 1; > tag_set->queue_depth = shost->can_queue; > + tag_set->reserved_tags = shost->nr_reserved_cmds; > + Why the blank line ? > tag_set->cmd_size = cmd_size; > tag_set->numa_node = dev_to_node(shost->dma_dev); > tag_set->flags = BLK_MQ_F_SHOULD_MERGE; > diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h > index 750ccf126377..91678c77398e 100644 > --- a/include/scsi/scsi_host.h > +++ b/include/scsi/scsi_host.h > @@ -360,10 +360,17 @@ struct scsi_host_template { > /* > * This determines if we will use a non-interrupt driven > * or an interrupt driven scheme. It is set to the maximum number > - * of simultaneous commands a single hw queue in HBA will accept. > + * of simultaneous commands a single hw queue in HBA will accept > + * including reserved commands. > */ > int can_queue; > > + /* > + * This determines how many commands the HBA will set aside > + * for reserved commands. > + */ > + int nr_reserved_cmds; > + > /* > * In many instances, especially where disconnect / reconnect are > * supported, our host also has an ID on the SCSI bus. If this is > @@ -611,6 +618,12 @@ struct Scsi_Host { > */ > unsigned nr_hw_queues; > unsigned nr_maps; > + > + /* > + * Number of reserved commands to allocate, if any. > + */ > + unsigned int nr_reserved_cmds; > + > unsigned active_mode:2; > > /* -- Damien Le Moal Western Digital Research