From nobody Wed Oct 13 02:11:52 2021 X-Original-To: dev-commits-src-branches@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 431BE17F8E7F; Wed, 13 Oct 2021 02:11:52 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HTbd41Pfgz4dpF; Wed, 13 Oct 2021 02:11:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 112661F5D4; Wed, 13 Oct 2021 02:11:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19D2BqGA092604; Wed, 13 Oct 2021 02:11:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19D2BqAg092603; Wed, 13 Oct 2021 02:11:52 GMT (envelope-from git) Date: Wed, 13 Oct 2021 02:11:52 GMT Message-Id: <202110130211.19D2BqAg092603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 884b89510faa - stable/13 - e1000: Lock nvm print sysctl List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 884b89510faa219c7345dcb3ce67286abba96768 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=884b89510faa219c7345dcb3ce67286abba96768 commit 884b89510faa219c7345dcb3ce67286abba96768 Author: Kevin Bowling AuthorDate: 2021-10-06 23:20:26 +0000 Commit: Kevin Bowling CommitDate: 2021-10-13 02:10:54 +0000 e1000: Lock nvm print sysctl Otherwise results in KASSERT with debug kernels because we rely on the iflib CTX lock to implement the software serialization to the NVM model Reviewed by: gallatin MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32333 (cherry picked from commit 9b3e252e59c6e63594fb20e3f65188dab9e1eeff) --- sys/dev/e1000/if_em.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 3153a44000c5..52eff393e848 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -4510,20 +4510,27 @@ em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) static void em_print_nvm_info(struct e1000_softc *sc) { + struct e1000_hw *hw = &sc->hw; + struct sx *iflib_ctx_lock = iflib_ctx_lock_get(sc->ctx); u16 eeprom_data; int i, j, row = 0; /* Its a bit crude, but it gets the job done */ printf("\nInterface EEPROM Dump:\n"); printf("Offset\n0x0000 "); + + /* We rely on the IFLIB_CTX_LOCK as part of NVM locking model */ + sx_xlock(iflib_ctx_lock); + ASSERT_CTX_LOCK_HELD(hw); for (i = 0, j = 0; i < 32; i++, j++) { if (j == 8) { /* Make the offset block */ j = 0; ++row; printf("\n0x00%x0 ",row); } - e1000_read_nvm(&sc->hw, i, 1, &eeprom_data); + e1000_read_nvm(hw, i, 1, &eeprom_data); printf("%04x ", eeprom_data); } + sx_xunlock(iflib_ctx_lock); printf("\n"); }