[IA64] use __ratelimit
[safe/jmp/linux-2.6] / arch / ia64 / kernel / irq_ia64.c
index 927ad02..f14c35f 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/kernel_stat.h>
-#include <linux/slab.h>
 #include <linux/ptrace.h>
 #include <linux/random.h>      /* for rand_initialize_irq() */
 #include <linux/signal.h>
@@ -30,6 +29,7 @@
 #include <linux/threads.h>
 #include <linux/bitops.h>
 #include <linux/irq.h>
+#include <linux/ratelimit.h>
 
 #include <asm/delay.h>
 #include <asm/intrinsics.h>
@@ -260,7 +260,6 @@ void __setup_vector_irq(int cpu)
 }
 
 #if defined(CONFIG_SMP) && (defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_DIG))
-#define IA64_IRQ_MOVE_VECTOR   IA64_DEF_FIRST_DEVICE_VECTOR
 
 static enum vector_domain_type {
        VECTOR_DOMAIN_NONE,
@@ -345,7 +344,7 @@ static irqreturn_t smp_irq_move_cleanup_interrupt(int irq, void *dev_id)
 
                desc = irq_desc + irq;
                cfg = irq_cfg + irq;
-               spin_lock(&desc->lock);
+               raw_spin_lock(&desc->lock);
                if (!cfg->move_cleanup_count)
                        goto unlock;
 
@@ -358,7 +357,7 @@ static irqreturn_t smp_irq_move_cleanup_interrupt(int irq, void *dev_id)
                spin_unlock_irqrestore(&vector_lock, flags);
                cfg->move_cleanup_count--;
        unlock:
-               spin_unlock(&desc->lock);
+               raw_spin_unlock(&desc->lock);
        }
        return IRQ_HANDLED;
 }
@@ -469,13 +468,9 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
                sp = ia64_getreg(_IA64_REG_SP);
 
                if ((sp - bsp) < 1024) {
-                       static unsigned char count;
-                       static long last_time;
+                       static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
 
-                       if (time_after(jiffies, last_time + 5 * HZ))
-                               count = 0;
-                       if (++count < 5) {
-                               last_time = jiffies;
+                       if (__ratelimit(&ratelimit)) {
                                printk("ia64_handle_irq: DANGER: less than "
                                       "1KB of free stack space!!\n"
                                       "(bsp=0x%lx, sp=%lx)\n", bsp, sp);
@@ -493,16 +488,15 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
        saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
        ia64_srlz_d();
        while (vector != IA64_SPURIOUS_INT_VECTOR) {
-               struct irq_desc *desc = irq_to_desc(vector);
+               int irq = local_vector_to_irq(vector);
+               struct irq_desc *desc = irq_to_desc(irq);
 
                if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {
                        smp_local_flush_tlb();
-                       kstat_incr_irqs_this_cpu(vector, desc);
-               } else if (unlikely(IS_RESCHEDULE(vector)))
-                       kstat_incr_irqs_this_cpu(vector, desc);
-               else {
-                       int irq = local_vector_to_irq(vector);
-
+                       kstat_incr_irqs_this_cpu(irq, desc);
+               } else if (unlikely(IS_RESCHEDULE(vector))) {
+                       kstat_incr_irqs_this_cpu(irq, desc);
+               } else {
                        ia64_setreg(_IA64_REG_CR_TPR, vector);
                        ia64_srlz_d();
 
@@ -545,24 +539,24 @@ void ia64_process_pending_intr(void)
 
        vector = ia64_get_ivr();
 
-        irq_enter();
-        saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
-        ia64_srlz_d();
+       irq_enter();
+       saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
+       ia64_srlz_d();
 
         /*
          * Perform normal interrupt style processing
          */
        while (vector != IA64_SPURIOUS_INT_VECTOR) {
-               struct irq_desc *desc = irq_to_desc(vector);
+               int irq = local_vector_to_irq(vector);
+               struct irq_desc *desc = irq_to_desc(irq);
 
                if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {
                        smp_local_flush_tlb();
-                       kstat_incr_irqs_this_cpu(vector, desc);
-               } else if (unlikely(IS_RESCHEDULE(vector)))
-                       kstat_incr_irqs_this_cpu(vector, desc);
-               else {
+                       kstat_incr_irqs_this_cpu(irq, desc);
+               } else if (unlikely(IS_RESCHEDULE(vector))) {
+                       kstat_incr_irqs_this_cpu(irq, desc);
+               else {
                        struct pt_regs *old_regs = set_irq_regs(NULL);
-                       int irq = local_vector_to_irq(vector);
 
                        ia64_setreg(_IA64_REG_CR_TPR, vector);
                        ia64_srlz_d();
@@ -611,6 +605,9 @@ static struct irqaction ipi_irqaction = {
        .name =         "IPI"
 };
 
+/*
+ * KVM uses this interrupt to force a cpu out of guest mode
+ */
 static struct irqaction resched_irqaction = {
        .handler =      dummy_handler,
        .flags =        IRQF_DISABLED,
@@ -628,7 +625,7 @@ static struct irqaction tlb_irqaction = {
 void
 ia64_native_register_percpu_irq (ia64_vector vec, struct irqaction *action)
 {
-       irq_desc_t *desc;
+       struct irq_desc *desc;
        unsigned int irq;
 
        irq = vec;
@@ -657,11 +654,8 @@ init_IRQ (void)
        register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
 #ifdef CONFIG_SMP
 #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_DIG)
-       if (vector_domain_type != VECTOR_DOMAIN_NONE) {
-               BUG_ON(IA64_FIRST_DEVICE_VECTOR != IA64_IRQ_MOVE_VECTOR);
-               IA64_FIRST_DEVICE_VECTOR++;
+       if (vector_domain_type != VECTOR_DOMAIN_NONE)
                register_percpu_irq(IA64_IRQ_MOVE_VECTOR, &irq_move_irqaction);
-       }
 #endif
 #endif
 #ifdef CONFIG_PERFMON