From patchwork Fri Jun 10 21:33:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Bottomley X-Patchwork-Id: 9170477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3CCFD6048F for ; Fri, 10 Jun 2016 21:33:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F6F028210 for ; Fri, 10 Jun 2016 21:33:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2438B2835E; Fri, 10 Jun 2016 21:33:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F39728210 for ; Fri, 10 Jun 2016 21:33:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753279AbcFJVdp (ORCPT ); Fri, 10 Jun 2016 17:33:45 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:56644 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342AbcFJVdo (ORCPT ); Fri, 10 Jun 2016 17:33:44 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 709298EE14C; Fri, 10 Jun 2016 14:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1465594423; bh=ZBU2N5q2Bop//Gi8BSBRaipudLRs3X1elbZlGeH9jFk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=MZj7xs6LiO3LQ42d5t90d439j8Gbq8cxCKaAEcKt87IymB3asVy2Zgk/upVxY2DP3 rOHg1JkrU6PXaq+PvKm2mgSF9zERTmxRozK/gcmnJCTDOK1dgOXTivzHJHygmHvfsc T78OxBo605bLcogsj7/EyjvIHnniEmGnXXV83feA= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TYg7ztRimG3o; Fri, 10 Jun 2016 14:33:43 -0700 (PDT) Received: from [153.66.254.194] (unknown [50.46.144.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id E56288EE147; Fri, 10 Jun 2016 14:33:42 -0700 (PDT) Message-ID: <1465594421.2224.58.camel@HansenPartnership.com> Subject: Re: kernel BUG in drivers/scsi/53c700.c:1129 From: James Bottomley To: emilne@redhat.com, Helge Deller Cc: "linux-parisc@vger.kernel.org" , linux-scsi , Christoph Hellwig Date: Fri, 10 Jun 2016 14:33:41 -0700 In-Reply-To: <1465592473.2224.52.camel@HansenPartnership.com> References: <5759C524.2030009@gmx.de> <1465511002.2259.19.camel@HansenPartnership.com> <575B2239.4020403@gmx.de> <1465592285.20724.173.camel@localhost.localdomain> <1465592473.2224.52.camel@HansenPartnership.com> X-Mailer: Evolution 3.16.5 Mime-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, 2016-06-10 at 14:01 -0700, James Bottomley wrote: > On Fri, 2016-06-10 at 16:58 -0400, Ewan D. Milne wrote: > > I'm not sure if this is the problem, but the tagging changes to > > scsi_tcq.h may have altered the 53c700 driver's assumptions. > > In one case it sets sdev->current_cmnd and then some of the > > tagging calls would return it if the tag was SCSI_NO_TAG. > > > > NCR_700_queuecommand_lck() does: > > > > if ((hostdata->tag_negotiated & (1< > SCp->device->simple_tags) { > > slot->tag = SCp->request->tag; > > CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot > > %p\n", > > slot->tag, slot); > > } else { > > slot->tag = SCSI_NO_TAG; > > /* must populate current_cmnd for > > scsi_host_find_tag > > to > > work */ > > SCp->device->current_cmnd = SCp; > > } > > Thanks ... I was just about to look for something this. I'd got to > interpreting the script as reselected with tag information present > and then trying to look the command up with no tag present, hence the > BUG(). Yes, you're right, it's commit 64d513ac31bd02a3c9b69ef04444f36c196f9a9d Author: Christoph Hellwig Date: Thu Oct 8 09:28:04 2015 +0100 scsi: use host wide tags by default Again. This time because it's transformation of the handling of SCSI_NO_TAG is wrong. You can't replace the return sdev->current_cmnd original in scsi_find_tag with the NULL return in scsi_find_host_tag. I think this changesets wins the prize for the greatest number of generated faults. Does this fix 53c700.c? I suppose we'd better look for other places where no tag fell through ... James --- -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index d4c2856..3ddc85e 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c @@ -1122,7 +1122,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, } else { struct scsi_cmnd *SCp; - SCp = scsi_host_find_tag(SDp->host, SCSI_NO_TAG); + SCp = SDp->current_cmnd; if(unlikely(SCp == NULL)) { sdev_printk(KERN_ERR, SDp, "no saved request for untagged cmd\n"); @@ -1826,7 +1826,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *) slot->tag, slot); } else { slot->tag = SCSI_NO_TAG; - /* must populate current_cmnd for scsi_host_find_tag to work */ + /* save current command for reselection */ SCp->device->current_cmnd = SCp; } /* sanity check: some of the commands generated by the mid-layer