aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Bowling <kbowling@FreeBSD.org>2021-10-06 23:20:26 +0000
committerKevin Bowling <kbowling@FreeBSD.org>2021-10-13 02:12:21 +0000
commit38d7f1c5b39145a9ac58678dba59288ffa85fd5e (patch)
tree19da28a71f67de8428a5840f84389cc88958b741
parent8d4cf1a63e1db1cd3aff8132e3e0e3ea00e3a6a9 (diff)
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)
-rw-r--r--sys/dev/e1000/if_em.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index cb6cf647a3e8..9e3064a13005 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -4499,20 +4499,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");
}