Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753277AbdFURJE convert rfc822-to-8bit (ORCPT ); Wed, 21 Jun 2017 13:09:04 -0400 Received: from mga07.intel.com ([134.134.136.100]:17136 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751961AbdFURJC (ORCPT ); Wed, 21 Jun 2017 13:09:02 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,369,1493708400"; d="scan'208";a="870320162" From: "Liang, Kan" To: Thomas Gleixner CC: "linux-kernel@vger.kernel.org" , "dzickus@redhat.com" , "mingo@kernel.org" , "akpm@linux-foundation.org" , "babu.moger@oracle.com" , "atomlin@redhat.com" , "prarit@redhat.com" , "torvalds@linux-foundation.org" , "peterz@infradead.org" , "eranian@google.com" , "acme@redhat.com" , "ak@linux.intel.com" , "stable@vger.kernel.org" Subject: RE: [PATCH V2] kernel/watchdog: fix spurious hard lockups Thread-Topic: [PATCH V2] kernel/watchdog: fix spurious hard lockups Thread-Index: AQHS6pyX93nZMscYGUu+rlSjZMkkxKIu5icAgACNjaA= Date: Wed, 21 Jun 2017 15:47:13 +0000 Message-ID: <37D7C6CF3E00A74B8858931C1DB2F077537101A3@SHSMSX103.ccr.corp.intel.com> References: <20170621144118.5939-1-kan.liang@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjQxZmFjMWEtMzJmMS00OGUwLTg1MTUtOThkODA4ZmE2MDI1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjVRbko2aGw2bEVHS0JQVnVjRWh4eVhIMXNUcURMcEU3Z0pHcmV2RElEdlE9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1620 Lines: 59 > 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? 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