~ubuntu-branches/ubuntu/trusty/linux-linaro-u8500/trusty

« back to all changes in this revision

Viewing changes to arch/x86/vdso/vclock_gettime.c

  • Committer: Bazaar Package Importer
  • Author(s): John Rigby, Upstream Fixes, Andy Green, John Rigby
  • Date: 2011-04-14 12:16:06 UTC
  • Revision ID: james.westby@ubuntu.com-20110414121606-b77podkyqgr2oix7
Tags: 2.6.38-1002.3
[ Upstream Fixes ]

* MUSB: shutdown: Make sure block is awake before doing shutdown
  - LP: #745737
* Fixed gpio polarity of gpio USB-phy reset.
  - LP: #747639

[ Andy Green ]

* LINARO: SAUCE: disable CONFIG_OMAP_RESET_CLOCKS
  - LP: #752900

[ John Rigby ]

* Rebase to new upstreams:
  Linux v2.6.38.1
  linaro-linux-2.6.38-upstream-29Mar2011
  Ubuntu-2.6.38-7.35
* SAUCE: OMAP4: clock: wait for module to become accessible on
  a clk enable
  - LP: #745737
* Rebase to new upstreams:
  Linux v2.6.38.2
  linaro-linux-2.6.38-upstream-5Apr2011
  Ubuntu-2.6.38-8.41
  - LP: #732842
* Update configs for device tree, dvfs and lttng
* LINARO: add building of dtb's
* LINARO: SAUCE: Disable lowest operating freqs on omap34xx
  - LP: #732912

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <asm/hpet.h>
23
23
#include <asm/unistd.h>
24
24
#include <asm/io.h>
 
25
#include <asm/trace-clock.h>
 
26
#include <asm/timer.h>
25
27
#include "vextern.h"
26
28
 
27
29
#define gtod vdso_vsyscall_gtod_data
111
113
        return 0;
112
114
}
113
115
 
 
116
/*
 
117
 * If the TSC is synchronized across all CPUs, read the current TSC
 
118
 * and export its value in the nsec field of the timespec
 
119
 */
 
120
notrace static noinline int do_trace_clock(struct timespec *ts)
 
121
{
 
122
        unsigned long seq;
 
123
        union lttng_timespec *lts = (union lttng_timespec *) ts;
 
124
 
 
125
        do {
 
126
                seq = read_seqbegin(&gtod->lock);
 
127
                if (unlikely(!gtod->trace_clock_is_sync))
 
128
                        return vdso_fallback_gettime(CLOCK_TRACE, ts);
 
129
                /*
 
130
                 * We don't protect the rdtsc with the rdtsc_barrier because
 
131
                 * we can't obtain with tracing that level of precision.
 
132
                 * The operation of recording an event is not atomic therefore
 
133
                 * the small chance of imprecision doesn't justify the overhead
 
134
                 * of a barrier.
 
135
                 */
 
136
                /*
 
137
                 * TODO: check that vget_cycles(), using paravirt ops, will
 
138
                 * match the TSC read by get_cycles() at the kernel level.
 
139
                 */
 
140
                lts->lttng_ts = vget_cycles();
 
141
        } while (unlikely(read_seqretry(&gtod->lock, seq)));
 
142
 
 
143
        return 0;
 
144
}
 
145
 
 
146
/*
 
147
 * Returns the cpu_khz, it needs to be a syscall because we can't access
 
148
 * this value from userspace and it will only be called at the beginning
 
149
 * of the tracing session
 
150
 */
 
151
notrace static noinline int do_trace_clock_freq(struct timespec *ts)
 
152
{
 
153
        return vdso_fallback_gettime(CLOCK_TRACE_FREQ, ts);
 
154
}
 
155
 
114
156
notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts)
115
157
{
116
158
        if (likely(gtod->sysctl_enabled))
127
169
                        return do_realtime_coarse(ts);
128
170
                case CLOCK_MONOTONIC_COARSE:
129
171
                        return do_monotonic_coarse(ts);
 
172
                case CLOCK_TRACE:
 
173
                        return do_trace_clock(ts);
 
174
                case CLOCK_TRACE_FREQ:
 
175
                        return do_trace_clock_freq(ts);
 
176
                default:
 
177
                        return -EINVAL;
130
178
                }
131
179
        return vdso_fallback_gettime(clock, ts);
132
180
}