From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1041454AbdDURKA (ORCPT ); Fri, 21 Apr 2017 13:10:00 -0400 Received: from merlin.infradead.org ([205.233.59.134]:40866 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422822AbdDURIV (ORCPT ); Fri, 21 Apr 2017 13:08:21 -0400 Message-Id: <20170421150733.958440647@infradead.org> User-Agent: quilt/0.63-1 Date: Fri, 21 Apr 2017 16:57:58 +0200 From: Peter Zijlstra To: tglx@linutronix.de, mingo@kernel.org Cc: linux-kernel@vger.kernel.org, ville.syrjala@linux.intel.com, daniel.lezcano@linaro.org, rafael.j.wysocki@intel.com, marta.lofstedt@intel.com, martin.peres@linux.intel.com, pasha.tatashin@oracle.com, peterz@infradead.org, daniel.vetter@ffwll.ch Subject: [PATCH 2/9] x86,tsc: Feed refined TSC calibration into sched_clock References: <20170421145756.305735607@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peterz-sched-clock-rubarb-2.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For the (older) CPUs that still need the refined TSC calibration, also update the sched_clock rate. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/kernel/tsc.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -1267,6 +1267,7 @@ static void tsc_refine_calibration_work( static int hpet; u64 tsc_stop, ref_stop, delta; unsigned long freq; + int cpu; /* Don't bother refining TSC on unstable systems */ if (check_tsc_unstable()) @@ -1317,6 +1318,10 @@ static void tsc_refine_calibration_work( /* Inform the TSC deadline clockevent devices about the recalibration */ lapic_update_tsc_freq(); + /* Update the sched_clock() rate to match the clocksource one */ + for_each_possible_cpu(cpu) + set_cyc2ns_scale(tsc_khz, cpu); + out: if (boot_cpu_has(X86_FEATURE_ART)) art_related_clocksource = &clocksource_tsc;