All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] block: another block copy offload
@ 2025-05-21 22:31 Keith Busch
  2025-05-21 22:31 ` [PATCH 1/5] block: new sector copy api Keith Busch
                   ` (6 more replies)
  0 siblings, 7 replies; 50+ messages in thread
From: Keith Busch @ 2025-05-21 22:31 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Keith Busch

From: Keith Busch <kbusch@kernel.org>

I was never happy with previous block copy offload attempts, so I had to
take a stab at it. And I was recently asked to take a look at this, so
here goes.

Some key implementation differences from previous approaches:

  1. Only one bio is needed to describe a copy request, so no plugging
     or dispatch tricks required. Like read and write requests, these
     can be artbitrarily large and will be split as needed based on the
     request_queue's limits. The bio's are mergeable with other copy
     commands on adjacent destination sectors.

  2. You can describe as many source sectors as you want in a vector in
     a single bio. This aligns with the nvme protocol's Copy implementation,
     which can be used to efficiently defragment scattered blocks into a
     contiguous destination with a single command.

Oh, and the nvme-target support was included with this patchset too, so
there's a purely in-kernel way to test out the code paths if you don't
have otherwise capable hardware. I also used qemu since that nvme device
supports copy offload too.

Keith Busch (5):
  block: new sector copy api
  block: add support for copy offload
  nvme: add support for copy offload
  block: add support for vectored copies
  nvmet: implement copy support for bdev backed target

 block/bio.c                       |  25 +++++++
 block/blk-core.c                  |   4 ++
 block/blk-lib.c                   | 115 ++++++++++++++++++++++++++++++
 block/blk-merge.c                 |  28 +++++++-
 block/blk-sysfs.c                 |   9 +++
 block/blk.h                       |  17 ++++-
 block/ioctl.c                     |  89 +++++++++++++++++++++++
 drivers/nvme/host/core.c          |  61 ++++++++++++++++
 drivers/nvme/target/io-cmd-bdev.c |  52 ++++++++++++++
 include/linux/bio.h               |  20 ++++++
 include/linux/blk-mq.h            |   5 ++
 include/linux/blk_types.h         |   2 +
 include/linux/blkdev.h            |  18 +++++
 include/linux/bvec.h              |  68 +++++++++++++++++-
 include/linux/nvme.h              |  42 ++++++++++-
 include/uapi/linux/fs.h           |  17 +++++
 16 files changed, 566 insertions(+), 6 deletions(-)

-- 
2.47.1


^ permalink raw reply	[flat|nested] 50+ messages in thread
* Re: [PATCH 2/5] block: add support for copy offload
@ 2025-05-22 12:51 kernel test robot
  0 siblings, 0 replies; 50+ messages in thread
From: kernel test robot @ 2025-05-22 12:51 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check first_new_problem: block/blk-integrity.c:29:38: sparse: sparse: missing braces around initializer"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250521223107.709131-3-kbusch@meta.com>
References: <20250521223107.709131-3-kbusch@meta.com>
TO: Keith Busch <kbusch@meta.com>

Hi Keith,

kernel test robot noticed the following build warnings:

[auto build test WARNING on axboe-block/for-next]
[also build test WARNING on next-20250522]
[cannot apply to linux-nvme/for-next brauner-vfs/vfs.all linus/master v6.15-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Keith-Busch/block-new-sector-copy-api/20250522-063316
base:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
patch link:    https://lore.kernel.org/r/20250521223107.709131-3-kbusch%40meta.com
patch subject: [PATCH 2/5] block: add support for copy offload
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
config: microblaze-randconfig-r133-20250522 (https://download.01.org/0day-ci/archive/20250522/202505222054.NVHC4kxh-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 7.5.0
reproduce: (https://download.01.org/0day-ci/archive/20250522/202505222054.NVHC4kxh-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202505222054.NVHC4kxh-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> block/blk-integrity.c:29:38: sparse: sparse: missing braces around initializer
>> block/blk-integrity.c:29:38: sparse: sparse: missing braces around initializer
   block/blk-integrity.c:69:38: sparse: sparse: missing braces around initializer
   block/blk-integrity.c:69:38: sparse: sparse: missing braces around initializer

vim +29 block/blk-integrity.c

7ba1ba12eeef0a Martin K. Petersen 2008-06-30  18  
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  19  /**
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  20   * blk_rq_count_integrity_sg - Count number of integrity scatterlist elements
13f05c8d8e98bb Martin K. Petersen 2010-09-10  21   * @q:		request queue
13f05c8d8e98bb Martin K. Petersen 2010-09-10  22   * @bio:	bio with integrity metadata attached
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  23   *
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  24   * Description: Returns the number of elements required in a
13f05c8d8e98bb Martin K. Petersen 2010-09-10  25   * scatterlist corresponding to the integrity metadata in a bio.
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  26   */
13f05c8d8e98bb Martin K. Petersen 2010-09-10  27  int blk_rq_count_integrity_sg(struct request_queue *q, struct bio *bio)
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  28  {
d57a5f7c6605f1 Kent Overstreet    2013-11-23 @29  	struct bio_vec iv, ivprv = { NULL };
13f05c8d8e98bb Martin K. Petersen 2010-09-10  30  	unsigned int segments = 0;
13f05c8d8e98bb Martin K. Petersen 2010-09-10  31  	unsigned int seg_size = 0;
d57a5f7c6605f1 Kent Overstreet    2013-11-23  32  	struct bvec_iter iter;
d57a5f7c6605f1 Kent Overstreet    2013-11-23  33  	int prev = 0;
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  34  
d57a5f7c6605f1 Kent Overstreet    2013-11-23  35  	bio_for_each_integrity_vec(iv, bio, iter) {
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  36  
d57a5f7c6605f1 Kent Overstreet    2013-11-23  37  		if (prev) {
3dccdae54fe836 Christoph Hellwig  2018-09-24  38  			if (!biovec_phys_mergeable(q, &ivprv, &iv))
13f05c8d8e98bb Martin K. Petersen 2010-09-10  39  				goto new_segment;
d57a5f7c6605f1 Kent Overstreet    2013-11-23  40  			if (seg_size + iv.bv_len > queue_max_segment_size(q))
13f05c8d8e98bb Martin K. Petersen 2010-09-10  41  				goto new_segment;
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  42  
d57a5f7c6605f1 Kent Overstreet    2013-11-23  43  			seg_size += iv.bv_len;
13f05c8d8e98bb Martin K. Petersen 2010-09-10  44  		} else {
13f05c8d8e98bb Martin K. Petersen 2010-09-10  45  new_segment:
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  46  			segments++;
d57a5f7c6605f1 Kent Overstreet    2013-11-23  47  			seg_size = iv.bv_len;
13f05c8d8e98bb Martin K. Petersen 2010-09-10  48  		}
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  49  
d57a5f7c6605f1 Kent Overstreet    2013-11-23  50  		prev = 1;
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  51  		ivprv = iv;
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  52  	}
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  53  
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  54  	return segments;
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  55  }
7ba1ba12eeef0a Martin K. Petersen 2008-06-30  56  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2025-07-03 14:47 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 22:31 [PATCH 0/5] block: another block copy offload Keith Busch
2025-05-21 22:31 ` [PATCH 1/5] block: new sector copy api Keith Busch
2025-05-22 10:02   ` Hannes Reinecke
2025-05-22 16:43     ` Keith Busch
2025-05-22 19:22   ` Bart Van Assche
2025-05-22 20:04     ` Keith Busch
2025-05-23 12:45   ` Christoph Hellwig
2025-05-23 17:02     ` Keith Busch
2025-05-26  5:18       ` Christoph Hellwig
2025-05-27 17:45         ` Keith Busch
2025-05-28  7:46           ` Christoph Hellwig
2025-05-28 22:41             ` Keith Busch
2025-06-02  4:58               ` Christoph Hellwig
2025-05-21 22:31 ` [PATCH 2/5] block: add support for copy offload Keith Busch
2025-05-22 10:04   ` kernel test robot
2025-05-22 13:49   ` Hannes Reinecke
2025-05-23 12:46   ` Christoph Hellwig
2025-05-23 13:26     ` Keith Busch
2025-05-23 13:37       ` Christoph Hellwig
2025-05-23 13:48         ` Keith Busch
2025-05-26  5:22           ` Christoph Hellwig
2025-05-27 21:33         ` Keith Busch
2025-05-28  7:47           ` Christoph Hellwig
2025-05-21 22:31 ` [PATCH 3/5] nvme: " Keith Busch
2025-05-22  0:47   ` Caleb Sander Mateos
2025-05-22  0:51     ` Caleb Sander Mateos
2025-05-22  3:23       ` Keith Busch
2025-05-22  3:41         ` Caleb Sander Mateos
2025-05-22  4:29           ` Keith Busch
2025-05-22 14:16             ` Caleb Sander Mateos
2025-05-23 12:49             ` Christoph Hellwig
2025-05-23 12:48           ` Christoph Hellwig
2025-05-22 13:54   ` Hannes Reinecke
2025-05-23 12:50     ` Christoph Hellwig
2025-05-23 14:22       ` Caleb Sander Mateos
2025-06-09  9:29   ` Niklas Cassel
2025-05-21 22:31 ` [PATCH 4/5] block: add support for vectored copies Keith Busch
2025-05-22  9:33   ` kernel test robot
2025-05-22 13:58   ` Hannes Reinecke
2025-05-22 16:36     ` Keith Busch
2025-05-21 22:31 ` [PATCH 5/5] nvmet: implement copy support for bdev backed target Keith Busch
2025-05-22 12:51   ` kernel test robot
2025-05-22 13:59   ` Hannes Reinecke
2025-05-23 13:18   ` Christoph Hellwig
2025-05-23 14:00     ` Keith Busch
2025-05-23 14:02       ` Christoph Hellwig
2025-05-22 15:52 ` [PATCH 0/5] block: another block copy offload Bart Van Assche
2025-05-23 12:53   ` Christoph Hellwig
2025-07-03 14:47 ` Niklas Cassel
  -- strict thread matches above, loose matches on Subject: below --
2025-05-22 12:51 [PATCH 2/5] block: add support for " kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.