From nobody Sun Aug 31 19:01:33 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cFLvd43Pxz66NG2; Sun, 31 Aug 2025 19:01:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cFLvd3LR6z3c1R; Sun, 31 Aug 2025 19:01:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756666893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bZpOGnGsKJbLizs0s9csrSV0vttLStLGDs7Yj9dp0Ds=; b=AnBfD6YBymXs6P1CFIkkyECmc17r3ffFw6L634+SCAZKrGqma1yIsgVF/54AB2NwfIDEBS IX2yZi4Aj08oA9Pz5yRJKBcMpf5gqqzgTK8D7o4JFC/zCqrC2egPqAAAqWcPc+bcioxBnb 7ORUiJXUcK3jXBs5ScD5AMfATSECIs5l2Sk5nLRInPYhVyzCP4Y/5oz4ILdvWtmm891QY9 b71PzOmMUdxhTcGaa5e/PureSbWKnM5qp1lfKryKk7ujxh+7JRfEQcg2BTVVb2zE2Rg7gi KR/uzK7t2BNaSYIcPT5BQyEJp57kFEI+51RZU6RnoLHE/VjKiaHJ9Z7PncNDzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756666893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bZpOGnGsKJbLizs0s9csrSV0vttLStLGDs7Yj9dp0Ds=; b=s4c7TGXLOKMFGRu80SqgO2F3vUo1n9tVn/DHbmBHKpcqWUyzu6lxWuw0TkmR/gxaYujkqQ gzdALQff3kO+4FOdYYYLCelSKf/te+Q0ZrsM2MFg/h+mgTatZcr+XXWiR4yDADayVeCvpb UmGIMY/bgKWY07MLFBysMI0FgqeqQ9R/h0BhQO5OvXf8UNfHRtE8nhm6HnYhr8+Jjy2a+/ R3w+UoZ3tyuC6X5xipDOTK1faj+1/co/GzLXJCpnFiej/BxFxepKGu0RYKVidQ7pya2iwU aSfZavhYQqjsv6fLhHXAcQNRakyl9B/VLzN6SSf2Jd4Lu2jG0mD4s9ShKUfozA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756666893; a=rsa-sha256; cv=none; b=tMof3BF6qp5bCWYRp/V0ipxmIhnIxQtqSRe1XPJurDn7XJ9Mg3swotIw/RSaR0RtnWm5Rh wgEgb3R5/xi2s7/UgS4RZMohDP78xhiAaXh65YPa1o5/uFIZxrF5jv4yFJhdNK7opRsJG/ 6eSXvQSQj/9t2mnE1VL8bhGbfjg/UGxsPpVDOx+XurzsHqu4hXaRdqiAex7TTg0rjkaEIS fpzv9+f5ZnqfdKmNtx5A1TxF6Tzwm75EMMpTq8FIB7WPbW9k/3xbqwYXhxLRMPp3jUoreu Sy8u+1hfG++IOiajQtFNnw6x+7ymv0Aedl2W3zIyCb7+QcR2vkcaKxjCBOVY+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cFLvd2TFLz9TQ; Sun, 31 Aug 2025 19:01:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 57VJ1X7U054851; Sun, 31 Aug 2025 19:01:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57VJ1XiG054848; Sun, 31 Aug 2025 19:01:33 GMT (envelope-from git) Date: Sun, 31 Aug 2025 19:01:33 GMT Message-Id: <202508311901.57VJ1XiG054848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 004ce88ad1ef - main - mpr: Add workaround for too few slots being automatically scanned List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 004ce88ad1efd42a1d7d5692849b4aa6906178fc Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=004ce88ad1efd42a1d7d5692849b4aa6906178fc commit 004ce88ad1efd42a1d7d5692849b4aa6906178fc Author: Peter Eriksson AuthorDate: 2025-08-31 18:58:56 +0000 Commit: Warner Losh CommitDate: 2025-08-31 19:01:09 +0000 mpr: Add workaround for too few slots being automatically scanned This patch adds a /boot/loader.conf setting that makes it possibly to override the detected number of slots in storage enclosures. Some (yes I'm looking at you HPE D6020!) reports less available slots that there actually are (the D6020 seems to report 18 but actually has 35 per drawer). This causes the mpr driver to have problems detecting/managing all drives in a multienclosure setting. For the D6020 this occurs when connecting two or more fully equipped (140 drives) enclosures to one controller... This problem can be "fixed" by adding the following to /boot/loader.conf and rebooting: hw.mpr.encl_min_slots="35" Note: I (Warner) don't have this hardware to see if there's some way to fix the detection, so I'm committing this as a stop-gap. It's a no-op if no tunable is set. PR: 271238 Reivewed by: imp --- sys/dev/mpr/mpr.c | 10 ++++++++++ sys/dev/mpr/mpr_mapping.c | 18 ++++++++++++++++++ sys/dev/mpr/mprvar.h | 1 + 3 files changed, 29 insertions(+) diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c index d1c572e40669..262d6b58b705 100644 --- a/sys/dev/mpr/mpr.c +++ b/sys/dev/mpr/mpr.c @@ -1729,6 +1729,7 @@ mpr_get_tunables(struct mpr_softc *sc) sc->enable_ssu = MPR_SSU_ENABLE_SSD_DISABLE_HDD; sc->spinup_wait_time = DEFAULT_SPINUP_WAIT; sc->use_phynum = 1; + sc->encl_min_slots = 0; sc->max_reqframes = MPR_REQ_FRAMES; sc->max_prireqframes = MPR_PRI_REQ_FRAMES; sc->max_replyframes = MPR_REPLY_FRAMES; @@ -1748,6 +1749,7 @@ mpr_get_tunables(struct mpr_softc *sc) TUNABLE_INT_FETCH("hw.mpr.enable_ssu", &sc->enable_ssu); TUNABLE_INT_FETCH("hw.mpr.spinup_wait_time", &sc->spinup_wait_time); TUNABLE_INT_FETCH("hw.mpr.use_phy_num", &sc->use_phynum); + TUNABLE_INT_FETCH("hw.mpr.encl_min_slots", &sc->encl_min_slots); TUNABLE_INT_FETCH("hw.mpr.max_reqframes", &sc->max_reqframes); TUNABLE_INT_FETCH("hw.mpr.max_prireqframes", &sc->max_prireqframes); TUNABLE_INT_FETCH("hw.mpr.max_replyframes", &sc->max_replyframes); @@ -1797,6 +1799,10 @@ mpr_get_tunables(struct mpr_softc *sc) device_get_unit(sc->mpr_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->use_phynum); + snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.encl_min_slots", + device_get_unit(sc->mpr_dev)); + TUNABLE_INT_FETCH(tmpstr, &sc->encl_min_slots); + snprintf(tmpstr, sizeof(tmpstr), "dev.mpr.%d.max_reqframes", device_get_unit(sc->mpr_dev)); TUNABLE_INT_FETCH(tmpstr, &sc->max_reqframes); @@ -1951,6 +1957,10 @@ mpr_setup_sysctl(struct mpr_softc *sc) SYSCTL_ADD_UQUAD(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "prp_page_alloc_fail", CTLFLAG_RD, &sc->prp_page_alloc_fail, "PRP page allocation failures"); + + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "encl_min_slots", CTLFLAG_RW, &sc->encl_min_slots, 0, + "force enclosure minimum slots"); } static struct mpr_debug_string { diff --git a/sys/dev/mpr/mpr_mapping.c b/sys/dev/mpr/mpr_mapping.c index f9a9ac1c53d0..38aa4dfc7ef2 100644 --- a/sys/dev/mpr/mpr_mapping.c +++ b/sys/dev/mpr/mpr_mapping.c @@ -2785,6 +2785,8 @@ mpr_mapping_enclosure_dev_status_change_event(struct mpr_softc *sc, * DPM, if it's being used. */ if (enc_idx != MPR_ENCTABLE_BAD_IDX) { + u16 new_num_slots; + et_entry = &sc->enclosure_table[enc_idx]; if (et_entry->init_complete && !et_entry->missing_count) { @@ -2796,6 +2798,17 @@ mpr_mapping_enclosure_dev_status_change_event(struct mpr_softc *sc, et_entry->enc_handle = le16toh(event_data-> EnclosureHandle); et_entry->start_slot = le16toh(event_data->StartSlot); + new_num_slots = le16toh(event_data->NumSlots); + if (new_num_slots < sc->encl_min_slots) { + mpr_dprint(sc, MPR_MAPPING, "%s: Enclosure %d num_slots %d, overriding with %d.\n", + __func__, enc_idx, new_num_slots, sc->encl_min_slots); + new_num_slots = sc->encl_min_slots; + } + if (et_entry->num_slots != new_num_slots) { + mpr_dprint(sc, MPR_MAPPING, "%s: Enclosure %d old num_slots %d, new %d.\n", + __func__, enc_idx, et_entry->num_slots, sc->encl_min_slots); + et_entry->num_slots = new_num_slots; + } saved_phy_bits = et_entry->phy_bits; et_entry->phy_bits |= le32toh(event_data->PhyBits); if (saved_phy_bits != et_entry->phy_bits) @@ -2858,6 +2871,11 @@ mpr_mapping_enclosure_dev_status_change_event(struct mpr_softc *sc, et_entry->start_index = MPR_MAPTABLE_BAD_IDX; et_entry->dpm_entry_num = MPR_DPM_BAD_IDX; et_entry->num_slots = le16toh(event_data->NumSlots); + if (et_entry->num_slots < sc->encl_min_slots) { + mpr_dprint(sc, MPR_ERROR | MPR_MAPPING, "%s: Enclosure %d num_slots is %d, overriding with %d.\n", + __func__, enc_idx, et_entry->num_slots, sc->encl_min_slots); + et_entry->num_slots = sc->encl_min_slots; + } et_entry->start_slot = le16toh(event_data->StartSlot); et_entry->phy_bits = le32toh(event_data->PhyBits); } diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h index 0f1743f4266e..93f3fbffe079 100644 --- a/sys/dev/mpr/mprvar.h +++ b/sys/dev/mpr/mprvar.h @@ -366,6 +366,7 @@ struct mpr_softc { int spinup_wait_time; int use_phynum; int dump_reqs_alltypes; + int encl_min_slots; uint64_t chain_alloc_fail; uint64_t prp_page_alloc_fail; struct sysctl_ctx_list sysctl_ctx;