From patchwork Fri Aug 27 07:50:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12461461 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 F4009C43216 for ; Fri, 27 Aug 2021 07:50:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D889160FD8 for ; Fri, 27 Aug 2021 07:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244395AbhH0Hvn (ORCPT ); Fri, 27 Aug 2021 03:51:43 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:42478 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244526AbhH0Hvh (ORCPT ); Fri, 27 Aug 2021 03:51:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1630050648; x=1661586648; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ecL1cTq5qzW9fwzQ+RZ0Ul1M8AxnpwjBwYswKenT5XA=; b=DRgkl3uKFCjRYX7J03qYhbWUnxRUMDvFrvdbis5TTH9wE5NW/NUmbuHW Eyemq+zubtMHouS+AwFnjXShqTrn6QDVFzDIGti/GpbvpGQgHaYi2kKQk 2VX/HbDEx+3oOcehEfyvVgEIFgXcIugtCkx7S3a2nijJHtwTG9ZRbbUW8 kz2XMFNRyDekhLuo3CezXIpAMolFXdPUlozvXIdq1681+vek9zWCySGOz VlT54d9Zx9fRs59rSxcUUFG42t01a7vTSgpVRZao4oR6x/UfUlEuafO/W 2rN/WM4tlGRVea2REV6vJHr/DN498+O8aCCyg+7TFcffjIN09t6wJeeFy w==; X-IronPort-AV: E=Sophos;i="5.84,356,1620662400"; d="scan'208";a="183342786" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 27 Aug 2021 15:50:47 +0800 IronPort-SDR: YKReJYtWwAjAVa+T8q6i6A6MoDCZfbzfgh92csE440M1DUR6TYzSrKF+Vzk9LRdziYOa2iqVoF t+rzRF+B8Gbe60BcKRYajf54dapQgpSJSQNzcDOGnwN3+HwK3mza7Q/MxxlCwSyWtm7eepqooW k+ei+oWcVbgfeB7JGKWqnCjtpCpXfMBbP7nbkaTvJyd0Ub6p4RtBSJnyaiEv6MxWjqlhLXagiA 5zBV9Xtb+xVabVXhgEhBJCqoJHmyO5ykTy2pXpLWgOWIczCpqw3d9ROuWMNEzHzZTba97giMZ7 LGb0XuFWDsdCb0mSRioMsZdG Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2021 00:26:00 -0700 IronPort-SDR: lXSxZJ96A6xJB1FPbWtLqFdSt3GLZWfhQ4JFvSJ6wlN9dCvDROumc4gz97V0GJpw2IOEQhItfo baietFxpmZtonEllRBVSR6m7aj6mN5I5TKQkngeNyLiy09J8hI2xt+nSpmFTGgoG8NZEOs16lt STAQZFQqjE9gqB8IncEcY57IAsfDVCVHd3s9GXhPJ43hucYxeiMqIo1S4A4CXLrLfqv3bad88Y WZNhxRgSiQSc5Z7EbTh3dNSBorI8A2xg7sFiRcDusPNPjCm+iXF/smCYlGvxMZTFl+F6negakj 0SI= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 27 Aug 2021 00:50:47 -0700 From: Damien Le Moal To: Jens Axboe , linux-block@vger.kernel.org, "Martin K . Petersen" , linux-scsi@vger.kernel.org Subject: [PATCH v6 1/5] block: Add independent access ranges support Date: Fri, 27 Aug 2021 16:50:40 +0900 Message-Id: <20210827075045.642269-2-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827075045.642269-1-damien.lemoal@wdc.com> References: <20210827075045.642269-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The Concurrent Positioning Ranges VPD page (for SCSI) and data log page (for ATA) contain parameters describing the set of contiguous LBAs that can be served independently by a single LUN multi-actuator hard-disk. Similarly, a logically defined block device composed of multiple disks can in some cases execute requests directed at different sector ranges in parallel. A dm-linear device aggregating 2 block devices togewther is an example. This patch implement support for exposing this information to the user to allow optimizing device accesses to increase performance. To describe the set of independent sector ranges of a device (actuators of a multi-actuator HDDs or table entries of a dm-linear device), The type struct blk_independent_access_ranges is introduced. This structure describes each sector range using an array of struct blk_independent_access_range structures. This range structure defines the start sector and number of sectors of the access range. The function disk_set_iaranges() allows a device driver to signal to the block layer that a device has multiple independent access ranges. struct blk_independent_access_ranges is attached to the device request queue by the disk_set_iaranges() function. The function disk_alloc_iaranges() is provided for drivers to allocate this structure. The blk_independent_access_ranges structure contains kobjects (struct kobject) to expose to the user through sysfs the set of independent access ranges supported by a device. When the device is initialized, sysfs registration of the range information is done from blk_register_queue() using the block layer internal function disk_register_iaranges(). If a driver calls disk_set_iaranges() for a registered queue, e.g. when a device is revalidated, disk_set_iaranges() will execute disk_register_iaranges() to update the queue sysfs attribute files. The sysfs file structure created starts from the independent_access_ranges sub-directory and contains the start sector and number of sectors of each range, with the information for each range grouped in sub-directories. E.g. for a dual actuator HDD, the user sees: $ tree /sys/block/sdk/queue/independent_access_ranges/ /sys/block/sdk/queue/independent_access_ranges/ |-- 0 | |-- nr_sectors | `-- sector `-- 1 |-- nr_sectors `-- sector For a regular device with a single access range, the independent_access_ranges sysfs directory does not exist. Device revalidation may lead to changes to this structure and to the attribute values. When manipulated, the queue sysfs_lock and sysfs_dir_lock are held for atomicity, similarly to how the blk-mq and elevator sysfs queue sub-directories are protected. The code related to the management of independent access rages is added in the new file block/blk-iaranges.c. Signed-off-by: Damien Le Moal --- block/Makefile | 2 +- block/blk-iaranges.c | 322 +++++++++++++++++++++++++++++++++++++++++ block/blk-sysfs.c | 26 +++- block/blk.h | 4 + include/linux/blkdev.h | 34 +++++ 5 files changed, 379 insertions(+), 9 deletions(-) create mode 100644 block/blk-iaranges.c diff --git a/block/Makefile b/block/Makefile index 0d951adce796..8e45fced0bb8 100644 --- a/block/Makefile +++ b/block/Makefile @@ -9,7 +9,7 @@ obj-$(CONFIG_BLOCK) := bio.o elevator.o blk-core.o blk-sysfs.o \ blk-lib.o blk-mq.o blk-mq-tag.o blk-stat.o \ blk-mq-sysfs.o blk-mq-cpumap.o blk-mq-sched.o ioctl.o \ genhd.o ioprio.o badblocks.o partitions/ blk-rq-qos.o \ - disk-events.o + disk-events.o blk-iaranges.o obj-$(CONFIG_BOUNCE) += bounce.o obj-$(CONFIG_BLK_SCSI_REQUEST) += scsi_ioctl.o diff --git a/block/blk-iaranges.c b/block/blk-iaranges.c new file mode 100644 index 000000000000..bdecdf095f6a --- /dev/null +++ b/block/blk-iaranges.c @@ -0,0 +1,322 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Block device concurrent positioning ranges. + * + * Copyright (C) 2021 Western Digital Corporation or its Affiliates. + */ +#include +#include +#include +#include + +#include "blk.h" + +static ssize_t +blk_iarange_sector_show(struct blk_independent_access_range *iar, char *buf) +{ + return sprintf(buf, "%llu\n", iar->sector); +} + +static ssize_t +blk_iarange_nr_sectors_show(struct blk_independent_access_range *iar, char *buf) +{ + return sprintf(buf, "%llu\n", iar->nr_sectors); +} + +struct blk_iarange_sysfs_entry { + struct attribute attr; + ssize_t (*show)(struct blk_independent_access_range *iar, char *buf); +}; + +static struct blk_iarange_sysfs_entry blk_iarange_sector_entry = { + .attr = { .name = "sector", .mode = 0444 }, + .show = blk_iarange_sector_show, +}; + +static struct blk_iarange_sysfs_entry blk_iarange_nr_sectors_entry = { + .attr = { .name = "nr_sectors", .mode = 0444 }, + .show = blk_iarange_nr_sectors_show, +}; + +static struct attribute *blk_iarange_attrs[] = { + &blk_iarange_sector_entry.attr, + &blk_iarange_nr_sectors_entry.attr, + NULL, +}; +ATTRIBUTE_GROUPS(blk_iarange); + +static ssize_t blk_iarange_sysfs_show(struct kobject *kobj, + struct attribute *attr, char *buf) +{ + struct blk_iarange_sysfs_entry *entry = + container_of(attr, struct blk_iarange_sysfs_entry, attr); + struct blk_independent_access_range *iar = + container_of(kobj, struct blk_independent_access_range, kobj); + ssize_t ret; + + mutex_lock(&iar->queue->sysfs_lock); + ret = entry->show(iar, buf); + mutex_unlock(&iar->queue->sysfs_lock); + + return ret; +} + +static const struct sysfs_ops blk_iarange_sysfs_ops = { + .show = blk_iarange_sysfs_show, +}; + +/* + * Independent access range entries are not freed individually, but alltogether + * with struct blk_independent_access_ranges and its array of range entries. + * Since kobject_add() takes a reference on the parent kobject contained in + * struct blk_independent_access_ranges, the array of independent access range + * entries cannot be freed until kobject_del() is called for all entries. + * So we do not need to do anything here, but still need this no-op release + * operation to avoid complaints from the kobject code. + */ +static void blk_iarange_sysfs_nop_release(struct kobject *kobj) +{ +} + +static struct kobj_type blk_iarange_ktype = { + .sysfs_ops = &blk_iarange_sysfs_ops, + .default_groups = blk_iarange_groups, + .release = blk_iarange_sysfs_nop_release, +}; + +/* + * This will be executed only after all independent access range entries are + * removed with kobject_del(), at which point, it is safe to free everything, + * including the array of range entries. + */ +static void blk_iaranges_sysfs_release(struct kobject *kobj) +{ + struct blk_independent_access_ranges *iars = + container_of(kobj, struct blk_independent_access_ranges, kobj); + + kfree(iars); +} + +static struct kobj_type blk_iaranges_ktype = { + .release = blk_iaranges_sysfs_release, +}; + +/** + * disk_register_iaranges - register with sysfs a set of independent + * access ranges + * @disk: Target disk + * @new_iars: New set of independent access ranges + * + * Register with sysfs a set of independent access ranges for @disk. + * If @new_iars is not NULL, this set of ranges is registered and the old set + * specified by q->iaranges is unregistered. Otherwise, q->iaranges is + * registered if it is not already. + */ +int disk_register_iaranges(struct gendisk *disk, + struct blk_independent_access_ranges *new_iars) +{ + struct request_queue *q = disk->queue; + struct blk_independent_access_ranges *iars; + int i, ret; + + lockdep_assert_held(&q->sysfs_dir_lock); + lockdep_assert_held(&q->sysfs_lock); + + /* If a new range set is specified, unregister the old one */ + if (new_iars) { + if (q->iaranges) + disk_unregister_iaranges(disk); + q->iaranges = new_iars; + } + + iars = q->iaranges; + if (!iars) + return 0; + + /* + * At this point, iars is the new set of sector access ranges that needs + * to be registered with sysfs. + */ + WARN_ON(iars->sysfs_registered); + ret = kobject_init_and_add(&iars->kobj, &blk_iaranges_ktype, + &q->kobj, "%s", "independent_access_ranges"); + if (ret) { + q->iaranges = NULL; + kfree(iars); + return ret; + } + + for (i = 0; i < iars->nr_iaranges; i++) { + iars->iarange[i].queue = q; + ret = kobject_init_and_add(&iars->iarange[i].kobj, + &blk_iarange_ktype, &iars->kobj, + "%d", i); + if (ret) { + while (--i >= 0) + kobject_del(&iars->iarange[i].kobj); + kobject_del(&iars->kobj); + kobject_put(&iars->kobj); + return ret; + } + } + + iars->sysfs_registered = true; + + return 0; +} + +void disk_unregister_iaranges(struct gendisk *disk) +{ + struct request_queue *q = disk->queue; + struct blk_independent_access_ranges *iars = q->iaranges; + int i; + + lockdep_assert_held(&q->sysfs_dir_lock); + lockdep_assert_held(&q->sysfs_lock); + + if (!iars) + return; + + if (iars->sysfs_registered) { + for (i = 0; i < iars->nr_iaranges; i++) + kobject_del(&iars->iarange[i].kobj); + kobject_del(&iars->kobj); + kobject_put(&iars->kobj); + } else { + kfree(iars); + } + + q->iaranges = NULL; +} + +static bool disk_check_iaranges(struct gendisk *disk, + struct blk_independent_access_ranges *iars) +{ + sector_t capacity = get_capacity(disk); + sector_t min_sector = (sector_t)-1; + sector_t max_sector = 0; + int i; + + /* + * Sector ranges may overlap but should overall contain all sectors + * within the disk capacity. + */ + for (i = 0; i < iars->nr_iaranges; i++) { + min_sector = min(min_sector, iars->iarange[i].sector); + max_sector = max(max_sector, iars->iarange[i].sector + + iars->iarange[i].nr_sectors); + } + + if (min_sector != 0 || max_sector < capacity) { + pr_warn("Invalid independent access ranges: missing sectors\n"); + return false; + } + + if (max_sector > capacity) { + pr_warn("Invalid independent access ranges: beyond capacity\n"); + return false; + } + + return true; +} + +static bool disk_iaranges_changed(struct gendisk *disk, + struct blk_independent_access_ranges *new) +{ + struct blk_independent_access_ranges *old = disk->queue->iaranges; + int i; + + if (!old) + return true; + + if (old->nr_iaranges != new->nr_iaranges) + return true; + + for (i = 0; i < old->nr_iaranges; i++) { + if (new->iarange[i].sector != old->iarange[i].sector || + new->iarange[i].nr_sectors != old->iarange[i].nr_sectors) + return true; + } + + return false; +} + +/** + * disk_alloc_iaranges - Allocate an independent access range structure + * @disk: target disk + * @nr_iaranges: Number of independent access ranges + * + * Allocate a struct blk_independent_access_ranges structure with @nr_iaranges + * access range descriptors. + */ +struct blk_independent_access_ranges *disk_alloc_iaranges(struct gendisk *disk, + int nr_iaranges) +{ + struct blk_independent_access_ranges *iars; + + iars = kzalloc_node(struct_size(iars, iarange, nr_iaranges), + GFP_KERNEL, disk->queue->node); + if (iars) + iars->nr_iaranges = nr_iaranges; + return iars; +} +EXPORT_SYMBOL_GPL(disk_alloc_iaranges); + +/** + * disk_set_iaranges - Set a disk independent access ranges + * @disk: target disk + * @iars: independent access ranges structure + * + * Set the independent access ranges information of the request queue + * of @disk to @iars. If @iars is NULL and the independent access ranges + * structure already set is cleared. If there are no differences between + * @iars and the independent access ranges structure already set, @iars + * is freed. + */ +void disk_set_iaranges(struct gendisk *disk, + struct blk_independent_access_ranges *iars) +{ + struct request_queue *q = disk->queue; + + if (WARN_ON_ONCE(iars && !iars->nr_iaranges)) { + kfree(iars); + iars = NULL; + } + + mutex_lock(&q->sysfs_dir_lock); + mutex_lock(&q->sysfs_lock); + + if (iars) { + if (!disk_check_iaranges(disk, iars)) { + kfree(iars); + iars = NULL; + goto reg; + } + + if (!disk_iaranges_changed(disk, iars)) { + kfree(iars); + goto unlock; + } + } + + /* + * This may be called for a registered queue. E.g. during a device + * revalidation. If that is the case, we need to unregister the old + * set of independent access ranges and register the new set. If the + * queue is not registered, registration of the device request queue + * will register the independent access ranges, so only swap in the + * new set and free the old one. + */ +reg: + if (blk_queue_registered(q)) { + disk_register_iaranges(disk, iars); + } else { + swap(q->iaranges, iars); + kfree(iars); + } + +unlock: + mutex_unlock(&q->sysfs_lock); + mutex_unlock(&q->sysfs_dir_lock); +} +EXPORT_SYMBOL_GPL(disk_set_iaranges); diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 614d9d47de36..874b34060efa 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -887,16 +887,15 @@ int blk_register_queue(struct gendisk *disk) } mutex_lock(&q->sysfs_lock); + + ret = disk_register_iaranges(disk, NULL); + if (ret) + goto put_dev; + if (q->elevator) { ret = elv_register_queue(q, false); - if (ret) { - mutex_unlock(&q->sysfs_lock); - mutex_unlock(&q->sysfs_dir_lock); - kobject_del(&q->kobj); - blk_trace_remove_sysfs(dev); - kobject_put(&dev->kobj); - return ret; - } + if (ret) + goto put_dev; } blk_queue_flag_set(QUEUE_FLAG_REGISTERED, q); @@ -927,6 +926,16 @@ int blk_register_queue(struct gendisk *disk) percpu_ref_switch_to_percpu(&q->q_usage_counter); } + return ret; + +put_dev: + disk_unregister_iaranges(disk); + mutex_unlock(&q->sysfs_lock); + mutex_unlock(&q->sysfs_dir_lock); + kobject_del(&q->kobj); + blk_trace_remove_sysfs(dev); + kobject_put(&dev->kobj); + return ret; } @@ -972,6 +981,7 @@ void blk_unregister_queue(struct gendisk *disk) mutex_lock(&q->sysfs_lock); if (q->elevator) elv_unregister_queue(q); + disk_unregister_iaranges(disk); mutex_unlock(&q->sysfs_lock); mutex_unlock(&q->sysfs_dir_lock); diff --git a/block/blk.h b/block/blk.h index bbbcc1a64a2d..2aab4a936c4e 100644 --- a/block/blk.h +++ b/block/blk.h @@ -370,4 +370,8 @@ extern struct device_attribute dev_attr_events; extern struct device_attribute dev_attr_events_async; extern struct device_attribute dev_attr_events_poll_msecs; +int disk_register_iaranges(struct gendisk *disk, + struct blk_independent_access_ranges *new_iars); +void disk_unregister_iaranges(struct gendisk *disk); + #endif /* BLK_INTERNAL_H */ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c9cb12483e12..62cebeec6699 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -377,6 +377,32 @@ static inline int blkdev_zone_mgmt_ioctl(struct block_device *bdev, #endif /* CONFIG_BLK_DEV_ZONED */ +/* + * Independent access ranges: struct blk_independent_access_range describes + * a range of contiguous sectors that can be accessed using device command + * execution resources that are independent form the resources used for + * other access ranges. This is typically found with multi-actuator HDDs where + * each access range is served by a different set of heads. + * The set of ranges defined in struct blk_independent_access_ranges must + * overall include all sectors within the device capacity. + * For a device with multiple ranges, e.g. a single LUN multi-actuator HDD, + * requests targeting sectors in different ranges can be executed in parallel. + * A request can straddle an access range boundary. + */ +struct blk_independent_access_range { + struct kobject kobj; + struct request_queue *queue; + sector_t sector; + sector_t nr_sectors; +}; + +struct blk_independent_access_ranges { + struct kobject kobj; + bool sysfs_registered; + unsigned int nr_iaranges; + struct blk_independent_access_range iarange[]; +}; + struct request_queue { struct request *last_merge; struct elevator_queue *elevator; @@ -569,6 +595,9 @@ struct request_queue { #define BLK_MAX_WRITE_HINTS 5 u64 write_hints[BLK_MAX_WRITE_HINTS]; + + /* Independent sector ranges */ + struct blk_independent_access_ranges *iaranges; }; /* Keep blk_queue_flag_name[] in sync with the definitions below */ @@ -1164,6 +1193,11 @@ extern void blk_queue_required_elevator_features(struct request_queue *q, extern bool blk_queue_can_use_dma_map_merging(struct request_queue *q, struct device *dev); +struct blk_independent_access_ranges *disk_alloc_iaranges(struct gendisk *disk, + int nr_iaranges); +void disk_set_iaranges(struct gendisk *disk, + struct blk_independent_access_ranges *iars); + /* * Number of physical segments as sent to the device. * From patchwork Fri Aug 27 07:50:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12461459 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 937E4C43214 for ; Fri, 27 Aug 2021 07:50:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 807E460FF2 for ; Fri, 27 Aug 2021 07:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244536AbhH0Hvm (ORCPT ); Fri, 27 Aug 2021 03:51:42 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:42485 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244495AbhH0Hvi (ORCPT ); Fri, 27 Aug 2021 03:51:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1630050648; x=1661586648; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ISHlTPMJP9UUVggdxZ0huPi7O49JHqjc4UhUHb2wpms=; b=bJIuT6NjZJ3DsZ8St0feOPIxG575pKDyQKw9goEER+XdsxOj5TcIs3xS xSKJDITmVC244td+ZcCan0VjkXAVp6Lwg1tqg49t1KaBUcEsOwPX79w4N HL4+Rdrvqdx9zLH/a/b2fvInVYhiKt7aFnwUxhNpP/HomVaaDi2kNGEJD XBzw3BVweTwGITo4meTPXtC+fQp0Sr66/WHgKcgWrYj+DsbPN/Ms/uvMz +p9VctogLJf7oxY++98R8nauq7aw2ejCN36DK52tfNG2Ko8xBugtrMLae WNiq/UXK3gISFE9BOfklKhw61Uv/+C6no1646T3wxCNLimP5JyvTRv77h w==; X-IronPort-AV: E=Sophos;i="5.84,356,1620662400"; d="scan'208";a="183342788" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 27 Aug 2021 15:50:48 +0800 IronPort-SDR: xLQLkIVohWynuewzNVreshDi1YszmnQMkpKcY7ulNeeg/PKAn931ryGvC7MkZNIz3cc46PT1MR HKJD8FOAmgZx0RfeDh0EUGNC0UfGuZsgY1+CsSr1l1HnSm8XJdD7u7Jrvjq6ACScF8YPvXIvDr 1ZaOZWGWmLfoQrJIm3QNwWdbCwmnuStYH1t2oXkF39RmD8AColuhex8Q9AhL4hVBtWuS33CgJP SMBgVGBb+pDXD/RQ4fQHODbnVwcyax3KvgBCtYBjZih0atym9Wlin371w5PdrvoXV8eQDqumib 6ABAZpPkdkPk+SJG6IByOAwt Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2021 00:26:01 -0700 IronPort-SDR: zZUgMCRPIIOcWSC6nOcWjThdcsg1VhpY72xJlmIxkgrE0vade1Tsd7qCNPx2aDfVRaU1XT91tI x7uNHoZFejJtLL3Le6w48Du1mQnc46JBAHsdXDjc5zdZ1DZ2AUjoLtoOExN3elvtgXKezVZ2AK pg7FyTKri8qDXuBbvnBB5f0kB+MZaWGEkjQ4/NYARkEO+XNiJ8VeKzsdSW2vaOQianeojAyj0k bnlP/PrQIl1zeqnvwwGCL3TM9+5wNP4gWfP+SbT2AG2fpCmu97C2OPyqzLElY1S/+PkmpipT3f qmc= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 27 Aug 2021 00:50:48 -0700 From: Damien Le Moal To: Jens Axboe , linux-block@vger.kernel.org, "Martin K . Petersen" , linux-scsi@vger.kernel.org Subject: [PATCH v6 2/5] scsi: sd: add concurrent positioning ranges support Date: Fri, 27 Aug 2021 16:50:41 +0900 Message-Id: <20210827075045.642269-3-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827075045.642269-1-damien.lemoal@wdc.com> References: <20210827075045.642269-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add the sd_read_cpr() function to the sd scsi disk driver to discover if a device has multiple concurrent positioning ranges (i.e. multiple actuators on an HDD). The existence of VPD page B9h indicates if a device has multiple concurrent positioning ranges. The page content describes each range supported by the device. sd_read_cpr() is called from sd_revalidate_disk() and uses the block layer functions disk_alloc_iaranges() and disk_set_iaranges() to represent the set of actuators of the device as independent access ranges. The format of the Concurrent Positioning Ranges VPD page B9h is defined in section 6.6.6 of SBC-5. Signed-off-by: Damien Le Moal --- drivers/scsi/sd.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/scsi/sd.h | 1 + 2 files changed, 82 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 610ebba0d66e..1bb49d74c3db 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3126,6 +3126,86 @@ static void sd_read_security(struct scsi_disk *sdkp, unsigned char *buffer) sdkp->security = 1; } +static inline sector_t sd64_to_sectors(struct scsi_disk *sdkp, u8 *buf) +{ + return logical_to_sectors(sdkp->device, get_unaligned_be64(buf)); +} + +/** + * sd_read_cpr - Query concurrent positioning ranges + * @sdkp: disk to query + */ +static void sd_read_cpr(struct scsi_disk *sdkp) +{ + struct blk_independent_access_ranges *iars = NULL; + unsigned char *buffer = NULL; + unsigned int nr_cpr = 0; + int i, vpd_len, buf_len = SD_BUF_SIZE; + u8 *desc; + + /* + * We need to have the capacity set first for the block layer to be + * able to check the ranges. + */ + if (sdkp->first_scan) + return; + + if (!sdkp->capacity) + goto out; + + /* + * Concurrent Positioning Ranges VPD: there can be at most 256 ranges, + * leading to a maximum page size of 64 + 256*32 bytes. + */ + buf_len = 64 + 256*32; + buffer = kmalloc(buf_len, GFP_KERNEL); + if (!buffer || scsi_get_vpd_page(sdkp->device, 0xb9, buffer, buf_len)) + goto out; + + /* We must have at least a 64B header and one 32B range descriptor */ + vpd_len = get_unaligned_be16(&buffer[2]) + 3; + if (vpd_len > buf_len || vpd_len < 64 + 32 || (vpd_len & 31)) { + sd_printk(KERN_ERR, sdkp, + "Invalid Concurrent Positioning Ranges VPD page\n"); + goto out; + } + + nr_cpr = (vpd_len - 64) / 32; + if (nr_cpr == 1) { + nr_cpr = 0; + goto out; + } + + iars = disk_alloc_iaranges(sdkp->disk, nr_cpr); + if (!iars) { + nr_cpr = 0; + goto out; + } + + desc = &buffer[64]; + for (i = 0; i < nr_cpr; i++, desc += 32) { + if (desc[0] != i) { + sd_printk(KERN_ERR, sdkp, + "Invalid Concurrent Positioning Range number\n"); + nr_cpr = 0; + break; + } + + iars->iarange[i].sector = sd64_to_sectors(sdkp, desc + 8); + iars->iarange[i].nr_sectors = sd64_to_sectors(sdkp, desc + 16); + } + +out: + disk_set_iaranges(sdkp->disk, iars); + if (nr_cpr && sdkp->nr_actuators != nr_cpr) { + sd_printk(KERN_NOTICE, sdkp, + "%u concurrent positioning ranges\n", nr_cpr); + sdkp->nr_actuators = nr_cpr; + } + + kfree(buffer); +} + /* * Determine the device's preferred I/O size for reads and writes * unless the reported value is unreasonably small, large, not a @@ -3241,6 +3321,7 @@ static int sd_revalidate_disk(struct gendisk *disk) sd_read_app_tag_own(sdkp, buffer); sd_read_write_same(sdkp, buffer); sd_read_security(sdkp, buffer); + sd_read_cpr(sdkp); } /* diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h index b59136c4125b..2e5932bde43d 100644 --- a/drivers/scsi/sd.h +++ b/drivers/scsi/sd.h @@ -106,6 +106,7 @@ struct scsi_disk { u8 protection_type;/* Data Integrity Field */ u8 provisioning_mode; u8 zeroing_mode; + u8 nr_actuators; /* Number of actuators */ unsigned ATO : 1; /* state of disk ATO bit */ unsigned cache_override : 1; /* temp override of WCE,RCD */ unsigned WCE : 1; /* state of disk WCE bit */ From patchwork Fri Aug 27 07:50:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12461457 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 929DEC432BE for ; Fri, 27 Aug 2021 07:50:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B7BF60FD8 for ; Fri, 27 Aug 2021 07:50:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244527AbhH0Hvk (ORCPT ); Fri, 27 Aug 2021 03:51:40 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:42487 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244535AbhH0Hvj (ORCPT ); Fri, 27 Aug 2021 03:51:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1630050650; x=1661586650; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=Pct8EeEecztMeJWAOQS8KuUpCZvdxSholvmEQ5/zfBM=; b=aTd456tIZNCDqNHniPUjzDf5YewyrfuJx/waT2KNzl9psw55mmjHudNY tjbcFFnwdLkdAvA4Rvp6aMPCoGXmd7uyGJT2bkrenRSxjxml36qg6DX0c CIVZKcK+Jozk8RKA8qvjHB6hiSk5FRMRgXo8K7iRWWc7dA3nZnmnSpCYZ P7r6pRls1DNqWheYP3hUH2obHiNA1mcfrRZFpE18SKc/wZKptk4ubVTdB G0EjvsF2a5qYe8fB+9FQPLiojPrBnJg5esGu4YqdppRVCrvXLipVoufA4 LZ9MpvqXCEpZPv2jIxdNZLhTiunznBkZNKaMj4I2HJoYXEkgVqYSmkiAs w==; X-IronPort-AV: E=Sophos;i="5.84,356,1620662400"; d="scan'208";a="183342790" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 27 Aug 2021 15:50:49 +0800 IronPort-SDR: 3LTNezyCi005tnZFpkAQxQtlVio5nvjrDjJtuE5D0cbOONsM/Na9nB+CNhdJKugVVBXy35NiZp 3lEsXXiGhwmisVih1P42FM4Q+4XxGkXux8qWp1a+qqPqLZXw/8vAHtdm48+ARFcA+457iRTL3X YXyevaOx7RNHwUgWOrVyreA6NyH+A1rIAOtTreAEZDKTUUfXMQgu341eBLcjYBwreG23VIFs5F fDciRPMityU0tHJAMaOpwI/81hN1MMVTfCQUgppYHvpUBK4OJN/7lSz4ooumShLZJBOcgqzWhT NPsarmlN4pup87G6jcRc7ejv Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2021 00:26:02 -0700 IronPort-SDR: E5E4rC9aQbtaqkAM7KwB41nw/V9aga4+ZwVHOmmEoEcJP87T9WRuI688/24vlfKY9xUFBiNiKK htjNJIMzYWer0e6sbMp0G8LNWRjKmg+z5IZBbqsLi0Rn52tOzf8gY6CSWdxkVe5HdnCePxtkoN bfaFvu9dxkCHvTE7aPwSTf/xum6KFcnUKjUa7Thilb8sZ6Z7QEW5sxu/hOn4j3mV0X7+Hp0O8D e6S16Htq2cbnOLbMp3KcB+W3MUBkEO40KkNoFk25DQdG8onewOckkm//Nt3IJTiF2ztqEVaggI q7o= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 27 Aug 2021 00:50:50 -0700 From: Damien Le Moal To: Jens Axboe , linux-block@vger.kernel.org, "Martin K . Petersen" , linux-scsi@vger.kernel.org Subject: [PATCH v6 3/5] libata: support concurrent positioning ranges log Date: Fri, 27 Aug 2021 16:50:42 +0900 Message-Id: <20210827075045.642269-4-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827075045.642269-1-damien.lemoal@wdc.com> References: <20210827075045.642269-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add support to discover if an ATA device supports the Concurrent Positioning Ranges Log (address 0x47), indicating that the device is capable of seeking to multiple different locations in parallel using multiple actuators serving different LBA ranges. Also add support to translate the concurrent positioning ranges log into its equivalent Concurrent Positioning Ranges VPD page B9h in libata-scsi.c. The format of the Concurrent Positioning Ranges Log is defined in ACS-5 r9. Signed-off-by: Damien Le Moal Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/ata/libata-core.c | 52 +++++++++++++++++++++++++++++++++++++++ drivers/ata/libata-scsi.c | 48 +++++++++++++++++++++++++++++------- include/linux/ata.h | 1 + include/linux/libata.h | 15 +++++++++++ 4 files changed, 107 insertions(+), 9 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 61c762961ca8..ab3f61ea743e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -2363,6 +2363,57 @@ static void ata_dev_config_trusted(struct ata_device *dev) dev->flags |= ATA_DFLAG_TRUSTED; } +static void ata_dev_config_cpr(struct ata_device *dev) +{ + unsigned int err_mask; + size_t buf_len; + int i, nr_cpr = 0; + struct ata_cpr_log *cpr_log = NULL; + u8 *desc, *buf = NULL; + + if (!ata_identify_page_supported(dev, + ATA_LOG_CONCURRENT_POSITIONING_RANGES)) + goto out; + + /* + * Read IDENTIFY DEVICE data log, page 0x47 + * (concurrent positioning ranges). We can have at most 255 32B range + * descriptors plus a 64B header. + */ + buf_len = (64 + 255 * 32 + 511) & ~511; + buf = kzalloc(buf_len, GFP_KERNEL); + if (!buf) + goto out; + + err_mask = ata_read_log_page(dev, ATA_LOG_IDENTIFY_DEVICE, + ATA_LOG_CONCURRENT_POSITIONING_RANGES, + buf, buf_len >> 9); + if (err_mask) + goto out; + + nr_cpr = buf[0]; + if (!nr_cpr) + goto out; + + cpr_log = kzalloc(struct_size(cpr_log, cpr, nr_cpr), GFP_KERNEL); + if (!cpr_log) + goto out; + + cpr_log->nr_cpr = nr_cpr; + desc = &buf[64]; + for (i = 0; i < nr_cpr; i++, desc += 32) { + cpr_log->cpr[i].num = desc[0]; + cpr_log->cpr[i].num_storage_elements = desc[1]; + cpr_log->cpr[i].start_lba = get_unaligned_le64(&desc[8]); + cpr_log->cpr[i].num_lbas = get_unaligned_le64(&desc[16]); + } + +out: + swap(dev->cpr_log, cpr_log); + kfree(cpr_log); + kfree(buf); +} + /** * ata_dev_configure - Configure the specified ATA/ATAPI device * @dev: Target device to configure @@ -2591,6 +2642,7 @@ int ata_dev_configure(struct ata_device *dev) ata_dev_config_sense_reporting(dev); ata_dev_config_zac(dev); ata_dev_config_trusted(dev); + ata_dev_config_cpr(dev); dev->cdb_len = 32; } diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index b9588c52815d..5cadbb9a8bf2 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1937,7 +1937,7 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) */ static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf) { - int num_pages; + int i, num_pages = 0; static const u8 pages[] = { 0x00, /* page 0x00, this page */ 0x80, /* page 0x80, unit serial no page */ @@ -1947,13 +1947,17 @@ static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf) 0xb1, /* page 0xb1, block device characteristics page */ 0xb2, /* page 0xb2, thin provisioning page */ 0xb6, /* page 0xb6, zoned block device characteristics */ + 0xb9, /* page 0xb9, concurrent positioning ranges */ }; - num_pages = sizeof(pages); - if (!(args->dev->flags & ATA_DFLAG_ZAC)) - num_pages--; + for (i = 0; i < sizeof(pages); i++) { + if (pages[i] == 0xb6 && + !(args->dev->flags & ATA_DFLAG_ZAC)) + continue; + rbuf[num_pages + 4] = pages[i]; + num_pages++; + } rbuf[3] = num_pages; /* number of supported VPD pages */ - memcpy(rbuf + 4, pages, num_pages); return 0; } @@ -2163,6 +2167,26 @@ static unsigned int ata_scsiop_inq_b6(struct ata_scsi_args *args, u8 *rbuf) return 0; } +static unsigned int ata_scsiop_inq_b9(struct ata_scsi_args *args, u8 *rbuf) +{ + struct ata_cpr_log *cpr_log = args->dev->cpr_log; + u8 *desc = &rbuf[64]; + int i; + + /* SCSI Concurrent Positioning Ranges VPD page: SBC-5 rev 1 or later */ + rbuf[1] = 0xb9; + put_unaligned_be16(64 + (int)cpr_log->nr_cpr * 32 - 4, &rbuf[3]); + + for (i = 0; i < cpr_log->nr_cpr; i++, desc += 32) { + desc[0] = cpr_log->cpr[i].num; + desc[1] = cpr_log->cpr[i].num_storage_elements; + put_unaligned_be64(cpr_log->cpr[i].start_lba, &desc[8]); + put_unaligned_be64(cpr_log->cpr[i].num_lbas, &desc[16]); + } + + return 0; +} + /** * modecpy - Prepare response for MODE SENSE * @dest: output buffer @@ -4162,11 +4186,17 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) ata_scsi_rbuf_fill(&args, ata_scsiop_inq_b2); break; case 0xb6: - if (dev->flags & ATA_DFLAG_ZAC) { + if (dev->flags & ATA_DFLAG_ZAC) ata_scsi_rbuf_fill(&args, ata_scsiop_inq_b6); - break; - } - fallthrough; + else + ata_scsi_set_invalid_field(dev, cmd, 2, 0xff); + break; + case 0xb9: + if (dev->cpr_log) + ata_scsi_rbuf_fill(&args, ata_scsiop_inq_b9); + else + ata_scsi_set_invalid_field(dev, cmd, 2, 0xff); + break; default: ata_scsi_set_invalid_field(dev, cmd, 2, 0xff); break; diff --git a/include/linux/ata.h b/include/linux/ata.h index 1b44f40c7700..199e47e97d64 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -329,6 +329,7 @@ enum { ATA_LOG_SECURITY = 0x06, ATA_LOG_SATA_SETTINGS = 0x08, ATA_LOG_ZONED_INFORMATION = 0x09, + ATA_LOG_CONCURRENT_POSITIONING_RANGES = 0x47, /* Identify device SATA settings log:*/ ATA_LOG_DEVSLP_OFFSET = 0x30, diff --git a/include/linux/libata.h b/include/linux/libata.h index 3fcd24236793..b159a245d88c 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -670,6 +670,18 @@ struct ata_ering { struct ata_ering_entry ring[ATA_ERING_SIZE]; }; +struct ata_cpr { + u8 num; + u8 num_storage_elements; + u64 start_lba; + u64 num_lbas; +}; + +struct ata_cpr_log { + u8 nr_cpr; + struct ata_cpr cpr[]; +}; + struct ata_device { struct ata_link *link; unsigned int devno; /* 0 or 1 */ @@ -729,6 +741,9 @@ struct ata_device { u32 zac_zones_optimal_nonseq; u32 zac_zones_max_open; + /* Concurrent positioning ranges */ + struct ata_cpr_log *cpr_log; + /* error history */ int spdn_cnt; /* ering is CLEAR_END, read comment above CLEAR_END */ From patchwork Fri Aug 27 07:50:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12461463 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 9C40DC432BE for ; Fri, 27 Aug 2021 07:50:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85E4460E08 for ; Fri, 27 Aug 2021 07:50:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244471AbhH0Hvo (ORCPT ); Fri, 27 Aug 2021 03:51:44 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:42485 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244542AbhH0Hvk (ORCPT ); Fri, 27 Aug 2021 03:51:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1630050651; x=1661586651; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=5rn+rIGZyCcnRoiq+blOYH9u92Uq0PoXUIKA2y3DWbE=; b=dD9VhdgPAXmzb+SRyCeEILA0TwOJFiXfSiSUiCp2F1B4whXb4tiXGUdJ nbBFKZG2NOPkT3gD+5/qWim8quXizb+t/EWc9ypApWkFsW3/qOcRHRLqk 1XhG/J3lHrlch8rsw1bjeIiPhBgdgLEcyI9EqiSDv8mkE+HGUrIKoQx/o zo1q1td2X42vj2Slgki0iYZmy/9tFyN3QLCTMHr72BqLIMSmDpgZtU4Qa hSESpSaaYaoFdcKsjOYxmSUj0+EriQT8pHqyLd+rpVMedEi7wNec7LZkc wXrF0XX3pKlOLIYOKsfcO5ursu0Wfxgh+xNjWiUDugloOt3FRTcE+zFI7 A==; X-IronPort-AV: E=Sophos;i="5.84,356,1620662400"; d="scan'208";a="183342793" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 27 Aug 2021 15:50:51 +0800 IronPort-SDR: 6yeqTUueLWK8fTGAFvgqxfdS1dcCCEmACs7eMGXK8AXuHUj7lJJDZFLxZbDqqyq6LNp44ZGu/k qCKomzk7u6K1zg2tQpW1Xh3Gv6vxT3rYnQhVfmheVCNTct/rNe4C4wKm7+EgP/Kwy1X8eGZlyy nsEzGZ0VFv6WbkAlYt37v24g5t3py4qe/5KYRM37N3qpo4LOGl7BVp8/KuD/4N1lgsTMmgdYgg wPxLAx/JIEOfutHVnXSEAP4WU2qWYzHtM39hPI6rMxEJBsEbP8eZLRDf/wv3kEPYgr5BRwY1Ug gQsZfLjeFwhMo4s30YDN8Y4Y Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2021 00:26:03 -0700 IronPort-SDR: rH8ZzW6Fw9EBpZDViIu6Bd2MSQ7YYr1TH6CKslcS3ECk7+QVYLYPUOQusQ0rkc3YJBQ7uDdXsU hzZ4e0RZ0usr3sCg4hY+O5Dg1e7DuoPmLN3lq3c+P0+O9c8JRRfDJSq8fjQx67bTWKOeqv2Nj2 IF/+7shlqiB8ZSmFPEL/5m8N72x9O6ldrd8GI6hrDWRcYsILdjIT4flDv0saNtouKgBs4UIiyp YRCEOiYq3+QjVC680iQcsV+6jdboqiQAluzNc/kthECs+BJNN5gBNshs8G+OdNc77iBX5vw4my MaE= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 27 Aug 2021 00:50:51 -0700 From: Damien Le Moal To: Jens Axboe , linux-block@vger.kernel.org, "Martin K . Petersen" , linux-scsi@vger.kernel.org Subject: [PATCH v6 4/5] doc: document sysfs queue/independent_access_ranges attributes Date: Fri, 27 Aug 2021 16:50:43 +0900 Message-Id: <20210827075045.642269-5-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827075045.642269-1-damien.lemoal@wdc.com> References: <20210827075045.642269-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Update the file Documentation/block/queue-sysfs.rst to add a description of a device queue sysfs entries related to independent access ranges (e.g. concurrent positioning ranges for multi-actuator hard-disks). Signed-off-by: Damien Le Moal --- Documentation/block/queue-sysfs.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Documentation/block/queue-sysfs.rst b/Documentation/block/queue-sysfs.rst index 4dc7f0d499a8..17eef55434e7 100644 --- a/Documentation/block/queue-sysfs.rst +++ b/Documentation/block/queue-sysfs.rst @@ -286,4 +286,32 @@ sequential zones of zoned block devices (devices with a zoned attributed that reports "host-managed" or "host-aware"). This value is always 0 for regular block devices. +independent_access_ranges (RO) +------------------------------ + +The presence of this sub-directory of the /sys/block/xxx/queue/ directory +indicates that the device is capable of executing requests targeting +different sector ranges in parallel. For instance, single LUN multi-actuator +hard-disks will likely have an independent_access_ranges directory if the +device correctly advertizes the sector ranges of its actuators. + +The independent_access_ranges directory contains one directory per access +range, with each range described using the sector (RO) attribute file to +indicate the first sector of the range and the nr_sectors (RO) attribute file +to indicate the total number of sector in the range starting from the first +sector of the range. For example, a dual-actuator hard disk will have the +following independent_access_ranges entries.:: + + $ tree /sys/block//queue/independent_access_ranges/ + /sys/block//queue/independent_access_ranges/ + |-- 0 + | |-- nr_sectors + | `-- sector + `-- 1 + |-- nr_sectors + `-- sector + +The sector and nr_sectors attributes use 512B sector unit, regardless of +the actual block size of the device. + Jens Axboe , February 2009 From patchwork Fri Aug 27 07:50:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12461465 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 25C2DC432BE for ; Fri, 27 Aug 2021 07:51:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0925060725 for ; Fri, 27 Aug 2021 07:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244467AbhH0Hv6 (ORCPT ); Fri, 27 Aug 2021 03:51:58 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:42493 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244534AbhH0Hvl (ORCPT ); Fri, 27 Aug 2021 03:51:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1630050652; x=1661586652; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=KLnIFkGLgwZ03ml7AypC27RGZyBe1s3zdaw+yhWbdmA=; b=IB8Ie+VrDkGHSnGD7cN7Nw+YWDyNOjzNj8dpK5PRUuneeGtUOlnhNAvN f/a4/6nwYWMlWdPqV/DRjgB508U5xnQp7oFqTlyXHQ/1vDlGZWBbTDJK5 oB9m0vdhPFOBninz9ETkay1tqIwRJNqjcPZ7hOAGp+UbiI8u7mnV1qJKn qS7Qou1E+5e17FB2SjTJzdlaf6dzWBc8RUBEgf8fJl+ldQljvvrOjIe6/ VnJ05tAZW25xcwypp7j40elAeuNUjCsBm9waMWqYHG+rr1shwijIJRJW0 dMeN3ZiYRHjnYIoKSDffNkdkhajfBmbecE8HZKvhHBZsDHbY786AAbqjv A==; X-IronPort-AV: E=Sophos;i="5.84,356,1620662400"; d="scan'208";a="183342797" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 27 Aug 2021 15:50:52 +0800 IronPort-SDR: A6FSCnJb0cgdm2npNxWIHDQbQ+Xt4YEJdGE4/K5bPlwXjpCp8K6LgoZvi0NDlJxvh3WW8snOM9 s8PGEwTzDrjq6LD8HGWg4SYZwL5E6iYOr91P9VpCjAfiCfBcjiT2wWZalemAuBxrK4amhG68yt nttBh2HGatPbpCb1kHUq7PH/iUkgbcwA5rO6pNJk5V7SJYZrZA+DY769VM7Mw3TCg8xDRl+ivp pyTa6/268F0pY59rzUDPY8jBHJYSrQpJug51s0zrFDaz7QdnFk6uQYa8mgjpnojLIj0uUUrrri 4bX0v2AQiu1rwTJIw4D0JvOA Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2021 00:26:05 -0700 IronPort-SDR: GH4lzFBNTInV6OQROMZHSVXJnjzOpbAaoVHEkHHead8JnSqBuVKuhw4EVu+ZZOPlwxHcg1UMd5 zHSMdxF9iAaIiry/vXFAyq5JPwHkeShZe2qVo4/rQJlNndFryZNl01z1j9g3RffjaM9TSuu3z7 XDXAkAVOzEk2n8Gz9y3DmoVqNfz38Xvr3JgVHv6wx/Nac9Qhrc4Mz+6GdsmQ4GXPLbVH4khqpj 6+oXd1gJM5B9v/9eVH5eWCyYm7pAsElB3ZbCIHNh4s5GhYWYUf+MNzjliJhI+1zDMo0KIP+IsO h80= WDCIronportException: Internal Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 27 Aug 2021 00:50:52 -0700 From: Damien Le Moal To: Jens Axboe , linux-block@vger.kernel.org, "Martin K . Petersen" , linux-scsi@vger.kernel.org Subject: [PATCH v6 5/5] doc: Fix typo in request queue sysfs documentation Date: Fri, 27 Aug 2021 16:50:44 +0900 Message-Id: <20210827075045.642269-6-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827075045.642269-1-damien.lemoal@wdc.com> References: <20210827075045.642269-1-damien.lemoal@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Fix a typo (are -> as) in the introduction paragraph of Documentation/block/queue-sysfs.rst. Signed-off-by: Damien Le Moal --- Documentation/block/queue-sysfs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/block/queue-sysfs.rst b/Documentation/block/queue-sysfs.rst index 17eef55434e7..f4cf9e20f878 100644 --- a/Documentation/block/queue-sysfs.rst +++ b/Documentation/block/queue-sysfs.rst @@ -4,7 +4,7 @@ Queue sysfs files This text file will detail the queue files that are located in the sysfs tree for each block device. Note that stacked devices typically do not export -any settings, since their queue merely functions are a remapping target. +any settings, since their queue merely functions as a remapping target. These files are the ones found in the /sys/block/xxx/queue/ directory. Files denoted with a RO postfix are readonly and the RW postfix means