Re: perfevents: irq loop stuck!

From: Vince Weaver
Date: Fri May 16 2014 - 00:21:45 EST


On Thu, 15 May 2014, Peter Zijlstra wrote:

> > So, not sure how to fix this without a total re-write, unless we want to
> > cheat and just say sample_period is capped at 62-bits or something.
>
> 63 bits should do I think, but yes, we hit a very similar but a few days
> ago in the sched_deadline code.
>
> I'm fine with capping it, allowing the full 64bit would mean we need 65
> bits (effectively 96 or 128 bit of course) math to make it all work
> which would be tedious and give no real gain.

Yes, it looks like 63 bits will be fine although I had to think about some
of the logic there to make sure there's no signed overflow.

> We'll then not make progress for a while, print the msg, get throttled,
> goto 1. This is possible if we're allowed 100+ interrupts per jiffy, so
> if you adjust /proc/sys/kernel/perf_event_max_sample_rate to below that
> and it doesn't trigger anymore we know the throttle works.

The odd thing is that even when I try to write a small reproducer I can
easily get the overflow of period to 2 to happen, but it doesn't trigger
the message. It will on occasion give a throttle message but that is all.

The fuzzer can reliably reproduce the actual IRQ warning, but a replay of
a gathered trace will not.

Even weirder, the even that triggers it is attached to CPU0 but only
triggers if the fuzzer itself is running on a different CPU. Also the
trigger event has all of exclude_kernel, exclude_user, and exclude_hv set
so I'm not sure how it even counts up to the 2 retired instructions to
trigger an overflow anyway. It doesn't help that there are 100+ other
active events at the time, although suspiciously a few of them are
apic_irq tracepoints (though attached to CPUs other than the trouble one).

anyway I'm not sure if it's worth tracking this more if it's possible to
mostly fix the case by fixing the sample_period bounds.

Vince
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/