linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rt-mutex usage in i2c
@ 2015-03-09 13:43 Sebastian Andrzej Siewior
  2015-03-14 11:27 ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2015-03-09 13:43 UTC (permalink / raw)
  To: linux-i2c
  Cc: Mauro Carvalho Chehab, linux-media@vger.kernel.org, Wolfram Sang,
	Mike Galbraith, Mike Rapoport, Jean Delvare

I have two questions:

- em28xx_i2c_xfer() in drivers/media/usb/em28xx/em28xx-i2c.c takes a
  rt_mutex lock. This struct i2c_algorithm's ->master_xfer callback.
  Why does it take an extra lock since it looks to me that it is
  protected by struct i2c_adapter's bus_lock already.

- 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.
  So _should_ this be invoked from an interrupt handler (for instance),
  then it would record the wrong process as the lock owner. This isn't
  problematic unless on SMP the owner gets boosted because a process
  with a higher priority needs the lock.

Sebastian

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-16 20:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 13:43 rt-mutex usage in i2c Sebastian Andrzej Siewior
2015-03-14 11:27 ` Wolfram Sang
2015-03-14 11:32   ` Wolfram Sang
2015-03-15  7:07     ` Mike Rapoport
     [not found]       ` <CABpLfoiQg1smiebL0=nWX4Sp1H+XD9VViUqGk13gRcfdAwkFoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-16 20:50         ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).