From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751485AbdB0R16 (ORCPT ); Mon, 27 Feb 2017 12:27:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37106 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751397AbdB0R14 (ORCPT ); Mon, 27 Feb 2017 12:27:56 -0500 Subject: Re: tip.today - scheduler bam boom crash (cpu hotplug) To: Peter Zijlstra References: <1484811069.17751.14.camel@gmx.de> <20170119101924.GJ6485@twins.programming.kicks-ass.net> <20170119133633.GB6536@twins.programming.kicks-ass.net> <20170227124349.GU6515@twins.programming.kicks-ass.net> <3e7c34e2-757b-19e9-f7e5-9bfaadd79e5d@redhat.com> <20170227130440.GW6500@twins.programming.kicks-ass.net> <15367170-e1c0-8901-7e15-940d8d699c21@redhat.com> <20170227155954.GY6500@twins.programming.kicks-ass.net> <111f89b9-22e3-5a0f-3469-6f64092521ff@redhat.com> <20170227163606.GZ6500@twins.programming.kicks-ass.net> Cc: Wanpeng Li , Mike Galbraith , LKML , Ingo Molnar , Thomas Gleixner , Borislav Petkov From: Paolo Bonzini Message-ID: Date: Mon, 27 Feb 2017 18:27:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170227163606.GZ6500@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 27 Feb 2017 17:27:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/02/2017 17:36, Peter Zijlstra wrote: > diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c > index 4e95b2e0d95f..bc3bbb6a8ab0 100644 > --- a/arch/x86/kernel/cpu/amd.c > +++ b/arch/x86/kernel/cpu/amd.c > @@ -555,10 +555,8 @@ static void early_init_amd(struct cpuinfo_x86 *c) > if (c->x86_power & (1 << 8)) { > set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); > set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); > - if (check_tsc_unstable()) > - clear_sched_clock_stable(); > } else { > - clear_sched_clock_stable(); > + mark_tsc_unstable("not invariant"); > } > > /* Bit 12 of 8000_0007 edx is accumulated power mechanism. */ > diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c > index 2c234a6d94c4..0fdff183aa30 100644 > --- a/arch/x86/kernel/cpu/centaur.c > +++ b/arch/x86/kernel/cpu/centaur.c > @@ -105,7 +105,7 @@ static void early_init_centaur(struct cpuinfo_x86 *c) > set_cpu_cap(c, X86_FEATURE_SYSENTER32); > #endif > > - clear_sched_clock_stable(); > + mark_tsc_unstable("not invariant"); > } > > static void init_centaur(struct cpuinfo_x86 *c) > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > index f07005e6f461..2b7ff648ea25 100644 > --- a/arch/x86/kernel/cpu/common.c > +++ b/arch/x86/kernel/cpu/common.c > @@ -86,7 +86,7 @@ static void default_init(struct cpuinfo_x86 *c) > strcpy(c->x86_model_id, "386"); > } > #endif > - clear_sched_clock_stable(); > + mark_tsc_unstable("not invariant"); > } > > static const struct cpu_dev default_cpu = { > @@ -1076,7 +1076,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) > if (this_cpu->c_init) > this_cpu->c_init(c); > else > - clear_sched_clock_stable(); > + mark_tsc_unstable("not invariant"); > > /* Disable the PN if appropriate */ > squash_the_stupid_serial_number(c); > diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c > index 47416f959a48..35057d67e864 100644 > --- a/arch/x86/kernel/cpu/cyrix.c > +++ b/arch/x86/kernel/cpu/cyrix.c > @@ -184,7 +184,7 @@ static void early_init_cyrix(struct cpuinfo_x86 *c) > set_cpu_cap(c, X86_FEATURE_CYRIX_ARR); > break; > } > - clear_sched_clock_stable(); > + mark_tsc_unstable("not invariant"); > } > > static void init_cyrix(struct cpuinfo_x86 *c) > diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c > index 017ecd3bb553..e0e192e43a4c 100644 > --- a/arch/x86/kernel/cpu/intel.c > +++ b/arch/x86/kernel/cpu/intel.c > @@ -161,10 +161,8 @@ static void early_init_intel(struct cpuinfo_x86 *c) > if (c->x86_power & (1 << 8)) { > set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); > set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC); > - if (check_tsc_unstable()) > - clear_sched_clock_stable(); > } else { > - clear_sched_clock_stable(); > + mark_tsc_unstable("not invariant"); > } > > /* Penwell and Cloverview have the TSC which doesn't sleep on S3 */ Doh, these are called _before_ kvmclock_init. But perhaps they can all be replaced by something like this: diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 2724dc82f992..3080b6877190 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -1398,6 +1398,9 @@ void __init tsc_init(void) use_tsc_delay(); + if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) + mark_tsc_unstable("not invariant"); + if (unsynchronized_tsc()) mark_tsc_unstable("TSCs unsynchronized"); The rest seems nice. Paolo