From owner-freebsd-current@FreeBSD.ORG Thu Nov 17 16:37:20 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11833106567A; Thu, 17 Nov 2011 16:37:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id DC9758FC0A; Thu, 17 Nov 2011 16:37:19 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 93CD346B17; Thu, 17 Nov 2011 11:37:19 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 25C0C8A050; Thu, 17 Nov 2011 11:37:19 -0500 (EST) From: John Baldwin To: Andriy Gapon Date: Thu, 17 Nov 2011 11:37:18 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <20111113083215.GV50300@deviant.kiev.zoral.com.ua> <4EC4C712.8040701@FreeBSD.org> <4EC4D83E.3090307@FreeBSD.org> In-Reply-To: <4EC4D83E.3090307@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201111171137.18663.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 17 Nov 2011 11:37:19 -0500 (EST) Cc: Kostik Belousov , Alexander Motin , freebsd-current@freebsd.org Subject: Re: Stop scheduler on panic X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 16:37:20 -0000 On Thursday, November 17, 2011 4:47:42 am Andriy Gapon wrote: > on 17/11/2011 10:34 Andriy Gapon said the following: > > on 17/11/2011 10:15 Kostik Belousov said the following: > >> I have the following change for eons on my test boxes. Without it, > >> I simply cannot get _any_ dump. > >> > >> diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c > >> index 10b89c7..a38e42f 100644 > >> --- a/sys/cam/cam_xpt.c > >> +++ b/sys/cam/cam_xpt.c > >> @@ -4230,7 +4230,7 @@ xpt_done(union ccb *done_ccb) > >> TAILQ_INSERT_TAIL(&cam_simq, sim, links); > >> mtx_unlock(&cam_simq_lock); > >> sim->flags |= CAM_SIM_ON_DONEQ; > >> - if (first) > >> + if (first && panicstr == NULL) > >> swi_sched(cambio_ih, 0); > >> } > >> } > > > > I think that this (or similar) change should go into the patch and the tree. > > > > And, BTW, I still would like to do something like the following (perhaps with > td_oncpu = NOCPU and td_flags &= ~TDF_NEEDRESCHED also moved to the common code): > > Index: sys/kern/sched_ule.c > =================================================================== > --- sys/kern/sched_ule.c (revision 227608) > +++ sys/kern/sched_ule.c (working copy) > @@ -1790,7 +1790,6 @@ sched_switch(struct thread *td, struct thread *new > td->td_oncpu = NOCPU; > if (!(flags & SW_PREEMPT)) > td->td_flags &= ~TDF_NEEDRESCHED; > - td->td_owepreempt = 0; > tdq->tdq_switchcnt++; > /* > * The lock pointer in an idle thread should never change. Reset it > Index: sys/kern/kern_synch.c > =================================================================== > --- sys/kern/kern_synch.c (revision 227608) > +++ sys/kern/kern_synch.c (working copy) > @@ -406,6 +406,8 @@ mi_switch(int flags, struct thread *newtd) > ("mi_switch: switch must be voluntary or involuntary")); > KASSERT(newtd != curthread, ("mi_switch: preempting back to ourself")); > > + td->td_owepreempt = 0; > + > /* > * Don't perform context switches from the debugger. > */ > Index: sys/kern/sched_4bsd.c > =================================================================== > --- sys/kern/sched_4bsd.c (revision 227608) > +++ sys/kern/sched_4bsd.c (working copy) > @@ -940,7 +940,6 @@ sched_switch(struct thread *td, struct thread *new > td->td_lastcpu = td->td_oncpu; > if (!(flags & SW_PREEMPT)) > td->td_flags &= ~TDF_NEEDRESCHED; > - td->td_owepreempt = 0; > td->td_oncpu = NOCPU; > > /* > > Does anybody see any potential problems with such a change? Hmm, does this mean the preemption will be lost if you break into the debugger and continue in the non-panic case? -- John Baldwin