From patchwork Tue Jan 17 09:20:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ingo Molnar X-Patchwork-Id: 9520249 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 5DF01601C3 for ; Tue, 17 Jan 2017 09:22:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5077C28512 for ; Tue, 17 Jan 2017 09:22:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44C7628516; Tue, 17 Jan 2017 09:22:31 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable 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 A055628512 for ; Tue, 17 Jan 2017 09:22:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751033AbdAQJWE (ORCPT ); Tue, 17 Jan 2017 04:22:04 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35684 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751095AbdAQJUb (ORCPT ); Tue, 17 Jan 2017 04:20:31 -0500 Received: by mail-wm0-f65.google.com with SMTP id d140so20555171wmd.2; Tue, 17 Jan 2017 01:20:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9UrxO2fYmeWrrla7wqrSA1zShFm2cyA9/ngKGeMgxvg=; b=J5OZhYy8IkVgQ5Jw34A3DBQK6/Dfz+VqWqOhPb1ARJZWdG107L8c8c5saWuxVmFCYG cj1rBzpWknt8SyRcdnTF0olNv71XnZZLmhdUYj3NMrwiqNAIuv/n0jrsKSQuuC6Muef2 M+4Xcusau9yzgzWCtNOfhx6GAAN4DB7FYI6Ea+hph00J9SZwkLghzcqGY+lFf/+TVi6H I3dTlNsD0xVjF00lpHiz6EFozTzWzDgp7Pj3g+slCwaC+HHJr1SVxUPu8h78kle4UNSt eJE60TyaNgRock35FX1uNJBCK3itiL13u7cp7N89EYkVX9O9PWBgZi6hx95xFOCo4TVn GR+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=9UrxO2fYmeWrrla7wqrSA1zShFm2cyA9/ngKGeMgxvg=; b=Bnb/Ph9lpOFM5L7AgQhMGnibD7jtzRj9oi55swo1Dgxxk4LQuFPmwfpQpovPttGYpS SMC97YVxFnhRQImyrXII+oGPZ9vDfhhNf/A2fC2tUwd7fPuAE8sQc2xftUfppN9clC5i AqAkqgc/ue40u2Qw3d/I+s605va9fiiIImabylMOKVdzSyW4RXS3vyHo5zl6v2pR+tRv Mw8XAbRJOBMagChTkc6Ik3YwnRDJNwSYMynOUvrru5RCFCdzrTryblLJLgSt07KmEDMz HG7gkoyy3qxw9UrMwXBS2WrrLha7yanmtbe0XuFoq59gKDXsRFnSBNMiS6znMCrJQg+v kTyA== X-Gm-Message-State: AIkVDXK/fwPmk14xIlZYl2bb5cAkxLKxiUdTCAfyj9JClgxWFyrBu/FN+6seKFioFuLizQ== X-Received: by 10.223.151.18 with SMTP id r18mr26508491wrb.129.1484644829452; Tue, 17 Jan 2017 01:20:29 -0800 (PST) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id f67sm35631946wmd.13.2017.01.17.01.20.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 01:20:28 -0800 (PST) Date: Tue, 17 Jan 2017 10:20:25 +0100 From: Ingo Molnar To: "Martin K. Petersen" Cc: James Bottomley , David Miller , Bart Van Assche , Christoph Hellwig , jbaron@akamai.com, "linux-kernel@vger.kernel.org" , sagi@grimberg.me, Sathya Prakash , Suganath Prabu Subramani , Hannes Reinecke , "linux-scsi@vger.kernel.org" , Christoph Hellwig , Chaitra Basappa , dledford@redhat.com, Sreekanth Reddy Subject: Re: [PATCH] scsi: mpt3sas: fix hang on ata passthru commands Message-ID: <20170117092025.GA9337@gmail.com> References: <20161229080250.GA11605@infradead.org> <1483226343.2518.32.camel@linux.vnet.ibm.com> <1483280506.5512.1.camel@sandisk.com> <20170101.113311.417107391370623850.davem@davemloft.net> <1483292364.2345.5.camel@linux.vnet.ibm.com> <1484596878.2540.58.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) 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 * Martin K. Petersen wrote: > >>>>> "James" == James Bottomley writes: > > James> Subject: [PATCH] scsi: mpt3sas: fix hang on ata passthrough > James> commands > > James> mpt3sas has a firmware failure where it can only handle one pass > James> through ATA command at a time. If another comes in, contrary to > James> the SAT standard, it will hang until the first one completes > James> (causing long commands like secure erase to timeout). The > James> original fix was to block the device when an ATA command came in, > James> but this caused a regression with > > Broadcom folks: Please test and ack as soon as possible so we can get > this fix queued up. > > Ingo: Since you appear to have hardware, it would be great if you could > test James' v3 (https://patchwork.kernel.org/patch/9519383/). Sorry for > the inconvenience. As per the interdiff below v2->v3 did not change the code in any way, only the name of the function and a comment, so you can add this to v3 as well: Reported-by: Ingo Molnar Tested-by: Ingo Molnar Thanks, Ingo --- 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/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 6f9b4c051e4d..830e2c10ba02 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -3899,7 +3899,7 @@ _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc, } } -static int set_satl_pending(struct scsi_cmnd *scmd, bool pending) +static int _scsih_set_satl_pending(struct scsi_cmnd *scmd, bool pending) { struct MPT3SAS_DEVICE *priv = scmd->device->hostdata; @@ -3934,7 +3934,7 @@ _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc) if (!scmd) continue; count++; - set_satl_pending(scmd, false); + _scsih_set_satl_pending(scmd, false); mpt3sas_base_free_smid(ioc, smid); scsi_dma_unmap(scmd); if (ioc->pci_error_recovery) @@ -4084,7 +4084,9 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) } /* - * Bug work around for firmware SATL handling + * Bug work around for firmware SATL handling. The loop + * is based on atomic operations and ensures consistency + * since we're lockless at this point */ do { if (sas_device_priv_data->ata_command_pending) { @@ -4092,7 +4094,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) scmd->scsi_done(scmd); return 0; } - } while (set_satl_pending(scmd, true)); + } while (_scsih_set_satl_pending(scmd, true)); sas_target_priv_data = sas_device_priv_data->sas_target; @@ -4661,7 +4663,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) if (scmd == NULL) return 1; - set_satl_pending(scmd, false); + _scsih_set_satl_pending(scmd, false); mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);