Acquiring ACPI_LOCK(acpi) from kernel module during boot process

Sergey Kandaurov pluknet at
Fri Oct 14 16:54:24 UTC 2011

On 14 October 2011 16:11, Maxim Ignatenko < at> wrote:
> Hi,
> I have this code:
> It works just fine when loaded into kernel manually, but crashes if
> loaded during boot via loader.conf:
> I've added some printf's to acpi_register_ioctl() to track down where
> it hangs and crashes after about one minute:
> What am I missing? Do I need to somehow (how?) specify module
> initialization order? Or just call acpi_register_ioctl() by some other
> mean when it would not cause panic?


The call of mtx_lock_spin() (as seen from your attached screenshot)
on MTX_DEF acpi mutex tells me that you try to use it before it was
initialized. This is usually done in acpi_attach() routine which is
called with SI_SUB_DRIVERS (? - correct me if I'm wrong) order.
Your module is initialized with the earlier SI_SUB_KLD order.
That also might depend on whether acpi.ko is statically compiled in,
even though you have MODULE_DEPEND(acpi_call, acpi, 1, 1, 1);

First I would change the order in DECLARE_MODULE() to a more
common SI_SUB_EXEC.


More information about the freebsd-hackers mailing list