public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tweak spin logic for hpilo
@ 2009-03-09 22:56 David Altobelli
  2009-03-09 23:04 ` Andrew Morton
  2009-03-09 23:14 ` Jiri Slaby
  0 siblings, 2 replies; 6+ messages in thread
From: David Altobelli @ 2009-03-09 22:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, david.altobelli

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.

Signed-off-by: David Altobelli <david.altobelli@hp.com>
---

--- linux-2.6.28/drivers/misc/hpilo.h.orig	2009-03-09 13:24:25.000000000 -0500
+++ linux-2.6.28/drivers/misc/hpilo.h	2009-03-09 13:28:22.000000000 -0500
@@ -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.
--- linux-2.6.28/drivers/misc/hpilo.c.orig	2009-03-09 13:24:31.000000000 -0500
+++ linux-2.6.28/drivers/misc/hpilo.c	2009-03-09 13:57:08.000000000 -0500
@@ -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 <david.altobelli@hp.com>");

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tweak spin logic for hpilo
  2009-03-09 22:56 [PATCH] tweak spin logic for hpilo David Altobelli
@ 2009-03-09 23:04 ` Andrew Morton
  2009-03-10 13:42   ` Altobelli, David
  2009-03-09 23:14 ` Jiri Slaby
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2009-03-09 23:04 UTC (permalink / raw)
  To: David Altobelli; +Cc: linux-kernel, david.altobelli

On Mon, 9 Mar 2009 16:56:52 -0600
David Altobelli <david.altobelli@hp.com> wrote:

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

err.. Why?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tweak spin logic for hpilo
  2009-03-09 22:56 [PATCH] tweak spin logic for hpilo David Altobelli
  2009-03-09 23:04 ` Andrew Morton
@ 2009-03-09 23:14 ` Jiri Slaby
  1 sibling, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2009-03-09 23:14 UTC (permalink / raw)
  To: David Altobelli; +Cc: linux-kernel, akpm

On 9.3.2009 23:56, David Altobelli wrote:
> 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?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] tweak spin logic for hpilo
  2009-03-09 23:04 ` Andrew Morton
@ 2009-03-10 13:42   ` Altobelli, David
  2009-03-10 23:37     ` Robert Hancock
  0 siblings, 1 reply; 6+ messages in thread
From: Altobelli, David @ 2009-03-10 13:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel@vger.kernel.org

> From: Andrew Morton
> David Altobelli wrote:
> > 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tweak spin logic for hpilo
  2009-03-10 13:42   ` Altobelli, David
@ 2009-03-10 23:37     ` Robert Hancock
  2009-03-10 23:56       ` Alan Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Hancock @ 2009-03-10 23:37 UTC (permalink / raw)
  To: Altobelli, David; +Cc: Andrew Morton, linux-kernel@vger.kernel.org

Altobelli, David wrote:
>> From: Andrew Morton
>> David Altobelli wrote:
>>> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tweak spin logic for hpilo
  2009-03-10 23:37     ` Robert Hancock
@ 2009-03-10 23:56       ` Alan Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Cox @ 2009-03-10 23:56 UTC (permalink / raw)
  To: Robert Hancock
  Cc: Altobelli, David, Andrew Morton, linux-kernel@vger.kernel.org

> 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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-10 23:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-09 22:56 [PATCH] tweak spin logic for hpilo David Altobelli
2009-03-09 23:04 ` Andrew Morton
2009-03-10 13:42   ` Altobelli, David
2009-03-10 23:37     ` Robert Hancock
2009-03-10 23:56       ` Alan Cox
2009-03-09 23:14 ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox