From owner-freebsd-current@FreeBSD.ORG Sat Jun 4 22:35:29 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 6A086106564A; Sat, 4 Jun 2011 22:35:29 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id E01988FC14; Sat, 4 Jun 2011 22:35:28 +0000 (UTC) Received: by gyg13 with SMTP id 13so1746480gyg.13 for ; Sat, 04 Jun 2011 15:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=lrZ1edEjVtym7htofHoC62s2wKoryNttfZYqcVgCQNw=; b=Tfxzha2AtNzeJhIxQo/uUNqYdTbfCnTw+MGvgF/W7SnZJFiaV553jsCDxWMSmH6pV7 qdm0mXCvztMVlF1efoDkxU7AW7Qv5YVwMn/EeHJpIvClWNPaDpCifq98efdOETHxoVDe nfFEFphj0RDtd9TFb+DRWrzSBPsvTuJ40TT2Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=XuVKSZFEec+LDEls2jQeS8/ksUehKoEgpBDni2/pTp+oCR51EefijU7L36vexim0XR Hf3VX1U8WH38qpHtPqPuN2KNrv4vRksEqNmVlI5yJyf1KH6ZyxF5ExyjYqwVZvnG+Xc+ 622Ue8WwindmlktUNeCxLwUArSPwJVRpHyV4U= MIME-Version: 1.0 Received: by 10.236.161.194 with SMTP id w42mr4157724yhk.237.1307226928163; Sat, 04 Jun 2011 15:35:28 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.103.136 with HTTP; Sat, 4 Jun 2011 15:35:28 -0700 (PDT) In-Reply-To: <4DE9EB61.3000006@FreeBSD.org> References: <4DE8FA2E.4030202@FreeBSD.org> <5E4D0F56-4338-4157-8BC6-17EE2831725F@FreeBSD.org> <4DE9EB61.3000006@FreeBSD.org> Date: Sat, 4 Jun 2011 18:35:28 -0400 X-Google-Sender-Auth: Iu3VIueuqAZNmZQIBs5oUET-vGQ Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-stable@freebsd.org, freebsd-current@freebsd.org, "Robert N. M. Watson" Subject: Re: [poll / rfc] kdb_stop_cpus 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: Sat, 04 Jun 2011 22:35:29 -0000 2011/6/4 Andriy Gapon : > on 03/06/2011 20:57 Robert N. M. Watson said the following: >> >> On 3 Jun 2011, at 16:13, Andriy Gapon wrote: >> >>> I wonder if anybody uses kdb_stop_cpus with non-default value. If, yes,= I >>> am very interested to learn about your usecase for it. >> >> The issue that prompted the sysctl was non-NMI IPIs being used to enter = the >> debugger or reboot following a core hanging with interrupts disabled. Wi= th >> the switch to NMI IPIs in some of those circumstances, life is better --= at >> least, on hardware that supports non-maskable IPIs. I seem to recall spa= rc64 >> doesn't, however? > > Seems to be so as Nathan has also pointed out for PPC. > For this I also plan the following change: > > commit 458ebd9aca7e91fc6e0825c727c7220ab9f61016 > > =C2=A0 =C2=A0generic_stop_cpus: move timeout detection code from under DI= AGNOSTIC > > =C2=A0 =C2=A0... and also increase it a bit. > =C2=A0 =C2=A0IMO it's better to detect and report the (rather serious) co= ndition and > =C2=A0 =C2=A0allow a system to proceed somehow rather than be stuck in an= endless > =C2=A0 =C2=A0loop. > > diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c > index ae52f4b..4bd766b 100644 > --- a/sys/kern/subr_smp.c > +++ b/sys/kern/subr_smp.c > @@ -232,12 +232,10 @@ generic_stop_cpus(cpumask_t map, u_int type) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* spin */ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cpu_spinwait(); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0i++; > -#ifdef DIAGNOSTIC > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (i =3D=3D 100000) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (i =3D=3D 100000000= ) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0printf("timeout stopping cpus\n"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0break; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > -#endif > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 =C2=A0 =C2=A0stopping_cpu =3D NOCPU; I'd also add the ability, once the deadlock is detected, to break in KDB, and put that under DIAGNOSTIC. I had such a patch and I used it to debug some deadlocks on shutdown code, but now it seems I can't find it anymore. Attilio --=20 Peace can only be achieved by understanding - A. Einstein