From nobody Thu Jun 23 22:23:03 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 B45BA85A1AB; Thu, 23 Jun 2022 22:23:03 +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 4LTZWq4NB8z4skn; Thu, 23 Jun 2022 22:23:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656022983; 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=EJ4uEtNOpXjZRVNQRKMyQ9FC2KhP0Khh3XUWVIFj380=; b=P5rdqBSkJqnAJnI1lp29xbi1lb0FA95ODffMZOaHBNoq2mhNEjlvfLB37cCZhel9UGB2W1 a01LagLB06z0+GaCl1u7F5XpRAuS4GqGkyrLh/oRM7dtIXEciMNRaWyamJmzjLqmduIdAZ Rt4UrARp92z0NEx+PrW351IWSgJ4Vd5f2YcHLmgSfsT/b/aeWFtITBNCLV0xfgiUHO8JLD iueN0k/5KHvsklef1wgjrHzbRM1PKrBMVR8dP6dIB8N81q3vyR/u+KgUPqwPvui8IyjGH+ jZHJ0KJBDBTDn0BD4B6k7FUsIWD0hTWP4YJRSAe3sm0//NZnymN7VPKU3rtHuw== 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 76BFB23D02; Thu, 23 Jun 2022 22:23:03 +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 25NMN3Dl055013; Thu, 23 Jun 2022 22:23:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25NMN3RK055012; Thu, 23 Jun 2022 22:23:03 GMT (envelope-from git) Date: Thu, 23 Jun 2022 22:23:03 GMT Message-Id: <202206232223.25NMN3RK055012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 0db22efc9445 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0db22efc94459609b99d5289c2fecf22bda646fc Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656022983; 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=EJ4uEtNOpXjZRVNQRKMyQ9FC2KhP0Khh3XUWVIFj380=; b=fcsZYm3xdeJaczabaf5xIX/hAwrAw0F75Mokz7nFvh6zsC2ylVcCn9tbRmWiIX/GX0yU8Q spxr7o5k43n81M2vSr3rLcUCGPbG8g7MHBehB5f3Sj+C8yli0J1kJ6Z/UEcmXicUEtzD7U SvAPLwS1hzei1v0DWEFP2JjmPzb6+RnrxBVdggluU7LW9xenwaz+4onFkbEHcOBvfZ2uVF eMsQ6bc6Tha1dhjgQu3zFAsbFRnHIZM2du6qGTRpynZWbLveRQQNoh6rAtE4nHKg8ZuCXy 5nhXLvbF6Iw+NuwsT2Xzqo1PzeBFoBOaDRJiG1UsYQfiU8zKyxCbJNVDbZcQqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656022983; a=rsa-sha256; cv=none; b=AjQw6XCotuTL+PP/0BxcXAUfSvrTYCmiCa9Bnbh0B5LN2stIl8kVcYFQgW44y6Kg0+owYe wLjd0ywNooUgIdqX7eLFehLIFXWCz/f8Jgb8Tk2IyFOSA1jeVHDB3jwQKdkecxVEiXDH8q dzOa/SCydk2zVgPvOXvJf76VlYt8vvXdqE9kjrpsaKGQ1SKUSnM1ADa5vlMovyThlayx9F 06oUo8CoZulDkQRWEdi3iXJGPwcXNYZGoHnU8RoPtpiE9AYwxeio8CApHanISr5Hacvpbw 7M0BTh5n2DqIgRR3xea9rVJTgXLTaLCaB1/Ly3ZgFf6d7u/+q8FXChBxY0vpuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=0db22efc94459609b99d5289c2fecf22bda646fc commit 0db22efc94459609b99d5289c2fecf22bda646fc Author: Mitchell Horne AuthorDate: 2022-06-02 13:14:41 +0000 Commit: Mitchell Horne CommitDate: 2022-06-23 22:19:26 +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 (cherry picked from commit 35eb9b10c265a27ce1f80a6eb74887240c7f4305) --- 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 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index ca2a5438f1f1..75129eccc251 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -7335,7 +7335,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 @@ -7366,7 +7366,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 8764eaa379c9..c5be9c443456 100644 --- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c +++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c @@ -720,7 +720,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 2357b377f1e5..38fda0a501c5 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 875d5edd2d4e..c635e33e5fb2 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -780,7 +780,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 @@ -877,7 +877,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; @@ -961,7 +961,7 @@ kproc_shutdown(void *arg, int howto) struct proc *p; int error; - if (panicstr) + if (KERNEL_PANICKED()) return; p = (struct proc *)arg; @@ -981,7 +981,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 825d7d4228c0..cf7c27c9c418 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)) {