* [PATCH] scsi: Set sg_tablesize to 1, for LLDDs that set SG_NONE
@ 2015-10-28 19:36 Manoj Kumar
2015-10-28 22:32 ` Matthew R. Ochs
0 siblings, 1 reply; 2+ messages in thread
From: Manoj Kumar @ 2015-10-28 19:36 UTC (permalink / raw)
To: James.Bottomley, linux-scsi; +Cc: Manoj Kumar, Youngjae Lee
Oops while testing blk_mq over the new 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 root cause of the problem was this low level device driver(LLDD),
in this case cxlflash, does not support scatter-gather and hence had
set it's sg_tablesize to SG_NONE (value of 0). In reality the tablesize
is of length 1. This value of SG_NONE does not cause any problems with
the standard block driver stack but causes issues for blk_mq, as shown
above. Since quite a few of the legacy LLDDs are setting sg_tablesize
to SG_NONE, it was preferable to override the LLDD provided value in
scsi_host_alloc().
Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Youngjae Lee <leeyo@linux.vnet.ibm.com>
---
drivers/scsi/hosts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 8bb173e..bd13c9d 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -413,7 +413,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
shost->hostt = sht;
shost->this_id = sht->this_id;
shost->can_queue = sht->can_queue;
- shost->sg_tablesize = sht->sg_tablesize;
+ shost->sg_tablesize = (sht->sg_tablesize ? sht->sg_tablesize : 1);
shost->sg_prot_tablesize = sht->sg_prot_tablesize;
shost->cmd_per_lun = sht->cmd_per_lun;
shost->unchecked_isa_dma = sht->unchecked_isa_dma;
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: Set sg_tablesize to 1, for LLDDs that set SG_NONE
2015-10-28 19:36 [PATCH] scsi: Set sg_tablesize to 1, for LLDDs that set SG_NONE Manoj Kumar
@ 2015-10-28 22:32 ` Matthew R. Ochs
0 siblings, 0 replies; 2+ messages in thread
From: Matthew R. Ochs @ 2015-10-28 22:32 UTC (permalink / raw)
To: Manoj Kumar; +Cc: James.Bottomley, linux-scsi, Youngjae Lee
> On Oct 28, 2015, at 2:36 PM, Manoj Kumar <manoj@linux.vnet.ibm.com> wrote:
>
> Oops while testing blk_mq over the new 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 root cause of the problem was this low level device driver(LLDD),
> in this case cxlflash, does not support scatter-gather and hence had
> set it's sg_tablesize to SG_NONE (value of 0). In reality the tablesize
> is of length 1. This value of SG_NONE does not cause any problems with
> the standard block driver stack but causes issues for blk_mq, as shown
> above. Since quite a few of the legacy LLDDs are setting sg_tablesize
> to SG_NONE, it was preferable to override the LLDD provided value in
> scsi_host_alloc().
>
> Signed-off-by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>
> Signed-off-by: Youngjae Lee <leeyo@linux.vnet.ibm.com>
> ---
> drivers/scsi/hosts.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> index 8bb173e..bd13c9d 100644
> --- a/drivers/scsi/hosts.c
> +++ b/drivers/scsi/hosts.c
> @@ -413,7 +413,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
> shost->hostt = sht;
> shost->this_id = sht->this_id;
> shost->can_queue = sht->can_queue;
> - shost->sg_tablesize = sht->sg_tablesize;
> + shost->sg_tablesize = (sht->sg_tablesize ? sht->sg_tablesize : 1);
> shost->sg_prot_tablesize = sht->sg_prot_tablesize;
> shost->cmd_per_lun = sht->cmd_per_lun;
> shost->unchecked_isa_dma = sht->unchecked_isa_dma;
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-28 22:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-28 19:36 [PATCH] scsi: Set sg_tablesize to 1, for LLDDs that set SG_NONE Manoj Kumar
2015-10-28 22:32 ` Matthew R. Ochs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox