lkml.org 
[lkml]   [2018]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v10 1/7] x86/tsc: remove tsc_disabled flag
    Date
    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 <pasha.tatashin@oracle.com>
    Reviewed-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
    ---
    arch/x86/kernel/tsc.c | 18 +++---------------
    1 file changed, 3 insertions(+), 15 deletions(-)

    diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
    index 74392d9d51e0..186395041725 100644
    --- a/arch/x86/kernel/tsc.c
    +++ b/arch/x86/kernel/tsc.c
    @@ -38,11 +38,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;
    @@ -248,8 +243,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
    @@ -1307,7 +1301,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_unstable)
    @@ -1414,12 +1408,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)
    @@ -1455,7 +1443,7 @@ unsigned long calibrate_delay_is_known(void)
    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 (!constant_tsc || !mask)
    return 0;

    sibling = cpumask_any_but(mask, cpu);
    --
    2.17.1
    \
     
     \ /
      Last update: 2018-06-15 19:45    [W:4.233 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site