From: Prarit Bhargava <prarit@redhat.com>
To: "Liang, Kan" <kan.liang@intel.com>, Thomas Gleixner <tglx@linutronix.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"dzickus@redhat.com" <dzickus@redhat.com>,
"mingo@kernel.org" <mingo@kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"babu.moger@oracle.com" <babu.moger@oracle.com>,
"atomlin@redhat.com" <atomlin@redhat.com>,
"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"eranian@google.com" <eranian@google.com>,
"acme@redhat.com" <acme@redhat.com>,
"ak@linux.intel.com" <ak@linux.intel.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH V2] kernel/watchdog: fix spurious hard lockups
Date: Wed, 21 Jun 2017 13:40:23 -0400 [thread overview]
Message-ID: <aa704956-5ad4-829f-d3e6-3325fa28022b@redhat.com> (raw)
In-Reply-To: <37D7C6CF3E00A74B8858931C1DB2F077537101A3@SHSMSX103.ccr.corp.intel.com>
On 06/21/2017 11:47 AM, Liang, Kan wrote:
>
>
>> On Wed, 21 Jun 2017, kan.liang@intel.com wrote:
>>>
>>> #ifdef CONFIG_HARDLOCKUP_DETECTOR
>>> +/*
>>> + * The NMI watchdog relies on PERF_COUNT_HW_CPU_CYCLES event,
>> which
>>> + * can tick faster than the measured CPU Frequency due to Turbo mode.
>>> + * That can lead to spurious timeouts.
>>> + * To workaround the issue, extending the period by 3 times.
>>> + */
>>> u64 hw_nmi_get_sample_period(int watchdog_thresh) {
>>> - return (u64)(cpu_khz) * 1000 * watchdog_thresh;
>>> + return (u64)(cpu_khz) * 1000 * watchdog_thresh * 3;
>>
>> The maximum turbo frequency of any given machine can be retrieved.
>
> The maximum turbo frequency is determined by the model of processor.
> I'm not sure if there is a generic way to get the maximum turbo frequency.
> Is there?
>
cpufreq_quick_get_max()
but iff cpufreq subsystem is initialized. O/w 0 is returned for the freq.
Quick test shows the correct turbo max of 3700000 on my 2000000 (2.00GHz)
system.
P.
> Thanks,
> Kan
>
>>
>> So why don't you simply take that ratio into account and apply it for the
>> machines which have those insane turbo loaders? That's not a huge effort,
>> can be easily backported and does not inflict this unconditially.
>>
>> So what you want is:
>>
>> return get_max_turbo_khz() * 1000 * watchdog_thresh;
>>
>> Where get_max_turbo_khz() by default returns cpu_khz for non turbo
>> motors.
>>
>> And instead of silently doing this it should emit a info into dmesg:
>>
>> u64 period, max_khz = get_max_turbo_khz();
>> static int once;
>>
>> period = max_khz * 1000 * watchdog_thresh;
>>
>> if (max_khz != cpu_khz && !once) {
>> unsigned int msec = period / cpu_khz;
>>
>> once = 1;
>> pr_info("Adjusted watchdog threshold to %u.%04u sec\n",
>> msec / 1000, msec % 1000);
>> }
>>
>> return period;
>>
>> Hmm?
>>
>> Thanks,
>>
>> tglx
>
next prev parent reply other threads:[~2017-06-21 17:40 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 14:41 [PATCH V2] kernel/watchdog: fix spurious hard lockups kan.liang
2017-06-21 15:12 ` Thomas Gleixner
2017-06-21 15:47 ` Liang, Kan
2017-06-21 17:40 ` Prarit Bhargava [this message]
2017-06-21 17:07 ` Andi Kleen
2017-06-21 19:59 ` Thomas Gleixner
2017-06-21 21:53 ` Thomas Gleixner
2017-06-22 15:33 ` Thomas Gleixner
2017-06-22 15:44 ` Don Zickus
2017-06-22 15:48 ` Liang, Kan
2017-06-23 8:01 ` Thomas Gleixner
2017-06-23 16:29 ` Don Zickus
2017-06-23 21:50 ` Thomas Gleixner
2017-06-26 20:19 ` Don Zickus
2017-06-26 20:30 ` Thomas Gleixner
2017-06-27 20:12 ` Don Zickus
2017-06-27 20:49 ` Liang, Kan
2017-06-27 21:09 ` Don Zickus
2017-06-27 23:48 ` Andi Kleen
2017-06-28 19:00 ` Don Zickus
2017-06-28 20:14 ` Andi Kleen
2017-06-29 15:44 ` Don Zickus
2017-06-29 16:12 ` Andi Kleen
2017-06-29 16:26 ` Don Zickus
2017-06-29 16:36 ` Andi Kleen
2017-07-17 1:24 ` Liang, Kan
2017-07-17 7:14 ` Thomas Gleixner
2017-07-17 12:18 ` Liang, Kan
2017-07-17 13:13 ` Thomas Gleixner
2017-07-17 14:46 ` Liang, Kan
2017-07-17 15:00 ` Thomas Gleixner
2017-07-17 14:46 ` Don Zickus
2017-08-15 1:16 ` Liang, Kan
2017-08-15 1:28 ` Linus Torvalds
2017-08-15 7:50 ` Thomas Gleixner
2017-08-17 15:45 ` Liang, Kan
2017-08-18 10:39 ` [tip:core/urgent] kernel/watchdog: Prevent false positives with turbo modes tip-bot for Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aa704956-5ad4-829f-d3e6-3325fa28022b@redhat.com \
--to=prarit@redhat.com \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=atomlin@redhat.com \
--cc=babu.moger@oracle.com \
--cc=dzickus@redhat.com \
--cc=eranian@google.com \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).