Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp292027ybh; Wed, 11 Mar 2020 01:02:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuaODZVLiryxJw99k2g2jJnxrA753yQRTYtf8rz7DeM1fDz5up4gzkQG4kCXSOi6IfFUJMf X-Received: by 2002:a9d:a51:: with SMTP id 75mr1352131otg.112.1583913761802; Wed, 11 Mar 2020 01:02:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583913761; cv=none; d=google.com; s=arc-20160816; b=AuPyCzSGZFtp1v+TtO7/hkvppkLcma8oKEQoI8rh8tVBdn7olmm1W99mudMP34ODq9 +Kh4oB5igLm0ER3rHqZ2SReXEJCKf51p9H58D5dOOJsMVGoB4REtpqGfUjv0kFk71KPV jvbk9lWwiGBDxMDL+JekaG5gvlncbiKzCRAgjqY/zIR3TNwwMTPGC7/pRRwbYH3Og7ES 6YTcROmeI7B+0EzhGvBKckLayDw31M7/vQw8/yPCOw0qMATp+nxXGkhAcwwzf5gUct9v VOnVEXIBxNhjWsPhtk8mkb0OC8dUS4YEiTArriW7o/EvZzbgX8iRG+kSA45cOU410w16 9wrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BTQ/qk+PVYNZHsKM28XRoYcuNh5fpwlLGdRZPJQp7IM=; b=mNsNXzWJCLdlngUpowjYaQnZ+/zxL9gkuL1DIHPuPWQDUxW8KpmunT3wgjxTC8CNP+ 06b39qbMCSIUMf2WRoGJL5f7fzDL6JAla/gGEFgs1XL0dPAmXhhew9jmddy3EQIkOQZ+ hI9D1qpWe3E8TObFvQTc1kS/RK83toNe9piLprvWQ/5h/xAg8VYvVgajXa8+WNkyEcyF c7nhdqqU8vLYpWO3ils33NVlXH8SZ1swJ2Ak1CTFKbjd/o+Hqia1sB96VpsDfgfxq96d O+vvZNBqIY2PLYW/UnqItIcW2i+I1ZkHpgrPOK8qxDvOjOTx4+mZTmyABI2NBJc2uV5E Q1RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LslJIrMG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g141si822810oib.45.2020.03.11.01.02.21; Wed, 11 Mar 2020 01:02:41 -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=@redhat.com header.s=mimecast20190719 header.b=LslJIrMG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728500AbgCKIAt (ORCPT + 99 others); Wed, 11 Mar 2020 04:00:49 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:48830 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726923AbgCKIAs (ORCPT ); Wed, 11 Mar 2020 04:00:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583913647; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BTQ/qk+PVYNZHsKM28XRoYcuNh5fpwlLGdRZPJQp7IM=; b=LslJIrMGyeY2qzQm10qSrcGvSYRN8FBQ5Hne4C9WZ7XT0uncO0TxbFEXclI+C5cpC57Rsy bXACM3pIn9caWatPyzNNfKi6V1BkVPnNisU36dUWbjYbaHT5IlTDejF23SOYr0cSUq9EqN Y/rlARvVePkrWt7DrapHVS12B6esNKw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-8-QGvsN90iOsqhbPUTuUsqug-1; Wed, 11 Mar 2020 04:00:43 -0400 X-MC-Unique: QGvsN90iOsqhbPUTuUsqug-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6EAB418B5F8A; Wed, 11 Mar 2020 08:00:41 +0000 (UTC) Received: from ming.t460p (ovpn-8-26.pek2.redhat.com [10.72.8.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69F7D60C18; Wed, 11 Mar 2020 08:00:30 +0000 (UTC) Date: Wed, 11 Mar 2020 16:00:26 +0800 From: Ming Lei To: Hannes Reinecke Cc: John Garry , axboe@kernel.dk, jejb@linux.ibm.com, martin.petersen@oracle.com, bvanassche@acm.org, hch@infradead.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, virtualization@lists.linux-foundation.org, esc.storagedev@microsemi.com, chenxiang66@hisilicon.com, Hannes Reinecke Subject: Re: [PATCH RFC v2 01/24] scsi: add 'nr_reserved_cmds' field to the SCSI host template Message-ID: <20200311080026.GB31504@ming.t460p> References: <1583857550-12049-1-git-send-email-john.garry@huawei.com> <1583857550-12049-2-git-send-email-john.garry@huawei.com> <20200310230835.GA16056@ming.t460p> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 11, 2020 at 07:55:46AM +0100, Hannes Reinecke wrote: > On 3/11/20 12:08 AM, Ming Lei wrote: > > On Wed, Mar 11, 2020 at 12:25:27AM +0800, John Garry wrote: > >> From: Hannes Reinecke > >> > >> Add a new field 'nr_reserved_cmds' to the SCSI host template to > >> instruct the block layer to set aside a tag space for reserved > >> commands. > >> > >> 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 610ee41fa54c..2967325df7a0 100644 > >> --- a/drivers/scsi/scsi_lib.c > >> +++ b/drivers/scsi/scsi_lib.c > >> @@ -1896,6 +1896,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; > > > > You reserve tags for special usage, meantime the whole queue depth > > isn't increased, that means the tags for IO request is decreased given > > reserved tags can't be used for IO, so IO performance may be effected. > > > > If not the case, please explain a bit in commit log. > > > The overall idea of this patchset is to fold _existing_ management > command handling into using the blk-mq bitmap. > Currently, 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) than the 'normal' I/O > commands. > But as they are using the same tagpool these drivers already decrement > the available number of commands; check eg. hpsa: > > static int hpsa_scsi_host_alloc(struct ctlr_info *h) > { > struct Scsi_Host *sh; > > sh = scsi_host_alloc(&hpsa_driver_template, sizeof(h)); > if (sh == NULL) { > dev_err(&h->pdev->dev, "scsi_host_alloc failed\n"); > return -ENOMEM; > } > > sh->io_port = 0; > sh->n_io_port = 0; > sh->this_id = -1; > sh->max_channel = 3; > sh->max_cmd_len = MAX_COMMAND_SIZE; > sh->max_lun = HPSA_MAX_LUN; > sh->max_id = HPSA_MAX_LUN; > sh->can_queue = h->nr_cmds - HPSA_NRESERVED_CMDS; > sh->cmd_per_lun = sh->can_queue; > > So the idea of this patchset is to convert existing use-cases; seeing > that they already reserve commands internally performance will not be > affected. > OK, got it. I'd suggest to add comment about this idea in commit log, cause it is one fundamental thing about this change. Thanks, Ming