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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15/05/2024 15:50, Guenter Roeck wrote:
Hi,

On Tue, Apr 09, 2024 at 04:37:29PM +0200, Christoph Hellwig wrote:
Turn __scsi_init_queue into scsi_init_limits which initializes
queue_limits structure that can be passed to blk_mq_alloc_queue.

The previous behavior would sanitize max_segment_size < PAGE_SIZE, so I suppose you could try:

--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -199,6 +199,8 @@ static int blk_validate_limits(struct queue_limits *lim)
                 */
                if (!lim->max_segment_size)
                        lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;
+               else if (lim->max_segment_size < PAGE_SIZE)
+                       lim->max_segment_size = PAGE_SIZE;
                if (WARN_ON_ONCE(lim->max_segment_size < PAGE_SIZE))
                        return -EINVAL;
        }

I guess that this following change could also be made since we fix-up a zero value for lim->max_segment_size, above:

--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -474,10 +474,7 @@ struct Scsi_Host *scsi_host_alloc(const struct scsi_host_template *sht, int priv
        else
                shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;

-       if (sht->max_segment_size)
-               shost->max_segment_size = sht->max_segment_size;
-       else
-               shost->max_segment_size = BLK_MAX_SEGMENT_SIZE;
+       shost->max_segment_size = sht->max_segment_size;





With this patch in linux mainline, I see

ata2: found unknown device (class 0)
ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
------------[ cut here ]------------
WARNING: CPU: 0 PID: 27 at block/blk-settings.c:202 blk_validate_limits+0x28c/0x304
Modules linked in:
CPU: 0 PID: 27 Comm: kworker/u4:2 Not tainted 6.9.0-05151-g1b294a1f3561 #1
Hardware name: PowerMac3,1 PPC970FX 0x3c0301 PowerMac
Workqueue: async async_run_entry_fn
NIP:  c0000000007ccec8 LR: c0000000007c805c CTR: 0000000000000000
REGS: c000000006def690 TRAP: 0700   Not tainted  (6.9.0-05151-g1b294a1f3561)
MSR:  8000000000028032 <SF,EE,IR,DR,RI>  CR: 84004228  XER: 20000000
IRQMASK: 0
GPR00: c0000000007c8040 c000000006def930 c00000000159f900 c000000006defac8
GPR04: c00000000146e788 0000000000000000 0000000000000000 0000000000000100
GPR08: 0000000000000200 000000000000ff00 0000000000000000 0000000000004000
GPR12: 000000000fa82000 c000000003330000 c000000000116508 c0000000060c5c40
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000088
GPR20: 0000000000000000 c0000000026f2f40 c0000000025eeff0 0000000000000000
GPR24: c000000006defc80 c0000000031cb3a0 c000000002571c80 c000000006defac8
GPR28: c0000000033052e0 ffffffffffffffff 0000000000000010 c000000008f13df0
NIP [c0000000007ccec8] blk_validate_limits+0x28c/0x304
LR [c0000000007c805c] blk_alloc_queue+0xbc/0x344
Call Trace:
[c000000006def930] [c0000000007c8040] blk_alloc_queue+0xa0/0x344 (unreliable)
[c000000006def990] [c0000000007e2658] blk_mq_alloc_queue+0x60/0xf4
[c000000006defa60] [c000000000a7a260] scsi_alloc_sdev+0x280/0x464
[c000000006defb90] [c000000000a7a6b4] scsi_probe_and_add_lun+0x270/0x388
[c000000006defc60] [c000000000a7b070] __scsi_add_device+0x168/0x1b4
[c000000006defcc0] [c000000000b08fe0] ata_scsi_scan_host+0x294/0x39c
[c000000006defd80] [c000000000af7704] async_port_probe+0x6c/0x98
[c000000006defdb0] [c000000000120028] async_run_entry_fn+0x50/0x13c
[c000000006defe00] [c00000000010821c] process_one_work+0x2c0/0x828
[c000000006deff00] [c000000000109090] worker_thread+0x224/0x474
[c000000006deff90] [c000000000116658] kthread+0x158/0x17c

followed by

scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
usb 1-1: new full-speed USB device number 2 using ohci-pci
scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
input: QEMU QEMU USB Keyboard as /devices/pci0000:f0/0000:f0:0d.0/usb1/1-1/1-1:1.0/0003:0627:0001.0001/input/input0
scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
ata2: WARNING: synchronous SCSI scan failed without making any progress, switching to async

and ultimately a boot hang. This is with the mac99 emulation in qemu.
The warning is always seen, the boot hang is seen when trying to boot
from ide/ata drive. Bisect log is attached.

Guenter

---
# bad: [1b294a1f35616977caddaddf3e9d28e576a1adbc] Merge tag 'net-next-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
# good: [a5131c3fdf2608f1c15f3809e201cf540eb28489] Merge tag 'x86-shstk-2024-05-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect start 'HEAD' 'a5131c3fdf26'
# good: [f8beae078c82abde57fed4a5be0bbc3579b59ad0] Merge tag 'gtp-24-05-07' of git://git.kernel.org/pub/scm/linux/kernel/git/pablo/gtp Pablo neira Ayuso says:
git bisect good f8beae078c82abde57fed4a5be0bbc3579b59ad0
# good: [ce952d8f0e9b58dc6a2bde7e47ca7fa7925583cc] Merge tag 'gpio-updates-for-v6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
git bisect good ce952d8f0e9b58dc6a2bde7e47ca7fa7925583cc
# bad: [113d1dd9c8ea2186d56a641a787e2588673c9c32] Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
git bisect bad 113d1dd9c8ea2186d56a641a787e2588673c9c32
# good: [a3d1f54d7aa4c3be2c6a10768d4ffa1dcb620da9] Merge tag 'for-6.10-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
git bisect good a3d1f54d7aa4c3be2c6a10768d4ffa1dcb620da9
# bad: [f92141e18c8b466027e226f3388de15b059b6f65] Merge patch series "convert SCSI to atomic queue limits, part 1 (v3)"
git bisect bad f92141e18c8b466027e226f3388de15b059b6f65
# good: [0e0a4da35284c85225e3b128912582ebc73256c8] Merge patch series "scsi: ufs: Remove overzealous memory barriers"
git bisect good 0e0a4da35284c85225e3b128912582ebc73256c8
# bad: [a25a9c85d17fd2f19bd5a2bb25b8361d72336bc7] scsi: libata: Switch to using ->device_configure
git bisect bad a25a9c85d17fd2f19bd5a2bb25b8361d72336bc7
# bad: [6248d7f7714f018f2c02f356582784e74596f8e8] scsi: core: Add a no_highmem flag to struct Scsi_Host
git bisect bad 6248d7f7714f018f2c02f356582784e74596f8e8
# good: [33507b3964f136ea1592718cb81885c8f9354f65] scsi: ufs: qcom: Add sanity checks for gear/lane values during ICC scaling
git bisect good 33507b3964f136ea1592718cb81885c8f9354f65
# good: [4373d2ecca7fa7ad04aa9c371c80049bafec2610] scsi: bsg: Pass queue_limits to bsg_setup_queue()
git bisect good 4373d2ecca7fa7ad04aa9c371c80049bafec2610
# bad: [afd53a3d852808bfeb5bc3ae3cd1caa9389bcc94] scsi: core: Initialize scsi midlayer limits before allocating the queue
git bisect bad afd53a3d852808bfeb5bc3ae3cd1caa9389bcc94
# good: [9042fb6d2c085eccdf11069b04754dac807c36ea] scsi: mpi3mr: Pass queue_limits to bsg_setup_queue()
git bisect good 9042fb6d2c085eccdf11069b04754dac807c36ea
# first bad commit: [afd53a3d852808bfeb5bc3ae3cd1caa9389bcc94] scsi: core: Initialize scsi midlayer limits before allocating the queue





[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux