public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* MFD: mutex from ISR in ezx-pcap?
@ 2009-06-29 19:34 Jiri Slaby
  2009-06-29 20:20 ` Daniel Ribeiro
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2009-06-29 19:34 UTC (permalink / raw)
  To: sameo; +Cc: LKML, laforge, drwyrm

Hi,

pcap_adc_irq tries to perform non-atomic operations in ISR which is not
allowed. Above that, it may deadlock.

Since all the operations there (read, write, mutex locking) may sleep,
any objections to convert the ISR contents to a workqueue?

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

* Re: MFD: mutex from ISR in ezx-pcap?
  2009-06-29 19:34 MFD: mutex from ISR in ezx-pcap? Jiri Slaby
@ 2009-06-29 20:20 ` Daniel Ribeiro
  2009-06-29 22:11   ` Jiri Slaby
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Ribeiro @ 2009-06-29 20:20 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: sameo, LKML, laforge

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

Hi Jiri,

Em Seg, 2009-06-29 às 21:34 +0200, Jiri Slaby escreveu:
> Hi,
> 
> pcap_adc_irq tries to perform non-atomic operations in ISR which is not
> allowed. Above that, it may deadlock.
> 
> Since all the operations there (read, write, mutex locking) may sleep,
> any objections to convert the ISR contents to a workqueue?

pcap_adc_irq actually already runs from a workqueue (pcap_isr_work).

-- 
Daniel Ribeiro

[-- Attachment #2: Esta é uma parte de mensagem assinada digitalmente --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: MFD: mutex from ISR in ezx-pcap?
  2009-06-29 20:20 ` Daniel Ribeiro
@ 2009-06-29 22:11   ` Jiri Slaby
  2009-06-30  8:57     ` Daniel Ribeiro
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2009-06-29 22:11 UTC (permalink / raw)
  To: Daniel Ribeiro; +Cc: sameo, LKML, laforge

On 06/29/2009 10:20 PM, Daniel Ribeiro wrote:
> Em Seg, 2009-06-29 às 21:34 +0200, Jiri Slaby escreveu:
>> pcap_adc_irq tries to perform non-atomic operations in ISR which is not
>> allowed. Above that, it may deadlock.
>>
>> Since all the operations there (read, write, mutex locking) may sleep,
>> any objections to convert the ISR contents to a workqueue?
> 
> pcap_adc_irq actually already runs from a workqueue (pcap_isr_work).

Aha, thanks, there is a specific irq handler. Ok, sounds fair.

But interrupts are disabled in pcap_isr_work anyway, so that
pcap_adc_irq shouldn't sleep, right? Or maybe I missed something again...

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

* Re: MFD: mutex from ISR in ezx-pcap?
  2009-06-29 22:11   ` Jiri Slaby
@ 2009-06-30  8:57     ` Daniel Ribeiro
  2009-07-01  6:56       ` Jiri Slaby
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Ribeiro @ 2009-06-30  8:57 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: sameo, LKML, laforge

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

Em Ter, 2009-06-30 às 00:11 +0200, Jiri Slaby escreveu: 
> > pcap_adc_irq actually already runs from a workqueue (pcap_isr_work).
> 
> Aha, thanks, there is a specific irq handler. Ok, sounds fair.
> 
> But interrupts are disabled in pcap_isr_work anyway,

Right.

> so that
> pcap_adc_irq shouldn't sleep, right? Or maybe I missed something again...

No. Interrupts are enabled again before pcap_adc_irq() runs.

pcap_isr_work() doesn't call pcap_adc_irq directly, it calls the
irq_flow_handler, handle_simple_irq(), which needs to run with
interrupts disabled. Interrupts are enabled again on handle_IRQ_event(),
as pcap_adc_irq is requested _without_ IRQF_DISABLED.

-- 
Daniel Ribeiro

[-- Attachment #2: Esta é uma parte de mensagem assinada digitalmente --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: MFD: mutex from ISR in ezx-pcap?
  2009-06-30  8:57     ` Daniel Ribeiro
@ 2009-07-01  6:56       ` Jiri Slaby
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2009-07-01  6:56 UTC (permalink / raw)
  To: Daniel Ribeiro; +Cc: sameo, LKML, laforge

On 06/30/2009 10:57 AM, Daniel Ribeiro wrote:
> Em Ter, 2009-06-30 às 00:11 +0200, Jiri Slaby escreveu: 
>> so that
>> pcap_adc_irq shouldn't sleep, right? Or maybe I missed something again...
> 
> No. Interrupts are enabled again before pcap_adc_irq() runs.
> 
> pcap_isr_work() doesn't call pcap_adc_irq directly, it calls the
> irq_flow_handler, handle_simple_irq(), which needs to run with
> interrupts disabled. Interrupts are enabled again on handle_IRQ_event(),
> as pcap_adc_irq is requested _without_ IRQF_DISABLED.

Correct. Thanks for clarification. I posted at least a lock fix which
made me poke in this all.

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

end of thread, other threads:[~2009-07-01  6:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-29 19:34 MFD: mutex from ISR in ezx-pcap? Jiri Slaby
2009-06-29 20:20 ` Daniel Ribeiro
2009-06-29 22:11   ` Jiri Slaby
2009-06-30  8:57     ` Daniel Ribeiro
2009-07-01  6:56       ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox