2010-10-22 09:08:31     Deadlock error in i2c_bfin_twi.c

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-10-22 09:08:31     Deadlock error in i2c_bfin_twi.c

Morten Kvistgaard (DENMARK)

Message: 94874   

 

Well, it's not a real deadlock I guess, but here's the thing:

 

The Blackfin TWI driver starts all actions, with validating the busy state: (This happens for both the smbus and the plain_i2c)

 

File: uclinux-dist-trunk-svn-9855/linux-2.6.x/drivers/i2c/busses/i2c_bfin_twi.c

 

Line: 394

 

-------------------------------------------------------------------------------------------------------

 

while (read_MASTER_STAT(iface) & BUSBUSY)

 

yield();

 

-------------------------------------------------------------------------------------------------------

 

 

 

If you got some faulty hw (like we do), this loop will risk never ending. Resulting in a locked system, without possible recovery.

 

Being a sw person, I don't know much about TWI or I2C. But I suggest inserting the timeout, which already exists in the i2c adapter, in the above loop. Like so:

 

-------------------------------------------------------------------------------------------------------

 

start_tick = jiffies;

 

while (read_MASTER_STAT(iface) & BUSBUSY)

 

{

 

if((jiffies-start_tick) > adap->timeout) return -ETIMEDOUT;

 

else yield();

 

}

 

-------------------------------------------------------------------------------------------------------

QuoteReplyEditDelete

 

 

2010-10-25 04:25:24     Re: Deadlock error in i2c_bfin_twi.c

Morten Kvistgaard (DENMARK)

Message: 95135   

 

I've added it to the bug list

QuoteReplyEditDelete

 

 

2010-10-26 00:27:15     Re: Deadlock error in i2c_bfin_twi.c

Sonic Zhang (CHINA)

Message: 95155   

 

Out of date already in SVN trunk.

QuoteReplyEditDelete

 

 

2010-10-26 04:21:15     Re: Deadlock error in i2c_bfin_twi.c

Morten Kvistgaard (DENMARK)

Message: 95228   

 

Might be a bit harsh reply, seeing that it wasn't "out of date" or "already in trunk" when I first posted the error, but yes, I see it in the trunk now. Very nice respose time

QuoteReplyEditDelete

 

 

2010-10-26 05:16:24     Re: Deadlock error in i2c_bfin_twi.c

Sonic Zhang (CHINA)

Message: 95229   

 

I just read you email today. So, ...

Attachments

    Outcomes