Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Dec 2011 12:53:19 +0000
From:      Chris Rees <utisoft@gmail.com>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        hackers@freebsd.org
Subject:   Re: Checking for other kernel modules on load
Message-ID:  <CADLo83-Dm8_k79zsfxJ_X6RW04AawcZaATcvZ86B3v26k32EmQ@mail.gmail.com>
In-Reply-To: <20111229120333.GI50300@deviant.kiev.zoral.com.ua>
References:  <CADLo838QjrUunABB=3R_d6NO9bnNAcKXM%2BZt3DRam3RnOGnxGw@mail.gmail.com> <B8D5A1B2-4790-48CA-AAC3-D4333D52ECEB@gsoft.com.au> <CADLo8382uPC6YmreCz8irVuiOhSwc2axJTgQRpVJk-%2B0Win8rQ@mail.gmail.com> <20111228135641.GV50300@deviant.kiev.zoral.com.ua> <CADLo83-OBNWzY_r_oFmUBjkNoCpifJ0_u9dYN52YTZ69X06o4Q@mail.gmail.com> <20111228150023.GY50300@deviant.kiev.zoral.com.ua> <CADLo83-zRNXWyPrs-7MtPfd2uz=56HsWtDaAoFGx8=S=ChQhwQ@mail.gmail.com> <20111229120333.GI50300@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/12/29 Kostik Belousov <kostikbel@gmail.com>:
> On Thu, Dec 29, 2011 at 11:46:57AM +0000, Chris Rees wrote:
>> 2011/12/28 Kostik Belousov <kostikbel@gmail.com>:
>> > On Wed, Dec 28, 2011 at 02:53:42PM +0000, Chris Rees wrote:
>> >> 2011/12/28 Kostik Belousov <kostikbel@gmail.com>:
>> >> > On Wed, Dec 28, 2011 at 12:23:58PM +0000, Chris Rees wrote:
>> >> >> On 28 December 2011 12:21, Daniel O'Connor <doconnor@gsoft.com.au>=
 wrote:
>> >> >> >
>> >> >> > On 28/12/2011, at 22:07, Chris Rees wrote:
>> >> >> >> Is there a simple way to check for existence of a driver? =A0I =
could
>> >> >> >> even check for /dev/sndstat, though that doesn't seem elegant t=
o me...
>> >> >> >
>> >> >> > kldstat -v, but really /dev/sndstat seems simpler and just as ef=
fective.
>> >> >> >
>> >> >>
>> >> >> Cheers-- I was thinking of a kernel-level function though.
>> >> >>
>> >> >> cognet@ suggested using modfind("sound"), I'll go with that.
>> >> > Obvious question is what the panic is. Checking for modules loaded =
is
>> >> > papering over some issue.
>> >>
>> >> True, although I figured that it was a simple conflict, possibly to d=
o
>> >> with sndstat.
>> >>
>> >> Also, I'm getting panics with the following patch, whether sound is
>> >> loaded or not :)
>> >>
>> >> + =A0if (modfind("sound") >=3D 0)
>> >> + =A0 =A0{
>> >> + =A0 =A0 =A0cmn_err (CE_WARN, "A conflicting sound driver is already=
 loaded");
>> >> + =A0 =A0 =A0return EBUSY;
>> >> + =A0 =A0}
>> >> +
>> >>
>> >> Is there a better way to handle such conflicts?
>> >
>> > You have missed the point. There is some bug in oss driver that causin=
g
>> > the panic. Presumed 'conflict' cannot cause the harm itself, besides n=
ot
>> > allowing second driver to attach to the same device, and should not re=
sult
>> > in panic. Trying to implement a half-measure that only covers the prob=
lem
>> > you do a mis-service.
>> >
>> > And you still did not provided the panic message.
>>
>> I'm sorry, you're right. =A0However, your guess was in fact correct;
>> make_dev was being called, which returned a null pointer because it
>> failed.
>>
>> The patch at [1] stops the panic, however I was hoping that returning
>> EBUSY would abort loading the module... At the moment it loads the
>> module, and doesn't create the sndstat dev, which causes weird errors
>> with the oss binary commands.
>>
>> Since this solves the panic and anyone should be able to work out from
>> the warning message what the problem is, AND this is a port that
>> apparently no-one else uses, should this be sufficient?
>>
>> BTW, it only affects FreeBSD 9+, couldn't reproduce on my 8.2 dev
>> machine, but could once I upgraded it.
> On 8.2, there is no check in the devfs for duplicated cdev names, AFAIR.
> So you get absolutely undeterministic behaviour which driver is reference=
d
> by devfs node.
>
>> Chris
>>
>> [1] http://www.bayofrum.net/~crees/patches/oss-patch-kernel-OS-FreeBSD-o=
s_freebsd.c
>
> I highly recommend to return error in case of any make_dev_p(9) failure, =
and
> not only EEXIST.

That'd be great-- but I can't work out how to do it :(

Do I need to return a different value?

Chris



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