* i2c_smbus_write_block_data vs scheduled routine calls (add_timer) - kernel crash
@ 2009-08-04 18:42 NiTr0
[not found] ` <4A788121.8020601-z9XQkeP78BxUq1AO9QMCaQ@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: NiTr0 @ 2009-08-04 18:42 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
I tried to improve voltage/FSB manipulation module for EeePC
(http://code.google.com/p/eeepc-linux) - and I found that
i2c_smbus_write_block_data will cause kernel panic when is called from
function called by timer. I can't see kernel panic message because
system print very long call trace. Also on EeePC there is no RS232 port
- but I have USB->RS232 dongle, can it be used as terminal for debug
messages?
All variables are declared as static, all data is prepared correctly -
so IMHO trouble is outside of my driver.
There is a part of code:
static struct i2c_client eee_pll_smbus_client = {
.adapter = NULL,
.addr = 0x69,
.flags = 0,
};
static char eee_pll_data[I2C_SMBUS_BLOCK_MAX];
static int eee_pll_datalen = 0;
.......................
i2c_smbus_write_block_data(&eee_pll_smbus_client,0,
eee_pll_datalen, eee_pll_data);
^ permalink raw reply [flat|nested] 3+ messages in thread[parent not found: <4A788121.8020601-z9XQkeP78BxUq1AO9QMCaQ@public.gmane.org>]
* Re: i2c_smbus_write_block_data vs scheduled routine calls (add_timer) - kernel crash [not found] ` <4A788121.8020601-z9XQkeP78BxUq1AO9QMCaQ@public.gmane.org> @ 2009-08-04 19:45 ` Matthias Kaehlcke 2009-08-04 20:35 ` Mark Brown 1 sibling, 0 replies; 3+ messages in thread From: Matthias Kaehlcke @ 2009-08-04 19:45 UTC (permalink / raw) To: NiTr0; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA El Tue, Aug 04, 2009 at 09:42:41PM +0300 NiTr0 ha dit: > I tried to improve voltage/FSB manipulation module for EeePC > (http://code.google.com/p/eeepc-linux) - and I found that > i2c_smbus_write_block_data will cause kernel panic when is called from > function called by timer. I can't see kernel panic message because > system print very long call trace. Also on EeePC there is no RS232 port > - but I have USB->RS232 dongle, can it be used as terminal for debug > messages? > > All variables are declared as static, all data is prepared correctly - > so IMHO trouble is outside of my driver. > There is a part of code: > > static struct i2c_client eee_pll_smbus_client = { > .adapter = NULL, > .addr = 0x69, > .flags = 0, > }; > static char eee_pll_data[I2C_SMBUS_BLOCK_MAX]; > static int eee_pll_datalen = 0; > ....................... > i2c_smbus_write_block_data(&eee_pll_smbus_client,0, > eee_pll_datalen, eee_pll_data); a possible source of problems is that i2c_smbus_xfer() (invoked by i2c_smbus_write_block_data()) tries to aquire a mutex if adapter->algo->smbus_xfer is set. http://lxr.linux.no/linux+v2.6.30/drivers/i2c/i2c-core.c#L1994 timers are executed in a softirq, ie in interrupt context, but mutexes must not be used within interrupts. i'm neither an i2c-core nor an kernel expert, but this point looks conflictive to me and might be the reason for the kernel panic you get. -- Matthias Kaehlcke Embedded Linux Engineer Barcelona They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety (Benjamin Franklin) .''`. using free software / Debian GNU/Linux | http://debian.org : :' : `. `'` gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `- ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: i2c_smbus_write_block_data vs scheduled routine calls (add_timer) - kernel crash [not found] ` <4A788121.8020601-z9XQkeP78BxUq1AO9QMCaQ@public.gmane.org> 2009-08-04 19:45 ` Matthias Kaehlcke @ 2009-08-04 20:35 ` Mark Brown 1 sibling, 0 replies; 3+ messages in thread From: Mark Brown @ 2009-08-04 20:35 UTC (permalink / raw) To: NiTr0; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA On Tue, Aug 04, 2009 at 09:42:41PM +0300, NiTr0 wrote: > All variables are declared as static, all data is prepared correctly > - so IMHO trouble is outside of my driver. > There is a part of code: The problem is that your driver is trying to do I2C/SMBus I/O from a timer, which is run from an interrupt context. Since I2C buses are generally very slow the controllers are interrupt driven and the read and write operations on them will sleep waiting for operations to complete. If the code waited for the I/O to complete in an interrupt context it would cause serious performance problems in the rest of the system. You should do the actual I/O from another context, such as a workqueue. schedule_delayed_work() may be helpful here. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-04 20:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-04 18:42 i2c_smbus_write_block_data vs scheduled routine calls (add_timer) - kernel crash NiTr0
[not found] ` <4A788121.8020601-z9XQkeP78BxUq1AO9QMCaQ@public.gmane.org>
2009-08-04 19:45 ` Matthias Kaehlcke
2009-08-04 20:35 ` Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox