• Uma Krishnan's avatar
    scsi: cxlflash: Set sg_tablesize to 1 instead of SG_NONE · 68ab2d76
    Uma Krishnan authored
    The following Oops is encountered when blk_mq is enabled with the
    cxlflash driver:
    
    [ 2960.817172] Oops: Kernel access of bad area, sig: 11 [#5]
    [ 2960.817309] NIP  __blk_mq_run_hw_queue+0x278/0x4c0
    [ 2960.817313] LR __blk_mq_run_hw_queue+0x2bc/0x4c0
    [ 2960.817314] Call Trace:
    [ 2960.817320] __blk_mq_run_hw_queue+0x2bc/0x4c0 (unreliable)
    [ 2960.817324] blk_mq_run_hw_queue+0xd8/0x100
    [ 2960.817329] blk_mq_insert_requests+0x14c/0x1f0
    [ 2960.817333] blk_mq_flush_plug_list+0x150/0x190
    [ 2960.817338] blk_flush_plug_list+0x11c/0x2b0
    [ 2960.817344] blk_finish_plug+0x58/0x80
    [ 2960.817348] __do_page_cache_readahead+0x1c0/0x2e0
    [ 2960.817352] force_page_cache_readahead+0x68/0xd0
    [ 2960.817356] generic_file_read_iter+0x43c/0x6a0
    [ 2960.817359] blkdev_read_iter+0x68/0xa0
    [ 2960.817361] __vfs_read+0x11c/0x180
    [ 2960.817364] vfs_read+0xa4/0x1c0
    [ 2960.817366] SyS_read+0x6c/0x110
    [ 2960.817369] system_call+0x38/0xb4
    
    The SCSI blk_mq stack assumes that sg_tablesize is always a non-zero
    value with scsi_mq_setup_tags() allocating tags using sg_tablesize.
    The cxlflash driver currently uses SG_NONE (0) for the sg_tablesize
    as the devices it supports are not capable of scatter gather. This
    mismatch of values results in the Oops above.
    
    To resolve this issue, sg_tablesize for cxlflash can simply be set
    to 1, a value which satisfies the constraints in cxlflash and the
    lack of support of SG_NONE in SCSI blk_mq.
    Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
    Acked-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    68ab2d76
main.c 73 KB