From owner-svn-src-all@freebsd.org Tue Oct 30 14:54:16 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C639F10EABAA; Tue, 30 Oct 2018 14:54:16 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7895669D87; Tue, 30 Oct 2018 14:54:16 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 403261EE8C; Tue, 30 Oct 2018 14:54:16 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9UEsGQ9098000; Tue, 30 Oct 2018 14:54:16 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9UEsGeB097999; Tue, 30 Oct 2018 14:54:16 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201810301454.w9UEsGeB097999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 30 Oct 2018 14:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339917 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 339917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 14:54:16 -0000 Author: vangyzen Date: Tue Oct 30 14:54:15 2018 New Revision: 339917 URL: https://svnweb.freebsd.org/changeset/base/339917 Log: Always stop the scheduler when entering kdb Set curthread->td_stopsched when entering kdb via any vector. Previously, it was only set when entering via panic, so when entering kdb another way, mutexes and such were still "live", and an attempt to lock an already locked mutex would panic. Reviewed by: kib, cem Discussed with: jhb Tested by: pho MFC after: 2 months Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D17687 Modified: head/sys/kern/subr_kdb.c Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Tue Oct 30 14:44:12 2018 (r339916) +++ head/sys/kern/subr_kdb.c Tue Oct 30 14:54:15 2018 (r339917) @@ -652,9 +652,7 @@ kdb_trap(int type, int code, struct trapframe *tf) struct kdb_dbbe *be; register_t intr; int handled; -#ifdef SMP int did_stop_cpus; -#endif be = kdb_dbbe; if (be == NULL || be->dbbe_trap == NULL) @@ -666,16 +664,17 @@ kdb_trap(int type, int code, struct trapframe *tf) intr = intr_disable(); -#ifdef SMP if (!SCHEDULER_STOPPED()) { +#ifdef SMP other_cpus = all_cpus; CPU_NAND(&other_cpus, &stopped_cpus); CPU_CLR(PCPU_GET(cpuid), &other_cpus); stop_cpus_hard(other_cpus); +#endif + curthread->td_stopsched = 1; did_stop_cpus = 1; } else did_stop_cpus = 0; -#endif kdb_active++; @@ -703,12 +702,13 @@ kdb_trap(int type, int code, struct trapframe *tf) kdb_active--; -#ifdef SMP if (did_stop_cpus) { + curthread->td_stopsched = 0; +#ifdef SMP CPU_AND(&other_cpus, &stopped_cpus); restart_cpus(other_cpus); - } #endif + } intr_restore(intr);