Re: libata/sata_nv latency on NVIDIA CK804 [was Re: AMD64 X2 lost ticks on PM timer]

Andi Kleen
2006-03-22T16:51:42Z

On Thursday 16 March 2006 17:57, Bill Rugolsky Jr. wrote:
> On Thu, Mar 16, 2006 at 03:13:39PM +0000, Alan Cox wrote:
> > On Mer, 2006-03-15 at 23:00 +0100, Ingo Molnar wrote:
> > > so my guess would be that this device doesnt do MMIO, and the PIO inb()
> > > causes some bad BIOS-based SMM handler/emulator to trigger, which takes
> > > 16.6 msecs. If indeed the device is not in MMIO mode, is there a way to
> > > force it into MMIO mode, to test this theory?
> >
> > There is a much more reliable way to check this. Use the profiling
> > registers to check the instruction issue count before/after the I/O and
> > you'll know if its something like SMM or just a bus stall.
>
>
> Brilliant [as usual 8-)].
>
>
> So I imagine that the thing to do is just insert before/after
> rdmsr(MSR_K7_PERFCTR[0123]) into the code, with a suitable printk(),
> and then program the counters with oprofile to use large event
> counts (lasting seconds)?

perfctr0 is already programmed. You can just use rdpmc on it

Also my latest patchkit has a debugging patch for lost tries

ftp://ftp.firstfloor.org/pub/ak/x86_64/quilt/patches/lost-cli-debug

Can you test it with this patch?

I'm still not quite convinced you're barking at the right tree
with these latency traces because it doesn't match the symptoms.

If some particular critical section would take too long the
interrupt should occur at its STI or POPF or one instruction after it.
But they happen on STIs that are not related to any critical section.
This more looks like a lost CLI to me.

> <idle>-0 0dns. 1855us : _spin_unlock_irqrestore (blk_run_queue)

This is very long, but still less than a tick (assuming HZ=250)
I guess it would be a good idea to add some code to split this up
though and enable interrupts more often, but that probably won't fix
your problem.

-Andi