Blocking wait for interrupt

Sebastian Sumpf Sebastian.Sumpf at ...1...
Tue Jul 25 12:52:24 CEST 2017


Hi Johannes,

On 07/25/2017 08:54 AM, Johannes Kliemann wrote:
> Hi,
> 
> I'm currently writing a dde_linux driver that requires to wait for an
> interrupt to be handled.
> It basically initializes the hardware and then waits for an event to
> occur. This event is usually triggered by the interrupt (respectively
> its handler) which occurs after hardware initialization.
> My problem is that this interrupt doesn't appear while the function
> triggering it didn't return. So when this function blocks to wait for
> the interrupt, a deadlock is created. Besides using the timer I tried to
> block the execution with a semaphore creating the same problem.
> Creating an async version is no option due to the architecture of the
> Linux driver.
> 
> How are interrupts handled in this case? What causes them to block and
> how can I work around this?
> 

If I gather your description correctly, you are executing Linux code
from the entrypoint context. If this code somehow blocks, lets say by
calling 'wait_event_interruptible' or something else, the EP cannot
receive signals, and therefore no interrupts. The solution to this
problem are 'Lx::Task'(s). All Linux code should be executed by these
tasks, which are able to block and can be unblocked by the EP upon
signal reception. A small example can be found under
'dde_linux/src/drivers/framebuffer/intel/main.cc', there the Linux code
is executed by a task in 'run_linux', which is woken up by the
'Policy_agent' signal handler.

Regards,

Sebastian

P.S. I hope you are porting a driver and not writing one from scratch ;)



-- 
Sebastian Sumpf
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth







More information about the users mailing list