From nobody Thu Jun 02 13:16:20 2022 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 3CCCE1B4EB15; Thu, 2 Jun 2022 13:16:21 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LDRNj1Dlbz4cNq; Thu, 2 Jun 2022 13:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654175781; 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=KBD2QOlpXG2Fr66MaoWLRxKuxwNFo/7EYMPXP95jleo=; b=XqsdyKEdx/MMxZY5RLwcpbGw4HJga9BgoGqqaSA9u6B2U88YhWjy0czsGj/BXQN3ZwwuRA hhtJgXkDjaxZw0aRGW0hs+BYlQ3ffHX7tLhOW8t16FAzZ1PLzFLn+FDuQrdpHuZKlnYD7D Q9H+65+SYeMceBfmREn2H6sHJpXXhFm89eN5mR+sdbi7HN5hMlw4VNdnVf6Jk+BX0C6yBU mCKUwKTTuKtj+9KpdVjRUlPiN4MQDek+CyI38tGnme7wOpj+c/wT8UovGE4EXW2rc3jMkP U014IFUe/1dEzeQJ1wuV0Hq7lCQkzuktIj1hH4m0u3aXIN4njfbIhO1Ss8Hvcw== 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 06A1A15539; Thu, 2 Jun 2022 13:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 252DGKBJ082505; Thu, 2 Jun 2022 13:16:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 252DGK8f082504; Thu, 2 Jun 2022 13:16:20 GMT (envelope-from git) Date: Thu, 2 Jun 2022 13:16:20 GMT Message-Id: <202206021316.252DGK8f082504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 35eb9b10c265 - main - Use KERNEL_PANICKED() in more places 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35eb9b10c265a27ce1f80a6eb74887240c7f4305 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654175781; 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=KBD2QOlpXG2Fr66MaoWLRxKuxwNFo/7EYMPXP95jleo=; b=y3ocRKuDFZmtl0FjHRJnb9shRUgZiPWi6rjns44ord6liDtRPijlcASdVehCTSRvx9nUSM WTfTMFhAXqNiwmVUuaJO1QmC2Oq//HBjcmkgKIXMXsFznMzGcJfve8DcDrbYRSgnXDGxev urGDOQ8r173QS7OH7msHGVeGBQV5T9D8Qc34Y6BTyQ461vj8OWZ65RXEDmC1jkEXKXI18v DrwLdtHiSoZmswo4UsBRiNfAwjIdnf8XmOLTDkTs7X1KWa0HLccb79M2xiYSaz/aL1dEtO ViPXZ7x1/jkh62VzPdq/OaHQboYnwjQQz26n4C2OI55whx29N6YwRpJOwDUTRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654175781; a=rsa-sha256; cv=none; b=on1I4tH/d3ek9OaJAOX3Ww1bEPfBfGwg8aZLeMauuXEHFZejrEBLqrbXVuxMt2B3UfhC/E 8+ptI14ix3WjEG970RSj40I+EMFEhKDyXxeID9pJwTJW8dA6NYK138l9BWEewz4ZZMYJAv 1h1a3iQ03OvNUZWSmWtSiVY+/uM0BEeZ4u6r85DWoRmY+4b9Z0qrhcEUyk3CStqJIXjWOH 2jU539Og4P5ixFi6gkhlr6hGYXaalzpct8R0UrQBT0FUP82FEpvoJ5e64JuGoz2uJ9HPCd 2iRvTd0OxohRSHETYZ/bLfjgojdEHaRQkvVItBWBJZ0LpgL1TTM3J+UHJywLyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=35eb9b10c265a27ce1f80a6eb74887240c7f4305 commit 35eb9b10c265a27ce1f80a6eb74887240c7f4305 Author: Mitchell Horne AuthorDate: 2022-06-02 13:14:41 +0000 Commit: Mitchell Horne CommitDate: 2022-06-02 13:15:43 +0000 Use KERNEL_PANICKED() in more places This is slightly more optimized than checking panicstr directly. For most of these instances performance doesn't matter, but let's make KERNEL_PANICKED() the common idiom. Reviewed by: mjg MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D35373 --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 4 ++-- sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 2 +- sys/dev/vt/vt_core.c | 3 ++- sys/kern/kern_shutdown.c | 8 ++++---- sys/kern/subr_asan.c | 2 +- sys/kern/subr_msan.c | 4 ++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index b2e7b01b125c..76aaa0920f8a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -7338,7 +7338,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, volatile uint16_t *flags; hrtime_t now; - if (panicstr != NULL) + if (KERNEL_PANICKED()) return; #ifdef illumos @@ -7369,7 +7369,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, #ifdef illumos if (panic_quiesce) { #else - if (panicstr != NULL) { + if (KERNEL_PANICKED()) { #endif /* * We don't trace anything if we're panicking. diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c index 5a8f992ce367..2e2ecf3dd228 100644 --- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c +++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c @@ -718,7 +718,7 @@ hv_storvsc_io_request(struct storvsc_softc *sc, * always uses sc->hs_chan, then we must send to that channel or a poll * timeout will occur. */ - if (panicstr) { + if (KERNEL_PANICKED()) { outgoing_channel = sc->hs_chan; } else { outgoing_channel = sc->hs_sel_chan[ch_sel]; diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 860cc0b00781..a623f50c9c06 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -593,7 +593,8 @@ vt_window_switch(struct vt_window *vw) * switch to console mode when panicking, making sure the panic * is readable (even when a GUI was using ttyv0). */ - if ((kdb_active || panicstr) && vd->vd_driver->vd_postswitch) + if ((kdb_active || KERNEL_PANICKED()) && + vd->vd_driver->vd_postswitch) vd->vd_driver->vd_postswitch(vd); VT_UNLOCK(vd); return (0); diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index c78b19ca454a..8c2ec0e42d5d 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -835,7 +835,7 @@ kassert_panic(const char *fmt, ...) * If we are suppressing secondary panics, log the warning but do not * re-enter panic/kdb. */ - if (panicstr != NULL && kassert_suppress_in_panic) { + if (KERNEL_PANICKED() && kassert_suppress_in_panic) { if (kassert_do_log) { printf("KASSERT failed: %s\n", buf); #ifdef KDB @@ -932,7 +932,7 @@ vpanic(const char *fmt, va_list ap) bootopt = RB_AUTOBOOT; newpanic = 0; - if (panicstr) + if (KERNEL_PANICKED()) bootopt |= RB_NOSYNC; else { bootopt |= RB_DUMP; @@ -1016,7 +1016,7 @@ kproc_shutdown(void *arg, int howto) struct proc *p; int error; - if (panicstr) + if (KERNEL_PANICKED()) return; p = (struct proc *)arg; @@ -1036,7 +1036,7 @@ kthread_shutdown(void *arg, int howto) struct thread *td; int error; - if (panicstr) + if (KERNEL_PANICKED()) return; td = (struct thread *)arg; diff --git a/sys/kern/subr_asan.c b/sys/kern/subr_asan.c index 19496346ce7e..003b89f888e9 100644 --- a/sys/kern/subr_asan.c +++ b/sys/kern/subr_asan.c @@ -387,7 +387,7 @@ kasan_shadow_check(unsigned long addr, size_t size, bool write, return; if (__predict_false(kasan_md_unsupported(addr))) return; - if (__predict_false(panicstr != NULL)) + if (KERNEL_PANICKED()) return; if (__builtin_constant_p(size)) { diff --git a/sys/kern/subr_msan.c b/sys/kern/subr_msan.c index 10ccc842012a..816f38fc74cb 100644 --- a/sys/kern/subr_msan.c +++ b/sys/kern/subr_msan.c @@ -178,7 +178,7 @@ kmsan_report_hook(const void *addr, size_t size, size_t off, const char *hook) char buf[128]; int type; - if (__predict_false(panicstr != NULL || kdb_active || kmsan_reporting)) + if (__predict_false(KERNEL_PANICKED() || kdb_active || kmsan_reporting)) return; kmsan_reporting = true; @@ -234,7 +234,7 @@ kmsan_report_inline(msan_orig_t orig, unsigned long pc) long foff; int type; - if (__predict_false(panicstr != NULL || kdb_active || kmsan_reporting)) + if (__predict_false(KERNEL_PANICKED() || kdb_active || kmsan_reporting)) return; kmsan_reporting = true;