Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2482412ybm; Thu, 23 May 2019 18:19:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJI5PeL8VpXY/Ru9f1H8B0335YHPQ2AOcE6IgIoXwDECFETa1V2XOKsKpxf5i0hB5mpfwi X-Received: by 2002:a62:e201:: with SMTP id a1mr108056983pfi.67.1558660765247; Thu, 23 May 2019 18:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558660765; cv=none; d=google.com; s=arc-20160816; b=laA9bNFkwE2xiddmvfg8OSm35oFjxGPS4Vds3yeAFt0eRWDxFwEcYvaaK1YkmGk6i4 AkLGsGaUbFOLMZ0S2oEOfez7TRkoZ0d5ZFjdoiNkTF4g/brnxQYb03hnbGqDEMquZx7R YsuErX0AzD1LcU2n+vBECo4tP9pLiuK4ybaD1lb5Bp+D5IZ7Av88ke4dahySk9QGIbXt wYd0I5pE7Brjij7Igus35X5GsROsSAbsbQkLoOO+6VOSqzXENtvlxTMSUMV6EFkMXbCW Qc1x6gX3pFSbLs9c7+Dml9SrJcPoNcUtgZOzgW8K8ygwGVeMYhzvt8+7uT/rHxzAd82x 9l/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=dC5SWRVd9VzerM2Fw/lbQoOEQJ365ah24GQ9s/QDU2Y=; b=EYOwZCJfMUlY9HF6pHvy/MxaUFFHFALGlk67UulNB+uH2XjdTPrXUWwokPXheKxcwE wRoxjgdTsmAF1aLTJ7pWdaf16Rj6/LaKw1MNDIWjgOQDgHBR/CDuf4HJy+B15kkRiJ2C YOUAV47uNCi0Q3EgIZscz/3dwRUSUkME+lphHSVH7Y1lOJVkVeDG6HuEFo9bbcKrw36t VJX5mQCXZ1pkeL2pmNpCqInQ8JjW1Lwxbm0x1O7FinpISUNBwfrKgTPqwoYZvUf9gqSd 7YVuqFDgDqG3gxH/8nzBrr8odKiggtCKPOslUX7+kmx9CidOCnL77/c8K7/yhYF/czbJ tYlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si1912396pfc.55.2019.05.23.18.19.04; Thu, 23 May 2019 18:19:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388911AbfEXBRD (ORCPT + 99 others); Thu, 23 May 2019 21:17:03 -0400 Received: from mga07.intel.com ([134.134.136.100]:15050 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388766AbfEXBQl (ORCPT ); Thu, 23 May 2019 21:16:41 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 May 2019 18:16:38 -0700 X-ExtLoop1: 1 Received: from unknown (HELO luv-build.sc.intel.com) ([172.25.110.25]) by fmsmga008.fm.intel.com with ESMTP; 23 May 2019 18:16:38 -0700 From: Ricardo Neri To: Thomas Gleixner , Ingo Molnar , Borislav Petkov Cc: Ashok Raj , Joerg Roedel , Andi Kleen , Peter Zijlstra , Suravee Suthikulpanit , Stephane Eranian , "Ravi V. Shankar" , Randy Dunlap , x86@kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Ricardo Neri , Ricardo Neri Subject: [RFC PATCH v4 17/21] x86/tsc: Switch to perf-based hardlockup detector if TSC become unstable Date: Thu, 23 May 2019 18:16:19 -0700 Message-Id: <1558660583-28561-18-git-send-email-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558660583-28561-1-git-send-email-ricardo.neri-calderon@linux.intel.com> References: <1558660583-28561-1-git-send-email-ricardo.neri-calderon@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The HPET-based hardlockup detector relies on the TSC to determine if an observed NMI interrupt was originated by HPET timer. Hence, this detector can no longer be used with an unstable TSC. In such case, permanently stop the HPET-based hardlockup detector and start the perf-based detector. Signed-off-by: Ricardo Neri --- arch/x86/include/asm/hpet.h | 2 ++ arch/x86/kernel/tsc.c | 2 ++ arch/x86/kernel/watchdog_hld.c | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/arch/x86/include/asm/hpet.h b/arch/x86/include/asm/hpet.h index fd99f2390714..a82cbe17479d 100644 --- a/arch/x86/include/asm/hpet.h +++ b/arch/x86/include/asm/hpet.h @@ -128,6 +128,7 @@ extern int hardlockup_detector_hpet_init(void); extern void hardlockup_detector_hpet_stop(void); extern void hardlockup_detector_hpet_enable(unsigned int cpu); extern void hardlockup_detector_hpet_disable(unsigned int cpu); +extern void hardlockup_detector_switch_to_perf(void); #else static inline struct hpet_hld_data *hpet_hardlockup_detector_assign_timer(void) { return NULL; } @@ -136,6 +137,7 @@ static inline int hardlockup_detector_hpet_init(void) static inline void hardlockup_detector_hpet_stop(void) {} static inline void hardlockup_detector_hpet_enable(unsigned int cpu) {} static inline void hardlockup_detector_hpet_disable(unsigned int cpu) {} +static void harrdlockup_detector_switch_to_perf(void) {} #endif /* CONFIG_X86_HARDLOCKUP_DETECTOR_HPET */ #else /* CONFIG_HPET_TIMER */ diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 59b57605e66c..b2210728ce3d 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -1158,6 +1158,8 @@ void mark_tsc_unstable(char *reason) clocksource_mark_unstable(&clocksource_tsc_early); clocksource_mark_unstable(&clocksource_tsc); + + hardlockup_detector_switch_to_perf(); } EXPORT_SYMBOL_GPL(mark_tsc_unstable); diff --git a/arch/x86/kernel/watchdog_hld.c b/arch/x86/kernel/watchdog_hld.c index c2512d4c79c5..c8547c227a41 100644 --- a/arch/x86/kernel/watchdog_hld.c +++ b/arch/x86/kernel/watchdog_hld.c @@ -76,3 +76,10 @@ void watchdog_nmi_stop(void) if (detector_type == X86_HARDLOCKUP_DETECTOR_HPET) hardlockup_detector_hpet_stop(); } + +void hardlockup_detector_switch_to_perf(void) +{ + detector_type = X86_HARDLOCKUP_DETECTOR_PERF; + hardlockup_detector_hpet_stop(); + hardlockup_start_all(); +} -- 2.17.1