Re: rt-mutex usage in i2c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/15/2015 08:07 AM, Mike Rapoport wrote:
> On Sat, Mar 14, 2015 at 1:32 PM, Wolfram Sang <wsa@xxxxxxxxxxxxx> wrote:
>> On Sat, Mar 14, 2015 at 12:27:03PM +0100, Wolfram Sang wrote:
>>> Hi Sebastian,
>>>
>>>> - i2c_transfer() has this piece:
>>>>   2091                 if (in_atomic() || irqs_disabled()) {
>>>>   2092                         ret = i2c_trylock_adapter(adap);
>>>>
>>>>   is this irqs_disabled() is what bothers me and should not be there.
>>>>   pxa does a spin_lock_irq() which would enable interrupts on return /
>>>>   too early.
>>>>   mxs has a wait_for_completion() which needs irqs enabled _and_ makes
>>>>   in_atomic() problematic, too. I have't checked other drivers but the
>>>>   commit, that introduced it, does not explain why it is required.
> 
> That was some time ago, but as far as I remember, PIO in i2c_pxa was
> required to enable communication with PMIC in interrupt context.

Let me add one thing I forgot: the locking is using raw locks which are
not irq safe. It usually works. But. If the wait_lock is hold during
the unlock's slow path (that means there is no owner but the owner
field is not yet NULL) and the interrupt handler gets here with a
try_lock attempt then and it will spin forever on the wait_lock.

I will try to lookup the threads later…

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux