aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile
diff options
context:
space:
mode:
authorHenrik Austad <haustad@cisco.com>2013-03-26 08:16:42 +0100
committerChris Metcalf <cmetcalf@tilera.com>2013-03-26 13:52:16 -0400
commit39e8202bb3b83a826e5825b1a07bbbf30ae9a140 (patch)
treea4c2a4fd3198fd326836d61db3f39a49f5b722de /arch/tile
parentd9acae6baf41c0561f8c532b20cfd955fd1edc2d (diff)
downloadkernel_goldelico_gta04-39e8202bb3b83a826e5825b1a07bbbf30ae9a140.zip
kernel_goldelico_gta04-39e8202bb3b83a826e5825b1a07bbbf30ae9a140.tar.gz
kernel_goldelico_gta04-39e8202bb3b83a826e5825b1a07bbbf30ae9a140.tar.bz2
tile: ns2cycles should use __raw_get_cpu_var
ns2cycles use per_cpu variables, and will, eventually, find its way into smp_processor_id(). This is not safe in a preemptible kernel; preemption should ideally be disabled. BUG: using smp_processor_id() in preemptible [00000000] code: systemd-modules/367 caller is ns2cycles+0x40/0xb8 Starting stack dump of tid 367, pid 367 (systemd-modules) on cpu 2 at cycle 20969956421 frame 0: 0xfffffff70004b860 dump_stack+0x0/0x20 (sp 0xfffffe407993fa90) frame 1: 0xfffffff7006abc28 debug_smp_processor_id+0x1a8/0x1e0 (sp 0xfffffe407993fa90) frame 2: 0xfffffff7004d7b40 ns2cycles+0x40/0xb8 (sp 0xfffffe407993fab8) frame 3: 0xfffffff7004dc578 __ndelay+0x38/0x80 (sp 0xfffffe407993fae0) However, in this case: - the frequency is the same accross all cores - we use the data read-only - we do not scale the frequency Which means that we can use the __raw_get_cpu_var instead. Signed-off-by: Henrik Austad <haustad@cisco.com> Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile')
-rw-r--r--arch/tile/kernel/time.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index f6f50f2a..5ac397e 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -230,6 +230,10 @@ int setup_profiling_timer(unsigned int multiplier)
*/
cycles_t ns2cycles(unsigned long nsecs)
{
- struct clock_event_device *dev = &__get_cpu_var(tile_timer);
+ /*
+ * We do not have to disable preemption here as each core has the same
+ * clock frequency.
+ */
+ struct clock_event_device *dev = &__raw_get_cpu_var(tile_timer);
return ((u64)nsecs * dev->mult) >> dev->shift;
}