Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp293133rwl; Wed, 29 Mar 2023 01:43:32 -0700 (PDT) X-Google-Smtp-Source: AKy350apEMR66XJizRJzvMVhY1z46Q+J3EKRGRsYb9Jr3WAfIVTQISOBdxEz7id7zVcDgdbUWtbS X-Received: by 2002:a17:90b:4a45:b0:23b:d506:226e with SMTP id lb5-20020a17090b4a4500b0023bd506226emr20731451pjb.42.1680079411773; Wed, 29 Mar 2023 01:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680079411; cv=none; d=google.com; s=arc-20160816; b=xEF5tNJHLv7tz9uDI/+lIxffaaf5pNboOuCM1s0DRaRCTFE2O2Q/TnvQ9I9QrwJnQN pwbM+SOdD7OraHulgL+u8jmkbnc0EjlEafiwUJ/7oMuJu6tLjdF98fmiLmM5xvd5Ilri F7/VchapNr8Rste72IhBcIKthS8JSfnZyNBJV9HepuhbAQPldKNpzlUqBo8iEKXByVMd 48e+YtkR5VjtOXiyiUQwQD1x2Tvr2Ym/Rgd1q3uvAeVy5e27jC8yXgAKEvnVuzporGLv LpldWzQ3WR0R9F5ZBHl3CsqyCc0S13gzZM8RDNMM9ABjgaFRlRBHczwx9yBGMzK8VyrQ cCow== 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=PCyOzDhhpDfbdpDRKDB3pbp+g0/ddJjuCTzvMhZZ+ss=; b=ynFl2NVcfFyYphIGkWlKaLxmGVEkSmu4AaLGhn6JjYOZSalgOsmkJGeXE4ubd8dU/E ErnaHBWOSGYmvSRYK0G57JNUs0ysXog4kx3/YOpaFWdQOweUbp6W7HsjSEWRsC+D+tNR CxXr6hrdmjvL1e2ft65ZynHQmbVM4PIVhGb/U40RCd4cxJiOFbUZCnfqhHhotSDRsHmQ NtZzigNXLPGRJPvEpMrTG5F6QiekJge4q5wHVLN2JtSXHKcEds2gnb+hZY6WKvhKEU/i aDI+ifMx5MB4bzP3MB6INDXQtCqn8L/yoZfRO0nE5SksQboMT+dBw5Grs8ZNWFhifySf MTMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=j2PB4OLL; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=ubojnNRZ; 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 s14-20020a17090aad8e00b002332c17dbfbsi1083664pjq.70.2023.03.29.01.43.20; Wed, 29 Mar 2023 01:43:31 -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=j2PB4OLL; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=ubojnNRZ; 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 S230449AbjC2IkZ (ORCPT + 99 others); Wed, 29 Mar 2023 04:40:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231230AbjC2IkS (ORCPT ); Wed, 29 Mar 2023 04:40:18 -0400 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 217E31BE for ; Wed, 29 Mar 2023 01:40:17 -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=1680079217; x=1711615217; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=E3jSijsKBSV9BsEzQr1YnSfmWJK8g8o7ns6B3bjeHLM=; b=j2PB4OLLIIECWeNdSrE5NvsZdyuFD6r+YlscbTX2TwdxLovrC2LIbjcX w+Y++RWrcq2y0I5buCYl/dPsMn8YX+KYryvugsqmQx/y6ZOLvEChkDb2T 1DATdc0LytDBhR7va2tqRZXjdxCIUQC5U5svCqhWv1zPWujT0GiPcgBZW Pl6WX07ay+iHC+osTcvHXvzeZnbnFHAAPgQvpzh0Tke7mQ2qcLEiCIthd U749Fm1jxZ5yn+BLenHh5QL2xW5Ym9G6WYJejmVLTaPkjq00BeN0rccXt vgs4VEBwA8IIDLWixZGGJ03F8lR2gjaWBUtCNoskbeifYAlgmIRJPkEWh A==; X-IronPort-AV: E=Sophos;i="5.98,300,1673884800"; d="scan'208";a="338845251" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 29 Mar 2023 16:40:16 +0800 IronPort-SDR: CMhdW78B4csc20e8pgSWpKDZJZiXA9oes5MTIHf+XuW5vkKg7FnR+Na6bvTJBVt3Qhe8On8zfs lJAfDybCuBKPXPOVffsVfRUdJVEUPNEKBoX7+MmtPkAe/HRzWPc0BPYQL464BE7bbCGanw9PAv 1dDJlPv1nul9jRJ9UqPrDJ2WnQV/OsxiaqQJDKhF9nDBzQ+7S78QELDB36M3Sj4z550Cal5GxR qeOBHg7/7cCNCy8zPXALUQPUJpO6qT1qhWelupoZqBL6YspINmJIR7IVGhfTtW2+gsDvJrnmwQ f58= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Mar 2023 00:56:26 -0700 IronPort-SDR: uFgAMB8l1TU09sOmWx4vX9yH9D09HAVj8UfcZftAcjKjV4mQOuH6pT8pS/5ar/fvUipHt4T8zW DgXdJsSRE+z3KWdu09PihlwWD0ItT46NIsTrFK93q/Bzf79jy1x44iFu5tB76gTGqkEYoI6wau q/+lNoB2hxyFC9lXDw/SoHbRQFvn3qbM4pTxidng+DL/JdEVTp4RBQJUVmqdKfHbFhD97kjQ6g hmsZ81MpUo1tVreK15zFtFctpQJeDpL/wUn/lMM9WHNI8Flndg8jSGITBX3wiZSeREY3kUxWqp KtY= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 29 Mar 2023 01:40:17 -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 4Pmg3h0CNqz1RtW2 for ; Wed, 29 Mar 2023 01:40:15 -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= 1680079215; x=1682671216; bh=E3jSijsKBSV9BsEzQr1YnSfmWJK8g8o7ns6 B3bjeHLM=; b=ubojnNRZtniIG4drMxCxpbcUUntc7UVjcuyQDdJq4Y4sJ6P2Jk/ k8QBkYTtobxjovRwL97Pc69e6lGQwgirLIzioWiy2p3Jz0SYjirs9SQdmSZHzT3K /3WMbS6vpWd0887PymxQxyApYp547FWCtFhI6IrU/eOBmbIshIEHOboKDZw7gfQh Ftpa4pU/OykstUUR3CAiBB0z+McsaAyRd+hHSFrn4tfUWLYa+IzL93WL2z1O03Pk 3fMfw8iQf8a88VcuSMAwxMB5p9+NQ2opoKmgeM3osaeh4u18V8DelxYQ26HlS76K V967+/rtR1Zczx+Gp7Dk/OcQkfIfDxL09sw== 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 iS2iNguvBYBD for ; Wed, 29 Mar 2023 01:40:15 -0700 (PDT) Received: from [10.225.163.116] (unknown [10.225.163.116]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4Pmg3Z3bThz1RtVm; Wed, 29 Mar 2023 01:40:10 -0700 (PDT) Message-ID: Date: Wed, 29 Mar 2023 17:40:09 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v8 1/9] block: Introduce queue limits for copy-offload support Content-Language: en-US To: Anuj Gupta , Jens Axboe , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Keith Busch , Christoph Hellwig , Sagi Grimberg , James Smart , Chaitanya Kulkarni , Alexander Viro , Christian Brauner Cc: bvanassche@acm.org, hare@suse.de, ming.lei@redhat.com, joshi.k@samsung.com, nitheshshetty@gmail.com, gost.dev@samsung.com, Nitesh Shetty , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org References: <20230327084103.21601-1-anuj20.g@samsung.com> <20230327084103.21601-2-anuj20.g@samsung.com> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20230327084103.21601-2-anuj20.g@samsung.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=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 3/27/23 17:40, Anuj Gupta wrote: > From: Nitesh Shetty > > Add device limits as sysfs entries, > - copy_offload (RW) > - copy_max_bytes (RW) > - copy_max_bytes_hw (RO) > > Above limits help to split the copy payload in block layer. > copy_offload: used for setting copy offload(1) or emulation(0). > copy_max_bytes: maximum total length of copy in single payload. > copy_max_bytes_hw: Reflects the device supported maximum limit. > > Reviewed-by: Hannes Reinecke > Signed-off-by: Nitesh Shetty > Signed-off-by: Kanchan Joshi > Signed-off-by: Anuj Gupta > --- > Documentation/ABI/stable/sysfs-block | 36 ++++++++++++++++ > block/blk-settings.c | 24 +++++++++++ > block/blk-sysfs.c | 64 ++++++++++++++++++++++++++++ > include/linux/blkdev.h | 12 ++++++ > include/uapi/linux/fs.h | 3 ++ > 5 files changed, 139 insertions(+) > > diff --git a/Documentation/ABI/stable/sysfs-block b/Documentation/ABI/stable/sysfs-block > index c57e5b7cb532..f5c56ad91ad6 100644 > --- a/Documentation/ABI/stable/sysfs-block > +++ b/Documentation/ABI/stable/sysfs-block > @@ -155,6 +155,42 @@ Description: > last zone of the device which may be smaller. > > > +What: /sys/block//queue/copy_offload > +Date: November 2022 > +Contact: linux-block@vger.kernel.org > +Description: > + [RW] When read, this file shows whether offloading copy to > + device is enabled (1) or disabled (0). Writing '0' to this ...to a device... > + file will disable offloading copies for this device. > + Writing any '1' value will enable this feature. If device If the device does... > + does not support offloading, then writing 1, will result in > + error. > + > + > +What: /sys/block//queue/copy_max_bytes > +Date: November 2022 > +Contact: linux-block@vger.kernel.org > +Description: > + [RW] While 'copy_max_bytes_hw' is the hardware limit for the > + device, 'copy_max_bytes' setting is the software limit. > + Setting this value lower will make Linux issue smaller size > + copies from block layer. This is the maximum number of bytes that the block layer will allow for a copy request. Must be smaller than or equal to the maximum size allowed by the hardware indicated by copy_max_bytes_hw. Write 0 to use the default kernel settings. > + > + > +What: /sys/block//queue/copy_max_bytes_hw > +Date: November 2022 > +Contact: linux-block@vger.kernel.org > +Description: > + [RO] Devices that support offloading copy functionality may have > + internal limits on the number of bytes that can be offloaded > + in a single operation. The `copy_max_bytes_hw` > + parameter is set by the device driver to the maximum number of > + bytes that can be copied in a single operation. Copy > + requests issued to the device must not exceed this limit. > + A value of 0 means that the device does not > + support copy offload. [RO] This is the maximum number of kilobytes supported in a single data copy offload operation. A value of 0 means that the device does not support copy offload. > + > + > What: /sys/block//queue/crypto/ > Date: February 2022 > Contact: linux-block@vger.kernel.org > diff --git a/block/blk-settings.c b/block/blk-settings.c > index 896b4654ab00..350f3584f691 100644 > --- a/block/blk-settings.c > +++ b/block/blk-settings.c > @@ -59,6 +59,8 @@ void blk_set_default_limits(struct queue_limits *lim) > lim->zoned = BLK_ZONED_NONE; > lim->zone_write_granularity = 0; > lim->dma_alignment = 511; > + lim->max_copy_sectors_hw = 0; > + lim->max_copy_sectors = 0; > } > > /** > @@ -82,6 +84,8 @@ void blk_set_stacking_limits(struct queue_limits *lim) > lim->max_dev_sectors = UINT_MAX; > lim->max_write_zeroes_sectors = UINT_MAX; > lim->max_zone_append_sectors = UINT_MAX; > + lim->max_copy_sectors_hw = ULONG_MAX; > + lim->max_copy_sectors = ULONG_MAX; > } > EXPORT_SYMBOL(blk_set_stacking_limits); > > @@ -183,6 +187,22 @@ void blk_queue_max_discard_sectors(struct request_queue *q, > } > EXPORT_SYMBOL(blk_queue_max_discard_sectors); > > +/** > + * blk_queue_max_copy_sectors_hw - set max sectors for a single copy payload > + * @q: the request queue for the device > + * @max_copy_sectors: maximum number of sectors to copy > + **/ > +void blk_queue_max_copy_sectors_hw(struct request_queue *q, > + unsigned int max_copy_sectors) > +{ > + if (max_copy_sectors >= MAX_COPY_TOTAL_LENGTH) Confusing name as LENGTH may be interpreted as bytes. MAX_COPY_SECTORS would be better. > + max_copy_sectors = MAX_COPY_TOTAL_LENGTH; > + > + q->limits.max_copy_sectors_hw = max_copy_sectors; > + q->limits.max_copy_sectors = max_copy_sectors; > +} > +EXPORT_SYMBOL_GPL(blk_queue_max_copy_sectors_hw); -- Damien Le Moal Western Digital Research