Skip to contentSkip to conversation

MFD: mutex from ISR in ezx-pcap?

DISCUSSION Jiri Slaby 2 participants 5 messages Jun 29, 2009 – Jul 1, 2009

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

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?

#1 lore raw

Hi Jiri,

Em Seg, 2009-06-29 às 21:34 +0200, Jiri Slaby escreveu:

Quoted 7 lines

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).

Signature · 1 line
Daniel Ribeiro
author
#2 lore raw
Quoted 8 lines · Daniel Ribeiro

Em Seg, 2009-06-29 às 21:34 +0200, Jiri Slaby escreveu:

Quoted 5 lines

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...

#3 lore raw

Em Ter, 2009-06-30 às 00:11 +0200, Jiri Slaby escreveu:

Quoted 5 lines
Quoted 1 line

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.

Quoted 2 lines

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.

Signature · 1 line
Daniel Ribeiro
author
#4 lore raw
Quoted 10 lines · Daniel Ribeiro

Em Ter, 2009-06-30 às 00:11 +0200, Jiri Slaby escreveu:

Quoted 2 lines

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.