Commit 69a1fbc6 authored by HardenedBSD Sync Service's avatar HardenedBSD Sync Service
Browse files

Merge branch 'freebsd/current/main' into hardened/current/master

parents 3bc428ad 90bc1cf6
...@@ -349,7 +349,7 @@ tws_detach(device_t dev) ...@@ -349,7 +349,7 @@ tws_detach(device_t dev)
{ {
struct tws_softc *sc = device_get_softc(dev); struct tws_softc *sc = device_get_softc(dev);
int i; int i;
u_int32_t reg __diagused; u_int32_t reg __tws_debug;
TWS_TRACE_DEBUG(sc, "entry", 0, 0); TWS_TRACE_DEBUG(sc, "entry", 0, 0);
......
...@@ -82,7 +82,7 @@ void tws_display_ctlr_info(struct tws_softc *sc); ...@@ -82,7 +82,7 @@ void tws_display_ctlr_info(struct tws_softc *sc);
int int
tws_init_ctlr(struct tws_softc *sc) tws_init_ctlr(struct tws_softc *sc)
{ {
u_int64_t reg __diagused; u_int64_t reg __tws_debug;
u_int32_t regh, regl; u_int32_t regh, regl;
TWS_TRACE_DEBUG(sc, "entry", sc, sc->is64bit); TWS_TRACE_DEBUG(sc, "entry", sc, sc->is64bit);
......
...@@ -61,10 +61,12 @@ void tws_init_qs(struct tws_softc *sc); ...@@ -61,10 +61,12 @@ void tws_init_qs(struct tws_softc *sc);
#endif #endif
#ifdef TWS_TRACE_DEBUG_ON #ifdef TWS_TRACE_DEBUG_ON
#define __tws_debug
#define TWS_TRACE_DEBUG(sc, desc, val1, val2) \ #define TWS_TRACE_DEBUG(sc, desc, val1, val2) \
tws_trace(__FILE__, __func__, __LINE__, sc, desc, \ tws_trace(__FILE__, __func__, __LINE__, sc, desc, \
(u_int64_t)val1, (u_int64_t)val2) (u_int64_t)val1, (u_int64_t)val2)
#else #else
#define __tws_debug __unused
#define TWS_TRACE_DEBUG(sc, desc, val1, val2) #define TWS_TRACE_DEBUG(sc, desc, val1, val2)
#endif #endif
......
...@@ -239,13 +239,14 @@ getnextcpuevent(int idle) ...@@ -239,13 +239,14 @@ getnextcpuevent(int idle)
/* Handle hardclock() events, skipping some if CPU is idle. */ /* Handle hardclock() events, skipping some if CPU is idle. */
event = state->nexthard; event = state->nexthard;
if (idle) { if (idle) {
hardfreq = (u_int)hz / 2; if (tc_min_ticktock_freq > 1
if (tc_min_ticktock_freq > 2
#ifdef SMP #ifdef SMP
&& curcpu == CPU_FIRST() && curcpu == CPU_FIRST()
#endif #endif
) )
hardfreq = hz / tc_min_ticktock_freq; hardfreq = hz / tc_min_ticktock_freq;
else
hardfreq = hz;
if (hardfreq > 1) if (hardfreq > 1)
event += tick_sbt * (hardfreq - 1); event += tick_sbt * (hardfreq - 1);
} }
......
...@@ -434,8 +434,7 @@ callout_process(sbintime_t now) ...@@ -434,8 +434,7 @@ callout_process(sbintime_t now)
struct callout_cpu *cc; struct callout_cpu *cc;
struct callout_list *sc; struct callout_list *sc;
struct thread *td; struct thread *td;
sbintime_t first, last, max, tmp_max; sbintime_t first, last, lookahead, max, tmp_max;
uint32_t lookahead;
u_int firstb, lastb, nowb; u_int firstb, lastb, nowb;
#ifdef CALLOUT_PROFILING #ifdef CALLOUT_PROFILING
int depth_dir = 0, mpcalls_dir = 0, lockcalls_dir = 0; int depth_dir = 0, mpcalls_dir = 0, lockcalls_dir = 0;
...@@ -455,7 +454,7 @@ callout_process(sbintime_t now) ...@@ -455,7 +454,7 @@ callout_process(sbintime_t now)
else if (nowb - firstb == 1) else if (nowb - firstb == 1)
lookahead = (SBT_1S / 8); lookahead = (SBT_1S / 8);
else else
lookahead = (SBT_1S / 2); lookahead = SBT_1S;
first = last = now; first = last = now;
first += (lookahead / 2); first += (lookahead / 2);
last += lookahead; last += lookahead;
......
...@@ -337,7 +337,6 @@ struct iflib_txq { ...@@ -337,7 +337,6 @@ struct iflib_txq {
uint64_t ift_map_failed; uint64_t ift_map_failed;
uint64_t ift_txd_encap_efbig; uint64_t ift_txd_encap_efbig;
uint64_t ift_pullups; uint64_t ift_pullups;
uint64_t ift_last_timer_tick;
struct mtx ift_mtx; struct mtx ift_mtx;
struct mtx ift_db_mtx; struct mtx ift_db_mtx;
...@@ -587,9 +586,9 @@ SYSCTL_INT(_net_iflib, OID_AUTO, min_tx_latency, CTLFLAG_RW, ...@@ -587,9 +586,9 @@ SYSCTL_INT(_net_iflib, OID_AUTO, min_tx_latency, CTLFLAG_RW,
static int iflib_no_tx_batch = 0; static int iflib_no_tx_batch = 0;
SYSCTL_INT(_net_iflib, OID_AUTO, no_tx_batch, CTLFLAG_RW, SYSCTL_INT(_net_iflib, OID_AUTO, no_tx_batch, CTLFLAG_RW,
&iflib_no_tx_batch, 0, "minimize transmit latency at the possible expense of throughput"); &iflib_no_tx_batch, 0, "minimize transmit latency at the possible expense of throughput");
static int iflib_timer_default = 1000; static int iflib_timer_period = 500;
SYSCTL_INT(_net_iflib, OID_AUTO, timer_default, CTLFLAG_RW, SYSCTL_INT(_net_iflib, OID_AUTO, timer_period, CTLFLAG_RW,
&iflib_timer_default, 0, "number of ticks between iflib_timer calls"); &iflib_timer_period, 0, "milliseconds between iflib_timer calls");
#if IFLIB_DEBUG_COUNTERS #if IFLIB_DEBUG_COUNTERS
...@@ -2393,7 +2392,6 @@ iflib_timer(void *arg) ...@@ -2393,7 +2392,6 @@ iflib_timer(void *arg)
iflib_txq_t txq = arg; iflib_txq_t txq = arg;
if_ctx_t ctx = txq->ift_ctx; if_ctx_t ctx = txq->ift_ctx;
if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; if_softc_ctx_t sctx = &ctx->ifc_softc_ctx;
uint64_t this_tick = ticks;
if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING))
return; return;
...@@ -2403,30 +2401,28 @@ iflib_timer(void *arg) ...@@ -2403,30 +2401,28 @@ iflib_timer(void *arg)
** can be done without the lock because its RO ** can be done without the lock because its RO
** and the HUNG state will be static if set. ** and the HUNG state will be static if set.
*/ */
if (this_tick - txq->ift_last_timer_tick >= iflib_timer_default) { IFDI_TIMER(ctx, txq->ift_id);
txq->ift_last_timer_tick = this_tick; if ((txq->ift_qstatus == IFLIB_QUEUE_HUNG) &&
IFDI_TIMER(ctx, txq->ift_id); ((txq->ift_cleaned_prev == txq->ift_cleaned) ||
if ((txq->ift_qstatus == IFLIB_QUEUE_HUNG) && (sctx->isc_pause_frames == 0)))
((txq->ift_cleaned_prev == txq->ift_cleaned) || goto hung;
(sctx->isc_pause_frames == 0))) if (txq->ift_qstatus != IFLIB_QUEUE_IDLE &&
goto hung; ifmp_ring_is_stalled(txq->ift_br)) {
KASSERT(ctx->ifc_link_state == LINK_STATE_UP,
if (txq->ift_qstatus != IFLIB_QUEUE_IDLE && ("queue can't be marked as hung if interface is down"));
ifmp_ring_is_stalled(txq->ift_br)) { txq->ift_qstatus = IFLIB_QUEUE_HUNG;
KASSERT(ctx->ifc_link_state == LINK_STATE_UP, }
("queue can't be marked as hung if interface is down")); txq->ift_cleaned_prev = txq->ift_cleaned;
txq->ift_qstatus = IFLIB_QUEUE_HUNG;
}
txq->ift_cleaned_prev = txq->ift_cleaned;
}
/* handle any laggards */ /* handle any laggards */
if (txq->ift_db_pending) if (txq->ift_db_pending)
GROUPTASK_ENQUEUE(&txq->ift_task); GROUPTASK_ENQUEUE(&txq->ift_task);
sctx->isc_pause_frames = 0; sctx->isc_pause_frames = 0;
if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)
callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, callout_reset_sbt_on(&txq->ift_timer,
txq, txq->ift_timer.c_cpu); iflib_timer_period * SBT_1MS, 0,
iflib_timer, txq, txq->ift_timer.c_cpu, C_PREL(1));
return; return;
hung: hung:
...@@ -2544,8 +2540,9 @@ iflib_init_locked(if_ctx_t ctx) ...@@ -2544,8 +2540,9 @@ iflib_init_locked(if_ctx_t ctx)
IFDI_INTR_ENABLE(ctx); IFDI_INTR_ENABLE(ctx);
txq = ctx->ifc_txqs; txq = ctx->ifc_txqs;
for (i = 0; i < sctx->isc_ntxqsets; i++, txq++) for (i = 0; i < sctx->isc_ntxqsets; i++, txq++)
callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, callout_reset_sbt_on(&txq->ift_timer,
txq->ift_timer.c_cpu); iflib_timer_period * SBT_1MS, 0,
iflib_timer, txq, txq->ift_timer.c_cpu, C_PREL(1));
/* Re-enable txsync/rxsync. */ /* Re-enable txsync/rxsync. */
netmap_enable_all_rings(ifp); netmap_enable_all_rings(ifp);
...@@ -4067,8 +4064,9 @@ _task_fn_admin(void *context) ...@@ -4067,8 +4064,9 @@ _task_fn_admin(void *context)
} }
IFDI_UPDATE_ADMIN_STATUS(ctx); IFDI_UPDATE_ADMIN_STATUS(ctx);
for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) { for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) {
callout_reset_on(&txq->ift_timer, iflib_timer_default, iflib_timer, txq, callout_reset_sbt_on(&txq->ift_timer,
txq->ift_timer.c_cpu); iflib_timer_period * SBT_1MS, 0,
iflib_timer, txq, txq->ift_timer.c_cpu, C_PREL(1));
} }
IFDI_LINK_INTR_ENABLE(ctx); IFDI_LINK_INTR_ENABLE(ctx);
if (do_reset) if (do_reset)
...@@ -5721,7 +5719,7 @@ iflib_device_iov_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *params) ...@@ -5721,7 +5719,7 @@ iflib_device_iov_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *params)
static int static int
iflib_module_init(void) iflib_module_init(void)
{ {
iflib_timer_default = hz / 2;
return (0); return (0);
} }
......
...@@ -277,11 +277,8 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk, ...@@ -277,11 +277,8 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk,
if (fs->fs_ckhash != (ckhash = ffs_calc_sbhash(fs))) { if (fs->fs_ckhash != (ckhash = ffs_calc_sbhash(fs))) {
if (chkhash == STDSB_NOMSG) if (chkhash == STDSB_NOMSG)
return (EINTEGRITY); return (EINTEGRITY);
if (chkhash == STDSB_NOHASHFAIL_NOMSG) { if (chkhash == STDSB_NOHASHFAIL_NOMSG)
fs->fs_flags |= FS_NEEDSFSCK;
fs->fs_fmod = 1;
return (0); return (0);
}
#ifdef _KERNEL #ifdef _KERNEL
res = uprintf("Superblock check-hash failed: recorded " res = uprintf("Superblock check-hash failed: recorded "
"check-hash 0x%x != computed check-hash 0x%x%s\n", "check-hash 0x%x != computed check-hash 0x%x%s\n",
...@@ -303,8 +300,6 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk, ...@@ -303,8 +300,6 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk,
if (chkhash == STDSB) if (chkhash == STDSB)
return (EINTEGRITY); return (EINTEGRITY);
/* chkhash == STDSB_NOHASHFAIL */ /* chkhash == STDSB_NOHASHFAIL */
fs->fs_flags |= FS_NEEDSFSCK;
fs->fs_fmod = 1;
return (0); return (0);
} }
/* Have to set for old filesystems that predate this field */ /* Have to set for old filesystems that predate this field */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment