From: Nigel Kukard <nkukard@lbsd.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev 145, when are events fully processed?
Date: Fri, 07 Aug 2009 16:40:47 +0000 [thread overview]
Message-ID: <4A7C590F.2050303@lbsd.net> (raw)
In-Reply-To: <4A749D9E.3020709@lbsd.net>
>> I think you guys are missing the problem I'm having. This has nothing to
>> do with USB, I don't use USB and don't load any USB modules. I've tried
>> this out on 3 boxes using kernel 2.9.29.6 and udev 145.
>>
>> Here are the modules loaded ...
>> ahci, piix, ide_core, ata_piix, pata_acpi, libata
>>
>> * I have a kernel with an initramfs, no disk controller modules are
>> loaded at all before the initramfs fires up
>> * My script is this ....
>> examine pci bus & modprobe modules we need for disks
>> fire up udev
>> udev trigger
>> udev settle
>> mount LABEL=root
>>
>> Simple. Now .... that works in 141 fine, it does not in 145. If I do an
>> ls /dev straight after settle, there are no sd* devices. If I add a
>> sleep 5s after settle, the devices are there.
>>
>> udevadm settle exits after about 1 second, when I check the creation
>> times on the devices it takes a few seconds, up to 5 depending on the
>> speed of the box.
>>
>> Kay, you said yourself that settle does not wait until the events are
>> fully processed and exits once they have been recieved by udev.
>>
>
> I did? Where? Must be misunderstanding.
>
Sorry ... wrong Kay ;)
I was then mis-informed.
I understood settle waits until everything is 100% processed that was
queued, right? so if sda is in the queue, settle will wait until
/dev/sda is created?
>> This is
>> EXACTLY what is happening in 145.
>>
>
> settle waits for all pending events in the kernel, and the ones
> already received by udev, to finish. It exits not before no events are
> pending anymore, in the kernel and in udev.
>
I can see udev trigger sending the correct events through to udev, I can
see sda there .... but after the settle, its not in /dev/ yet, takes a
second or two and its there.
What would happen if udev is started, trigger, settle, kill udev. Start
udev, trigger, settle .... would I get the behavior I have now
(expected?), or should it still wait until everything is 100% processed
and the devices exist before exiting if sda was in the queue?
>> You further said this is due to the
>> speed improvements with 145 and I was just lucky in 141 and I should be
>> waiting for the udev event that the device has been processed. I went
>> over the chat logs again to make sure I'm not imagining things.
>>
>
> Not sure what you mean, but it's probably not pending events and
> udevsettle which causes your problem. Sound like events which are not
> pending.
> You definitely can not be sure that there are no future events coming
> in, which are not queued anywhere at this moment, not in the kernel,
> not in udev. You can not be sure about this at any point. And settle
> can not do anything here. It's just the next interrupt from the
> hardware that may cause your device to appear, and there is usually no
> way to predict that.
>
The thing is trigger is sending the sda event to udev, I can see it if I
enable debugging, but udevadm settle is exiting before /dev/sda exists.
>> This will not work ... udevadm settle
>> --exit-if-exists=/dev/disk/by-label/foo , 'udevadm settle' exits
>> BEFORE the device is created.
>>
>
> Might be. But then no event is pending as described above. If you wait
> for a specific device, just loop until it shows up. I guess, you just
> cannot use the udev queue to tell you anything it does not know.
>
By pending, do you mean trigger would queue it? because I can guarantee
you if I enable debugging in trigger I see it.
-N
prev parent reply other threads:[~2009-08-07 16:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-01 19:55 udev 145, when are events fully processed? Nigel Kukard
2009-08-07 12:26 ` Harald Hoyer
2009-08-07 12:56 ` Nigel Kukard
2009-08-07 14:15 ` Alan Jenkins
2009-08-07 14:48 ` Nigel Kukard
2009-08-07 15:34 ` Kay Sievers
2009-08-07 16:00 ` Alan Jenkins
2009-08-07 16:10 ` Nigel Kukard
2009-08-07 16:24 ` Kay Sievers
2009-08-07 16:40 ` Nigel Kukard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A7C590F.2050303@lbsd.net \
--to=nkukard@lbsd.net \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).