From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BD4BC8300A for ; Thu, 30 Apr 2020 13:20:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05EB42076D for ; Thu, 30 Apr 2020 13:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726765AbgD3NUD (ORCPT ); Thu, 30 Apr 2020 09:20:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:60542 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726550AbgD3NUD (ORCPT ); Thu, 30 Apr 2020 09:20:03 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A9401AEF8; Thu, 30 Apr 2020 13:20:01 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , John Garry , Ming Lei , Bart van Assche , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH RFC v3 01/41] scsi: add 'nr_reserved_cmds' field to the SCSI host template Date: Thu, 30 Apr 2020 15:18:24 +0200 Message-Id: <20200430131904.5847-2-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200430131904.5847-1-hare@suse.de> References: <20200430131904.5847-1-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke Quite a lot of 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 --- drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi_host.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 47835c4b4ee0..5358f553f526 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1885,6 +1885,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost) shost->tag_set.ops = &scsi_mq_ops_no_commit; shost->tag_set.nr_hw_queues = shost->nr_hw_queues ? : 1; shost->tag_set.queue_depth = shost->can_queue; + shost->tag_set.reserved_tags = shost->nr_reserved_cmds; shost->tag_set.cmd_size = cmd_size; shost->tag_set.numa_node = NUMA_NO_NODE; shost->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 822e8cda8d9b..37bb7d74e4c4 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -599,6 +599,12 @@ struct Scsi_Host { * is nr_hw_queues * can_queue. */ unsigned nr_hw_queues; + + /* + * Number of commands to reserve, if any. + */ + unsigned nr_reserved_cmds; + unsigned active_mode:2; unsigned unchecked_isa_dma:1; -- 2.16.4