Skip to contentSkip to conversation

tweak spin logic for hpilo

PATCH In review David Altobelli 5 participants 6 messages Mar 9, 2009 – Mar 10, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tweak spin logic for hpilo

Change hpilo open and close logic to spin for 10usec between checking device, rather than every usec. Applies to 2.6.29.

Please CC me on any replies.

---

drivers/misc/hpilo.h renamed from drivers/misc/hpilo.h.orig +5 -1
@@ -19,8 +19,12 @@
 #define MAX_ILO_DEV	1
 /* max number of files */
 #define MAX_OPEN	(MAX_CCB * MAX_ILO_DEV)
+/* total wait time in usec */
+#define MAX_WAIT_TIME	10000
+/* per spin wait time in usec */
+#define WAIT_TIME	10
 /* spin counter for open/close delay */
-#define MAX_WAIT	10000
+#define MAX_WAIT	(MAX_WAIT_TIME / WAIT_TIME)
 
 /*
  * Per device, used to track global memory allocations.
drivers/misc/hpilo.c renamed from drivers/misc/hpilo.c.orig +3 -3
@@ -209,7 +209,7 @@ static void ilo_ccb_close(struct pci_dev
 	/* give iLO some time to process stop request */
 	for (retries = MAX_WAIT; retries > 0; retries--) {
 		doorbell_set(driver_ccb);
-		udelay(1);
+		udelay(WAIT_TIME);
 		if (!(ioread32(&device_ccb->send_ctrl) & (1 << CTRL_BITPOS_A))
 		    &&
 		    !(ioread32(&device_ccb->recv_ctrl) & (1 << CTRL_BITPOS_A)))
@@ -312,7 +312,7 @@ static int ilo_ccb_open(struct ilo_hwinf
 	for (i = MAX_WAIT; i > 0; i--) {
 		if (ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, NULL, NULL))
 			break;
-		udelay(1);
+		udelay(WAIT_TIME);
 	}
 
 	if (i) {
@@ -759,7 +759,7 @@ static void __exit ilo_exit(void)
 	class_destroy(ilo_class);
 }
 
-MODULE_VERSION("1.0");
+MODULE_VERSION("1.1");
 MODULE_ALIAS(ILO_NAME);
 MODULE_DESCRIPTION(ILO_NAME);
 MODULE_AUTHOR("David Altobelli <[email protected]>");
#1 lore raw
Quoted 2 lines · On Mon, 9 Mar 2009 16:56:52 -0600 David Altobelli <[email protected]>…

Change hpilo open and close logic to spin for 10usec between checking device, rather than every usec.

err.. Why?

#2 lore raw
Quoted 6 lines

From: Andrew Morton

Quoted 2 lines · David Altobelli

Change hpilo open and close logic to spin for 10usec between checking device, rather than every usec.

err.. Why?

Because the loop is coded to take up to 10ms, it seemed prudent to increase the interval between polling the device, to reduce the load on the system and allow more other work to happen.

#3 lore raw
Quoted 9 lines · David
Quoted 5 lines

From: Andrew Morton

Quoted 2 lines · David Altobelli

Change hpilo open and close logic to spin for 10usec between checking device, rather than every usec.

err.. Why?

Because the loop is coded to take up to 10ms, it seemed prudent to increase the interval between polling the device, to reduce the load on the system and allow more other work to happen.

You're using udelay, which is a spin loop. Nothing else can happen on that CPU while it's delaying anyway.

#4 lore raw
Quoted 2 lines

You're using udelay, which is a spin loop. Nothing else can happen on that CPU while it's delaying anyway.

However if your polling is doing I/O its clogging up the I/O busses (and quite often the bridge)

#5 lore raw
In reply to David Altobelli
Quoted 2 lines · David Altobelli

Change hpilo open and close logic to spin for 10usec between checking device, rather than every usec. Applies to 2.6.29.

Hi,

the description misses a `why' part. In what is this approach better?