From owner-freebsd-hackers@freebsd.org Tue May 23 06:33:51 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C016D7A1E1 for ; Tue, 23 May 2017 06:33:51 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-13.reflexion.net [208.70.210.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E20161BB6 for ; Tue, 23 May 2017 06:33:50 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 26532 invoked from network); 23 May 2017 06:37:26 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 23 May 2017 06:37:26 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v8.40.0) with SMTP; Tue, 23 May 2017 02:33:48 -0400 (EDT) Received: (qmail 19644 invoked from network); 23 May 2017 06:33:48 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 23 May 2017 06:33:48 -0000 Received: from [192.168.1.114] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id B6125EC8B7B; Mon, 22 May 2017 23:33:47 -0700 (PDT) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: TARGET_ARCH=powerpc: how to cause a dump from kernel thread without disturbing that thread's stack? Message-Id: Date: Mon, 22 May 2017 23:33:47 -0700 To: FreeBSD PowerPC ML , freebsd-hackers@freebsd.org X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 May 2017 06:33:51 -0000 I've been trying to track down an occasional kernel panic on an old PowerMac G5 so-called "Quad Core" used with 32-bit PowerPC FreeBSD. The panics report absurdly large exception figures and such --and it turns out the content matches some very low memory (not necessarily properly aligned for its starting address). The following is an as-if investigative example. The eventual details may differ. But, presuming that theses tests in these places were appropriate, I'd like to be able to cause a dump without making calls that update the contents of the stack for the kernel thread: I want see the original stack contents in the dump for its history. content. The calls to panic in the example code below would disturb the history available on the kernel-thread's stack, something I'd like to avoid. Is there a known FreeBSD technique for preserving such memory contents when getting a dump at a specific place? void powerpc_interrupt(struct trapframe *framep) { struct thread *td; struct trapframe *oldframe; register_t ee; td =3D curthread; if ((void*)framep <=3D (void*)0x1000) panic("0:bad framep: %p\n", = (void*)framep); if (0x2f00 <=3D framep->exc) panic("0:bad framep->exc: %x (%p)\n", = framep->exc, (void*)framep); CTR2(KTR_INTR, "%s: EXC=3D%x", __func__, framep->exc); switch (framep->exc) { . . . default: /* Re-enable interrupts if applicable. */ ee =3D framep->srr1 & PSL_EE; if (ee !=3D 0) mtmsr(mfmsr() | ee); if ((void*)framep <=3D (void*)0x1000) panic("1:bad framep: %p\n", = (void*)framep); if (0x2f00 <=3D framep->exc) panic("1:bad framep->exc: %x (%p)\n", = framep->exc, (void*)framep); trap(framep); } } =3D=3D=3D Mark Millard markmi at dsl-only.net