Received: by 10.223.164.202 with SMTP id h10csp2827470wrb; Sun, 12 Nov 2017 19:53:11 -0800 (PST) X-Google-Smtp-Source: AGs4zMZryZ08z9fZ9SzuM1x1WdYzZMyCvxuyVubf6tNfXI+fvDcQs4neur/v6nxN2DBK0XFXRWlA X-Received: by 10.101.93.12 with SMTP id e12mr7439095pgr.214.1510545191414; Sun, 12 Nov 2017 19:53:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510545191; cv=none; d=google.com; s=arc-20160816; b=HomcMC6kSnTqRxizKtU2CkNcqdxJ6SIacjzSzAIuXpzlTL788m1sCNMYxXDPerSHAH P5maG/Pu1WVl2MBmdvnOmsplUNwgk4SZXhZe3zKnsxdNK9Dewm2AOP7hX1TIV/LYsveG PrNYYmbo7iV39LJYlWLaoElFkBEh4B4/W5i8+hjQ9NYzmCjLAmfaH9/5+1cVgZd0M0Or 7TIBBP5l9MLbFp8R5pjk+I/Bv1nBq4uuSAPAnn3tdNujr84RJqlYj/7eFw18QxticE8j 5fqr3tl5BVYHM9pKWCpYeHjbbA7aRkA13KQvlikUQbQ18XKx9/NX+HlbU+8l2JXqjRVZ e20Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject :arc-authentication-results; bh=bHIVQH1KRyfzonUvzIVAXEPMjh6oS5jbUme3s6Ka+40=; b=0VEOR7MvT6EMJEODubki00oEWGQ+W315MVVV1Y9Ho5yDqE4rL4tYST3RrymlcNwJel HdKsNSBGExp/pXehS1YY97YrXYxraqIP4CqeWALM+OyKP2B+agpxhUVnQkTMFdZI/5xB HwMx/Pdz2gnYokgdZlHi94x8TYh0m8DDCr4/KeT47eMYTPc6rzYp/JSvPmL1Wr3c1Scf sH5d32amFNRdW40LS6FOOJboYmzDbMG77SwLePDFxOZYN5giOlCuazRM5vAScd9qyJ+M /mu5EenRMyDbuKTVn5JNmC99xOzOYT9zKwRA4+qSYftdxaCLc9yb+29u6VElvChD8NkF FVUw== 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 l3si12844034pgr.804.2017.11.12.19.52.58; Sun, 12 Nov 2017 19:53:11 -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 S1751755AbdKMDwW (ORCPT + 87 others); Sun, 12 Nov 2017 22:52:22 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:44639 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751349AbdKMDwW (ORCPT ); Sun, 12 Nov 2017 22:52:22 -0500 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="30121291" Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 13 Nov 2017 11:52:19 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 50AAF480D725; Mon, 13 Nov 2017 11:52:16 +0800 (CST) Received: from localhost.localdomain (10.167.226.106) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 13 Nov 2017 11:52:18 +0800 Subject: Re: [PATCH v8 1/6] x86/tsc: remove tsc_disabled flag To: Pavel Tatashin , , , , , , , , , , , , References: <20171109030201.5991-1-pasha.tatashin@oracle.com> <20171109030201.5991-2-pasha.tatashin@oracle.com> From: Dou Liyang Message-ID: Date: Mon, 13 Nov 2017 11:52:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171109030201.5991-2-pasha.tatashin@oracle.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: 50AAF480D725.A9FDD X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pavel, At 11/09/2017 11:01 AM, Pavel Tatashin wrote: > 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 I am not sure if I could add the signature. Anyway, it looks good to me. Reviewed-by: Dou Liyang > --- > arch/x86/kernel/tsc.c | 19 +++---------------- > 1 file changed, 3 insertions(+), 16 deletions(-) > > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c > index 97907e152356..dbce6fa32aa9 100644 > --- a/arch/x86/kernel/tsc.c > +++ b/arch/x86/kernel/tsc.c > @@ -37,11 +37,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; > @@ -247,8 +242,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 > @@ -1229,7 +1223,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_clocksource_reliable) > @@ -1330,12 +1324,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) > @@ -1365,10 +1353,9 @@ void __init tsc_init(void) > unsigned long calibrate_delay_is_known(void) > { > int sibling, cpu = smp_processor_id(); > - 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 (!cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC) || !mask) > return 0; > > sibling = cpumask_any_but(mask, cpu); > From 1583556112237079209@xxx Thu Nov 09 03:06:32 +0000 2017 X-GM-THRID: 1582976283006455482 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread