Hi,
I want to schedule timeouts more lazily from softclock() in order to
spend less time processing timeouts that will be cancelled and avoid
double-processing timeouts that will fire at the next softclock()
anyway.
This means introducing an additional timeout queue, probably named
"timeout_new", and appending timeouts to that queue from
timeout_add(9) instead of appending them to "timeout_todo" as we do
today.
However, before I do that, I need to make sure I'm not breaking
drivers that rely on the ability to spin the softclock():
There are a handful of timeouts in the tree that set a timeout of zero
ticks. Currently these will fire *immediately* if they are added
during an ongoing softclock(). I hope that these are just typos, but
I need to be sure.
Here's a first batch of conversions: rx refill timeouts for bnxt(4),
myx(4), and vr(4). All of these can run during a softclock(). Will
changing these to one tick break these drivers?
If not, ok?
Index: pci/if_myx.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_myx.c,v
retrieving revision 1.108
diff -u -p -r1.108 if_myx.c
--- pci/if_myx.c 3 Jul 2019 10:34:59 -0000 1.108
+++ pci/if_myx.c 16 Jan 2020 17:37:58 -0000
@@ -1792,7 +1792,7 @@ myx_rxeof(struct myx_softc *sc)
if_rxr_put(&mrr->mrr_rxr, rxfree[ring]);
myx_rx_fill(sc, mrr);
if (mrr->mrr_prod == mrr->mrr_cons)
- timeout_add(&mrr->mrr_refill, 0);
+ timeout_add(&mrr->mrr_refill, 1);
}
}
Index: pci/if_bnxt.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bnxt.c,v
retrieving revision 1.21
diff -u -p -r1.21 if_bnxt.c
--- pci/if_bnxt.c 3 Sep 2019 09:00:44 -0000 1.21
+++ pci/if_bnxt.c 16 Jan 2020 17:37:58 -0000
@@ -1306,7 +1306,7 @@ bnxt_intr(void *xsc)
bnxt_rx_fill(sc);
if ((sc->sc_rx_cons == sc->sc_rx_prod) ||
(sc->sc_rx_ag_cons == sc->sc_rx_ag_prod))
- timeout_add(&sc->sc_rx_refill, 0);
+ timeout_add(&sc->sc_rx_refill, 1);
if_input(&sc->sc_ac.ac_if, &ml);
}
Index: pci/if_vr.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_vr.c,v
retrieving revision 1.153
diff -u -p -r1.153 if_vr.c
--- pci/if_vr.c 22 Jan 2017 10:17:38 -0000 1.153
+++ pci/if_vr.c 16 Jan 2020 17:37:58 -0000
@@ -807,7 +807,7 @@ vr_fill_rx_ring(struct vr_softc *sc)
if_rxr_put(&sc->sc_rxring, slots);
if (if_rxr_inuse(&sc->sc_rxring) == 0)
- timeout_add(&sc->sc_rxto, 0);
+ timeout_add(&sc->sc_rxto, 1);
}
/*