diff options
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | contrib/sendmail/src/newaliases.1 | 2 | ||||
-rw-r--r-- | sbin/ipf/libipf/printdstl_live.c | 3 | ||||
-rw-r--r-- | sbin/ipf/libipf/printdstlist.c | 2 | ||||
-rw-r--r-- | sbin/ipf/libipf/printdstlistdata.c | 5 | ||||
-rw-r--r-- | sys/x86/include/mca.h | 25 | ||||
-rw-r--r-- | sys/x86/x86/mca.c | 88 | ||||
-rw-r--r-- | usr.bin/sockstat/sockstat.1 | 11 | ||||
-rw-r--r-- | usr.bin/sockstat/sockstat.c | 54 |
9 files changed, 175 insertions, 20 deletions
@@ -179,7 +179,7 @@ TGTS= all all-man buildenv buildenvvars buildetc buildkernel buildworld \ create-packages-world create-packages-kernel \ create-packages-kernel-repo create-packages-world-repo \ create-packages-source create-packages \ - update-packages packages installconfig real-packages real-update-packages \ + installconfig real-packages real-update-packages \ sign-packages package-pkg print-dir test-system-compiler test-system-linker \ test-includes @@ -529,6 +529,9 @@ kernels: .PHONY worlds: .PHONY @cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe +packages update-packages: .PHONY + ${_+_}@cd ${.CURDIR}; ${_MAKE} DISTDIR=/ ${.TARGET} + # # universe # diff --git a/contrib/sendmail/src/newaliases.1 b/contrib/sendmail/src/newaliases.1 index 59dc0de20cf7..cdb6eef67416 100644 --- a/contrib/sendmail/src/newaliases.1 +++ b/contrib/sendmail/src/newaliases.1 @@ -14,7 +14,7 @@ .TH NEWALIASES 1 "$Date: 2013-11-22 20:51:56 $" .SH NAME newaliases -\- rebuild the data base for the mail aliases file +\- rebuild the data base for the sendmail aliases file .SH SYNOPSIS .B newaliases .SH DESCRIPTION diff --git a/sbin/ipf/libipf/printdstl_live.c b/sbin/ipf/libipf/printdstl_live.c index 088448e6656d..72cb75a832c9 100644 --- a/sbin/ipf/libipf/printdstl_live.c +++ b/sbin/ipf/libipf/printdstl_live.c @@ -40,6 +40,9 @@ printdstl_live( ippool_dst_t *d, int fd, char *name, int opts, if ((d->ipld_flags & IPHASH_DELETE) != 0) PRINTF("# "); + if (opts & OPT_SAVEOUT) + PRINTF("{\n"); + if ((opts & OPT_DEBUG) == 0) PRINTF("\t{"); diff --git a/sbin/ipf/libipf/printdstlist.c b/sbin/ipf/libipf/printdstlist.c index 2cf41ffe414c..497d7004c94c 100644 --- a/sbin/ipf/libipf/printdstlist.c +++ b/sbin/ipf/libipf/printdstlist.c @@ -42,6 +42,8 @@ printdstlist( ippool_dst_t *pp, copyfunc_t copyfunc, char *name, int opts, return (NULL); } + if (opts & OPT_SAVEOUT) + PRINTF("\t"); node = printdstlistnode(n, bcopywrap, opts, fields); free(n); diff --git a/sbin/ipf/libipf/printdstlistdata.c b/sbin/ipf/libipf/printdstlistdata.c index 7940d2ae021b..546bf35cabf6 100644 --- a/sbin/ipf/libipf/printdstlistdata.c +++ b/sbin/ipf/libipf/printdstlistdata.c @@ -11,8 +11,7 @@ void printdstlistdata( ippool_dst_t *pool, int opts) { - - if ((opts & OPT_DEBUG) == 0) { + if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) { if ((pool->ipld_flags & IPDST_DELETE) != 0) PRINTF("# "); PRINTF("pool "); @@ -24,7 +23,7 @@ printdstlistdata( ippool_dst_t *pool, int opts) printunit(pool->ipld_unit); - if ((opts & OPT_DEBUG) == 0) { + if ((opts & OPT_DEBUG) == 0 || opts & OPT_SAVEOUT) { PRINTF("/dstlist (name %s;", pool->ipld_name); if (pool->ipld_policy != IPLDP_NONE) { PRINTF(" policy "); diff --git a/sys/x86/include/mca.h b/sys/x86/include/mca.h index 183480625f6d..553b5d765f17 100644 --- a/sys/x86/include/mca.h +++ b/sys/x86/include/mca.h @@ -44,6 +44,31 @@ struct mca_record { int mr_cpu; }; +enum mca_stat_types { + MCA_T_NONE = 0, + MCA_T_UNCLASSIFIED, + MCA_T_UCODE_ROM_PARITY, + MCA_T_EXTERNAL, + MCA_T_FRC, + MCA_T_INTERNAL_PARITY, + MCA_T_SMM_HANDLER, + MCA_T_INTERNAL_TIMER, + MCA_T_GENERIC_IO, + MCA_T_INTERNAL, + MCA_T_MEMORY, + MCA_T_TLB, + MCA_T_MEMCONTROLLER_GEN, + MCA_T_MEMCONTROLLER_RD, + MCA_T_MEMCONTROLLER_WR, + MCA_T_MEMCONTROLLER_AC, + MCA_T_MEMCONTROLLER_MS, + MCA_T_MEMCONTROLLER_OTHER, + MCA_T_CACHE, + MCA_T_BUS, + MCA_T_UNKNOWN, + MCA_T_COUNT /* Must stay last */ +}; + #ifdef _KERNEL void cmc_intr(void); diff --git a/sys/x86/x86/mca.c b/sys/x86/x86/mca.c index 4ba49469d3a2..e43c88b3a27b 100644 --- a/sys/x86/x86/mca.c +++ b/sys/x86/x86/mca.c @@ -131,8 +131,16 @@ static STAILQ_HEAD(, mca_internal) mca_pending; static int mca_ticks = 300; static struct taskqueue *mca_tq; static struct task mca_resize_task; +static struct task mca_postscan_task; static struct timeout_task mca_scan_task; static struct mtx mca_lock; +static bool mca_startup_done = false; + +/* Statistics on number of MCA events by type, updated atomically. */ +static uint64_t mca_stats[MCA_T_COUNT]; +SYSCTL_OPAQUE(_hw_mca, OID_AUTO, stats, CTLFLAG_RD | CTLFLAG_SKIP, + mca_stats, MCA_T_COUNT * sizeof(mca_stats[0]), + "S", "Array of MCA events by type"); static unsigned int mca_ia32_ctl_reg(int bank) @@ -356,21 +364,27 @@ mca_error_request(uint16_t mca_error) } static const char * -mca_error_mmtype(uint16_t mca_error) +mca_error_mmtype(uint16_t mca_error, enum mca_stat_types *event_type) { switch ((mca_error & 0x70) >> 4) { case 0x0: + *event_type = MCA_T_MEMCONTROLLER_GEN; return ("GEN"); case 0x1: + *event_type = MCA_T_MEMCONTROLLER_RD; return ("RD"); case 0x2: + *event_type = MCA_T_MEMCONTROLLER_WR; return ("WR"); case 0x3: + *event_type = MCA_T_MEMCONTROLLER_AC; return ("AC"); case 0x4: + *event_type = MCA_T_MEMCONTROLLER_MS; return ("MS"); } + *event_type = MCA_T_MEMCONTROLLER_OTHER; return ("???"); } @@ -426,6 +440,7 @@ static void mca_log(const struct mca_record *rec) { uint16_t mca_error; + enum mca_stat_types event_type; if (mca_mute(rec)) return; @@ -473,34 +488,44 @@ mca_log(const struct mca_record *rec) if (rec->mr_status & MC_STATUS_OVER) printf("OVER "); mca_error = rec->mr_status & MC_STATUS_MCA_ERROR; + event_type = MCA_T_COUNT; switch (mca_error) { /* Simple error codes. */ case 0x0000: printf("no error"); + event_type = MCA_T_NONE; break; case 0x0001: printf("unclassified error"); + event_type = MCA_T_UNCLASSIFIED; break; case 0x0002: printf("ucode ROM parity error"); + event_type = MCA_T_UCODE_ROM_PARITY; break; case 0x0003: printf("external error"); + event_type = MCA_T_EXTERNAL; break; case 0x0004: printf("FRC error"); + event_type = MCA_T_FRC; break; case 0x0005: printf("internal parity error"); + event_type = MCA_T_INTERNAL_PARITY; break; case 0x0006: printf("SMM handler code access violation"); + event_type = MCA_T_SMM_HANDLER; break; case 0x0400: printf("internal timer error"); + event_type = MCA_T_INTERNAL_TIMER; break; case 0x0e0b: printf("generic I/O error"); + event_type = MCA_T_GENERIC_IO; if (rec->mr_cpu_vendor_id == CPU_VENDOR_INTEL && (rec->mr_status & MC_STATUS_MISCV)) { printf(" (pci%d:%d:%d:%d)", @@ -513,6 +538,7 @@ mca_log(const struct mca_record *rec) default: if ((mca_error & 0xfc00) == 0x0400) { printf("internal error %x", mca_error & 0x03ff); + event_type = MCA_T_INTERNAL; break; } @@ -521,6 +547,7 @@ mca_log(const struct mca_record *rec) /* Memory hierarchy error. */ if ((mca_error & 0xeffc) == 0x000c) { printf("%s memory error", mca_error_level(mca_error)); + event_type = MCA_T_MEMORY; break; } @@ -528,12 +555,14 @@ mca_log(const struct mca_record *rec) if ((mca_error & 0xeff0) == 0x0010) { printf("%sTLB %s error", mca_error_ttype(mca_error), mca_error_level(mca_error)); + event_type = MCA_T_TLB; break; } /* Memory controller error. */ if ((mca_error & 0xef80) == 0x0080) { - printf("%s channel ", mca_error_mmtype(mca_error)); + printf("%s channel ", mca_error_mmtype(mca_error, + &event_type)); if ((mca_error & 0x000f) != 0x000f) printf("%d", mca_error & 0x000f); else @@ -548,12 +577,14 @@ mca_log(const struct mca_record *rec) mca_error_ttype(mca_error), mca_error_level(mca_error), mca_error_request(mca_error)); + event_type = MCA_T_CACHE; break; } /* Extended memory error. */ if ((mca_error & 0xef80) == 0x0280) { - printf("%s channel ", mca_error_mmtype(mca_error)); + printf("%s channel ", mca_error_mmtype(mca_error, + &event_type)); if ((mca_error & 0x000f) != 0x000f) printf("%d", mca_error & 0x000f); else @@ -565,6 +596,7 @@ mca_log(const struct mca_record *rec) /* Bus and/or Interconnect error. */ if ((mca_error & 0xe800) == 0x0800) { printf("BUS%s ", mca_error_level(mca_error)); + event_type = MCA_T_BUS; switch ((mca_error & 0x0600) >> 9) { case 0: printf("Source"); @@ -600,6 +632,7 @@ mca_log(const struct mca_record *rec) } printf("unknown error %x", mca_error); + event_type = MCA_T_UNKNOWN; break; } printf("\n"); @@ -615,6 +648,12 @@ mca_log(const struct mca_record *rec) } if (rec->mr_status & MC_STATUS_MISCV) printf("MCA: Misc 0x%llx\n", (long long)rec->mr_misc); + if (event_type < 0 || event_type >= MCA_T_COUNT) { + KASSERT(0, ("%s: invalid event type (%d)", __func__, + event_type)); + event_type = MCA_T_UNKNOWN; + } + atomic_add_64(&mca_stats[event_type], 1); } static bool @@ -979,6 +1018,16 @@ mca_process_records(enum scan_mode mode) { struct mca_internal *mca; + /* + * If in an interrupt context, defer the post-scan activities to a + * task queue. + */ + if (mode != POLLED) { + if (mca_startup_done) + taskqueue_enqueue(mca_tq, &mca_postscan_task); + return; + } + mtx_lock_spin(&mca_lock); while ((mca = STAILQ_FIRST(&mca_pending)) != NULL) { STAILQ_REMOVE_HEAD(&mca_pending, link); @@ -986,10 +1035,19 @@ mca_process_records(enum scan_mode mode) mca_store_record(mca); } mtx_unlock_spin(&mca_lock); - if (mode == POLLED) - mca_resize_freelist(); - else if (!cold) - taskqueue_enqueue(mca_tq, &mca_resize_task); + mca_resize_freelist(); +} + +/* + * Emit log entries and resize the free list. This is intended to be called + * from a task queue to handle work which does not need to be done (or cannot + * be done) in an interrupt context. + */ +static void +mca_postscan(void *context __unused, int pending __unused) +{ + + mca_process_records(POLLED); } /* @@ -1060,7 +1118,7 @@ sysctl_mca_maxcount(SYSCTL_HANDLER_ARGS) doresize = true; } mtx_unlock_spin(&mca_lock); - if (doresize && !cold) + if (doresize && mca_startup_done) taskqueue_enqueue(mca_tq, &mca_resize_task); return (error); } @@ -1072,12 +1130,16 @@ mca_startup(void *dummy) if (mca_banks <= 0) return; - /* CMCIs during boot may have claimed items from the freelist. */ - mca_resize_freelist(); - taskqueue_start_threads(&mca_tq, 1, PI_SWI(SWI_TQ), "mca taskq"); taskqueue_enqueue_timeout_sbt(mca_tq, &mca_scan_task, mca_ticks * SBT_1S, 0, C_PREL(1)); + mca_startup_done = true; + + /* + * CMCIs during boot may have recorded entries. Conduct the post-scan + * activities now. + */ + mca_postscan(NULL, 0); } SYSINIT(mca_startup, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, mca_startup, NULL); @@ -1137,6 +1199,7 @@ mca_setup(uint64_t mcg_cap) TIMEOUT_TASK_INIT(mca_tq, &mca_scan_task, 0, mca_scan_cpus, NULL); STAILQ_INIT(&mca_freelist); TASK_INIT(&mca_resize_task, 0, mca_resize, NULL); + TASK_INIT(&mca_postscan_task, 0, mca_postscan, NULL); mca_resize_freelist(); SYSCTL_ADD_INT(NULL, SYSCTL_STATIC_CHILDREN(_hw_mca), OID_AUTO, "count", CTLFLAG_RD, (int *)(uintptr_t)&mca_count, 0, @@ -1540,6 +1603,9 @@ mca_intr(void) panic("Unrecoverable machine check exception"); } + if (count) + mca_process_records(MCE); + /* Clear MCIP. */ wrmsr(MSR_MCG_STATUS, mcg_status & ~MCG_STATUS_MCIP); } diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1 index ca486a088b13..eba4b1c4aed5 100644 --- a/usr.bin/sockstat/sockstat.1 +++ b/usr.bin/sockstat/sockstat.1 @@ -25,7 +25,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 15, 2024 +.Dd October 7, 2025 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -33,7 +33,7 @@ .Nd list open sockets .Sh SYNOPSIS .Nm -.Op Fl 46CcfIiLlnqSsUuvw +.Op Fl 46bCcfIiLlnqSsUuvw .Op Fl j Ar jail .Op Fl p Ar ports .Op Fl P Ar protocols @@ -54,6 +54,9 @@ Show Show .Dv AF_INET6 (IPv6) sockets. +.It Fl b +Show the BBLog state of the socket. +This is currently only implemented for TCP. .It Fl C Display the congestion control module, if applicable. This is currently only implemented for TCP. @@ -195,6 +198,10 @@ is specified (only for SCTP). The connection state if .Fl s is specified (only for SCTP or TCP). +.It Li BBLOG STATE +The BBLog state if +.Fl b +is specified (only for TCP). .It Li STACK The protocol stack if .Fl S diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index 11434a6efa68..4548eb8a0b11 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -52,6 +52,7 @@ #include <netinet/tcp_fsm.h> #include <netinet/tcp_seq.h> #include <netinet/tcp_var.h> +#include <netinet/tcp_log_buf.h> #include <arpa/inet.h> #include <capsicum_helpers.h> @@ -81,6 +82,7 @@ static int opt_4; /* Show IPv4 sockets */ static int opt_6; /* Show IPv6 sockets */ +static bool opt_b; /* Show BBLog state */ static int opt_C; /* Show congestion control */ static int opt_c; /* Show connected sockets */ static int opt_f; /* Show FIB numbers */ @@ -143,6 +145,7 @@ struct sock { int proto; int state; int fibnum; + int bblog_state; const char *protoname; char stack[TCP_FUNCTION_NAME_LEN_MAX]; char cc[TCP_CA_NAME_MAX]; @@ -797,6 +800,7 @@ gather_inet(int proto) sock->vflag = xip->inp_vflag; if (proto == IPPROTO_TCP) { sock->state = xtp->t_state; + sock->bblog_state = xtp->t_logstate; memcpy(sock->stack, xtp->xt_stack, TCP_FUNCTION_NAME_LEN_MAX); memcpy(sock->cc, xtp->xt_cc, TCP_CA_NAME_MAX); @@ -1105,6 +1109,37 @@ sctp_path_state(int state) } } +static const char * +bblog_state(int state) +{ + switch (state) { + case TCP_LOG_STATE_OFF: + return "OFF"; + break; + case TCP_LOG_STATE_TAIL: + return "TAIL"; + break; + case TCP_LOG_STATE_HEAD: + return "HEAD"; + break; + case TCP_LOG_STATE_HEAD_AUTO: + return "HEAD_AUTO"; + break; + case TCP_LOG_STATE_CONTINUAL: + return "CONTINUAL"; + break; + case TCP_LOG_STATE_TAIL_AUTO: + return "TAIL_AUTO"; + break; + case TCP_LOG_VIA_BBPOINTS: + return "BBPOINTS"; + break; + default: + return "UNKNOWN"; + break; + } +} + static void displaysock(struct sock *s, int pos) { @@ -1299,6 +1334,16 @@ displaysock(struct sock *s, int pos) } offset += 13; } + if (opt_b) { + if (s->proto == IPPROTO_TCP) { + do + pos += xprintf(" "); + while (pos < offset); + pos += xprintf("%s", + bblog_state(s->bblog_state)); + } + offset += 13; + } if (opt_S) { if (s->proto == IPPROTO_TCP) { do @@ -1359,6 +1404,8 @@ display(void) printf(" %-12s", "PATH STATE"); printf(" %-12s", "CONN STATE"); } + if (opt_b) + printf(" %-12s", "BBLOG STATE"); if (opt_S) printf(" %-*.*s", TCP_FUNCTION_NAME_LEN_MAX, TCP_FUNCTION_NAME_LEN_MAX, "STACK"); @@ -1477,7 +1524,7 @@ static void usage(void) { errx(1, - "usage: sockstat [-46CcfIiLlnqSsUuvw] [-j jid] [-p ports] [-P protocols]"); + "usage: sockstat [-46bCcfIiLlnqSsUuvw] [-j jid] [-p ports] [-P protocols]"); } int @@ -1491,7 +1538,7 @@ main(int argc, char *argv[]) int o, i; opt_j = -1; - while ((o = getopt(argc, argv, "46CcfIij:Llnp:P:qSsUuvw")) != -1) + while ((o = getopt(argc, argv, "46bCcfIij:Llnp:P:qSsUuvw")) != -1) switch (o) { case '4': opt_4 = 1; @@ -1499,6 +1546,9 @@ main(int argc, char *argv[]) case '6': opt_6 = 1; break; + case 'b': + opt_b = true; + break; case 'C': opt_C = 1; break; |