Hi everyone,
I have encountered some problems when enable SMP, which led l4android fails to start. There is an error happened in l4lx_task_create() from "ports-foc/src
/lib/l4lx/l4lx_task.cc". The error message we got is " Inserting element 18... twice into avl tree! "
Through analysis we find the method " Linux::Irq_guard guard; " can only mask interrupts on current processor(vcpu0 or vcpu1), that means when vcpu0 is executing the function l4lx_task_create, vcpu1 thread can also enter this function. So, we should have a mutual lock here. The error will gone after adding
a lock that genode provided, like this:
static Genode::Lock _lock_create;
int l4lx_task_create(l4_cap_idx_t task_no)
{
using namespace L4lx;
Linux::Irq_guard guard;
Genode::Lock::Guard lock_guard(_lock_create);
Env::env()->tasks()->insert(new (Genode::env()->heap()) Task(task_no));
return 0;
}
Similar problem also arises in l4lx_task_delete_task(). I don't know if this is a good solution, do you have some better methods? and are there any other interfaces
in l4lx library, whilch need to be considered mutual exclusive operation after enabling SMP?