x86/iopl: Fix iopl capability check on Xen PV
[pandora-kernel.git] / arch / x86 / xen / time.c
index 0296a95..1a82319 100644 (file)
@@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
 /* snapshots of runstate info */
 static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
 
-/* unused ns of stolen and blocked time */
+/* unused ns of stolen time */
 static DEFINE_PER_CPU(u64, xen_residual_stolen);
-static DEFINE_PER_CPU(u64, xen_residual_blocked);
 
 /* return an consistent snapshot of 64-bit time/counter value */
 static u64 get64(const u64 *p)
@@ -115,7 +114,7 @@ static void do_stolen_accounting(void)
 {
        struct vcpu_runstate_info state;
        struct vcpu_runstate_info *snap;
-       s64 blocked, runnable, offline, stolen;
+       s64 runnable, offline, stolen;
        cputime_t ticks;
 
        get_runstate_snapshot(&state);
@@ -125,7 +124,6 @@ static void do_stolen_accounting(void)
        snap = &__get_cpu_var(xen_runstate_snapshot);
 
        /* work out how much time the VCPU has not been runn*ing*  */
-       blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
        runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable];
        offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
 
@@ -141,17 +139,6 @@ static void do_stolen_accounting(void)
        ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
        __this_cpu_write(xen_residual_stolen, stolen);
        account_steal_ticks(ticks);
-
-       /* Add the appropriate number of ticks of blocked time,
-          including any left-overs from last time. */
-       blocked += __this_cpu_read(xen_residual_blocked);
-
-       if (blocked < 0)
-               blocked = 0;
-
-       ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
-       __this_cpu_write(xen_residual_blocked, blocked);
-       account_idle_ticks(ticks);
 }
 
 /* Get the TSC speed from Xen */
@@ -410,7 +397,7 @@ void xen_setup_timer(int cpu)
        irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
                                      IRQF_DISABLED|IRQF_PERCPU|
                                      IRQF_NOBALANCING|IRQF_TIMER|
-                                     IRQF_FORCE_RESUME,
+                                     IRQF_FORCE_RESUME|IRQF_EARLY_RESUME,
                                      name, NULL);
 
        evt = &per_cpu(xen_clock_events, cpu);
@@ -497,7 +484,11 @@ static void xen_hvm_setup_cpu_clockevents(void)
 {
        int cpu = smp_processor_id();
        xen_setup_runstate_info(cpu);
-       xen_setup_timer(cpu);
+       /*
+        * xen_setup_timer(cpu) - snprintf is bad in atomic context. Hence
+        * doing it xen_hvm_cpu_notify (which gets called by smp_init during
+        * early bootup and also during CPU hotplug events).
+        */
        xen_setup_cpu_clockevents();
 }