Re: [PATCH 04/23] scsi: initialize scsi midlayer limits before allocating the queue

John Garry
2024-05-16T13:10:21Z

On 15/05/2024 17:52, Guenter Roeck wrote:
> max_segment_size is 65280; PAGE_SIZE is 65536; BLK_MAX_SEGMENT_SIZE is
> 65536
> WARNING: CPU: 0 PID: 12 at block/blk-settings.c:202
> blk_validate_limits+0x2d4/0x364
> ...
>
> This is with PPC_BOOK3S_64 which selects a default page size of 64k.
> Looking at the old code, I think it did what you suggested above,
>
> void blk_queue_max_segment_size(struct request_queue *q, unsigned int
> max_size)
> {
>         if (max_size < PAGE_SIZE) {
>                 max_size = PAGE_SIZE;
>                 printk(KERN_INFO "%s: set to minimum %d\n",
>                        __func__, max_size);
>         }
> ...
>
> but assuming that the driver requested a lower limit on purpose that
> may not be the best solution.

Right, it is relied on that PAGE_SIZE can fit into a segment.

>
> Never mind, though - I updated my test configuration to explicitly
> configure the page size to 4k to work around the problem. With that,
> please consider this report a note in case someone hits the problem
> on a real system (and sorry for the noise).

Other controllers do have a 4K segment limit and are broken on systems
with 16/64K PAGE_SIZE, like:

https://lore.kernel.org/linux-block/20230612203314.17820-1-bvanassche@acm.org/

Thanks,
John