Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7371404imu; Mon, 3 Dec 2018 11:48:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/U9u6CC+zk7UYt4Q3nb4iyhDiNcVao8au+oWieel3A9FCa/ZMvJfSGYKFHUb9r134XvZvxu X-Received: by 2002:a62:ea09:: with SMTP id t9mr12786609pfh.228.1543866497389; Mon, 03 Dec 2018 11:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543866497; cv=none; d=google.com; s=arc-20160816; b=JxmPVLUTIa2ix/IIhWLCBF1BHOShnxImN8mL8bkhK3mwgB0rW22leqiZjhA47eCljP R5lQrGB+cv9D2dE9UHZ2KrJRkE7KznSPq2NwqdfC7NwGMTStmIIs4vsCweNfZtzoyrgC iuw/1T4vl9JK/KOghPNi+pg+XTcGMJtKdI5x5CTiVUYz2kiHZobnZGloBWOiIHscuPee MRjc5T1PEvjWCECEwYxOA4xiAsaYviwulyUgHTBxiDwYlTz+p2kBweK9PA0TY8Wnpcir 6P5u1DBDD8VZZc5Kg5QMOamxOOUXKCXbBGVf9uRyv2EoJ2rVEKl1z88IZ/JT19u3Fay1 6xUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=JJm575QL8MC+RSSQIZyB6pCWK5TMGw6hz68T6cjGQtE=; b=0vdUVQV2Va/iR0UKCX1csnHPnW/yyLrJIDQaUlQ9wnYWexfkwZxRkvBD3iQU22di+9 Cf7IJpLMJgn+lOHVvFq2DlBSMQUrm9CTKB8g1ABFVCeUpnWzI9Ny+vAy5NCIgde5wqka jWPckH3l8qiVqqQEeKsk+/9tBtHAQGy+izXBjWm5eVVHLurvKQ56BCdg47rrRxNbw0gL 90dOTuEfuDbmBqtdLvCCAxIiPbmGsHlFGsljwTq0hq3Gptl/BE5+Nz6eLOCnzZlhYVSJ RhN06L4hLlbujBN/uQXooqaxw7ZrLJdrEbsZfvdkzjMuRz/0mRr3diHkGJkO2l9ZOp3L HheQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l8si14122929pgr.345.2018.12.03.11.48.01; Mon, 03 Dec 2018 11:48:17 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726031AbeLCTqL convert rfc822-to-8bit (ORCPT + 99 others); Mon, 3 Dec 2018 14:46:11 -0500 Received: from mga.supermicro.com ([207.212.57.84]:33650 "EHLO MGA.supermicro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbeLCTqL (ORCPT ); Mon, 3 Dec 2018 14:46:11 -0500 X-Greylist: delayed 453 seconds by postgrey-1.27 at vger.kernel.org; Mon, 03 Dec 2018 14:46:11 EST Received: from pps.filterd (MGA.supermicro.com [127.0.0.1]) by MGA.supermicro.com (8.16.0.22/8.16.0.22) with SMTP id wB3JYejD028919; Mon, 3 Dec 2018 11:37:33 -0800 Received: from ex2013-mbx3.supermicro.com (EX2013-MBX3.supermicro.com [10.2.1.46]) by MGA.supermicro.com with ESMTP id 2p3tsvsmv7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 03 Dec 2018 11:37:33 -0800 Received: from EX2013-MBX2.supermicro.com (10.2.1.38) by EX2013-MBX3.supermicro.com (10.2.1.46) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Mon, 3 Dec 2018 11:37:24 -0800 Received: from EX2013-MBX2.supermicro.com ([::1]) by Ex2013-MBX2.supermicro.com ([fe80::80ad:66c2:9e01:4b74%18]) with mapi id 15.00.1236.000; Mon, 3 Dec 2018 11:37:24 -0800 From: Patrick Geary To: Prarit Bhargava , "Brown, Len" , "linux-kernel@vger.kernel.org" CC: "mingo@kernel.org" , "Du, Alek" , "arjan@linux.intel.com" , "Tang, Feng" Subject: Re: [RFC] x86, tsc: Add kcmdline args for skipping tsc calibration sequences Thread-Topic: [RFC] x86, tsc: Add kcmdline args for skipping tsc calibration sequences Thread-Index: AQHUGt5AveUKS9tr5UqDaitbRIV+waSOd8AAgApENgCABhwFAIADHfUAgCDhbYCAbf6ZAIAAgwoA//+e3wCAPVDI8w== Date: Mon, 3 Dec 2018 19:37:24 +0000 Message-ID: <1543865843219.51523@supermicro.com> References: <1A7043D5F58CCB44A599DFD55ED4C94849A1AACF@FMSMSX126.amr.corp.intel.com> <94bebaa1-992b-572b-0d24-e08037611358@supermicro.com> <70cdf321-cef7-aa26-1ca8-33378b3afdd9@supermicro.com> <18d873f6-a911-200b-7bc7-8f4b4f3c5161@supermicro.com> <6e40fea8-9b42-3785-7d4d-36f120980d66@redhat.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.2.0.41] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-03_10:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'm sorry; I'm OoO and this is all I have for a mailer. ---Copypasta of first RFC patch--- --- diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 74392d9..5a07d12 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -47,6 +47,13 @@ static DEFINE_STATIC_KEY_FALSE(__use_tsc); int tsc_clocksource_reliable; +/* + * TSC calibration sequence disablement + */ +int calibrate_cpuid_khz_disabled = 0; +int calibrate_msr_disabled = 0; +int calibrate_quick_disabled = 0; + static u32 art_to_tsc_numerator; static u32 art_to_tsc_denominator; static u64 art_to_tsc_offset; @@ -281,6 +288,32 @@ static int __init tsc_setup(char *str) __setup("tsc=", tsc_setup); +static int __init setup_tsc_calibration_order(char *str) +{ + if (!str) + return -EINVAL; + + while (*str) { + if (!strncmp(str, "nocpuid", 7)) { + calibrate_cpuid_khz_disabled = 1; + pr_info("TSC CPUID khz calibrate disabled\n"); + } else if (!strncmp(str, "nomsr", 5)) { + calibrate_msr_disabled = 1; + pr_info("TSC msr calibrate disabled\n"); + } else if (!strncmp(str, "noquick", 7)) { + calibrate_quick_disabled = 1; + pr_info("TSC quick calibrate disabled\n"); + } + + str += strcspn(str, ","); + while (*str == ',') + str++; + } + return 1; +} + +__setup("tsc_calibrate=", setup_tsc_calibration_order); + #define MAX_RETRIES 5 #define SMI_TRESHOLD 50000 @@ -675,19 +708,25 @@ unsigned long native_calibrate_cpu(void) unsigned long flags, latch, ms, fast_calibrate; int hpet = is_hpet_enabled(), i, loopmin; - fast_calibrate = cpu_khz_from_cpuid(); - if (fast_calibrate) - return fast_calibrate; + if (!calibrate_cpuid_khz_disabled) { + fast_calibrate = cpu_khz_from_cpuid(); + if (fast_calibrate) + return fast_calibrate; + } - fast_calibrate = cpu_khz_from_msr(); - if (fast_calibrate) - return fast_calibrate; + if (!calibrate_msr_disabled) { + fast_calibrate = cpu_khz_from_msr(); + if (fast_calibrate) + return fast_calibrate; + } - local_irq_save(flags); - fast_calibrate = quick_pit_calibrate(); - local_irq_restore(flags); - if (fast_calibrate) - return fast_calibrate; + if (!calibrate_quick_disabled) { + local_irq_save(flags); + fast_calibrate = quick_pit_calibrate(); + local_irq_restore(flags); + if (fast_calibrate) + return fast_calibrate; + } /* * Run 5 calibration loops to get the lowest frequency value --- ________________________________________ From: patrickg Sent: Thursday, October 25, 2018 12:13 PM To: Prarit Bhargava; Brown, Len; linux-kernel@vger.kernel.org Cc: mingo@kernel.org; Du, Alek; arjan@linux.intel.com; Tang, Feng Subject: Re: [RFC] x86, tsc: Add kcmdline args for skipping tsc calibration sequences Sorry for the delay; lkml folder sorting gone wrong. On 10/25/18 11:01 AM, Prarit Bhargava wrote: > Patrick can you reply back with the entire patch Yes; watch the editor bork it even more than it originally did, though. ---Copypasta of first RFC patch--- --- diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 74392d9..5a07d12 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -47,6 +47,13 @@ static DEFINE_STATIC_KEY_FALSE(__use_tsc); int tsc_clocksource_reliable; +/* + * TSC calibration sequence disablement + */ +int calibrate_cpuid_khz_disabled = 0; +int calibrate_msr_disabled = 0; +int calibrate_quick_disabled = 0; + static u32 art_to_tsc_numerator; static u32 art_to_tsc_denominator; static u64 art_to_tsc_offset; @@ -281,6 +288,32 @@ static int __init tsc_setup(char *str) __setup("tsc=", tsc_setup); +static int __init setup_tsc_calibration_order(char *str) +{ + if (!str) + return -EINVAL; + + while (*str) { + if (!strncmp(str, "nocpuid", 7)) { + calibrate_cpuid_khz_disabled = 1; + pr_info("TSC CPUID khz calibrate disabled\n"); + } else if (!strncmp(str, "nomsr", 5)) { + calibrate_msr_disabled = 1; + pr_info("TSC msr calibrate disabled\n"); + } else if (!strncmp(str, "noquick", 7)) { + calibrate_quick_disabled = 1; + pr_info("TSC quick calibrate disabled\n"); + } + + str += strcspn(str, ","); + while (*str == ',') + str++; + } + return 1; +} + +__setup("tsc_calibrate=", setup_tsc_calibration_order); + #define MAX_RETRIES 5 #define SMI_TRESHOLD 50000 @@ -675,19 +708,25 @@ unsigned long native_calibrate_cpu(void) unsigned long flags, latch, ms, fast_calibrate; int hpet = is_hpet_enabled(), i, loopmin; - fast_calibrate = cpu_khz_from_cpuid(); - if (fast_calibrate) - return fast_calibrate; + if (!calibrate_cpuid_khz_disabled) { + fast_calibrate = cpu_khz_from_cpuid(); + if (fast_calibrate) + return fast_calibrate; + } - fast_calibrate = cpu_khz_from_msr(); - if (fast_calibrate) - return fast_calibrate; + if (!calibrate_msr_disabled) { + fast_calibrate = cpu_khz_from_msr(); + if (fast_calibrate) + return fast_calibrate; + } - local_irq_save(flags); - fast_calibrate = quick_pit_calibrate(); - local_irq_restore(flags); - if (fast_calibrate) - return fast_calibrate; + if (!calibrate_quick_disabled) { + local_irq_save(flags); + fast_calibrate = quick_pit_calibrate(); + local_irq_restore(flags); + if (fast_calibrate) + return fast_calibrate; + } /* * Run 5 calibration loops to get the lowest frequency value ---