Skip to contentSkip to conversation

IPMI: add polled interface

PATCH In review Corey Minyard 1 participant 1 message Oct 12, 2007 IPMI

lore
Share & tools
lore
#0 lore raw

PATCH 4/7 IPMI: add polled interface

From: Corey Minyard <[email protected]>

Currently the IPMI watchdog timer sets the watchdog timeout on a panic, but it doesn't actually poll the interface to make sure the message goes out.

Add an interface for polling the IPMI driver, and add code to the IPMI watchdog timer to poll the interface when the timer is set from a panic.

Not needed for the stable kernel.

--

 drivers/char/ipmi/ipmi_msghandler.c |    9 +++
 drivers/char/ipmi/ipmi_si_intf.c    |    6 +-
 drivers/char/ipmi/ipmi_watchdog.c   |  105 ++++++++++++++++++++----------------
 include/linux/ipmi.h                |   10 +++
 4 files changed, 83 insertions(+), 47 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +9 -0
Index: linux-2.6.22/drivers/char/ipmi/ipmi_msghandler.c
===================================================================
@@ -2624,6 +2624,14 @@ channel_handler(ipmi_smi_t intf, struct 
 	return;
 }
 
+void ipmi_poll_interface(ipmi_user_t user)
+{
+	ipmi_smi_t intf = user->intf;
+
+	if (intf->handlers->poll)
+		intf->handlers->poll(intf->send_info);
+}
+
 int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
 		      void		       *send_info,
 		      struct ipmi_device_id    *device_id,
@@ -4177,6 +4185,7 @@ EXPORT_SYMBOL(ipmi_destroy_user);
 EXPORT_SYMBOL(ipmi_get_version);
 EXPORT_SYMBOL(ipmi_request_settime);
 EXPORT_SYMBOL(ipmi_request_supply_msgs);
+EXPORT_SYMBOL(ipmi_poll_interface);
 EXPORT_SYMBOL(ipmi_register_smi);
 EXPORT_SYMBOL(ipmi_unregister_smi);
 EXPORT_SYMBOL(ipmi_register_for_cmd);
drivers/char/ipmi/ipmi_watchdog.c +59 -46

156 lines not on this page · raw message

include/linux/ipmi.h +10 -0
Index: linux-2.6.22/include/linux/ipmi.h
===================================================================
@@ -365,6 +365,16 @@ int ipmi_request_supply_msgs(ipmi_user_t
 			     int                  priority);
 
 /*
+ * Poll the IPMI interface for the user.  This causes the IPMI code to
+ * do an immediate check for information from the driver and handle
+ * anything that is immediately pending.  This will not block in any
+ * way.  This is useful if you need to implement polling from the user
+ * for things like modifying the watchdog timeout when a panic occurs
+ * or disabling the watchdog timer on a reboot.
+ */
+void ipmi_poll_interface(ipmi_user_t user);
+
+/*
  * When commands come in to the SMS, the user can register to receive
  * them.  Only one user can be listening on a specific netfn/cmd/chan tuple
  * at a time, you will get an EBUSY error if the command is already
drivers/char/ipmi/ipmi_si_intf.c +5 -1
Index: linux-2.6.22/drivers/char/ipmi/ipmi_si_intf.c
===================================================================
@@ -675,7 +675,8 @@ static void handle_transaction_done(stru
 }
 
 /* Called on timeouts and events.  Timeouts should pass the elapsed
-   time, interrupts should pass in zero. */
+   time, interrupts should pass in zero.  Must be called with
+   si_lock held and interrupts disabled. */
 static enum si_sm_result smi_event_handler(struct smi_info *smi_info,
 					   int time)
 {
@@ -892,13 +893,16 @@ static int ipmi_thread(void *data)
 static void poll(void *send_info)
 {
 	struct smi_info *smi_info = send_info;
+	unsigned long flags;
 
 	/*
 	 * Make sure there is some delay in the poll loop so we can
 	 * drive time forward and timeout things.
 	 */
 	udelay(10);
+	spin_lock_irqsave(&smi_info->si_lock, flags);
 	smi_event_handler(smi_info, 10);
+	spin_unlock_irqrestore(&smi_info->si_lock, flags);
 }
 
 static void request_events(void *send_info)