From owner-freebsd-current@FreeBSD.ORG Thu Jun 10 19:22:16 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 071D016A4CE for ; Thu, 10 Jun 2004 19:22:16 +0000 (GMT) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0653F43D4C for ; Thu, 10 Jun 2004 19:22:15 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86])i5AJM34u020750; Fri, 11 Jun 2004 05:22:03 +1000 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i5AJM12O022993; Fri, 11 Jun 2004 05:22:02 +1000 Date: Fri, 11 Jun 2004 05:22:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Don Bowman In-Reply-To: Message-ID: <20040611051146.L10787@gamplex.bde.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: "'current@freebsd.org'" Subject: RE: kernel trap 19 with interrupts disabled X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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, 10 Jun 2004 19:22:16 -0000 On Thu, 10 Jun 2004, Don Bowman wrote: > Out of curiousity, why not use something like this, so the > timeout is fixed in time, rather than a #? I used the tsc here. > > static int > my_stop_cpus(u_int map) > { > unsigned long long end_ts = rdtsc() + > 1ULL * tsc_freq; > /* send the Xcpustop IPI to all CPUs in map */ > selected_apic_ipi(map, XCPUSTOP_OFFSET, APIC_DELMODE_FIXED); > while ((stopped_cpus & map) != map) > { > /* Wait 1 second */ > if ( rdtsc() > end_ts ) > return 0; > } > return 1; > } I just copied stop_cpus(). rdtsc() and microtime() can't be used there, and neither can DELAY() if we call stop_cpus() from ddb (which we do), since some versions of DELAY() use locks and ddb can't use any public locks since it weould deadlock if it was trapped to from code that holds a lock that ddb wants to use. Bruce