* Who mounts sysfs?
@ 2009-06-25 10:36 Will Newton
2009-06-25 15:18 ` Greg KH
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Will Newton @ 2009-06-25 10:36 UTC (permalink / raw)
To: linux-hotplug
Hi all,
I'm trying to get the libertas driver working on an embedded
development board and I've run into what looks like a sysfs problem.
Although I'm actually using the BusyBox mdev hotplug helper rather
than udev, I hope this is the right list to be asking this question.
What appears to be happening is I get my initramfs extracted, so I
have access to the various necessary files including the hotplug
helper and my firmware files. This step is taken care of by the rootfs
initcall level. Then the driver initcalls are run, including the
libertas setup routines, which call request_firmware. request_firmware
fires off a uevent and calls the hotplug helper. The hotplug helper
looks for the /sys/class/firmware entry for the libertas device, but
it doesn't find one because I don't appear to have a mounted sysfs on
the /sys mountpoint.
So my question is: who should be mounting sysfs here? init will mount
sysfs, but is run much later than the device initcalls.
Any help would be much appreciated,
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Who mounts sysfs?
2009-06-25 10:36 Who mounts sysfs? Will Newton
@ 2009-06-25 15:18 ` Greg KH
2009-06-25 15:53 ` Will Newton
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2009-06-25 15:18 UTC (permalink / raw)
To: linux-hotplug
On Thu, Jun 25, 2009 at 11:36:29AM +0100, Will Newton wrote:
> Hi all,
>
> I'm trying to get the libertas driver working on an embedded
> development board and I've run into what looks like a sysfs problem.
> Although I'm actually using the BusyBox mdev hotplug helper rather
> than udev, I hope this is the right list to be asking this question.
For busybox questions, not really, but we reserve the right to poke fun
at you for using mdev :)
> What appears to be happening is I get my initramfs extracted, so I
> have access to the various necessary files including the hotplug
> helper and my firmware files. This step is taken care of by the rootfs
> initcall level. Then the driver initcalls are run, including the
> libertas setup routines, which call request_firmware. request_firmware
> fires off a uevent and calls the hotplug helper. The hotplug helper
> looks for the /sys/class/firmware entry for the libertas device, but
> it doesn't find one because I don't appear to have a mounted sysfs on
> the /sys mountpoint.
>
> So my question is: who should be mounting sysfs here? init will mount
> sysfs, but is run much later than the device initcalls.
You need to mount sysfs as one of the first things to have happen. Look
at your distro's startup scripts as an example of this.
good luck,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Who mounts sysfs?
2009-06-25 10:36 Who mounts sysfs? Will Newton
2009-06-25 15:18 ` Greg KH
@ 2009-06-25 15:53 ` Will Newton
2009-06-25 16:28 ` Greg KH
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Will Newton @ 2009-06-25 15:53 UTC (permalink / raw)
To: linux-hotplug
On Thu, Jun 25, 2009 at 4:18 PM, Greg KH<greg@kroah.com> wrote:
> On Thu, Jun 25, 2009 at 11:36:29AM +0100, Will Newton wrote:
>> Hi all,
>>
>> I'm trying to get the libertas driver working on an embedded
>> development board and I've run into what looks like a sysfs problem.
>> Although I'm actually using the BusyBox mdev hotplug helper rather
>> than udev, I hope this is the right list to be asking this question.
>
> For busybox questions, not really, but we reserve the right to poke fun
> at you for using mdev :)
>
>> What appears to be happening is I get my initramfs extracted, so I
>> have access to the various necessary files including the hotplug
>> helper and my firmware files. This step is taken care of by the rootfs
>> initcall level. Then the driver initcalls are run, including the
>> libertas setup routines, which call request_firmware. request_firmware
>> fires off a uevent and calls the hotplug helper. The hotplug helper
>> looks for the /sys/class/firmware entry for the libertas device, but
>> it doesn't find one because I don't appear to have a mounted sysfs on
>> the /sys mountpoint.
>>
>> So my question is: who should be mounting sysfs here? init will mount
>> sysfs, but is run much later than the device initcalls.
>
> You need to mount sysfs as one of the first things to have happen. Look
> at your distro's startup scripts as an example of this.
Yes, I want my sysfs mounted as early as possible, but userspace (via
/sbin/init) does not get a chance to do this until after the device
initcalls have been run. I'm interested to know if there's a standard
way to get sysfs mounted before /sbin/init is run.
I could modify mdev to mount sysfs if it detects that it isn't
already, but that seems like something of a hack.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Who mounts sysfs?
2009-06-25 10:36 Who mounts sysfs? Will Newton
2009-06-25 15:18 ` Greg KH
2009-06-25 15:53 ` Will Newton
@ 2009-06-25 16:28 ` Greg KH
2009-06-25 16:57 ` Will Newton
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2009-06-25 16:28 UTC (permalink / raw)
To: linux-hotplug
On Thu, Jun 25, 2009 at 04:53:07PM +0100, Will Newton wrote:
> On Thu, Jun 25, 2009 at 4:18 PM, Greg KH<greg@kroah.com> wrote:
> > On Thu, Jun 25, 2009 at 11:36:29AM +0100, Will Newton wrote:
> >> Hi all,
> >>
> >> I'm trying to get the libertas driver working on an embedded
> >> development board and I've run into what looks like a sysfs problem.
> >> Although I'm actually using the BusyBox mdev hotplug helper rather
> >> than udev, I hope this is the right list to be asking this question.
> >
> > For busybox questions, not really, but we reserve the right to poke fun
> > at you for using mdev :)
> >
> >> What appears to be happening is I get my initramfs extracted, so I
> >> have access to the various necessary files including the hotplug
> >> helper and my firmware files. This step is taken care of by the rootfs
> >> initcall level. Then the driver initcalls are run, including the
> >> libertas setup routines, which call request_firmware. request_firmware
> >> fires off a uevent and calls the hotplug helper. The hotplug helper
> >> looks for the /sys/class/firmware entry for the libertas device, but
> >> it doesn't find one because I don't appear to have a mounted sysfs on
> >> the /sys mountpoint.
> >>
> >> So my question is: who should be mounting sysfs here? init will mount
> >> sysfs, but is run much later than the device initcalls.
> >
> > You need to mount sysfs as one of the first things to have happen. Look
> > at your distro's startup scripts as an example of this.
>
> Yes, I want my sysfs mounted as early as possible, but userspace (via
> /sbin/init) does not get a chance to do this until after the device
> initcalls have been run. I'm interested to know if there's a standard
> way to get sysfs mounted before /sbin/init is run.
There isn't.
> I could modify mdev to mount sysfs if it detects that it isn't
> already, but that seems like something of a hack.
Yeah, that sounds wrong. Look at how your desktop distro does this,
this shouldn't be an issue.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Who mounts sysfs?
2009-06-25 10:36 Who mounts sysfs? Will Newton
` (2 preceding siblings ...)
2009-06-25 16:28 ` Greg KH
@ 2009-06-25 16:57 ` Will Newton
2009-06-25 17:13 ` Greg KH
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Will Newton @ 2009-06-25 16:57 UTC (permalink / raw)
To: linux-hotplug
On Thu, Jun 25, 2009 at 5:28 PM, Greg KH<greg@kroah.com> wrote:
> On Thu, Jun 25, 2009 at 04:53:07PM +0100, Will Newton wrote:
>> On Thu, Jun 25, 2009 at 4:18 PM, Greg KH<greg@kroah.com> wrote:
>> > On Thu, Jun 25, 2009 at 11:36:29AM +0100, Will Newton wrote:
>> >> Hi all,
>> >>
>> >> I'm trying to get the libertas driver working on an embedded
>> >> development board and I've run into what looks like a sysfs problem.
>> >> Although I'm actually using the BusyBox mdev hotplug helper rather
>> >> than udev, I hope this is the right list to be asking this question.
>> >
>> > For busybox questions, not really, but we reserve the right to poke fun
>> > at you for using mdev :)
>> >
>> >> What appears to be happening is I get my initramfs extracted, so I
>> >> have access to the various necessary files including the hotplug
>> >> helper and my firmware files. This step is taken care of by the rootfs
>> >> initcall level. Then the driver initcalls are run, including the
>> >> libertas setup routines, which call request_firmware. request_firmware
>> >> fires off a uevent and calls the hotplug helper. The hotplug helper
>> >> looks for the /sys/class/firmware entry for the libertas device, but
>> >> it doesn't find one because I don't appear to have a mounted sysfs on
>> >> the /sys mountpoint.
>> >>
>> >> So my question is: who should be mounting sysfs here? init will mount
>> >> sysfs, but is run much later than the device initcalls.
>> >
>> > You need to mount sysfs as one of the first things to have happen. Look
>> > at your distro's startup scripts as an example of this.
>>
>> Yes, I want my sysfs mounted as early as possible, but userspace (via
>> /sbin/init) does not get a chance to do this until after the device
>> initcalls have been run. I'm interested to know if there's a standard
>> way to get sysfs mounted before /sbin/init is run.
>
> There isn't.
Ok, so we cannot expect sysfs to be mounted on /sys before /sbin/init
has been run?
What do we do with callers of request_firmware prior to /sbin/init
running? Should drivers that require firmware always be modules?
I would rather build in my drivers monolithically if possible for ease
of deployment and boot speed.
Is there some non-standard other way of mounting sysfs people are
using in this situation?
>> I could modify mdev to mount sysfs if it detects that it isn't
>> already, but that seems like something of a hack.
>
> Yeah, that sounds wrong. Look at how your desktop distro does this,
> this shouldn't be an issue.
Looks like RHEL calls mount in /etc/rc.sysinit, which is still a bit
late for drivers calling request_firmware that are built in to the
kernel.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Who mounts sysfs?
2009-06-25 10:36 Who mounts sysfs? Will Newton
` (3 preceding siblings ...)
2009-06-25 16:57 ` Will Newton
@ 2009-06-25 17:13 ` Greg KH
2009-06-25 18:06 ` Will Newton
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2009-06-25 17:13 UTC (permalink / raw)
To: linux-hotplug
On Thu, Jun 25, 2009 at 05:57:51PM +0100, Will Newton wrote:
> On Thu, Jun 25, 2009 at 5:28 PM, Greg KH<greg@kroah.com> wrote:
> > On Thu, Jun 25, 2009 at 04:53:07PM +0100, Will Newton wrote:
> >> On Thu, Jun 25, 2009 at 4:18 PM, Greg KH<greg@kroah.com> wrote:
> >> > On Thu, Jun 25, 2009 at 11:36:29AM +0100, Will Newton wrote:
> >> >> Hi all,
> >> >>
> >> >> I'm trying to get the libertas driver working on an embedded
> >> >> development board and I've run into what looks like a sysfs problem.
> >> >> Although I'm actually using the BusyBox mdev hotplug helper rather
> >> >> than udev, I hope this is the right list to be asking this question.
> >> >
> >> > For busybox questions, not really, but we reserve the right to poke fun
> >> > at you for using mdev :)
> >> >
> >> >> What appears to be happening is I get my initramfs extracted, so I
> >> >> have access to the various necessary files including the hotplug
> >> >> helper and my firmware files. This step is taken care of by the rootfs
> >> >> initcall level. Then the driver initcalls are run, including the
> >> >> libertas setup routines, which call request_firmware. request_firmware
> >> >> fires off a uevent and calls the hotplug helper. The hotplug helper
> >> >> looks for the /sys/class/firmware entry for the libertas device, but
> >> >> it doesn't find one because I don't appear to have a mounted sysfs on
> >> >> the /sys mountpoint.
> >> >>
> >> >> So my question is: who should be mounting sysfs here? init will mount
> >> >> sysfs, but is run much later than the device initcalls.
> >> >
> >> > You need to mount sysfs as one of the first things to have happen. Look
> >> > at your distro's startup scripts as an example of this.
> >>
> >> Yes, I want my sysfs mounted as early as possible, but userspace (via
> >> /sbin/init) does not get a chance to do this until after the device
> >> initcalls have been run. I'm interested to know if there's a standard
> >> way to get sysfs mounted before /sbin/init is run.
> >
> > There isn't.
>
> Ok, so we cannot expect sysfs to be mounted on /sys before /sbin/init
> has been run?
How would that possibly happen?
> What do we do with callers of request_firmware prior to /sbin/init
> running?
They would fail, as no userspace filesystems would be mounted yet to
provide the firmware in the firstplace.
> Should drivers that require firmware always be modules?
Depends on your system setup :)
You could use an initramfs to solve this problem :)
> I would rather build in my drivers monolithically if possible for ease
> of deployment and boot speed.
>
> Is there some non-standard other way of mounting sysfs people are
> using in this situation?
Possibly an initramfs?
Or just replay the uevents when init starts up, after you have mounted
sysfs, and other filesystems, so that the firmware can be properly
loaded. That is what almost all distros do.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Who mounts sysfs?
2009-06-25 10:36 Who mounts sysfs? Will Newton
` (4 preceding siblings ...)
2009-06-25 17:13 ` Greg KH
@ 2009-06-25 18:06 ` Will Newton
2009-06-25 18:29 ` Greg KH
2009-06-26 0:12 ` Kay Sievers
7 siblings, 0 replies; 9+ messages in thread
From: Will Newton @ 2009-06-25 18:06 UTC (permalink / raw)
To: linux-hotplug
On Thu, Jun 25, 2009 at 6:13 PM, Greg KH<greg@kroah.com> wrote:
> On Thu, Jun 25, 2009 at 05:57:51PM +0100, Will Newton wrote:
>> On Thu, Jun 25, 2009 at 5:28 PM, Greg KH<greg@kroah.com> wrote:
>> > On Thu, Jun 25, 2009 at 04:53:07PM +0100, Will Newton wrote:
>> >> On Thu, Jun 25, 2009 at 4:18 PM, Greg KH<greg@kroah.com> wrote:
>> >> > On Thu, Jun 25, 2009 at 11:36:29AM +0100, Will Newton wrote:
>> >> >> Hi all,
>> >> >>
>> >> >> I'm trying to get the libertas driver working on an embedded
>> >> >> development board and I've run into what looks like a sysfs problem.
>> >> >> Although I'm actually using the BusyBox mdev hotplug helper rather
>> >> >> than udev, I hope this is the right list to be asking this question.
>> >> >
>> >> > For busybox questions, not really, but we reserve the right to poke fun
>> >> > at you for using mdev :)
>> >> >
>> >> >> What appears to be happening is I get my initramfs extracted, so I
>> >> >> have access to the various necessary files including the hotplug
>> >> >> helper and my firmware files. This step is taken care of by the rootfs
>> >> >> initcall level. Then the driver initcalls are run, including the
>> >> >> libertas setup routines, which call request_firmware. request_firmware
>> >> >> fires off a uevent and calls the hotplug helper. The hotplug helper
>> >> >> looks for the /sys/class/firmware entry for the libertas device, but
>> >> >> it doesn't find one because I don't appear to have a mounted sysfs on
>> >> >> the /sys mountpoint.
>> >> >>
>> >> >> So my question is: who should be mounting sysfs here? init will mount
>> >> >> sysfs, but is run much later than the device initcalls.
>> >> >
>> >> > You need to mount sysfs as one of the first things to have happen. Look
>> >> > at your distro's startup scripts as an example of this.
>> >>
>> >> Yes, I want my sysfs mounted as early as possible, but userspace (via
>> >> /sbin/init) does not get a chance to do this until after the device
>> >> initcalls have been run. I'm interested to know if there's a standard
>> >> way to get sysfs mounted before /sbin/init is run.
>> >
>> > There isn't.
>>
>> Ok, so we cannot expect sysfs to be mounted on /sys before /sbin/init
>> has been run?
>
> How would that possibly happen?
>
>> What do we do with callers of request_firmware prior to /sbin/init
>> running?
>
> They would fail, as no userspace filesystems would be mounted yet to
> provide the firmware in the firstplace.
My initramfs has the firmware in it. I thought this was one of the
reasons one might use an initramfs, to load drivers and firmware for
your root device e.g. network devices for nfs root.
>> Should drivers that require firmware always be modules?
>
> Depends on your system setup :)
>
> You could use an initramfs to solve this problem :)
Well I do have an initramfs (in fact it's all I have), but I'm not
sure how I can solve this problem with it. The initramfs is extracted
just fine, but I'm not sure if it provides me with a way to mount
sysfs before the device initcalls occur.
>> I would rather build in my drivers monolithically if possible for ease
>> of deployment and boot speed.
>>
>> Is there some non-standard other way of mounting sysfs people are
>> using in this situation?
>
> Possibly an initramfs?
>
> Or just replay the uevents when init starts up, after you have mounted
> sysfs, and other filesystems, so that the firmware can be properly
> loaded. That is what almost all distros do.
Can udev help with this? Have the distros got a standard way of doing
this? It sounds slightly complex...
Thanks for your patience,
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Who mounts sysfs?
2009-06-25 10:36 Who mounts sysfs? Will Newton
` (5 preceding siblings ...)
2009-06-25 18:06 ` Will Newton
@ 2009-06-25 18:29 ` Greg KH
2009-06-26 0:12 ` Kay Sievers
7 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2009-06-25 18:29 UTC (permalink / raw)
To: linux-hotplug
On Thu, Jun 25, 2009 at 07:06:15PM +0100, Will Newton wrote:
> On Thu, Jun 25, 2009 at 6:13 PM, Greg KH<greg@kroah.com> wrote:
> > On Thu, Jun 25, 2009 at 05:57:51PM +0100, Will Newton wrote:
> >> On Thu, Jun 25, 2009 at 5:28 PM, Greg KH<greg@kroah.com> wrote:
> >> > On Thu, Jun 25, 2009 at 04:53:07PM +0100, Will Newton wrote:
> >> >> On Thu, Jun 25, 2009 at 4:18 PM, Greg KH<greg@kroah.com> wrote:
> >> >> > On Thu, Jun 25, 2009 at 11:36:29AM +0100, Will Newton wrote:
> >> >> >> Hi all,
> >> >> >>
> >> >> >> I'm trying to get the libertas driver working on an embedded
> >> >> >> development board and I've run into what looks like a sysfs problem.
> >> >> >> Although I'm actually using the BusyBox mdev hotplug helper rather
> >> >> >> than udev, I hope this is the right list to be asking this question.
> >> >> >
> >> >> > For busybox questions, not really, but we reserve the right to poke fun
> >> >> > at you for using mdev :)
> >> >> >
> >> >> >> What appears to be happening is I get my initramfs extracted, so I
> >> >> >> have access to the various necessary files including the hotplug
> >> >> >> helper and my firmware files. This step is taken care of by the rootfs
> >> >> >> initcall level. Then the driver initcalls are run, including the
> >> >> >> libertas setup routines, which call request_firmware. request_firmware
> >> >> >> fires off a uevent and calls the hotplug helper. The hotplug helper
> >> >> >> looks for the /sys/class/firmware entry for the libertas device, but
> >> >> >> it doesn't find one because I don't appear to have a mounted sysfs on
> >> >> >> the /sys mountpoint.
> >> >> >>
> >> >> >> So my question is: who should be mounting sysfs here? init will mount
> >> >> >> sysfs, but is run much later than the device initcalls.
> >> >> >
> >> >> > You need to mount sysfs as one of the first things to have happen. Look
> >> >> > at your distro's startup scripts as an example of this.
> >> >>
> >> >> Yes, I want my sysfs mounted as early as possible, but userspace (via
> >> >> /sbin/init) does not get a chance to do this until after the device
> >> >> initcalls have been run. I'm interested to know if there's a standard
> >> >> way to get sysfs mounted before /sbin/init is run.
> >> >
> >> > There isn't.
> >>
> >> Ok, so we cannot expect sysfs to be mounted on /sys before /sbin/init
> >> has been run?
> >
> > How would that possibly happen?
> >
> >> What do we do with callers of request_firmware prior to /sbin/init
> >> running?
> >
> > They would fail, as no userspace filesystems would be mounted yet to
> > provide the firmware in the firstplace.
>
> My initramfs has the firmware in it. I thought this was one of the
> reasons one might use an initramfs, to load drivers and firmware for
> your root device e.g. network devices for nfs root.
Great, then mount /sys in your initramfs, and it should be all fine.
Have you tried that?
> > Or just replay the uevents when init starts up, after you have mounted
> > sysfs, and other filesystems, so that the firmware can be properly
> > loaded. That is what almost all distros do.
>
> Can udev help with this? Have the distros got a standard way of doing
> this? It sounds slightly complex...
Yes, udev provides a standard way to do this, using 'udevadm trigger'.
Again, look at your desktop's distro's startup scripts for an example of
this.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Who mounts sysfs?
2009-06-25 10:36 Who mounts sysfs? Will Newton
` (6 preceding siblings ...)
2009-06-25 18:29 ` Greg KH
@ 2009-06-26 0:12 ` Kay Sievers
7 siblings, 0 replies; 9+ messages in thread
From: Kay Sievers @ 2009-06-26 0:12 UTC (permalink / raw)
To: linux-hotplug
On Thu, Jun 25, 2009 at 20:29, Greg KH<greg@kroah.com> wrote:
> On Thu, Jun 25, 2009 at 07:06:15PM +0100, Will Newton wrote:
>> Can udev help with this? Have the distros got a standard way of doing
>> this? It sounds slightly complex...
>
> Yes, udev provides a standard way to do this, using 'udevadm trigger'.
>
> Again, look at your desktop's distro's startup scripts for an example of
> this.
That should work fine, if the request is still valid and not timed out.
I guess you either use a kernel module you load later, or you compile
the firmware into the kernel. Having a monolithic kernel and a modular
firmware just doesn't sound right.
Or you "fix" the driver to do a delayed firmware requests, when the
interface is brought up, not when the driver gets initialized, that
seems to work fine for other drivers.
Kay
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-06-26 0:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-25 10:36 Who mounts sysfs? Will Newton
2009-06-25 15:18 ` Greg KH
2009-06-25 15:53 ` Will Newton
2009-06-25 16:28 ` Greg KH
2009-06-25 16:57 ` Will Newton
2009-06-25 17:13 ` Greg KH
2009-06-25 18:06 ` Will Newton
2009-06-25 18:29 ` Greg KH
2009-06-26 0:12 ` Kay Sievers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).