From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 5 20:14:38 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6A2B1065679; Thu, 5 Aug 2010 20:14:38 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 89A8D8FC13; Thu, 5 Aug 2010 20:14:38 +0000 (UTC) Received: by ywf9 with SMTP id 9so3275303ywf.13 for ; Thu, 05 Aug 2010 13:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=rRQ+JFjhhcogWQNgD/AMDZQnKwCoAVxVk6nKg+x5y9E=; b=ekBivTMeqjG+uqG6Xc/8A6rVQG12dDYb06VYqX/LHZ/v1Qpnn/ZvVeG3gUWwvw+nul ZG0COcoJVLE1Smwvy8JvncZ80B5UElLnpzVhG60kVAxTyf8oA3ErEuQwLqohV4yrCuT4 l6/3zlNf9J3/Mxug9d3gAPvtiHK6IDT7/355k= 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=WW+S6mb++OSHct7j1Wb1CKyhO50b7YYGVKdFa3cpfzfAwbYTYXkbpY0Trr/9/XS3B8 zSTsJ/YvBBMLVXF8FyRC/Q2QR67sq6ci0HrswjADG53VXVd2Oaz6odPKOsmppWckhw6S Ucgp95wz6tyhf0Y+An76FJGfW+8B3FBF0tYTE= MIME-Version: 1.0 Received: by 10.150.13.15 with SMTP id 15mr13145253ybm.40.1281039277755; Thu, 05 Aug 2010 13:14:37 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.42.3.140 with HTTP; Thu, 5 Aug 2010 13:14:37 -0700 (PDT) In-Reply-To: <201008051312.25854.jhb@freebsd.org> References: <201008041455.26066.jhb@freebsd.org> <201008051312.25854.jhb@freebsd.org> Date: Thu, 5 Aug 2010 13:14:37 -0700 X-Google-Sender-Auth: aMCHHOwGEKrg8ig0f10WvWyHVEA Message-ID: From: mdf@FreeBSD.org To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: sched_pin() versus PCPU_GET X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2010 20:14:39 -0000 >> (gdb) p panic_cpu >> $9 =3D 2 >> (gdb) p dumptid >> $12 =3D 100751 >> (gdb) p cpuhead.slh_first->pc_allcpu.sle_next->pc_curthread->td_tid >> $14 =3D 100751 >> >> (gdb) p *cpuhead.slh_first->pc_allcpu.sle_next >> $6 =3D { >> =A0 pc_curthread =3D 0xffffff00716d6960, >> =A0 pc_cpuid =3D 2, >> =A0 pc_spinlocks =3D 0xffffffff80803198, >> >> (gdb) p lock_list >> $2 =3D (struct lock_list_entry *) 0xffffffff80803fb0 >> >> (gdb) p *cpuhead.slh_first->pc_allcpu.sle_next->pc_allcpu.sle_next- >>pc_allcpu.sle_next >> $8 =3D { >> =A0 pc_curthread =3D 0xffffff0005479960, >> =A0 pc_cpuid =3D 0, >> =A0 pc_spinlocks =3D 0xffffffff80803fb0, >> >> I.e. we're dumping on CPU 2, but the lock_list pointer that was saved >> in the dump matches that of CPU 0. > > Can you print out the tid's for the two curthreads? =A0It's not impossibl= e that > the thread migrated after calling panic. =A0In fact we force threads to C= PU 0 > during shutdown. dumptid matches the pc_curthread for CPU 2 and is printed above. The lock_list local variable matches the PCPU for CPU 0, which has tid: (gdb) p cpuhead.slh_first->pc_allcpu.sle_next->pc_allcpu.sle_next->pc_allcp= u.sle_next->pc_curthread->td_tid $2 =3D 100005 (gdb) p cpuhead.slh_first->pc_allcpu.sle_next->pc_allcpu.sle_next->pc_allcp= u.sle_next->pc_curthread->td_proc->p_comm $3 =3D "idle: cpu0\000\000\000\000\000\000\000\000\000" Note that lock_list->ll_count is now 0, but of course wasn't when we panic'd. Also, the panic message showed "exclusive spin mutex sched lock 0 (sched lock) r =3D 0 (0xffffffff806cf640) locked @ /build/mnt/src/sys/kern/sys_generic.c:826"; i.e. the lock was for CPU 0 as well. If we truly were returning to user space with that lock held it would still be held and we'd still be on CPU 0. Cheers, matthew