aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2010-05-26 14:43:48 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 09:12:49 -0700
commitea4078ca1a7a3a198e519c2a7a2ed6126e40b130 (patch)
tree8b53cbda0032c2eb5eac6f2c0bad563d2217bfdc
parent754d453185275951d39792865927ec494fa1ebd8 (diff)
ipmi: reduce polling when interrupts are available
If we're not currently in the middle of a transaction, and if we have interrupts, there's no real reason to poll the controller more frequently than the core IPMI code does. Set the interrupt_disabled flag appropriately as the interrupt state changes, and make the timeout code reset itself only if the transaction is incomplete or we have no interrupts. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 5b7bf7d2249..c8d68cf6859 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -454,6 +454,9 @@ static inline void disable_si_irq(struct smi_info *smi_info)
if ((smi_info->irq) && (!smi_info->interrupt_disabled)) {
start_disable_irq(smi_info);
smi_info->interrupt_disabled = 1;
+ if (!atomic_read(&smi_info->stop_operation))
+ mod_timer(&smi_info->si_timer,
+ jiffies + SI_TIMEOUT_JIFFIES);
}
}
@@ -706,6 +709,8 @@ static void handle_transaction_done(struct smi_info *smi_info)
printk(KERN_WARNING
"ipmi_si: Could not enable interrupts"
", failed set, using polled mode.\n");
+ } else {
+ smi_info->interrupt_disabled = 0;
}
smi_info->si_state = SI_NORMAL;
break;
@@ -886,6 +891,8 @@ static void sender(void *send_info,
printk("**Enqueue: %d.%9.9d\n", t.tv_sec, t.tv_usec);
#endif
+ mod_timer(&smi_info->si_timer, jiffies + SI_TIMEOUT_JIFFIES);
+
if (smi_info->run_to_completion) {
/*
* If we are running to completion, then throw it in
@@ -1086,7 +1093,8 @@ static void smi_timeout(unsigned long data)
}
do_add_timer:
- add_timer(&(smi_info->si_timer));
+ if ((smi_result != SI_SM_IDLE) || smi_info->interrupt_disabled)
+ add_timer(&(smi_info->si_timer));
}
static irqreturn_t si_irq_handler(int irq, void *data)
@@ -3117,7 +3125,7 @@ static int try_smi_init(struct smi_info *new_smi)
for (i = 0; i < SI_NUM_STATS; i++)
atomic_set(&new_smi->stats[i], 0);
- new_smi->interrupt_disabled = 0;
+ new_smi->interrupt_disabled = 1;
atomic_set(&new_smi->stop_operation, 0);
new_smi->intf_num = smi_num;
smi_num++;