usb_drv: Wait for IRQ on SKB exhaustion
Do not use 'wait_event' when SKB-backend allocation fails, explicitly wait for an interrupt, which in turn frees SKBs, instead. Fixes issue #788
This commit is contained in:
parent
2045fffe2a
commit
aacb91f22a
|
@ -116,6 +116,7 @@ namespace Irq
|
||||||
{
|
{
|
||||||
void init(Genode::Signal_receiver *recv);
|
void init(Genode::Signal_receiver *recv);
|
||||||
void check_irq();
|
void check_irq();
|
||||||
|
void wait_for_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Event
|
namespace Event
|
||||||
|
|
|
@ -98,9 +98,8 @@ class Skb
|
||||||
|
|
||||||
|
|
||||||
/* wait until some SKBs are freed */
|
/* wait until some SKBs are freed */
|
||||||
_wait_free = false;
|
for (_wait_free = false; !_wait_free;)
|
||||||
//PDBG("wait for free skbs ...");
|
Irq::wait_for_irq();
|
||||||
_wait_event(_wait_free);
|
|
||||||
|
|
||||||
return alloc();
|
return alloc();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ extern "C" {
|
||||||
/* our local incarnation of sender and receiver */
|
/* our local incarnation of sender and receiver */
|
||||||
static Signal_helper *_signal = 0;
|
static Signal_helper *_signal = 0;
|
||||||
static Genode::Lock _irq_sync(Genode::Lock::LOCKED);
|
static Genode::Lock _irq_sync(Genode::Lock::LOCKED);
|
||||||
|
static Genode::Lock _irq_wait(Genode::Lock::LOCKED);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This contains the Linux-driver handlers
|
* This contains the Linux-driver handlers
|
||||||
|
@ -80,6 +81,9 @@ class Irq_context : public Driver_context,
|
||||||
static Genode::Lock handler_lock;
|
static Genode::Lock handler_lock;
|
||||||
Genode::Lock::Guard guard(handler_lock);
|
Genode::Lock::Guard guard(handler_lock);
|
||||||
|
|
||||||
|
/* unlock if main thread is waiting */
|
||||||
|
_irq_wait.unlock();
|
||||||
|
|
||||||
Irq_context *ctx = static_cast<Irq_context *>(irq);
|
Irq_context *ctx = static_cast<Irq_context *>(irq);
|
||||||
|
|
||||||
/* set context & submit signal */
|
/* set context & submit signal */
|
||||||
|
@ -120,7 +124,7 @@ class Irq_context : public Driver_context,
|
||||||
/* report IRQ to all clients */
|
/* report IRQ to all clients */
|
||||||
for (Irq_handler *h = _handler_list.first(); h; h = h->next()) {
|
for (Irq_handler *h = _handler_list.first(); h; h = h->next()) {
|
||||||
|
|
||||||
if (_handle_one(h))
|
if ((handled = _handle_one(h)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
dde_kit_log(DEBUG_IRQ, "IRQ: %u ret: %u h: %p dev: %p", _irq, handled, h->handler, h->dev);
|
dde_kit_log(DEBUG_IRQ, "IRQ: %u ret: %u h: %p dev: %p", _irq, handled, h->handler, h->dev);
|
||||||
|
@ -191,6 +195,13 @@ void Irq::check_irq()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Irq::wait_for_irq()
|
||||||
|
{
|
||||||
|
while (!Irq_context::check_irq())
|
||||||
|
_irq_wait.lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************
|
/***********************
|
||||||
** linux/interrupt.h **
|
** linux/interrupt.h **
|
||||||
***********************/
|
***********************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user