aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-09-19 14:38:25 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-09-19 14:38:25 -0400
commitf15f41383d466860f8b22f669da8c841f8d73c3b (patch)
tree527f4d443832deb11e592d6a7f33edd4b726b1ac /arch
parentdbe3ed1c078c193be34326728d494c5c4bc115e2 (diff)
parentc27da339698145a9383e052c1070a950d30da478 (diff)
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: [POWERPC] Fix timekeeping on PowerPC 601 [POWERPC] Don't expose clock vDSO functions when CPU has no timebase [POWERPC] spusched: Fix null pointer dereference in find_victim
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/time.c8
-rw-r--r--arch/powerpc/kernel/vdso.c12
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c4
3 files changed, 19 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 727a6699f2f4..c627cf86d1e3 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -239,7 +239,7 @@ static void snapshot_tb_and_purr(void *data)
239 struct cpu_purr_data *p = &__get_cpu_var(cpu_purr_data); 239 struct cpu_purr_data *p = &__get_cpu_var(cpu_purr_data);
240 240
241 local_irq_save(flags); 241 local_irq_save(flags);
242 p->tb = mftb(); 242 p->tb = get_tb_or_rtc();
243 p->purr = mfspr(SPRN_PURR); 243 p->purr = mfspr(SPRN_PURR);
244 wmb(); 244 wmb();
245 p->initialized = 1; 245 p->initialized = 1;
@@ -317,7 +317,7 @@ static void snapshot_purr(void)
317 */ 317 */
318void snapshot_timebase(void) 318void snapshot_timebase(void)
319{ 319{
320 __get_cpu_var(last_jiffy) = get_tb(); 320 __get_cpu_var(last_jiffy) = get_tb_or_rtc();
321 snapshot_purr(); 321 snapshot_purr();
322} 322}
323 323
@@ -684,6 +684,8 @@ void timer_interrupt(struct pt_regs * regs)
684 684
685 write_seqlock(&xtime_lock); 685 write_seqlock(&xtime_lock);
686 tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy; 686 tb_next_jiffy = tb_last_jiffy + tb_ticks_per_jiffy;
687 if (__USE_RTC() && tb_next_jiffy >= 1000000000)
688 tb_next_jiffy -= 1000000000;
687 if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) { 689 if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) {
688 tb_last_jiffy = tb_next_jiffy; 690 tb_last_jiffy = tb_next_jiffy;
689 do_timer(1); 691 do_timer(1);
@@ -977,7 +979,7 @@ void __init time_init(void)
977 tb_to_ns_scale = scale; 979 tb_to_ns_scale = scale;
978 tb_to_ns_shift = shift; 980 tb_to_ns_shift = shift;
979 /* Save the current timebase to pretty up CONFIG_PRINTK_TIME */ 981 /* Save the current timebase to pretty up CONFIG_PRINTK_TIME */
980 boot_tb = get_tb(); 982 boot_tb = get_tb_or_rtc();
981 983
982 tm = get_boot_time(); 984 tm = get_boot_time();
983 985
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index cef01e4e8989..213fa31ac537 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -98,6 +98,18 @@ static struct vdso_patch_def vdso_patches[] = {
98 CPU_FTR_USE_TB, 0, 98 CPU_FTR_USE_TB, 0,
99 "__kernel_gettimeofday", NULL 99 "__kernel_gettimeofday", NULL
100 }, 100 },
101 {
102 CPU_FTR_USE_TB, 0,
103 "__kernel_clock_gettime", NULL
104 },
105 {
106 CPU_FTR_USE_TB, 0,
107 "__kernel_clock_getres", NULL
108 },
109 {
110 CPU_FTR_USE_TB, 0,
111 "__kernel_get_tbfreq", NULL
112 },
101}; 113};
102 114
103/* 115/*
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index c784edd40ea7..5bebe7fbe056 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -579,7 +579,7 @@ static struct spu *find_victim(struct spu_context *ctx)
579 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) { 579 list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
580 struct spu_context *tmp = spu->ctx; 580 struct spu_context *tmp = spu->ctx;
581 581
582 if (tmp->prio > ctx->prio && 582 if (tmp && tmp->prio > ctx->prio &&
583 (!victim || tmp->prio > victim->prio)) 583 (!victim || tmp->prio > victim->prio))
584 victim = spu->ctx; 584 victim = spu->ctx;
585 } 585 }
@@ -611,9 +611,9 @@ static struct spu *find_victim(struct spu_context *ctx)
611 611
612 mutex_lock(&cbe_spu_info[node].list_mutex); 612 mutex_lock(&cbe_spu_info[node].list_mutex);
613 cbe_spu_info[node].nr_active--; 613 cbe_spu_info[node].nr_active--;
614 spu_unbind_context(spu, victim);
614 mutex_unlock(&cbe_spu_info[node].list_mutex); 615 mutex_unlock(&cbe_spu_info[node].list_mutex);
615 616
616 spu_unbind_context(spu, victim);
617 victim->stats.invol_ctx_switch++; 617 victim->stats.invol_ctx_switch++;
618 spu->stats.invol_ctx_switch++; 618 spu->stats.invol_ctx_switch++;
619 mutex_unlock(&victim->state_mutex); 619 mutex_unlock(&victim->state_mutex);