From owner-svn-src-stable-10@freebsd.org Tue Nov 28 19:57:17 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8405CDECF63; Tue, 28 Nov 2017 19:57:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DAE275C52; Tue, 28 Nov 2017 19:57:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vASJvGgP051009; Tue, 28 Nov 2017 19:57:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vASJvGDR051008; Tue, 28 Nov 2017 19:57:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201711281957.vASJvGDR051008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 28 Nov 2017 19:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326341 - stable/10/sys/dev/mpr X-SVN-Group: stable-10 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/10/sys/dev/mpr X-SVN-Commit-Revision: 326341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 19:57:17 -0000 Author: asomers Date: Tue Nov 28 19:57:16 2017 New Revision: 326341 URL: https://svnweb.freebsd.org/changeset/base/326341 Log: MFC r325363: Fix mpr(4) panics caused by bad drive mapping tables sys/dev/mpr/mpr_mapping.c If _mapping_process_dpm_pg0 detects inconsistencies in the drive mapping table (stored in the HBA's NVRAM), abort reading it and continue to boot as if the mapping table were blank. I observed such inconsistencies in several HBAs after upgrading firmware from 14.0.0.0 to 15.0.0.0. Reviewed by: slm Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12901 Modified: stable/10/sys/dev/mpr/mpr_mapping.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mpr/mpr_mapping.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_mapping.c Tue Nov 28 19:46:48 2017 (r326340) +++ stable/10/sys/dev/mpr/mpr_mapping.c Tue Nov 28 19:57:16 2017 (r326341) @@ -2210,7 +2210,7 @@ mpr_mapping_free_memory(struct mpr_softc *sc) free(sc->dpm_pg0, M_MPR); } -static void +static bool _mapping_process_dpm_pg0(struct mpr_softc *sc) { u8 missing_cnt, enc_idx; @@ -2339,7 +2339,7 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc) "%s: Conflict in mapping table for " " enclosure %d\n", __func__, enc_idx); - break; + goto fail; } physical_id = dpm_entry->PhysicalIdentifier.High; @@ -2366,7 +2366,7 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc) mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: " "Conflict in mapping table for device %d\n", __func__, map_idx); - break; + goto fail; } physical_id = dpm_entry->PhysicalIdentifier.High; mt_entry->physical_id = (physical_id << 32) | @@ -2378,6 +2378,18 @@ _mapping_process_dpm_pg0(struct mpr_softc *sc) mt_entry->device_info = MPR_DEV_RESERVED; } } /*close the loop for DPM table */ + return (true); + +fail: + for (entry_num = 0; entry_num < sc->max_dpm_entries; entry_num++) { + sc->dpm_entry_used[entry_num] = 0; + /* + * for IR firmware, it may be necessary to wipe out + * sc->mapping_table volumes tooi + */ + } + sc->num_enc_table_entries = 0; + return (false); } /* @@ -2617,9 +2629,11 @@ retry_read_dpm: } } - if (sc->is_dpm_enable) - _mapping_process_dpm_pg0(sc); - else { + if (sc->is_dpm_enable) { + if (!_mapping_process_dpm_pg0(sc)) + sc->is_dpm_enable = 0; + } + if (! sc->is_dpm_enable) { mpr_dprint(sc, MPR_MAPPING, "%s: DPM processing is disabled. " "Device mappings will not persist across reboots or " "resets.\n", __func__);