From owner-svn-src-head@freebsd.org Fri Feb 17 10:15:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7685CE28CF; Fri, 17 Feb 2017 10:15:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id 23AC6157F; Fri, 17 Feb 2017 10:15:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 9E804D463DD; Fri, 17 Feb 2017 21:15:02 +1100 (AEDT) Date: Fri, 17 Feb 2017 21:15:00 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Hans Petter Selasky cc: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r313859 - in head/sys: kern sys In-Reply-To: <2c01557a-3412-8b46-ef4d-77214566b74a@selasky.org> Message-ID: <20170217203028.K2144@besplex.bde.org> References: <201702170645.v1H6j4l6060548@repo.freebsd.org> <2c01557a-3412-8b46-ef4d-77214566b74a@selasky.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=Ca543Pjl c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=Ue2R6lYrubxZHF9GuYkA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2017 10:15:12 -0000 On Fri, 17 Feb 2017, Hans Petter Selasky wrote: >> Log: >> Introduce SCHEDULER_STOPPED_TD for use when the thread pointer was >> already read >> >> Sprinkle in few places. >> >> Modified: >> head/sys/kern/kern_condvar.c >> head/sys/kern/kern_synch.c >> head/sys/sys/systm.h > > Do these checks also cover panics? Or only shutdown? This is just an optimization. I don't like it because it moves further from moving the stopped flag back out of the thread to a global. The stopped flag is only set for panics. > Should you also add a check for kdb_active // panicstr ? Then I could factor > out some checks I've sprinkled in the USB code. No. kdb active is very different from the scheduler being stopped. The stopped flag is just a different spelling of panicstr != NULL, modulo minor races. panicstr is used as a flag to avoid doing all sorts of things during panics. This is a bit hackish, but SCHEDULER_STOPPED() is worse. Things are not done, and it is correct to not do them, not because the scheduler is stopped, but because the system is panicing. E.g., not doing normal locking is necessary because normal locking might deadlock, but correct because locking is done in another way (by spinlock_enter() and stopping other CPUs); it is not possible to get back to normal locking, but this is correct since a reboot occurs first. Bruce