From patchwork Tue Nov 10 22:45:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manoj Kumar X-Patchwork-Id: 7592551 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4D83DBF90C for ; Tue, 10 Nov 2015 22:45:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 67DF62045B for ; Tue, 10 Nov 2015 22:45:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D71720459 for ; Tue, 10 Nov 2015 22:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751761AbbKJWpu (ORCPT ); Tue, 10 Nov 2015 17:45:50 -0500 Received: from e17.ny.us.ibm.com ([129.33.205.207]:50341 "EHLO e17.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750950AbbKJWpt (ORCPT ); Tue, 10 Nov 2015 17:45:49 -0500 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 10 Nov 2015 17:45:48 -0500 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Nov 2015 17:45:47 -0500 X-IBM-Helo: d01dlp01.pok.ibm.com X-IBM-MailFrom: manoj@linux.vnet.ibm.com X-IBM-RcptTo: linux-scsi@vger.kernel.org Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 32CAD38C8041 for ; Tue, 10 Nov 2015 17:45:46 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tAAMjkqJ63963154 for ; Tue, 10 Nov 2015 22:45:46 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tAAMjj2k021743 for ; Tue, 10 Nov 2015 17:45:45 -0500 Received: from p8tul1-build.aus.stglabs.ibm.com (als141206.austin.ibm.com [9.3.141.206]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tAAMjiqH021699; Tue, 10 Nov 2015 17:45:44 -0500 From: Manoj Kumar To: James Bottomley , linux-scsi@vger.kernel.org Cc: "Matthew R. Ochs" , "Manoj N. Kumar" , Youngjae Lee Subject: [PATCH RESEND] scsi: Set sg_tablesize to 1, for LLDDs that set SG_NONE Date: Tue, 10 Nov 2015 16:45:20 -0600 Message-Id: <1447195520-27307-1-git-send-email-manoj@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15111022-0041-0000-0000-0000024D4317 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Youngjae Lee Reviewed-by: Matthew R. Ochs --- 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;