Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-24 Thread Thomas Gleixner
On Fri, 24 Apr 2015, Andi Kleen wrote: > > There are better ways to do that than using heuristics. We have to > > deal with 3 variants of the reference counter: > > > > 1) Core and Atom: counts bus cycles and we know that frequency already > > from the local apic calibration > > > >

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-24 Thread Andi Kleen
> There are better ways to do that than using heuristics. We have to > deal with 3 variants of the reference counter: > > 1) Core and Atom: counts bus cycles and we know that frequency already > from the local apic calibration > > 2) Nehalem, Westmere: Same as TSC > > 3) Sandybri

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-24 Thread Thomas Gleixner
On Fri, 24 Apr 2015, Alexander Shishkin wrote: > Thomas Gleixner writes: > > > On Fri, 24 Apr 2015, Thomas Gleixner wrote: > >> On Thu, 23 Apr 2015, Andi Kleen wrote: > >> > > We can just detect the deviation in the callback itself: > >> > > > >> > >u64 now = ktime_get_mono_fast_ns(); >

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-24 Thread Alexander Shishkin
Thomas Gleixner writes: > On Fri, 24 Apr 2015, Thomas Gleixner wrote: >> On Thu, 23 Apr 2015, Andi Kleen wrote: >> > > We can just detect the deviation in the callback itself: >> > > >> > >u64 now = ktime_get_mono_fast_ns(); >> > > >> > >if (now - __this_cpu_read(nmi_timestamp)

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-24 Thread Thomas Gleixner
On Fri, 24 Apr 2015, Thomas Gleixner wrote: > On Thu, 23 Apr 2015, Andi Kleen wrote: > > > We can just detect the deviation in the callback itself: > > > > > >u64 now = ktime_get_mono_fast_ns(); > > > > > >if (now - __this_cpu_read(nmi_timestamp) < period) > > > r

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-24 Thread Borislav Petkov
On Thu, Apr 23, 2015 at 05:51:33PM -0700, Andi Kleen wrote: > There were systems in the past that ran TSC at a much slower > frequency, such as the early AMD Barcelona systems. You mean the eval boxes which were never sold as production systems? -- Regards/Gruss, Boris. ECO tip #101: Trim y

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-24 Thread Thomas Gleixner
On Thu, 23 Apr 2015, Andi Kleen wrote: > > We can just detect the deviation in the callback itself: > > > >u64 now = ktime_get_mono_fast_ns(); > > > >if (now - __this_cpu_read(nmi_timestamp) < period) > >return; > > > >__this_cpu_write(nmi_timestamp, n

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-23 Thread Andi Kleen
> We can just detect the deviation in the callback itself: > >u64 now = ktime_get_mono_fast_ns(); > >if (now - __this_cpu_read(nmi_timestamp) < period) > return; > >__this_cpu_write(nmi_timestamp, now); > > It's that simple. It's a simple short term

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-23 Thread Thomas Gleixner
On Thu, 23 Apr 2015, Andi Kleen wrote: > On Thu, Apr 23, 2015 at 10:01:04PM +0200, Thomas Gleixner wrote: > > On Thu, 23 Apr 2015, Alexander Shishkin wrote: > > > > > The problem with using cycle counter for NMI watchdog is that its > > > frequency changes with the corresponding core's frequency.

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-23 Thread Andi Kleen
On Thu, Apr 23, 2015 at 10:01:04PM +0200, Thomas Gleixner wrote: > On Thu, 23 Apr 2015, Alexander Shishkin wrote: > > > The problem with using cycle counter for NMI watchdog is that its > > frequency changes with the corresponding core's frequency. This means > > that, in particular, if the core f

Re: [PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-23 Thread Thomas Gleixner
On Thu, 23 Apr 2015, Alexander Shishkin wrote: > The problem with using cycle counter for NMI watchdog is that its > frequency changes with the corresponding core's frequency. This means > that, in particular, if the core frequency scales up, watchdog NMI will > arrive more frequently than what us

[PATCH v1] watchdog: Use a reference cycle counter to avoid scaling issues

2015-04-23 Thread Alexander Shishkin
The problem with using cycle counter for NMI watchdog is that its frequency changes with the corresponding core's frequency. This means that, in particular, if the core frequency scales up, watchdog NMI will arrive more frequently than what user requested through watchdog_thresh and also increasing