Re: [PATCH 1/2] x86, mce, therm_throt: Optimize logging of thermal throttle messages

From: Peter Zijlstra
Date: Tue Oct 15 2019 - 04:53:12 EST

On Mon, Oct 14, 2019 at 03:27:35PM -0700, Luck, Tony wrote:
> On Mon, Oct 14, 2019 at 11:36:18PM +0200, Borislav Petkov wrote:
> > This description is already *begging* for this delay value to be
> > automatically set by the kernel. Putting yet another knob in front of
> > the user who doesn't have a clue most of the time shows one more time
> > that we haven't done our job properly by asking her to know what we
> > already do.
> >
> > IOW, a simple history feedback mechanism which sets the timeout based on
> > the last couple of values is much smarter. The thing would have a max
> > value, of course, which, when exceeded should mean an anomaly, etc, but
> > almost anything else is better than merely asking the user to make an
> > educated guess.
> You need a plausible start point for the "when to worry the user"
> message. Maybe that is your "max value"?
> So if the system has a couple of excursions above temperature lasting
> 1 second and then 2 seconds ... would you like to see those ignored
> (because they are below the initial max)? But now we have a couple
> of data points pick some new value to be the threshold for reporting?
> What value should we pick (based on 1 sec, then 2 sec)?
> I would be worried that it would self tune to the point where it
> does report something that it really didn't need to (e.g. as a result
> of a few consecutive very short excursions).

I'm guessing Boris is thinking of a simple IIR like avg filter.

avg = avg + (sample-avg) / 4

And then only print when sample > 2*avg. If you initialize that with
some appropriately large value, it should settle down into what it
'normal' for that particular piece of hardware.

Still, I'm boggled by the whole idea that hitting critical hard throttle
is considered 'normal' at all.

> We also need to take into account the "typical sampling interval"
> for user space thermal control software.

Why is control of critical thermal crud in userspace? That seems like a
massive design fail.