Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp526913ybt; Wed, 1 Jul 2020 04:17:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfsgb0A0rpTEbvN93UDIi9X9XmvYKWwSt7DnlXCt3jrHZ+xPlW3odML+aOQlrz+W9CdVUS X-Received: by 2002:a17:906:cd18:: with SMTP id oz24mr22070022ejb.118.1593602250218; Wed, 01 Jul 2020 04:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593602250; cv=none; d=google.com; s=arc-20160816; b=m6HekTOygVuguIpuXV1b61cho557Ef4OMndJ6/GTNu3oL9e8VPspg100rydqXsOZQH mPK4cs+OHEqrcXY3qtFdgCDFTrpOtyQfaeTw4VP/Vo+LqJcyoK55eNznHb+uPEXxmJyb waKa6D1MOWuPX3frAN/3rCIu4t+7SLJrPXIyGey0rSbtZ2mZuLTOsN0Rnm5Id/Adkqxo vMFKpyVcTpgnJlxxJvinzAHuMJ+hk1nw3jyhObuqB4wWtnpFTmzvLpXS62PxN30qVkSl SDpzPBesENA7xPvcqajeURNMJrU70JE84NxKUrI/HisV753PbGKpwOhcGHCzFhMCOPdx vIBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=w5k0/vPEZeTqwY5SXJ0/YDPUmmXWJlzEh3JyeTs1JGI=; b=TFT/6JHctIhVhDxFIIrtYiTfbM9K1CJV3YH/z6d1JMSDL7yOZE44zRecPpW//MYza9 qnQoHVX/s6KoylK+94xm3QBrfL3Yt1sKQ5G3Jt9SMCBRkISzc3MMk5tbHIKxPrQQ8lxK XZ2QlgHrYnWVTM3ihUiuPR3MbU8THjQQtmahLhxQ1vBCARRUAqmG/7w7/gKqxUEYrcv4 dV4BrfBey7I1gcYYUilbqSIM8ngoqvCh4YlqtrALm8NhJhfh3vh5xCVTq9OJSdas1k2r 5mzpAhFmC3IlmALDif+EuHjMtWNEicjBB9FYBqW6G4oSAYXe3pJxwZZktUEjTmYJhycI Ay6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b="izsE4d/M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la26si3674473ejb.587.2020.07.01.04.17.05; Wed, 01 Jul 2020 04:17:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b="izsE4d/M"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730159AbgGALQ4 (ORCPT + 99 others); Wed, 1 Jul 2020 07:16:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730140AbgGALQz (ORCPT ); Wed, 1 Jul 2020 07:16:55 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B368C03E979 for ; Wed, 1 Jul 2020 04:16:55 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id n26so10201643ejx.0 for ; Wed, 01 Jul 2020 04:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=w5k0/vPEZeTqwY5SXJ0/YDPUmmXWJlzEh3JyeTs1JGI=; b=izsE4d/MxGx5PCBufUvd6Yby0hi5tUgK41AM6BrSGZML4kl+Q5GVb4kIosbzdcdZ6Q y8jEE9b2jt4DcXdhclUnQjFSOLyQBgnTCrK34sqvoKQzYD+kh1INlDOXUSg1UvK8N3ov FiBhVLW6YBYsHLL1g4yLijqhLct2dO+rIAAA+zcFY0UkZ6L8f/wicU9arfRCoPZ5mkbB J/GTwRbSYp7WPzfl5x0GKHQD94hEVEc7/ENiN/lCY6K4WGIYlSVAoxHxjQDq/1/as9A4 w40i1d0DkjwdoCdX+GTg9zDJporiggTqcGdLE8cR3LxyfnzW2Lzx2O5/5BFiWOLQBS6p i1/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=w5k0/vPEZeTqwY5SXJ0/YDPUmmXWJlzEh3JyeTs1JGI=; b=gE12Mkk2ItevlF2ZXPbSn1D1L+z96MBD1s5eIaqZxwLWWDocaC8C8UKSUQxgsM8Lch XBF0WlBPQBo1Al21QcA4IV2CfPcJG/EnaT9AchPn/01rnBH5VgGzjuz9MWzC8yru9Jfy JdVTrnj8tay1PGWX8RdzOtVU4tBQZmFGGIIij66TXHE9bEVqe2VpLr8VTkVXhjaLioIV q/RJu1jHryDUtnpmYGGF+Jf7DTUd/qLpUkxUYZK/FFCFRMIdQF4K6PlrDouWX/xrPcwY x8BMqTjalOfbSRRFwbGVaWMKV8Gih3NIg7eJp0cSFDRIuTUk9Y1EEwLq+LrFsRYHGEYp BPcQ== X-Gm-Message-State: AOAM533QSgWgpttlkJPbiCOpoLe8ZWBChaHvK4FdR45sDwlLHMG3tVoF r00+0r9nQjKHFDv3W7JVQsnXpA== X-Received: by 2002:a17:906:2616:: with SMTP id h22mr22010171ejc.154.1593602214045; Wed, 01 Jul 2020 04:16:54 -0700 (PDT) Received: from localhost ([194.62.217.57]) by smtp.gmail.com with ESMTPSA id b14sm3081906ejg.18.2020.07.01.04.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 04:16:53 -0700 (PDT) Date: Wed, 1 Jul 2020 13:16:52 +0200 From: Javier =?utf-8?B?R29uesOhbGV6?= To: Niklas Cassel Cc: Jonathan Corbet , Jens Axboe , Keith Busch , Christoph Hellwig , Sagi Grimberg , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: Re: [PATCH 2/2] block: add max_active_zones to blk-sysfs Message-ID: <20200701111330.3vpivrovh3i46maa@mpHalley.local> References: <20200616102546.491961-1-niklas.cassel@wdc.com> <20200616102546.491961-3-niklas.cassel@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: <20200616102546.491961-3-niklas.cassel@wdc.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.06.2020 12:25, Niklas Cassel wrote: >Add a new max_active zones definition in the sysfs documentation. >This definition will be common for all devices utilizing the zoned block >device support in the kernel. > >Export max_active_zones according to this new definition for NVMe Zoned >Namespace devices, ZAC ATA devices (which are treated as SCSI devices by >the kernel), and ZBC SCSI devices. > >Add the new max_active_zones struct member to the request_queue, rather >than as a queue limit, since this property cannot be split across stacking >drivers. > >For SCSI devices, even though max active zones is not part of the ZBC/ZAC >spec, export max_active_zones as 0, signifying "no limit". > >Signed-off-by: Niklas Cassel >--- > Documentation/block/queue-sysfs.rst | 7 +++++++ > block/blk-sysfs.c | 14 +++++++++++++- > drivers/nvme/host/zns.c | 1 + > drivers/scsi/sd_zbc.c | 1 + > include/linux/blkdev.h | 20 ++++++++++++++++++++ > 5 files changed, 42 insertions(+), 1 deletion(-) > >diff --git a/Documentation/block/queue-sysfs.rst b/Documentation/block/queue-sysfs.rst >index f01cf8530ae4..f261a5c84170 100644 >--- a/Documentation/block/queue-sysfs.rst >+++ b/Documentation/block/queue-sysfs.rst >@@ -117,6 +117,13 @@ Maximum number of elements in a DMA scatter/gather list with integrity > data that will be submitted by the block layer core to the associated > block driver. > >+max_active_zones (RO) >+--------------------- >+For zoned block devices (zoned attribute indicating "host-managed" or >+"host-aware"), the sum of zones belonging to any of the zone states: >+EXPLICIT OPEN, IMPLICIT OPEN or CLOSED, is limited by this value. >+If this value is 0, there is no limit. >+ > max_open_zones (RO) > ------------------- > For zoned block devices (zoned attribute indicating "host-managed" or >diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c >index fa42961e9678..624bb4d85fc7 100644 >--- a/block/blk-sysfs.c >+++ b/block/blk-sysfs.c >@@ -310,6 +310,11 @@ static ssize_t queue_max_open_zones_show(struct request_queue *q, char *page) > return queue_var_show(queue_max_open_zones(q), page); > } > >+static ssize_t queue_max_active_zones_show(struct request_queue *q, char *page) >+{ >+ return queue_var_show(queue_max_active_zones(q), page); >+} >+ > static ssize_t queue_nomerges_show(struct request_queue *q, char *page) > { > return queue_var_show((blk_queue_nomerges(q) << 1) | >@@ -677,6 +682,11 @@ static struct queue_sysfs_entry queue_max_open_zones_entry = { > .show = queue_max_open_zones_show, > }; > >+static struct queue_sysfs_entry queue_max_active_zones_entry = { >+ .attr = {.name = "max_active_zones", .mode = 0444 }, >+ .show = queue_max_active_zones_show, >+}; >+ > static struct queue_sysfs_entry queue_nomerges_entry = { > .attr = {.name = "nomerges", .mode = 0644 }, > .show = queue_nomerges_show, >@@ -776,6 +786,7 @@ static struct attribute *queue_attrs[] = { > &queue_zoned_entry.attr, > &queue_nr_zones_entry.attr, > &queue_max_open_zones_entry.attr, >+ &queue_max_active_zones_entry.attr, > &queue_nomerges_entry.attr, > &queue_rq_affinity_entry.attr, > &queue_iostats_entry.attr, >@@ -803,7 +814,8 @@ static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr, > (!q->mq_ops || !q->mq_ops->timeout)) > return 0; > >- if (attr == &queue_max_open_zones_entry.attr && >+ if ((attr == &queue_max_open_zones_entry.attr || >+ attr == &queue_max_active_zones_entry.attr) && > !blk_queue_is_zoned(q)) > return 0; > >diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c >index af156529f3b6..502070763266 100644 >--- a/drivers/nvme/host/zns.c >+++ b/drivers/nvme/host/zns.c >@@ -83,6 +83,7 @@ int nvme_update_zone_info(struct gendisk *disk, struct nvme_ns *ns, > q->limits.zoned = BLK_ZONED_HM; > blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q); > blk_queue_max_open_zones(q, le32_to_cpu(id->mor) + 1); >+ blk_queue_max_active_zones(q, le32_to_cpu(id->mar) + 1); > free_data: > kfree(id); > return status; >diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c >index aa3564139b40..d8b2c49d645b 100644 >--- a/drivers/scsi/sd_zbc.c >+++ b/drivers/scsi/sd_zbc.c >@@ -721,6 +721,7 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) > blk_queue_max_open_zones(q, 0); > else > blk_queue_max_open_zones(q, sdkp->zones_max_open); >+ blk_queue_max_active_zones(q, 0); > nr_zones = round_up(sdkp->capacity, zone_blocks) >> ilog2(zone_blocks); > > /* READ16/WRITE16 is mandatory for ZBC disks */ >diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h >index 2f332f00501d..3776140f8f20 100644 >--- a/include/linux/blkdev.h >+++ b/include/linux/blkdev.h >@@ -521,6 +521,7 @@ struct request_queue { > unsigned long *conv_zones_bitmap; > unsigned long *seq_zones_wlock; > unsigned int max_open_zones; >+ unsigned int max_active_zones; > #endif /* CONFIG_BLK_DEV_ZONED */ Looking a second time at these patches, wouldn't it make sense to move this to queue_limits? Javier