Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2137887imm; Thu, 19 Jul 2018 13:58:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdGTqSiILgk7xxZYL4sfN67W5uIME5I9gbxXxxlOHjK3Io8I97eGXx/+fUFH9lZPPSl8coW X-Received: by 2002:a63:4d06:: with SMTP id a6-v6mr11245071pgb.408.1532033903650; Thu, 19 Jul 2018 13:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532033903; cv=none; d=google.com; s=arc-20160816; b=iLLQHDcIhF5yXzEk/Uyos+Vld3r9/lydt0Yzau4WY3gUTtXYn24WRei1bouap0oqKm AZIez6QqFtRv2lsC9XBGlI6hR+/jJGTDsHCuoDhhnCMVmlMtxzHBzNFgPJzyTgstFWyq 3X5sSSH9exE8L0QmqbZQVoEIdP2b9eZoNy1jPGEJEt5SEWne4btuioqAP0jM/7ykUjsQ KT8DBfuVWwpNjZ+mJFKd0k90pmpMibhkppF4owPXwf+5Qr5mSTmEX44crVGMGlTPuczy YKg7S93RZR3jXx8vuPk6fOtgtS0sHmCMaapmJiLFOmJp9w3JItBi28GznXArSrBeDa53 UflA== 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:to:from:dkim-signature:arc-authentication-results; bh=vpVuqI3dCGRTRVqqUCAOO+Kfyc5A1QkjfDo78BnIP54=; b=CaVeGMyQGJSws3eP3jM5GrBF4ZAup2f16a0yxfHRqugrLiZyVr8OmdXKEts97Ncxf8 lKkwFmnit2n4EGLr90lG2U7QH8ikwS+1xCFUnP+oZivydfGXdSto49Omb5XZj7BGKdd/ qKTnoySKKHPXyREbwv9tp0qXtR2N0JWlIw8k2KR2bUQ95gy3owKEnk+VnYDcdOYPltAG EpgUvFPwyR+RntySoGzkudLuuxzwJOKf8rYEDZJTDx0yNsh1zc3AvK/6A0ERn2czwEGt ij3Lie9fpQSeyhyrFCZn54FB5NMOjZY3I+oNC5B6ru3nnqu+SjYACKXJ9Tlp+PU0Fxrc PPdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=Wi8ib9Pv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n128-v6si144830pfn.90.2018.07.19.13.58.08; Thu, 19 Jul 2018 13:58:23 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=Wi8ib9Pv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731190AbeGSVmL (ORCPT + 99 others); Thu, 19 Jul 2018 17:42:11 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:55570 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731069AbeGSVmK (ORCPT ); Thu, 19 Jul 2018 17:42:10 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6JKse1X186324; Thu, 19 Jul 2018 20:56:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=vpVuqI3dCGRTRVqqUCAOO+Kfyc5A1QkjfDo78BnIP54=; b=Wi8ib9PvEs+ervZrLk8P5mTP/GKF9anebuWzRTuzGwsAs7iUq5/shzsJSAghojvtd0RJ UFNydvnbBX3eFLuTQ5ccPDjnKUTayAMDCaawy8wpTRpELGKmUqtMjZyBctbXTpP3/g+p Hg8O+Ig9pC6G/8EtHbxJzmERuXmvYduVDYcgTwN3/xrxST3kWTiFsleyHbITHIOpigrs jglGd5nhfPszHz0ANiVi0mK6geRvR6kr3w2A1sNZyeqIag5b2gYo2KsTCVXyolTwBA4a SnDF/qrCuRlDGCh3WP9s5RBX0u52gq/uiKUYecGFSUGIEweAq1APVe+gwr3KCFL2G1Sw yg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2k7a3tca6c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jul 2018 20:56:33 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6JKuX19001253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jul 2018 20:56:33 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6JKuW0F003714; Thu, 19 Jul 2018 20:56:32 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 19 Jul 2018 20:56:32 +0000 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux@armlinux.org.uk, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, douly.fnst@cn.fujitsu.com, peterz@infradead.org, prarit@redhat.com, feng.tang@intel.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org, pasha.tatashin@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com, pbonzini@redhat.com Subject: [PATCH v15 11/26] x86/tsc: redefine notsc to behave as tsc=unstable Date: Thu, 19 Jul 2018 16:55:30 -0400 Message-Id: <20180719205545.16512-12-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180719205545.16512-1-pasha.tatashin@oracle.com> References: <20180719205545.16512-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8959 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807190218 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, notsc kernel parameter disables the use of tsc register by sched_clock(). However, this parameter does not prevent linux from accessing tsc in other places in kernel. The only rational to boot with notsc is to avoid timing discrepancies on multi-socket systems where different tsc frequencies may present, and thus fallback to jiffies for clock source. However, there is another method to solve the above problem, it is to boot with tsc=unstable parameter. This parameter allows sched_clock() to use tsc but in case tsc is outside of expected interval it is corrected back to a sane value. This is why there is no reason to keep notsc, and it can be removed. But, for compatibility reasons we will keep this parameter but change its definition to be the same as tsc=unstable. Signed-off-by: Pavel Tatashin Reviewed-by: Dou Liyang Reviewed-by: Thomas Gleixner --- .../admin-guide/kernel-parameters.txt | 2 -- Documentation/x86/x86_64/boot-options.txt | 4 +--- arch/x86/kernel/tsc.c | 18 +++--------------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 533ff5c68970..5aed30cd0350 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2835,8 +2835,6 @@ nosync [HW,M68K] Disables sync negotiation for all devices. - notsc [BUGS=X86-32] Disable Time Stamp Counter - nowatchdog [KNL] Disable both lockup detectors, i.e. soft-lockup and NMI watchdog (hard-lockup). diff --git a/Documentation/x86/x86_64/boot-options.txt b/Documentation/x86/x86_64/boot-options.txt index 8d109ef67ab6..66114ab4f9fe 100644 --- a/Documentation/x86/x86_64/boot-options.txt +++ b/Documentation/x86/x86_64/boot-options.txt @@ -92,9 +92,7 @@ APICs Timing notsc - Don't use the CPU time stamp counter to read the wall time. - This can be used to work around timing problems on multiprocessor systems - with not properly synchronized CPUs. + Deprecated, use tsc=unstable instead. nohpet Don't use the HPET timer. diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 74392d9d51e0..186395041725 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -38,11 +38,6 @@ EXPORT_SYMBOL(tsc_khz); */ static int __read_mostly tsc_unstable; -/* native_sched_clock() is called before tsc_init(), so - we must start with the TSC soft disabled to prevent - erroneous rdtsc usage on !boot_cpu_has(X86_FEATURE_TSC) processors */ -static int __read_mostly tsc_disabled = -1; - static DEFINE_STATIC_KEY_FALSE(__use_tsc); int tsc_clocksource_reliable; @@ -248,8 +243,7 @@ EXPORT_SYMBOL_GPL(check_tsc_unstable); #ifdef CONFIG_X86_TSC int __init notsc_setup(char *str) { - pr_warn("Kernel compiled with CONFIG_X86_TSC, cannot disable TSC completely\n"); - tsc_disabled = 1; + mark_tsc_unstable("boot parameter notsc"); return 1; } #else @@ -1307,7 +1301,7 @@ static void tsc_refine_calibration_work(struct work_struct *work) static int __init init_tsc_clocksource(void) { - if (!boot_cpu_has(X86_FEATURE_TSC) || tsc_disabled > 0 || !tsc_khz) + if (!boot_cpu_has(X86_FEATURE_TSC) || !tsc_khz) return 0; if (tsc_unstable) @@ -1414,12 +1408,6 @@ void __init tsc_init(void) set_cyc2ns_scale(tsc_khz, cpu, cyc); } - if (tsc_disabled > 0) - return; - - /* now allow native_sched_clock() to use rdtsc */ - - tsc_disabled = 0; static_branch_enable(&__use_tsc); if (!no_sched_irq_time) @@ -1455,7 +1443,7 @@ unsigned long calibrate_delay_is_known(void) int constant_tsc = cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC); const struct cpumask *mask = topology_core_cpumask(cpu); - if (tsc_disabled || !constant_tsc || !mask) + if (!constant_tsc || !mask) return 0; sibling = cpumask_any_but(mask, cpu); -- 2.18.0