Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Oct 2011 20:28:21 +0400
From:      Sergey Kandaurov <pluknet@gmail.com>
To:        Maxim Ignatenko <gelraen.ua@gmail.com>
Cc:        freebsd-hackers@freebsd.org, freebsd-acpi@freebsd.org
Subject:   Re: Acquiring ACPI_LOCK(acpi) from kernel module during boot process
Message-ID:  <CAE-mSOJQETjMA58EFuLO4acqWqf55VmOX_y3cejPGiRdvTt9AQ@mail.gmail.com>
In-Reply-To: <CABWTX-Zj%2Bx-g3YVEZEqjwMJhyAq2g_jayQanCi6P=favCzRn-w@mail.gmail.com>
References:  <CABWTX-Zj%2Bx-g3YVEZEqjwMJhyAq2g_jayQanCi6P=favCzRn-w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 14 October 2011 16:11, Maxim Ignatenko <gelraen.ua@gmail.com> wrote:
> Hi,
>
> I have this code:
> https://gitorious.org/acpi_call-freebsd/acpi_call-freebsd/blobs/5e6a79869721a2bd8de88b5cfa90c14b429cb5c7/acpi_call.c
> It works just fine when loaded into kernel manually, but crashes if
> loaded during boot via loader.conf: http://i.imgur.com/fLPen.png
>
> I've added some printf's to acpi_register_ioctl() to track down where
> it hangs and crashes after about one minute:
> http://pastebin.com/vvJutWLA
>
> 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?
>

Hi.

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.

-- 
wbr,
pluknet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSOJQETjMA58EFuLO4acqWqf55VmOX_y3cejPGiRdvTt9AQ>