Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 May 2010 08:56:57 +0300
From:      Alexander Motin <mav@FreeBSD.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        freebsd-arch@FreeBSD.org
Subject:   Re: Device driver unload
Message-ID:  <4BF77229.3050205@FreeBSD.org>
In-Reply-To: <20100521.230703.1076064300569247858.imp@bsdimp.com>
References:  <4BF751DD.7020701@FreeBSD.org> <20100521.230703.1076064300569247858.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
M. Warner Losh wrote:
> In message: <4BF751DD.7020701@FreeBSD.org>
>             Alexander Motin <mav@freebsd.org> writes:
> : I think we have some inconsistency around device driver unloading. When
> : devices gets no driver during boot, bus driver receives
> : BUS_PROBE_NOMATCH() call, allowing to power-down the device. But if
> : device looses driver after module unload - nothing happens.
> 
> Correct.
> 
> : So my question is: shouldn't we call either device_probe_and_attach() or
> : BUS_PROBE_NOMATCH() for devices detached due to driver unload?
> 
> I don't think so.  We're not really setup to do that.  If we were to
> do that, then reloading the old driver would break since the new,
> alternative driver wouldn't detach when we kldload the new one.  This

Yes, I consider this. It is indeed a problem, but it is not new, it is
already exist. Now I can't load ahci(4) driver in runtime after ata(4)
grabbed devices on boot.

> is an important case to keep working, even if there might be some
> slight benefit to your proposed change.  There's some infrastructure
> to do this already, in the DF_REBID stuff I did a while ago.

Yes, I've seen it, but I can hardly see how can it be really used, while
calling probe require device to be detached first. It will not be nice
to loose root file system on loading sound driver.

> Alternatively, we'll need to fix the so-called '/dev/foot' patches to
> give direct control.

What is this? Is it something to control attach/detach from user-level?
I would really like to see such mechanisms, but I have no good idea how
to reliably identify device when it's name changes with driver change.
It would be nice to be able to address device via attachment point, but
it seems too bus-specific now.

> BUS_PROBE_NOMATCH likely isn't a bad choice to call on detach,
> however.  Oh, and we'll need to unset DF_NOMATCH on attach.  At least
> I think that's the right place...

Sure.

-- 
Alexander Motin



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