linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: Hannes Reinecke <hare@kernel.org>, Jens Axboe <axboe@kernel.dk>
Cc: Matthew Wilcox <willy@infradead.org>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Pankaj Raghav <p.raghav@samsung.com>,
	linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Subject: Re: [PATCH 3/6] blk-merge: split bio by max_segment_size, not PAGE_SIZE
Date: Tue, 14 May 2024 18:20:59 -0600	[thread overview]
Message-ID: <258db2c1-6c08-467d-a365-6b623c208c85@oracle.com> (raw)
In-Reply-To: <20240514173900.62207-4-hare@kernel.org>

On 14/05/2024 11:38, Hannes Reinecke wrote:
> Bvecs can be larger than a page, and the block layer handles
> this just fine. So do not split by PAGE_SIZE but rather by
> the max_segment_size if that happens to be larger.
Can you check scsi_debug for this series? I took this series only up to 
this change, and got:

     Startin[    1.736470] ------------[ cut here ]------------
g Load [    1.737777] WARNING: CPU: 0 PID: 52 at block/blk-merge.c:581 
__blk_rq_map_sg+0x46a/0x480
Kernel Module fu[    1.738862] Modules linked in:
se...[    1.739370] CPU: 0 PID: 52 Comm: kworker/0:1H Not tainted 
6.9.0-00002-g4eaa50af9312-dirty #2416

[    1.740474] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 
rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
[    1.741809] Workqueue: kblockd blk_mq_run_work_fn
[    1.742379] RIP: 0010:__blk_rq_map_sg+0x46a/0x480
[    1.742939] Code: 17 fe ff ff 44 89 58 0c 48 8b 01 e9 ec fc ff ff 43 
8d 3c 06 48 8b 14 24 81 ff 00 10 00 00 0f 86 af fc ff ff e9 02 f0
[    1.743015] systemd[1]: File System Check on Root Device was skipped 
because of a failed condition check (ConditionPathIsReadWrite=!/.
[    1.745122] RSP: 0018:ff37636e4032bb90 EFLAGS: 00010212
[    1.746419] systemd[1]: systemd-journald.service: unit configures an 
IP firewall, but the local system does not support BPF/cgroup fi.
[    1.746891] RAX: 000000000000001c RBX: 00000000000001b0 RCX: 
ff28e6d8b0950a00
[    1.747903] systemd[1]: (This warning is only shown for the first 
unit using IP firewalling.)
[    1.748549] RDX: ff7662becb4ac482 RSI: 0000000000001000 RDI: 
00000000fffffffd
[    1.749688] systemd[1]: Starting Journal Service...
[    1.749895] RBP: ff7662becb4abf80 R08: 0000000000000000 R09: 
ff28e6d880fadd40
[    1.750965] R10: ff7662becb4ac480 R11: 0000000000000000 R12: 
0000000000000000
[    1.750966] R13: 0000000000000002 R14: 0000000000001000 R15: 
ff7662becb4ac480
[    1.750970] FS:  0000000000000000(0000) GS:ff28e6da75c00000(0000) 
knlGS:0000000000000000
[    1.750972] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    1.750973] CR2: 00007f7407f19000 CR3: 0000000100f24002 CR4: 
0000000000771ef0
[    1.750974] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[    1.750975] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 
0000000000000400
[    1.750976] PKRU: 55555554
[    1.750977] Call Trace:
[    1.750984]  <TASK>
[    1.750986]  ? __warn+0x7e/0x130
[    1.750992]  ? __blk_rq_map_sg+0x46a/0x480
[    1.750994]  ? report_bug+0x18e/0x1a0
[    1.750999]  ? handle_bug+0x3d/0x70
[    1.751003]  ? exc_invalid_op+0x18/0x70
[    1.751006]  ? asm_exc_invalid_op+0x1a/0x20
[    1.751009]  ? __blk_rq_map_sg+0x46a/0x480
[    1.751012]  scsi_alloc_sgtables+0xb7/0x3f0
[    1.751019]  sd_init_command+0x177/0x9d0
[    1.751023]  scsi_queue_rq+0x7c1/0xae0
[    1.751027]  blk_mq_dispatch_rq_list+0x2bc/0x7c0
[    1.751031]  __blk_mq_sched_dispatch_requests+0x409/0x5c0
[    1.751035]  blk_mq_sched_dispatch_requests+0x2c/0x60
[    1.751037]  blk_mq_run_work_fn+0x5f/0x70
[    1.751039]  process_one_work+0x149/0x360

I suspect that you would need to also change the PAGE_SIZE check in 
__blk_bios_map_sg() also. However, I am not confident that the change 
below is ok to begin with...

BTW, scsi_debug does use an insane max_segment_size of -1

> 
> Signed-off-by: Hannes Reinecke <hare@kernel.org>
> ---
>   block/blk-merge.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index 4e3483a16b75..570573d7a34f 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -278,6 +278,7 @@ struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim,
>   	struct bio_vec bv, bvprv, *bvprvp = NULL;
>   	struct bvec_iter iter;
>   	unsigned nsegs = 0, bytes = 0;
> +	unsigned bv_seg_lim = max(PAGE_SIZE, lim->max_segment_size);
>   
>   	bio_for_each_bvec(bv, bio, iter) {
>   		/*
> @@ -289,7 +290,7 @@ struct bio *bio_split_rw(struct bio *bio, const struct queue_limits *lim,
>   
>   		if (nsegs < lim->max_segments &&
>   		    bytes + bv.bv_len <= max_bytes &&
> -		    bv.bv_offset + bv.bv_len <= PAGE_SIZE) {
> +		    bv.bv_offset + bv.bv_len <= bv_seg_lim) {
>   			nsegs++;
>   			bytes += bv.bv_len;
>   		} else {



  reply	other threads:[~2024-05-15  0:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 17:38 [PATCHv2 0/6] enable bs > ps for block devices Hannes Reinecke
2024-05-14 17:38 ` [PATCH 1/6] fs/mpage: avoid negative shift for large blocksize Hannes Reinecke
2024-05-14 17:38 ` [PATCH 2/6] fs/mpage: use blocks_per_folio instead of blocks_per_page Hannes Reinecke
2024-05-14 17:38 ` [PATCH 3/6] blk-merge: split bio by max_segment_size, not PAGE_SIZE Hannes Reinecke
2024-05-15  0:20   ` John Garry [this message]
2024-05-15 12:29     ` Hannes Reinecke
2024-05-15 12:32       ` Hannes Reinecke
2024-05-15 15:21       ` John Garry
2024-05-14 17:38 ` [PATCH 4/6] block/bdev: enable large folio support for large logical block sizes Hannes Reinecke
2024-05-15  4:21   ` kernel test robot
2024-05-14 17:38 ` [PATCH 5/6] block/bdev: lift restrictions on supported blocksize Hannes Reinecke
2024-05-15  1:03   ` kernel test robot
2024-05-15  4:00   ` kernel test robot
2024-05-14 17:39 ` [PATCH 6/6] nvme: enable logical block size > PAGE_SIZE Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=258db2c1-6c08-467d-a365-6b623c208c85@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=hare@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mcgrof@kernel.org \
    --cc=p.raghav@samsung.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).