Skip to contentSkip to conversation

I2C: Fix i2c fail problem when a process is terminated by a signal on octeon in 3.8

DISCUSSION David Daney 1 participant 1 message Feb 26, 2013 1 message not in the archive I2C subsystem host drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 6 lines · 송은봉

I've been debugging the abnormal operation of i2c on octeon. If a process is terminated by signal in the middle of i2c operation, next i2c read operation which is done by another process was failed. So i changed to ignore signal in the middle of i2c operation. After that the problem was not reproduced.

This is a known issue. However I don't think the solution you have is correct...

Quoted 16 lines

<mailto:[email protected]>>

diff -up drivers/i2c/busses/i2c-octeon.c{.orig,}

i2c/busses/i2c-octeon.c 2013-02-21 08:09:38.344018898 -0800 renamed from i2c/busses/i2c-octeon.c.orig 2013-02-21 08:09:03.168018843 -0800 +1 -1
@@ -183,7 +183,7 @@ static irqreturn_t octeon_i2c_isr(int ir
   struct octeon_i2c *i2c = dev_id;
 
   octeon_i2c_int_disable(i2c);
- wake_up_interruptible(&i2c->queue);
+ wake_up(&i2c->queue);
 
   return IRQ_HANDLED;
  }

i2c/busses/i2c-octeon.c 2013-02-21 08:09:38.344018898 -0800 static int octeon_i2c_wait(struct octeon · line 209

Quoted 5 lines
i2c/busses/i2c-octeon.c 2013-02-21 08:09:38.344018898 -0800 renamed from i2c/busses/i2c-octeon.c.orig 2013-02-21 08:09:03.168018843 -0800 +1 -1
@@ -206,7 +206,7 @@ static int octeon_i2c_wait(struct octeon
 
   octeon_i2c_int_enable(i2c);
 
- result = wait_event_interruptible_timeout(i2c->queue,
+ result = wait_event_timeout(i2c->queue,

If the wait is not interruptible, I think you will not be able to 'kill -9' a userspace process blocked here.

i2c/busses/i2c-octeon.c 2013-02-21 08:09:38.344018898 -0800 static int octeon_i2c_wait(struct octeon · line 212

Quoted 3 lines
i2c/busses/i2c-octeon.c 2013-02-21 08:09:38.344018898 -0800 renamed from i2c/busses/i2c-octeon.c.orig 2013-02-21 08:09:03.168018843 -0800 +0 -0
          octeon_i2c_test_iflg(i2c),
          i2c->adap.timeout);
 

The real solution is to move processing of the I2C protocol to a kernel thread and communicate between the this thread and userspace via a command queue mechanism, much like the way it is done in the mmc/host driver infrastructure.

David Daney