Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 May 2017 23:33:47 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, freebsd-hackers@freebsd.org
Subject:   TARGET_ARCH=powerpc: how to cause a dump from kernel thread without disturbing that thread's stack?
Message-ID:  <DCE41693-7E27-451E-9880-42762E96FE3E@dsl-only.net>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DCE41693-7E27-451E-9880-42762E96FE3E>