lkml.org 
[lkml]   [2007]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3/10] allow sched clock to be overridden by paravirt
    Date
    This patch turns the sched_clock into native_sched_clock.
    sched clock becomes a weak symbol, which can then give its
    place to a paravirt definition.

    Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
    ---
    arch/x86/kernel/tsc_64.c | 15 ++++++++++++++-
    1 files changed, 14 insertions(+), 1 deletions(-)

    diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
    index 9c70af4..5158476 100644
    --- a/arch/x86/kernel/tsc_64.c
    +++ b/arch/x86/kernel/tsc_64.c
    @@ -30,7 +30,7 @@ static unsigned long long cycles_2_ns(unsigned long long cyc)
    return (cyc * cyc2ns_scale) >> NS_SCALE;
    }

    -unsigned long long sched_clock(void)
    +unsigned long long native_sched_clock(void)
    {
    unsigned long a = 0;

    @@ -44,6 +44,19 @@ unsigned long long sched_clock(void)
    return cycles_2_ns(a);
    }

    +/* We need to define a real function for sched_clock, to override the
    + weak default version */
    +#ifdef CONFIG_PARAVIRT
    +unsigned long long sched_clock(void)
    +{
    + return paravirt_sched_clock();
    +}
    +#else
    +unsigned long long
    +sched_clock(void) __attribute__((alias("native_sched_clock")));
    +#endif
    +
    +
    static int tsc_unstable;

    inline int check_tsc_unstable(void)
    --
    1.4.4.2


    \
     
     \ /
      Last update: 2007-12-04 14:57    [W:0.020 / U:119.936 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site