Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...

From: Bodo Eggert
Date: Mon Feb 25 2008 - 10:46:50 EST


Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:

>> we were talking about the load order. This will solve the load order,
>> but if we have races like the kind you described, then the whole mISDN
>> design is broken.
>
> It's more a generic problem of the module code.

It's a problem of not enough synchronisation before a module load completes.

If a module provides an interface, but needs some time after being load to
initialize, it obviously MUST provide a way to wait for it. Since you'll
need some i-need-module-foo functions anyway, why not: (bar needs foo)

-foo.c---
DECLARE_COMPLETION(init_complete); /* static? */
module_foo_init_async() {
...
void complete_all(&init_complete);
}

void usemod_foo()
{
wait_for_completion(&init_complete);
}
EXPORT_SYMBOL(usemod_foo)

-bar.c---
DECLARE_COMPLETION(init_complete);
module_bar_init_async() {
usemod_foo();
...
void complete_all(&init_complete);
}

void usemod_bar()
{
wait_for_completion(&init_complete);
}
EXPORT_SYMBOL(usemod_bar)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/