]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/s390/kernel/smp.c
[S390] vdso: compile fix
[linux-2.6-omap-h63xx.git] / arch / s390 / kernel / smp.c
index 3ed5c7a83c6c477e242ab411de06f7af35121f7a..2d337cbb9329c33e07f9dfccb2f51daa94269e30 100644 (file)
@@ -47,6 +47,7 @@
 #include <asm/lowcore.h>
 #include <asm/sclp.h>
 #include <asm/cpu.h>
+#include <asm/vdso.h>
 #include "entry.h"
 
 /*
@@ -500,6 +501,9 @@ static int __cpuinit smp_alloc_lowcore(int cpu)
                        goto out;
                lowcore->extended_save_area_addr = (u32) save_area;
        }
+#else
+       if (vdso_alloc_per_cpu(cpu, lowcore))
+               goto out;
 #endif
        lowcore_ptr[cpu] = lowcore;
        return 0;
@@ -522,6 +526,8 @@ static void smp_free_lowcore(int cpu)
 #ifndef CONFIG_64BIT
        if (MACHINE_HAS_IEEE)
                free_page((unsigned long) lowcore->extended_save_area_addr);
+#else
+       vdso_free_per_cpu(cpu, lowcore);
 #endif
        free_page(lowcore->panic_stack - PAGE_SIZE);
        free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER);
@@ -664,6 +670,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
        lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order);
        panic_stack = __get_free_page(GFP_KERNEL);
        async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
+       BUG_ON(!lowcore || !panic_stack || !async_stack);
 #ifndef CONFIG_64BIT
        if (MACHINE_HAS_IEEE)
                save_area = get_zeroed_page(GFP_KERNEL);
@@ -677,6 +684,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 #ifndef CONFIG_64BIT
        if (MACHINE_HAS_IEEE)
                lowcore->extended_save_area_addr = (u32) save_area;
+#else
+       if (vdso_alloc_per_cpu(smp_processor_id(), lowcore))
+               BUG();
 #endif
        set_prefix((u32)(unsigned long) lowcore);
        local_mcck_enable();
@@ -845,9 +855,11 @@ static ssize_t show_idle_count(struct sys_device *dev,
        unsigned long long idle_count;
 
        idle = &per_cpu(s390_idle, dev->id);
-       spin_lock_irq(&idle->lock);
+       spin_lock(&idle->lock);
        idle_count = idle->idle_count;
-       spin_unlock_irq(&idle->lock);
+       if (idle->idle_enter)
+               idle_count++;
+       spin_unlock(&idle->lock);
        return sprintf(buf, "%llu\n", idle_count);
 }
 static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL);
@@ -856,18 +868,17 @@ static ssize_t show_idle_time(struct sys_device *dev,
                                struct sysdev_attribute *attr, char *buf)
 {
        struct s390_idle_data *idle;
-       unsigned long long new_time;
+       unsigned long long now, idle_time, idle_enter;
 
        idle = &per_cpu(s390_idle, dev->id);
-       spin_lock_irq(&idle->lock);
-       if (idle->in_idle) {
-               new_time = get_clock();
-               idle->idle_time += new_time - idle->idle_enter;
-               idle->idle_enter = new_time;
-       }
-       new_time = idle->idle_time;
-       spin_unlock_irq(&idle->lock);
-       return sprintf(buf, "%llu\n", new_time >> 12);
+       spin_lock(&idle->lock);
+       now = get_clock();
+       idle_time = idle->idle_time;
+       idle_enter = idle->idle_enter;
+       if (idle_enter != 0ULL && idle_enter < now)
+               idle_time += now - idle_enter;
+       spin_unlock(&idle->lock);
+       return sprintf(buf, "%llu\n", idle_time >> 12);
 }
 static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL);