From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4E59C282CA for ; Wed, 13 Feb 2019 18:52:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A368120811 for ; Wed, 13 Feb 2019 18:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733126AbfBMSwP (ORCPT ); Wed, 13 Feb 2019 13:52:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60402 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394160AbfBMSwL (ORCPT ); Wed, 13 Feb 2019 13:52:11 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E6F93DDB3; Wed, 13 Feb 2019 18:52:11 +0000 (UTC) Received: from emilne (unknown [10.18.25.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6CFD608BB; Wed, 13 Feb 2019 18:52:10 +0000 (UTC) Message-ID: <8d799a1a4e8b801bdf9ae019510582264d0695e6.camel@redhat.com> Subject: Re: [PATCH 1/4] lpfc: fix calls to dma_set_mask_and_coherent() From: "Ewan D. Milne" To: Hannes Reinecke , Christoph Hellwig Cc: "Martin K. Petersen" , James Bottomley , linux-scsi@vger.kernel.org, stable@vger.kernel.org, Hannes Reinecke Date: Wed, 13 Feb 2019 13:52:10 -0500 In-Reply-To: <20190213114234.67275-2-hare@suse.de> References: <20190213114234.67275-1-hare@suse.de> <20190213114234.67275-2-hare@suse.de> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 13 Feb 2019 18:52:11 +0000 (UTC) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org See below. Also, this patch only fixes 1 of the 2 places, we need to fix lpfc_sli4_pci_mem_setup() also. With the same code applied in both places, the NVMe/FC issue is fixed. I expect the SCSI/FCP tests would pass too, but those take a couple of days. -Ewan On Wed, 2019-02-13 at 12:42 +0100, Hannes Reinecke wrote: > The change to use dma_set_mask_and_coherent() incorrectly made a second > call with the 32 bit DMA mask value when the call with the 64 bit DMA > mask value succeeded. This resulted in NVMe/FC connections failing due > to corrupted data buffers, and various other SCSI/FCP I/O errors. > > Fixes: f30e1bfd6154 ("scsi: lpfc: use dma_set_mask_and_coherent") > Cc: > Suggested-by: Don Dutile > Signed-off-by: Ewan D. Milne > Signed-off-by: Hannes Reinecke > --- > drivers/scsi/lpfc/lpfc_init.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c > index bede11e16349..8a4b096ffe47 100644 > --- a/drivers/scsi/lpfc/lpfc_init.c > +++ b/drivers/scsi/lpfc/lpfc_init.c > @@ -7361,15 +7361,18 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba) > unsigned long bar0map_len, bar2map_len; > int i, hbq_count; > void *ptr; > - int error = -ENODEV; > + int error; > > if (!pdev) > return error; Since this patch removes the initialization of "error" above, this return statement returns an undefined value. Change it to return -ENODEV? > > /* Set the device DMA mask size */ > - if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || > - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) > + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); > + if (error) > + error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > + if (error) > return error; > + error = -ENODEV; > > /* Get the bus address of Bar0 and Bar2 and the number of bytes > * required by each mapping.