From nobody Fri Nov 29 21:39:28 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y0RQm5cT9z5flPR; Fri, 29 Nov 2024 21:39:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y0RQm423Gz44b3; Fri, 29 Nov 2024 21:39:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732916368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yw5F9U3HNOK6wI9bdEe7mBI+SyMNpoa7StELVqd0c/U=; b=i7WMjkg0fKHg/ywOH5czNPht0fw4lFQ7BtvUgv5FFBRbq0Mo9R0jpL5+b9Ykw33tSJdd+V P3T+1IfxLu6ySmqy2GKGL89ERTvbRvbK6Xaba/YgAbjgrt9Y8HzqMzQWW6cT/BH9kF4gZd 14uiYG5nMAnSiATnXOVHsNrM4gmo4AsmsvTybVjMUoCAubcy9StFT/XDjCqwh4CdLEDXcz jmlmXOjv9079SU+tXa71THUPBdpg1xCrJ7jlE1P4lkQxdxoNjOAy8kB8Ec1S7CfFhZlFrI neoWezrxiDUTwk6MdoqHFMc/DZv2MpG2GaK/5iLJf8m73xUkqLqd/QioLt7TMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732916368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yw5F9U3HNOK6wI9bdEe7mBI+SyMNpoa7StELVqd0c/U=; b=JsqlemjAkSmpS0BX5doj576Vd/ZMXhjMPf1Uaodpj9iUsm2laSgnRKwEmvh/RHuPoLc27N l6+IZxFDOw92mwxEMaUx4zK8EE3p+xcqNV047FAdr+Ua2llJ8K+FDU/n7YoYY2ENqWD8f3 oFglp5jTG27bUZc2q6rGoX6Zv2Cv1tLO+g/FHvHk1/HeGa2xQ8+/6jaQCeAtJixHSV9ZsK DtAfJnE1wE76b0nNrWLqfwXmIwA4lqZa2WP79JyDLfMx/J2F+DAx+LOtMXDgKcHTQp+KfI A+5KL/N8s2oIwkkBZtB0TMFfMXft0avrNx9WLTxnjZoUXjn+3ZntWZ9WYfKYFQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732916368; a=rsa-sha256; cv=none; b=ltLn9iA/+n81x8//BOWW95P3gLx4SgiSruhFCeiWM5+nQldqadDyiSov1BPJflYGYfxA+f N6wxOS/0gaYBw4pjeS6xOHGQCARBmJd9Sf8JvWlekv48TfBCXNIxt5oBW7poV1+m7eUtuU QNqwG8sD8DEcYgRv4XTKy8W1AmFOsOT9q28suEC0VcOpQrLzbChO2AkiFF5YjskdKCIHHh J8J1dO46VHBQJmKbKJQ/26/PRx1C3BCW/HNfJMuZCjhL2iFfLqlwT5uF6iTnv/IGtVBmEI xdX97zfm3d/XXFUqMoO9H+D1E9ArIMSavUbHtEtNn6RynIGLnLgjNpqaPHFIyg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y0RQm2LjMzghf; Fri, 29 Nov 2024 21:39:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ATLdSdg094104; Fri, 29 Nov 2024 21:39:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ATLdSkj094101; Fri, 29 Nov 2024 21:39:28 GMT (envelope-from git) Date: Fri, 29 Nov 2024 21:39:28 GMT Message-Id: <202411292139.4ATLdSkj094101@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: df79daa0fde8 - main - Reduce additional console output when muted List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df79daa0fde87ac90d4d73604b98107009c9c1bf Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=df79daa0fde87ac90d4d73604b98107009c9c1bf commit df79daa0fde87ac90d4d73604b98107009c9c1bf Author: Craig Woodward AuthorDate: 2024-09-03 18:42:50 +0000 Commit: Warner Losh CommitDate: 2024-11-29 21:38:36 +0000 Reduce additional console output when muted While trying to resolve some custom installer issues, we found that using conscontrol(8) or setting kern.always_console_output=0 in sysctrl.conf(5) did not always prevent console output. This is in part because some areas of the kernel were outputting to the console device without checking the status of the setting. These changes enforce checking of the value in both locations where console output occurs from kernel and init(8) based callouts. Details on changes: - Moves check for mute to earlier in sequence to silence kernel output even if EARLY_PRINTF is defined. - Modifies call prf_putbuf() and prf_putchar() in subr_prf.c to strip TOCONS flag if muting is enabled, to honor the setting at print level. This is a rather simple change, which increases areas where flags to silence console output are honored. We have been running this change since 10/23 in-house without issue. (Patching prior to 14.0 also required making cn_mute non-static.) Signed-off-by: Craig.Woodward@redcom.com Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1407 --- sys/kern/kern_cons.c | 5 +++-- sys/kern/subr_prf.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c index 2ab86d5905a9..fbe52735cf86 100644 --- a/sys/kern/kern_cons.c +++ b/sys/kern/kern_cons.c @@ -525,6 +525,9 @@ cnputc(int c) struct consdev *cn; const char *cp; + if (cn_mute || c == '\0') + return; + #ifdef EARLY_PRINTF if (early_putc != NULL) { if (c == '\n') @@ -534,8 +537,6 @@ cnputc(int c) } #endif - if (cn_mute || c == '\0') - return; STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { cn = cnd->cnd_cn; if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG)) { diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 8ecabdec18d5..5cfc92e9761a 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -112,6 +112,7 @@ struct snprintf_arg { }; extern int log_open; +extern int cn_mute; static void msglogchar(int c, int pri); static void msglogstr(char *str, int pri, int filter_cr); @@ -425,7 +426,7 @@ prf_putchar(int c, int flags, int pri) msgbuftrigger = 1; } - if (flags & TOCONS) { + if ((flags & TOCONS) && !cn_mute) { if ((!KERNEL_PANICKED()) && (constty != NULL)) msgbuf_addchar(&consmsgbuf, c); @@ -443,7 +444,7 @@ prf_putbuf(char *bufr, int flags, int pri) msgbuftrigger = 1; } - if (flags & TOCONS) { + if ((flags & TOCONS) && !cn_mute) { if ((!KERNEL_PANICKED()) && (constty != NULL)) msgbuf_addstr(&consmsgbuf, -1, bufr, /*filter_cr*/ 0); @@ -511,6 +512,11 @@ putchar(int c, void *arg) if ((flags & TOTTY) && tp != NULL && !KERNEL_PANICKED()) tty_putchar(tp, c); + if ((flags & TOCONS ) && cn_mute) { + flags &= ~TOCONS; + ap->flags = flags; + } + if ((flags & (TOCONS | TOLOG)) && c != '\0') putbuf(c, ap); }