Author: np
Date: Sat Feb  9 01:49:53 2019
New Revision: 343923
URL: https://svnweb.freebsd.org/changeset/base/343923

Log:
  cxgbe(4): Delay the panic due to a fatal error by 30s.
  
  This lets information logged by the interrupt handler reach the system
  log before the system goes down.

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c        Fri Feb  8 23:03:28 2019        
(r343922)
+++ head/sys/dev/cxgbe/t4_main.c        Sat Feb  9 01:49:53 2019        
(r343923)
@@ -556,7 +556,7 @@ SYSCTL_INT(_hw_cxgbe, OID_AUTO, pcie_relaxed_ordering,
 
 static int t4_panic_on_fatal_err = 0;
 SYSCTL_INT(_hw_cxgbe, OID_AUTO, panic_on_fatal_err, CTLFLAG_RDTUN,
-    &t4_panic_on_fatal_err, 0, "panic on fatal firmware errors");
+    &t4_panic_on_fatal_err, 0, "panic on fatal errors");
 
 #ifdef TCP_OFFLOAD
 /*
@@ -2562,6 +2562,16 @@ vcxgbe_detach(device_t dev)
        return (0);
 }
 
+static struct callout fatal_callout;
+
+static void
+delayed_panic(void *arg)
+{
+       struct adapter *sc = arg;
+
+       panic("%s: panic on fatal error", device_get_nameunit(sc->dev));
+}
+
 void
 t4_fatal_err(struct adapter *sc, bool fw_error)
 {
@@ -2569,9 +2579,6 @@ t4_fatal_err(struct adapter *sc, bool fw_error)
        t4_shutdown_adapter(sc);
        log(LOG_ALERT, "%s: encountered fatal error, adapter stopped.\n",
            device_get_nameunit(sc->dev));
-       if (t4_panic_on_fatal_err)
-               panic("panic requested on fatal error");
-
        if (fw_error) {
                ASSERT_SYNCHRONIZED_OP(sc);
                sc->flags |= ADAP_ERR;
@@ -2580,6 +2587,12 @@ t4_fatal_err(struct adapter *sc, bool fw_error)
                sc->flags |= ADAP_ERR;
                ADAPTER_UNLOCK(sc);
        }
+
+       if (t4_panic_on_fatal_err) {
+               log(LOG_ALERT, "%s: panic on fatal error after 30s",
+                   device_get_nameunit(sc->dev));
+               callout_reset(&fatal_callout, hz * 30, delayed_panic, sc);
+       }
 }
 
 void
@@ -10685,6 +10698,7 @@ mod_event(module_t mod, int cmd, void *arg)
                            do_smt_write_rpl);
                        sx_init(&t4_list_lock, "T4/T5 adapters");
                        SLIST_INIT(&t4_list);
+                       callout_init(&fatal_callout, 1);
 #ifdef TCP_OFFLOAD
                        sx_init(&t4_uld_list_lock, "T4/T5 ULDs");
                        SLIST_INIT(&t4_uld_list);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to