Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1588833

Re: tip.today - scheduler bam boom crash (cpu hotplug)

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: tip.today - scheduler bam boom crash (cpu hotplug)
Date 2017-02-27 18:30 +0100
Message-ID <tfxhv-jQ-9@gated-at.bofh.it> (permalink)
References (6 earlier) <tfvz5-7vd-45@gated-at.bofh.it> <tfvz5-7vd-43@gated-at.bofh.it> <tfwls-86h-17@gated-at.bofh.it> <tfwls-86h-15@gated-at.bofh.it> <tfwv8-8at-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: tip.today - scheduler bam boom crash (cpu hotplug) Wanpeng Li <kernellwp@gmail.com> - 2017-02-27 13:40 +0100
  Re: tip.today - scheduler bam boom crash (cpu hotplug) Peter Zijlstra <peterz@infradead.org> - 2017-02-27 13:50 +0100
    Re: tip.today - scheduler bam boom crash (cpu hotplug) Paolo Bonzini <pbonzini@redhat.com> - 2017-02-27 14:00 +0100
      Re: tip.today - scheduler bam boom crash (cpu hotplug) Paolo Bonzini <pbonzini@redhat.com> - 2017-02-27 16:40 +0100
        Re: tip.today - scheduler bam boom crash (cpu hotplug) Paolo Bonzini <pbonzini@redhat.com> - 2017-02-27 17:30 +0100
          Re: tip.today - scheduler bam boom crash (cpu hotplug) Peter Zijlstra <peterz@infradead.org> - 2017-02-27 17:40 +0100
            Re: tip.today - scheduler bam boom crash (cpu hotplug) Paolo Bonzini <pbonzini@redhat.com> - 2017-02-27 18:30 +0100
              Re: tip.today - scheduler bam boom crash (cpu hotplug) Thomas Gleixner <tglx@linutronix.de> - 2017-02-27 19:10 +0100
                Re: tip.today - scheduler bam boom crash (cpu hotplug) Paolo Bonzini <pbonzini@redhat.com> - 2017-02-27 20:10 +0100
                Re: tip.today - scheduler bam boom crash (cpu hotplug) Peter Zijlstra <peterz@infradead.org> - 2017-02-28 00:00 +0100
          Re: tip.today - scheduler bam boom crash (cpu hotplug) Wanpeng Li <kernellwp@gmail.com> - 2017-02-28 03:00 +0100
            Re: tip.today - scheduler bam boom crash (cpu hotplug) Peter Zijlstra <peterz@infradead.org> - 2017-02-28 09:10 +0100
              Re: tip.today - scheduler bam boom crash (cpu hotplug) Wanpeng Li <kernellwp@gmail.com> - 2017-02-28 09:20 +0100
        Re: tip.today - scheduler bam boom crash (cpu hotplug) Peter Zijlstra <peterz@infradead.org> - 2017-02-27 17:50 +0100
      Re: tip.today - scheduler bam boom crash (cpu hotplug) Peter Zijlstra <peterz@infradead.org> - 2017-02-27 23:50 +0100
    Re: tip.today - scheduler bam boom crash (cpu hotplug) Wanpeng Li <kernellwp@gmail.com> - 2017-02-27 15:00 +0100
      Re: tip.today - scheduler bam boom crash (cpu hotplug) Peter Zijlstra <peterz@infradead.org> - 2017-02-27 15:50 +0100
  Re: tip.today - scheduler bam boom crash (cpu hotplug) Paolo Bonzini <pbonzini@redhat.com> - 2017-02-27 16:10 +0100

csiph-web