x86/tsc: Be consistent about use_tsc_delay()
JIRA: https://issues.redhat.com/browse/RHEL-20163 commit 69f8aeab437c6bae1394673154917e0a218edb44 Author: Peter Zijlstra <peterz@infradead.org> Date: Fri Mar 4 16:19:54 2022 +0100 x86/tsc: Be consistent about use_tsc_delay() Currently loops_per_jiffy is set in tsc_early_init(), but then don't switch to delay_tsc, with the result that delay_loop is used with loops_per_jiffy set for delay_tsc. Then in (late) tsc_init() lpj_fine is set (which is mostly unused) and after which use_tsc_delay() is finally called. Move both loops_per_jiffy and use_tsc_delay() into tsc_enable_sched_clock() which is called the moment tsc_khz is determined, be it early or late. Keeping the lot consistent. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20220304152135.914397165@infradead.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
This commit is contained in:
parent
baa8a84bd1
commit
0faeb8e095
|
@ -1513,6 +1513,9 @@ static unsigned long __init get_loops_per_jiffy(void)
|
||||||
|
|
||||||
static void __init tsc_enable_sched_clock(void)
|
static void __init tsc_enable_sched_clock(void)
|
||||||
{
|
{
|
||||||
|
loops_per_jiffy = get_loops_per_jiffy();
|
||||||
|
use_tsc_delay();
|
||||||
|
|
||||||
/* Sanitize TSC ADJUST before cyc2ns gets initialized */
|
/* Sanitize TSC ADJUST before cyc2ns gets initialized */
|
||||||
tsc_store_and_check_tsc_adjust(true);
|
tsc_store_and_check_tsc_adjust(true);
|
||||||
cyc2ns_init_boot_cpu();
|
cyc2ns_init_boot_cpu();
|
||||||
|
@ -1528,8 +1531,6 @@ void __init tsc_early_init(void)
|
||||||
return;
|
return;
|
||||||
if (!determine_cpu_tsc_frequencies(true))
|
if (!determine_cpu_tsc_frequencies(true))
|
||||||
return;
|
return;
|
||||||
loops_per_jiffy = get_loops_per_jiffy();
|
|
||||||
|
|
||||||
tsc_enable_sched_clock();
|
tsc_enable_sched_clock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1563,7 +1564,6 @@ void __init tsc_init(void)
|
||||||
enable_sched_clock_irqtime();
|
enable_sched_clock_irqtime();
|
||||||
|
|
||||||
lpj_fine = get_loops_per_jiffy();
|
lpj_fine = get_loops_per_jiffy();
|
||||||
use_tsc_delay();
|
|
||||||
|
|
||||||
check_system_tsc_reliable();
|
check_system_tsc_reliable();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue