From nobody Wed Feb 22 15:14:23 2023 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 4PMKSb5NTJz3t6J5; Wed, 22 Feb 2023 15:14:23 +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 4PMKSb4s2dz3s41; Wed, 22 Feb 2023 15:14:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677078863; 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=0qr5DOxO72ivpfSPW+gnzOkv4G15Wu53KgpfLa81eR0=; b=C2occZePTqRlg0ikuP0dauGLwhA45FJri6U6yMsAnIwvhgBchOAqGz8/98oNgW0qlxFxPV cEDzUljJOUKAgN5NWcED4xglaroJD62I5suvzU9URwadZiX9IiWBv0gxhPeEc4JjHbz4xA NvUj3XGQtjV11Mm6K4s0LrOSDCMSlqqxEM64Mlxa1FkDSMgplpxr9fOtCAUKCaIheiFoVG WqKnWtUjGJyJdLyJ0xBNDZFzyKopR/OZaIyIK6+a1P4jFc0aB0CLY3oqpT1YiGvgDYshx1 u+lseV8LZu8iHCZMfyLmB3mBpbwzhmXV3he+4s7e5WGmsIdW6vKcBQtKKp9a9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677078863; 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=0qr5DOxO72ivpfSPW+gnzOkv4G15Wu53KgpfLa81eR0=; b=PmybuR/nwHtmqtowjRAKtdgBTC6fYDXyxavpKkaiOf8yaYLrdVRd/agny3df6pqe4EPzlZ E5steMOeOFklEvkqhC1OcSbNsukm7fr4NI8dD1vPAGyBurUo3qB3B4hvrMWpM9aL0Fect5 CDgy+5GbdRWmuMyG+SY/6mhNefw+wDgkFoP02dUvlgdwu1JXOPh6G3f5NdkwrhBTkEdnnS awFWp8blRvn16LdJ/SHH0UmkQoLlVlzh/rvelV6dov5Jxc32+03HYagQMSqIDvnHA2TQP8 li472YFPipcmqThtmsTNpkMYVUK6eG6Mbo/lBgoTkBDrVIxXkWY448WHFiAI/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677078863; a=rsa-sha256; cv=none; b=kYjM4aK/ULMxTgTFr9VJgTEGwfo8z1jrR84bEG5UJ2VkSktwZA67vBkQWbTfb/u9RslAGp yCU2/niNydJCSfFRFrgEN5L9Xa2VCNVWOpRcLeVPQXqJrAc9JYaOWJfFkPxKxBnQlCuLIl RoHa1oWLL69xVImxvdypjIUslo2s0HNQZV/CDF4owggpA5MjtpqsRnoN87qnXMDLvrxttT Nn5l4ZLVxXzpY5mLreTbiaJilsciyulnbJ8pSQXFuGvd+HCoRpCZfw7tRZaSSbDRUwnzEa xV72VH9EWcvkETeEvSpxiYNYCyG6FQ8X1qxM0U6YFWuUU3LUf/wDgCaF5LZ78g== 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 4PMKSb3cBYz15dW; Wed, 22 Feb 2023 15:14:23 +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 31MFENHf085231; Wed, 22 Feb 2023 15:14:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31MFENwW085230; Wed, 22 Feb 2023 15:14:23 GMT (envelope-from git) Date: Wed, 22 Feb 2023 15:14:23 GMT Message-Id: <202302221514.31MFENwW085230@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: 9a7f7c26c5b2 - main - lockmgr: upgrade panic return checks 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: 9a7f7c26c5b280924072e2d9947ad39ef4cc022c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=9a7f7c26c5b280924072e2d9947ad39ef4cc022c commit 9a7f7c26c5b280924072e2d9947ad39ef4cc022c Author: Mitchell Horne AuthorDate: 2023-02-22 15:11:15 +0000 Commit: Mitchell Horne CommitDate: 2023-02-22 15:12:22 +0000 lockmgr: upgrade panic return checks We short-circuit lockmgr functions in the face of a kernel panic. Other lock implementations do this with a SCHEDULER_STOPPED() check, which covers the additional case where the debugger is active but the system has not panicked. Update this code to match that behaviour. Reviewed by: mjg, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38655 --- sys/kern/kern_lock.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 2eb4feb7c4b5..ee34e03188a5 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -603,7 +603,7 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, #endif struct lock_delay_arg lda; - if (KERNEL_PANICKED()) + if (SCHEDULER_STOPPED()) goto out; tid = (uintptr_t)curthread; @@ -789,7 +789,7 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struct lock_object *ilk, #endif struct lock_delay_arg lda; - if (KERNEL_PANICKED()) + if (SCHEDULER_STOPPED()) goto out; tid = (uintptr_t)curthread; @@ -985,7 +985,7 @@ lockmgr_upgrade(struct lock *lk, u_int flags, struct lock_object *ilk, int error = 0; int op; - if (KERNEL_PANICKED()) + if (SCHEDULER_STOPPED()) goto out; tid = (uintptr_t)curthread; @@ -1046,7 +1046,7 @@ lockmgr_lock_flags(struct lock *lk, u_int flags, struct lock_object *ilk, u_int op; bool locked; - if (KERNEL_PANICKED()) + if (SCHEDULER_STOPPED()) return (0); op = flags & LK_TYPE_MASK; @@ -1109,7 +1109,7 @@ lockmgr_sunlock_hard(struct lock *lk, uintptr_t x, u_int flags, struct lock_obje { int wakeup_swapper = 0; - if (KERNEL_PANICKED()) + if (SCHEDULER_STOPPED()) goto out; wakeup_swapper = wakeupshlk(lk, file, line); @@ -1128,7 +1128,7 @@ lockmgr_xunlock_hard(struct lock *lk, uintptr_t x, u_int flags, struct lock_obje u_int realexslp; int queue; - if (KERNEL_PANICKED()) + if (SCHEDULER_STOPPED()) goto out; tid = (uintptr_t)curthread; @@ -1320,7 +1320,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk, int contested = 0; #endif - if (KERNEL_PANICKED()) + if (SCHEDULER_STOPPED()) return (0); error = 0; @@ -1729,7 +1729,7 @@ _lockmgr_assert(const struct lock *lk, int what, const char *file, int line) { int slocked = 0; - if (KERNEL_PANICKED()) + if (SCHEDULER_STOPPED()) return; switch (what) { case KA_SLOCKED: