performance monitor exceptions

2 messages, 2 authors, 2002-02-12 · open the first message on its own page

performance monitor exceptions

From: Werner Almesberger <hidden>
Date: 2002-02-11 22:37:30

Hi,

I'm banging my head at a problem with exceptions. What I want to
do is to get the performance monitor to give me exceptions at
roughly 1 kHz, to drive the kernel profiler. The problem is that
my changes usually kill the system within a few minutes :-(

I'm quite new to the PPC, so I'll include a bit more details, in
case I made some trivial mistake. My kernel is 2.4.17, my CPU is a
MPC7410.

First of all, I changed the vector to:

        . = 0xf00
        b       PerformanceMonitor

Then, I added a tiny little handler that does nothing but re-enable
the PE exception. For getting a register, I mimicked EXCEPTION_PROLOG:

PerformanceMonitor:
        // 955 is SIAR
        mtspr   955,r20
        mfspr   r20,SPRN_MMCR0
        oris    r20,r20,MMCR0_PMXE@h
        mtspr   SPRN_MMCR0,r20
        mfspr   r20,955
        SYNC
        RFI

And then I added of course a bit of code to enable all this:

int __init setup_perf_mon(void)
{
        unsigned long flags;

        local_irq_save(flags);
        local_irq_disable();
        /* ca. 3 kHz */
        mtspr(SPRN_MMCR0,(mfspr(SPRN_MMCR0) & ~MMCR0_TBSEL_MASK) |
          MMCR0_PMXE | (MMCR0_TBSEL_TBL15 << MMCR0_TBSEL_SHIFT) | MMCR0_TBEE);
        local_irq_restore(flags);
        return 0;
}

It seems to work (I had a handler there that does something a little
more useful), but when I start kernel builds, I get a dead system
(rebooted by hardware watchdog) within a few minutes.

Instead of SIAR, I also tried SPRG0 and SPRG1, but got exactly the
same behaviour. Time to crash varies from one to ten minutes. The
time increases proportionally if I use TLB[19] (~200 Hz) instead.

Any ideas of what I could be trampling over (or be trampled over
by) ? This code seems rather bullet-proof to me, and I don't think
anything else is using SIAR, or could change it while I'm using it.

Thanks,
- Werner

--
  _________________________________________________________________________
 / Werner Almesberger, Lausanne, CH                    wa@almesberger.net /
/_http://icawww.epfl.ch/almesberger/_____________________________________/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

Re: performance monitor exceptions

From: benh@kernel.crashing.org
Date: 2002-02-12 12:55:01

It seems to work (I had a handler there that does something a little
more useful), but when I start kernel builds, I get a dead system
(rebooted by hardware watchdog) within a few minutes.

Instead of SIAR, I also tried SPRG0 and SPRG1, but got exactly the
same behaviour. Time to crash varies from one to ten minutes. The
time increases proportionally if I use TLB[19] (~200 Hz) instead.

Any ideas of what I could be trampling over (or be trampled over
by) ? This code seems rather bullet-proof to me, and I don't think
anything else is using SIAR, or could change it while I'm using it.
A first quick look doesn't seem to show any problem with your code
I have two clues at hand:

 - I don't know how the perf. mon stuff works, but couldn't you
enter a condition were the CPU is continuously sending your the
pef monitor exception until you clear something else ?

 - I encountered a problem with the TAU stuff and the 7400 where
the CPU could actually get mixed up when getting both a normal
interrupt and a TAU exception and scew up itself (by taking both
exceptions and screwing up SRR0/1)

Ben.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help