Received: by 10.223.176.5 with SMTP id f5csp949295wra; Sat, 3 Feb 2018 14:13:45 -0800 (PST) X-Google-Smtp-Source: AH8x224USwQt2bTPKG+qpEQo/r6hMOnXeZ4YOAxj8Uc3xWODezf1bFjlMJO9afjn2ryV/S1Xuav/ X-Received: by 10.99.60.28 with SMTP id j28mr6811183pga.207.1517696025217; Sat, 03 Feb 2018 14:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517696025; cv=none; d=google.com; s=arc-20160816; b=xJ5TvYZbMtjDmLJyD3xAxzJkblByNlOvZ8rihkT6kHUScjSkYpqMliX+KkTz8UrSBM C7cExQ+x31niq4ckTe0IW6grV8W/3RRPQxeVzHLS48YDQdhMNSdcnRxeYp9KpkK0cad8 0Uzl3YRmntHYxAo/QePBakR5rDt5XtL24jJ1ocP1g3zOSYFhKEMXQ29jsCUG7zqVZj/w FGV+pYtR8solSNUO2lT3YPSpocKzNRwGdhAONqWkcqQCb5i8Y+JOErFykPhJahUmHegn gM7VJ4EBQI+sJcHkbRr1H0qntfZUVJamUZVBlK7h9ZygnL8BdzydqKfUpIzjAWSY2gsG NV9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=RwLl4iCFLSFHW2Ydm8X23T4pnr+ILjQcfj9nOf7XaLI=; b=bObQECUxtPT+kfFSwdXvlT7xadfx/FBE8JIq8OwSg4odiBH5MKcOKowuqoBquLfJ3g zrFeJjFVIbs9iObfg/kg7mAlrrJcqnV8b/IcaHSkbRte/0LZnwbWaEVWvmFBN+pIvNvD io0c9EqNqNEflRgWMNz7JKBkzugFBHne8i0NNW9bKwInyDHRGT+b5Fte5m1VA1SOXO7e jhgyy9DMKvjamvv1Tso1HLJeWqY5fkxKk6GTeyxuCOTOxNsBSP53qkpQewEXSC2QGArc QzDWKOnrIpg4TXc7sUFA2HmszK5Udkl3oblp/5UrtAiIrc/eeo5GiQI9WCYdStygVguz oBcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=AW7FVa9A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11-v6si3802704pli.790.2018.02.03.14.13.30; Sat, 03 Feb 2018 14:13:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=AW7FVa9A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755358AbeBCSqX (ORCPT + 99 others); Sat, 3 Feb 2018 13:46:23 -0500 Received: from mail-by2nam03on0097.outbound.protection.outlook.com ([104.47.42.97]:1354 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752816AbeBCSCk (ORCPT ); Sat, 3 Feb 2018 13:02:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=RwLl4iCFLSFHW2Ydm8X23T4pnr+ILjQcfj9nOf7XaLI=; b=AW7FVa9A7fBgZ8Q+bYQS6xcZPvcAVPF6yTsx2+yRIzerz9UwtEVCT0MzxUbIe5iNASPHTUAoVNuPAaYeacnkjwoBgMZR9+X79asUB+byDHN/gvqOrJczdAouwdAZ1JmFQWBMlQdGYDhwS4HmEXiICe4Lww853lPoscCpM4wtTO0= Received: from BL0PR2101MB1027.namprd21.prod.outlook.com (52.132.20.161) by BL0PR2101MB1105.namprd21.prod.outlook.com (52.132.24.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.485.5; Sat, 3 Feb 2018 18:02:03 +0000 Received: from BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9]) by BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9%3]) with mapi id 15.20.0485.006; Sat, 3 Feb 2018 18:02:03 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: "Guilherme G. Piccoli" , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 063/110] bnx2x: Improve reliability in case of nested PCI errors Thread-Topic: [PATCH AUTOSEL for 4.14 063/110] bnx2x: Improve reliability in case of nested PCI errors Thread-Index: AQHTnRjx+R5CpkqpjE6CIbsdmneITg== Date: Sat, 3 Feb 2018 18:00:58 +0000 Message-ID: <20180203180015.29073-63-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BL0PR2101MB1105;6:4D0U2rbjSFslJVTEe47Nl5+J9mye+9hSiJ+5UaKaISfeytKhUXQKPLJCoFltGsYYpqOlKqBpxe+8KZ/ZPlBPYk5wWzHWdDQh1SdLY9sDOcfqbEal0+mOCG3bKNlyMdz1mfbyNxaM44UHo+v2TYxFW9yfJ0dKJMLnfHDuposH+/Aq5Oq/aMFfaPDiqNkhzYPCHXtQiDCfTPCcrTvE3AQu040iJazUTssVZlVeTVYs3SOFevTwwmx9Eh4V0IdrSAeOmTY7sDmYkA4n6zcVFnXH99kBZ7QuKbsfCO8OWU70M3Ko/9usU69TU3lFaUiRBUh0XHGdtm1YtG4l6oPeHhp7iEkiFe+2CVDZAChX/cy0sjcj9Kbst1BX348PNBdyavvG;5:wV1DrrSyV4vBh7NKER8HDnCMod7oHNoBSbR7g0MOMNZNh9dA5H75RdwA05AEP575KaNNNHPrOx03Gdlj7m+Uz74DrfvfN4CrKztUsVN4V4e9L9/8CD95Hj3pz5aFLTz8KA07AXRr6q0oPqTR/flDGuFq6ZMsHQ7jbnnFUx8bql0=;24:KaNmiA4eRBkpMi/oXsI9Z0LZ/c/PC6CSlD3OX+t0K4LOD6HszCeIQZa7SHE573F8O/kbRKaYFrIoLSC5ihPcwnRTOrrQQA9/HcbTX1pGwvk=;7:JTncwpRecp+Y2EpYZRB9yw+/zoHkz3MTuh7Ocnum0huRXlv+9t1F7f0feFbN2KgKFyg8v8SSeuEcLwb0Bz+tvPEOvZYLLvgiva5VAt/7Fctn4D3dl9KDKuEV/9L1hjYXEpuAkrXxiH4tITshL3RQppafo7V5eptV1VvM3COWHwxr8CDTcBqhPMza64eW9YQlRGmvO30nPDzUV/VSMJNorLE2dGislfbpVzPfOalwNi4S3Xl++sEzpyZNrzxOxp2G x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9220970a-0677-42ad-cf7f-08d56b303b03 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:BL0PR2101MB1105; x-ms-traffictypediagnostic: BL0PR2101MB1105: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(190756311086443)(89211679590171)(104084551191319); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231101)(2400082)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:BL0PR2101MB1105;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB1105; x-forefront-prvs: 05724A8921 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39380400002)(39860400002)(346002)(376002)(199004)(189003)(6346003)(97736004)(6512007)(7736002)(26005)(305945005)(102836004)(105586002)(68736007)(5250100002)(8936002)(59450400001)(6486002)(6436002)(106356001)(6506007)(551934003)(81166006)(81156014)(2501003)(2906002)(10090500001)(99286004)(66066001)(54906003)(6116002)(3846002)(36756003)(1076002)(8676002)(110136005)(107886003)(72206003)(2950100002)(478600001)(10290500003)(22452003)(6666003)(5660300001)(2900100001)(4326008)(25786009)(14454004)(316002)(86362001)(53936002)(3280700002)(186003)(3660700001)(76176011)(86612001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB1105;H:BL0PR2101MB1027.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: 0XnXqmEXOgRgbw9W+IQ9h2x+KpUfR7X3b65yPIZwQ3v6i2EJonqEyie6uXIB2Zvs1znRQdQQ2Ul5zAhwlaBDbQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9220970a-0677-42ad-cf7f-08d56b303b03 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:00:58.7221 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1105 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Guilherme G. Piccoli" [ Upstream commit f7084059a9cb9e56a186e1677b1dcffd76c2cd24 ] While in recovery process of PCI error (called EEH on PowerPC arch), another PCI transaction could be corrupted causing a situation of nested PCI errors. Also, this scenario could be reproduced with error injection mechanisms (for debug purposes). We observe that in case of nested PCI errors, bnx2x might attempt to initialize its shmem and cause a kernel crash due to bad addresses read from MCP. Multiple different stack traces were observed depending on the point the second PCI error happens. This patch avoids the crashes by: * failing PCI recovery in case of nested errors (since multiple PCI errors in a row are not expected to lead to a functional adapter anyway), and by, * preventing access to adapter FW when MCP is failed (we mark it as failed when shmem cannot get initialized properly). Reported-by: Abdul Haleem Signed-off-by: Guilherme G. Piccoli Acked-by: Shahed Shaikh Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 4 ++-- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/= ethernet/broadcom/bnx2x/bnx2x_cmn.c index 1216c1f1e052..6465414dad74 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -3030,7 +3030,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mod= e, bool keep_link) =20 del_timer_sync(&bp->timer); =20 - if (IS_PF(bp)) { + if (IS_PF(bp) && !BP_NOMCP(bp)) { /* Set ALWAYS_ALIVE bit in shmem */ bp->fw_drv_pulse_wr_seq |=3D DRV_PULSE_ALWAYS_ALIVE; bnx2x_drv_pulse(bp); @@ -3116,7 +3116,7 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mod= e, bool keep_link) bp->cnic_loaded =3D false; =20 /* Clear driver version indication in shmem */ - if (IS_PF(bp)) + if (IS_PF(bp) && !BP_NOMCP(bp)) bnx2x_update_mng_version(bp); =20 /* Check if there are pending parity attentions. If there are - set diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net= /ethernet/broadcom/bnx2x/bnx2x_main.c index c12b4d3e946e..e855a271db48 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -9578,6 +9578,15 @@ static int bnx2x_init_shmem(struct bnx2x *bp) =20 do { bp->common.shmem_base =3D REG_RD(bp, MISC_REG_SHARED_MEM_ADDR); + + /* If we read all 0xFFs, means we are in PCI error state and + * should bail out to avoid crashes on adapter's FW reads. + */ + if (bp->common.shmem_base =3D=3D 0xFFFFFFFF) { + bp->flags |=3D NO_MCP_FLAG; + return -ENODEV; + } + if (bp->common.shmem_base) { val =3D SHMEM_RD(bp, validity_map[BP_PORT(bp)]); if (val & SHR_MEM_VALIDITY_MB) @@ -14315,7 +14324,10 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct= pci_dev *pdev) BNX2X_ERR("IO slot reset --> driver unload\n"); =20 /* MCP should have been reset; Need to wait for validity */ - bnx2x_init_shmem(bp); + if (bnx2x_init_shmem(bp)) { + rtnl_unlock(); + return PCI_ERS_RESULT_DISCONNECT; + } =20 if (IS_PF(bp) && SHMEM2_HAS(bp, drv_capabilities_flag)) { u32 v; --=20 2.11.0