From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 1 13:56:06 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7250216A41F for ; Sat, 1 Oct 2005 13:56:06 +0000 (GMT) (envelope-from apelisse@gmail.com) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.195]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F03743D45 for ; Sat, 1 Oct 2005 13:56:05 +0000 (GMT) (envelope-from apelisse@gmail.com) Received: by nproxy.gmail.com with SMTP id x4so24422nfb for ; Sat, 01 Oct 2005 06:56:03 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=JoxOmOvqobB7gk3ZvaHN26Nln/Evt3Fm/NBw9aBpqQAEZqS18azmrvW4KDKxWw2hRk/N4PNMrsk4CuiZlIXvBJu/0M59AsPz3mpO5CDxLh3vDAnOoDfU6whvEnh+zLLq3mWr2+Tc0g3mUAALRSTPVM8lhJs9+haMbU3ahDTIjM0= Received: by 10.48.239.6 with SMTP id m6mr146597nfh; Sat, 01 Oct 2005 06:56:03 -0700 (PDT) Received: by 10.48.108.18 with HTTP; Sat, 1 Oct 2005 06:56:03 -0700 (PDT) Message-ID: <61c746830510010656o363cfbc7icc28556a6df27d36@mail.gmail.com> Date: Sat, 1 Oct 2005 14:56:03 +0100 From: Antoine Pelisse To: John Baldwin In-Reply-To: <200509301310.03124.jhb@FreeBSD.org> MIME-Version: 1.0 References: <61c746830509300824g2f368d26pcc500403fe319b3b@mail.gmail.com> <61c746830509300825s5ad197fbt908267d54f1b7b8f@mail.gmail.com> <200509301310.03124.jhb@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: freebsd-5.4-stable panics X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Antoine Pelisse List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Oct 2005 13:56:06 -0000 On 9/30/05, John Baldwin wrote: > > On Friday 30 September 2005 11:25 am, Antoine Pelisse wrote: > > On 9/30/05, John Baldwin wrote: > > > On Friday 30 September 2005 05:24 am, Antoine Pelisse wrote: > > > > Hi Robert, > > > > I don't think your patch is correct, the total linked list can be > > > > broken > > > > > > > > while the lock is released, thus just passing the link may not be > > > > enough I have submitted a PR[1] for this a month ago but nobody too= k > > > > care of it yet Regards, > > > > Antoine Pelisse > > > > > > > > [1] http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dkern/84684 > > > > > > I think this patch looks ok. Robert, can you get the original panic o= n > > > this > > > thread tested against this patch? > > > > I had a small program which could reproduce this panic in 10 seconds, i= t > > was basically creating empty threads and calling kvm_getprocs() in the > same > > time. Anyway the patch was able to stop the program from panicing. > > The panic is also reproducible in RELENG_6 and HEAD IIRC. > > It turns out that the sysctl buffer is already wired in one of the two > cases > that this function is called, so I moved the wiring up to the upper layer > in > the other case and cut out a bunch of the locking gymnastics as a result. > Can you try this patch? > > Index: kern_proc.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /usr/cvs/src/sys/kern/kern_proc.c,v > retrieving revision 1.231 > diff -u -r1.231 kern_proc.c > --- kern_proc.c 27 Sep 2005 18:03:15 -0000 1.231 > +++ kern_proc.c 30 Sep 2005 17:04:57 -0000 > @@ -875,22 +875,16 @@ > > if (flags & KERN_PROC_NOTHREADS) { > fill_kinfo_proc(p, &kinfo_proc); > - PROC_UNLOCK(p); > error =3D SYSCTL_OUT(req, (caddr_t)&kinfo_proc, > sizeof(kinfo_proc)); > - PROC_LOCK(p); > } else { > - _PHOLD(p); > FOREACH_THREAD_IN_PROC(p, td) { > fill_kinfo_thread(td, &kinfo_proc); > - PROC_UNLOCK(p); > error =3D SYSCTL_OUT(req, (caddr_t)&kinfo_proc, > sizeof(kinfo_proc)); > - PROC_LOCK(p); > if (error) > break; > } > - _PRELE(p); > } > PROC_UNLOCK(p); > if (error) > @@ -932,6 +926,9 @@ > if (oid_number =3D=3D KERN_PROC_PID) { > if (namelen !=3D 1) > return (EINVAL); > + error =3D sysctl_wire_old_buffer(req, 0); > + if (error) > + return (error); > p =3D pfind((pid_t)name[0]); > if (!p) > return (ESRCH); > > -- > John Baldwin <>< http://www.FreeBSD.org/~jhb/ > "Power Users Use the Power to Serve" =3D http://www.FreeBSD.org > Hi John, I'm sorry I can't test it right now, I'm in a foreign country for three months and can only connect to the internet through the university connection. I'll be back home mid-december. Maybe Rob should take care of testing it. Regards, Antoine Pelisse