Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1074837imm; Fri, 15 Jun 2018 10:45:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJrzK9CF+jHZDf8gSRCuQnyYypwCpdkwCX/wHn9Eq3sxF1gOfZo5xfYBqyD9MFfrgRXW/4c X-Received: by 2002:a62:808f:: with SMTP id j137-v6mr2994644pfd.91.1529084745020; Fri, 15 Jun 2018 10:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529084744; cv=none; d=google.com; s=arc-20160816; b=09pDpyI4V8DgD5tt24DxPY6vYemAV8hI52kXeUpiqS0zCTEj6iXo415ItVGt8TB41N uqOwWUS1TcafYduB20KmaKiG/IB4Ds/32s30lMwXq0WKgNqinnbFUhHyl0Al1jLgiAfh dal0mLW95CiDfJ78F/Ky2lEO7njd5TWu3dO0c5BUd8Q8D3wn8Yi1n2vy2lHSAWs2Yw8S 5lMMjPGu2JmE5NrSdJySZy5iTRriIYOTPLgclYpR/VU4UiteeU82DGpMCZPLG8spMELe XaLmBFbPSCfgg4/YFFmtASeDaGPHRyvLcdCfLszFpLUlE7INVI+Tb7wUtWmicB/ye/Bu 3NTA== 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=QZZNDBMtLradJ4r2PazNNQLYAzjOsg9w4tRyYGQqI7A=; b=Hd2gEYT/pnj2Gp1/qJEnBXppw8kAp0RGrH9tbNtw/RM13QOcvI9MBvvqnOFldrl5m6 1b+bbMQ2f21gbLNcim0RemOdmz4wnXbAGqlTQT6HzfEP2bFk2Q9GOUN+L3lgxQ3Jxhal 6+CIAPJ8tXoj+MjRG2cmK014ykAFmF4h7Y0jRdY32ImePmo3a5KqD1AVlJK9wPKdLI9I pyPqpJTnQGCskxpzpfSW2KLzj3Fry5N1RhKHTClkgmuTkDW+KD6VTeOkMgoNDUyNHIQV 1r1tNBL19XjGQ9LSjjfzg1o4zgnGOBkaUwmfYVcYRKjaq07dzlUb7pc1oNxC0uF9zLEM 4EWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=ljMbKcHX; 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 k9-v6si7092037pgf.60.2018.06.15.10.45.30; Fri, 15 Jun 2018 10:45:44 -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-2017-10-26 header.b=ljMbKcHX; 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 S966370AbeFORnj (ORCPT + 99 others); Fri, 15 Jun 2018 13:43:39 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:59012 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966075AbeFORnP (ORCPT ); Fri, 15 Jun 2018 13:43:15 -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 w5FHcmiI139454; Fri, 15 Jun 2018 17:42:15 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-2017-10-26; bh=QZZNDBMtLradJ4r2PazNNQLYAzjOsg9w4tRyYGQqI7A=; b=ljMbKcHXPH/jVAAeCclJ2HY4ZOgNdVFVBphGsPiSPAriAqGiMOUXs5evu7TAcWtXYKDJ oBq+0AMQX7xBe7/kV2SEZQuLSV14gw5f0LtuHqF7nUE0fy7TN732DCJfxgxzerOcjUBM NJj6T6JZfOqWSxGho0KX1d+cZStXyhupFb8Fs7J1LSuO0wJP914bY/wR0n1bHF6f085w 9IIq7bB/c3ibJg4Zx0yN/5TEg0PIB88VZU/lG6O9iMI+eyH2EgAG3rt7T4kkgYFyMAqI v9LqZ5/M54QcprmYqHKzrO/h3gzuMqJsUs67pXi0hzbRcmuq0RyAk6TjUSNKLxBw2qWd LQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2jk0xr1vy7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jun 2018 17:42:15 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w5FHgE43002155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 15 Jun 2018 17:42:14 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5FHgCAt004391; Fri, 15 Jun 2018 17:42:12 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 15 Jun 2018 10:42:12 -0700 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 Subject: [PATCH v10 1/7] x86/tsc: remove tsc_disabled flag Date: Fri, 15 Jun 2018 13:41:58 -0400 Message-Id: <20180615174204.30581-2-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180615174204.30581-1-pasha.tatashin@oracle.com> References: <20180615174204.30581-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8925 signatures=668702 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-1805220000 definitions=main-1806150189 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org tsc_disabled is set when notsc is passed as kernel parameter. The reason we have notsc is to avoid timing problems on multi-socket systems. We already have a mechanism, however, to detect and resolve these issues by invoking tsc unstable path. Thus, make notsc to behave the same as tsc=unstable. Signed-off-by: Pavel Tatashin Reviewed-by: Dou Liyang --- arch/x86/kernel/tsc.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) 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.17.1