* [Patch] kenvctrld causes very high cpu load
@ 2007-02-15 21:08 Joerg Friedrich
2007-02-21 7:57 ` Jurij Smakov
0 siblings, 1 reply; 2+ messages in thread
From: Joerg Friedrich @ 2007-02-15 21:08 UTC (permalink / raw)
To: sparclinux
[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]
Hi!
I recently got a Sun Blade 1000.
I encountered the same problem described at
http://ubuntuforums.org/showthread.php?t=297474
The mentioned solution (removing the msleep) and switch to polling mode
is imho no good option.
Problem:
kthread kenvctrld calls wait_for_pin(), attaches itself to the
wait_queue and sets itself INTERRUPTIBLE (unneccesary because
msleep_interruptible does the same). Then it checks if the i2c-query is
already done. Usually this is not the case at first check.
Then kenvctrl calles msleep_interruptible(250). Usually 1 or 2 ms later
the i2c-bus signals by interrupt that the desired operation is done.
The interrupt-handler wakes up all tasks in the wq.
Know kenvctrld is reset to TASK_RUNNING and does about 248 ms sleeping
at kernel priority :-(
the patch attached will switch this to wait_event_interruptible_timeout.
It might be possible to change this line:
if ((val != -ERESTARTSYS) && (val > 0)) {
to
if (val > 0) {
but I was not sure if I can rely on errror codes <0
Please check this patch since I do not know exactly how to proceed.
--
Jörg Friedrich
There are only 10 types of people:
Those who understand binary and those who don't.
[-- Attachment #2: bbc_i2c.c.diff --]
[-- Type: text/plain, Size: 976 bytes --]
--- linux-2.6.20/drivers/sbus/char/bbc_i2c.c.orig 2007-02-15 21:26:56.000000000 +0100
+++ linux-2.6.20/drivers/sbus/char/bbc_i2c.c 2007-02-15 21:28:36.000000000 +0100
@@ -187,19 +187,18 @@
bp->waiting = 1;
add_wait_queue(&bp->wq, &wait);
while (limit-- > 0) {
- u8 val;
+ long val;
- set_current_state(TASK_INTERRUPTIBLE);
- *status = val = readb(bp->i2c_control_regs + 0);
- if ((val & I2C_PCF_PIN) == 0) {
+ val = wait_event_interruptible_timeout(bp->wq,
+ (((*status = readb(bp->i2c_control_regs + 0)) & I2C_PCF_PIN) == 0),
+ msecs_to_jiffies(250));
+ if ((val != -ERESTARTSYS) && (val > 0)) {
ret = 0;
break;
}
- msleep_interruptible(250);
}
remove_wait_queue(&bp->wq, &wait);
bp->waiting = 0;
- current->state = TASK_RUNNING;
return ret;
}
@@ -340,7 +339,7 @@
*/
if (bp->waiting &&
!(readb(bp->i2c_control_regs + 0x0) & I2C_PCF_PIN))
- wake_up(&bp->wq);
+ wake_up_interruptible(&bp->wq);
return IRQ_HANDLED;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch] kenvctrld causes very high cpu load
2007-02-15 21:08 [Patch] kenvctrld causes very high cpu load Joerg Friedrich
@ 2007-02-21 7:57 ` Jurij Smakov
0 siblings, 0 replies; 2+ messages in thread
From: Jurij Smakov @ 2007-02-21 7:57 UTC (permalink / raw)
To: sparclinux
On Thu, Feb 15, 2007 at 10:08:55PM +0100, Joerg Friedrich wrote:
> Hi!
>
> I recently got a Sun Blade 1000.
> I encountered the same problem described at
> http://ubuntuforums.org/showthread.php?t)7474
This problem also affects Blade 2000 machines, as mentioned in this
post on debian-sparc:
http://lists.debian.org/debian-sparc/2007/02/msg00055.html
Joerg's patch seems to be doing the right thing there.
Best regards,
--
Jurij Smakov jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/ KeyID: C99E03CC
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-02-21 7:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-15 21:08 [Patch] kenvctrld causes very high cpu load Joerg Friedrich
2007-02-21 7:57 ` Jurij Smakov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.