* [PATCH] Enable all events for initramfs
@ 2004-07-13 11:16 Hannes Reinecke
2004-07-14 4:01 ` Alexander E. Patrakov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Hannes Reinecke @ 2004-07-13 11:16 UTC (permalink / raw)
To: Linux Kernel; +Cc: hotplug
[-- Attachment #1: Type: text/plain, Size: 584 bytes --]
Hi all,
currently most driver events are not sent out when using initramfs as
driver_init() (which triggers the events) is called before init_workqueues.
This patch rearranges the init calls so that the hotplug event queue is
enabled prior to calling driver_init(), hence we're getting all hotplug
events again.
Patch is relative to 2.6.7-mm6, but should apply to 2.6.8-rc1 also.
Please apply.
Cheers,
Hannes
--
Dr. Hannes Reinecke hare@suse.de
SuSE Linux AG S390 & zSeries
Maxfeldstraße 5 +49 911 74053 688
90409 Nürnberg http://www.suse.de
[-- Attachment #2: early-hotplug-events.patch --]
[-- Type: text/x-patch, Size: 1120 bytes --]
--- linux-2.6.7-mm6/init/main.c.orig 2004-07-09 11:01:04.000000000 +0200
+++ linux-2.6.7-mm6/init/main.c 2004-07-09 11:14:19.000000000 +0200
@@ -93,6 +93,7 @@
extern void populate_rootfs(void);
extern void driver_init(void);
extern void prepare_namespace(void);
+extern void usermodehelper_init(void);
#ifdef CONFIG_TC
extern void tc_init(void);
@@ -599,6 +600,10 @@
*/
static void __init do_basic_setup(void)
{
+ /* drivers will send hotplug events */
+ init_workqueues();
+ usermodehelper_init();
+
driver_init();
#ifdef CONFIG_SYSCTL
@@ -608,7 +613,6 @@
/* Networking initialization needs a process context */
sock_init();
- init_workqueues();
do_initcalls();
}
--- linux-2.6.7-mm6/kernel/kmod.c.orig 2004-07-09 11:02:32.000000000 +0200
+++ linux-2.6.7-mm6/kernel/kmod.c 2004-07-13 14:11:09.287575443 +0200
@@ -272,10 +272,8 @@
}
EXPORT_SYMBOL(call_usermodehelper);
-static __init int usermodehelper_init(void)
+void __init usermodehelper_init(void)
{
khelper_wq = create_singlethread_workqueue("khelper");
BUG_ON(!khelper_wq);
- return 0;
}
-core_initcall(usermodehelper_init);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Enable all events for initramfs
2004-07-13 11:16 [PATCH] Enable all events for initramfs Hannes Reinecke
@ 2004-07-14 4:01 ` Alexander E. Patrakov
2004-07-14 6:24 ` Olaf Hering
2004-07-15 16:45 ` Alexander E. Patrakov
2 siblings, 0 replies; 4+ messages in thread
From: Alexander E. Patrakov @ 2004-07-14 4:01 UTC (permalink / raw)
To: linux-hotplug
Hannes Reinecke wrote:
> Hi all,
>
> currently most driver events are not sent out when using initramfs as
> driver_init() (which triggers the events) is called before init_workqueues.
>
> This patch rearranges the init calls so that the hotplug event queue is
> enabled prior to calling driver_init(), hence we're getting all hotplug
> events again.
>
> Patch is relative to 2.6.7-mm6, but should apply to 2.6.8-rc1 also.
>
> Please apply.
This is probably a very good news.
I see the following application of it. Since no hotplug events are
dropped any more, the initramfs could save their type and environment in
files on a ramfs, and then remount that ramfs to some location
accessible by the main system. The information accumulated in these
files can be used for re-synthesis of events not handled because e.g.
/usr was not mounted.
This means that we can drop the udevstart program and *.rc files that
come with the hotplug package and replace them by playback of such
recorded events. This looks much cleaner, since right now the
reconstruction is imperfect.
I will try to implement this approach (i.e, create initramfs and modify
the hotplug and udev packages) during this week on a copy of Linux From
Scratch 20040702, and report the results here.
--
Alexander E. Patrakov
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Enable all events for initramfs
2004-07-13 11:16 [PATCH] Enable all events for initramfs Hannes Reinecke
2004-07-14 4:01 ` Alexander E. Patrakov
@ 2004-07-14 6:24 ` Olaf Hering
2004-07-15 16:45 ` Alexander E. Patrakov
2 siblings, 0 replies; 4+ messages in thread
From: Olaf Hering @ 2004-07-14 6:24 UTC (permalink / raw)
To: linux-hotplug
On Wed, Jul 14, Alexander E. Patrakov wrote:
> I see the following application of it. Since no hotplug events are
> dropped any more, the initramfs could save their type and environment in
> files on a ramfs, and then remount that ramfs to some location
> accessible by the main system. The information accumulated in these
> files can be used for re-synthesis of events not handled because e.g.
> /usr was not mounted.
The info as already in sysfs. See how udevstart regenerates each
relevant event.
The whole point of handling these events on the fly is speed. No need to
run udevstart anymore. But you better not drop udevstart. It will
rebuild /dev/ if you toasted its content.
And a hotplug package is really broken if it relies on stuff in /usr
--
USB is for mice, FireWire is for men!
sUse lINUX ag, n√úRNBERG
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Enable all events for initramfs
2004-07-13 11:16 [PATCH] Enable all events for initramfs Hannes Reinecke
2004-07-14 4:01 ` Alexander E. Patrakov
2004-07-14 6:24 ` Olaf Hering
@ 2004-07-15 16:45 ` Alexander E. Patrakov
2 siblings, 0 replies; 4+ messages in thread
From: Alexander E. Patrakov @ 2004-07-15 16:45 UTC (permalink / raw)
To: linux-hotplug
Alexander E. Patrakov wrote:
> Hannes Reinecke wrote:
>
>> Hi all,
>>
>> currently most driver events are not sent out when using initramfs as
>> driver_init() (which triggers the events) is called before
>> init_workqueues.
>>
>> This patch rearranges the init calls so that the hotplug event queue
>> is enabled prior to calling driver_init(), hence we're getting all
>> hotplug events again.
>>
>> Patch is relative to 2.6.7-mm6, but should apply to 2.6.8-rc1 also.
>>
>> Please apply.
>
LFS-ers: get it from http://lkml.org/lkml/diff/2004/7/13/74/1
>
> This is probably a very good news.
>
> I see the following application of it. Since no hotplug events are
> dropped any more, the initramfs could save their type and environment in
> files on a ramfs, and then remount that ramfs to some location
> accessible by the main system. The information accumulated in these
> files can be used for re-synthesis of events not handled because e.g.
> /usr was not mounted.
It appeared to be easier to just make /sbin/hotplug processes in
initramfs sleep until they can call /sbin/hotplug on the real root.
> This means that we can drop the udevstart program and *.rc files that
> come with the hotplug package and replace them by playback of such
> recorded events. This looks much cleaner, since right now the
> reconstruction is imperfect.
>
> I will try to implement this approach (i.e, create initramfs and modify
> the hotplug and udev packages) during this week on a copy of Linux From
> Scratch 20040702, and report the results here.
>
Done.
The initramfs image (busybox-based) is available at:
http://ums.physics.usu.ru/~patrakov/initramfs_data.cpio.gz
md5sum: 69f5b834526b4ce918887c2f7a4067a6
This has been tested on my computer with LFS SVN-20040702 and
LFS-bootscripts 20040704 with the following changes:
1) The mountkernfs, udev, checkfs and hotplug initscripts should be
disabled or removed. Removal of checkfs is because of (3) below, other
initscripts are not needed because my initramfs does their jobs. For
those not familiar with LFS, the "mountkernfs" initscript mounts /proc
and /sys, the "udev" initscript mounts ramfs on /dev and then runs
udevstart and creates some extra nodes, "checkfs" runs fsck, "hotplug"
is a pretty much original initscript that comes with the hotplug package
that should be well-known here :)
2) The LFS-specific change of the kmod.c file should be dropped
3) The use of a journaled filesystem (e.g. ext3) mounted rw at boot is a
must. /sbin/hotplug may mishandle hotplug events on read-only root.
4) The /proc, /sys and /proc/bus/usb entries in /etc/fstab should be
marked as "noauto"
5) The following line should be added to /etc/modprobe.conf:
install usbcore /sbin/modprobe -i usbcore ; mount /proc/bus/usb
(usbcore must be a module, or a modification of /init is needed)
Results: all my devices are in /dev, all modules for my hardware are
loaded due to early hotplug events delivered to /sbin/hotplug without
any loss.
Caveats:
1) a kernel bogusly complains about runaway modprobe loop net-pf-1. This
is really not a loop, just imagine that 200 "udevd" behemots
simultaneously try to create a socket :( Don't compile af-unix as a module.
2) The loop that waits for all hotplug processes to go away doesn't seem
to work. As a result, a bug involving a race between hotplug and e.g.
swapon is likely to exist.
--
Alexander E. Patrakov
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idG21&alloc_id\x10040&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-15 16:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-13 11:16 [PATCH] Enable all events for initramfs Hannes Reinecke
2004-07-14 4:01 ` Alexander E. Patrakov
2004-07-14 6:24 ` Olaf Hering
2004-07-15 16:45 ` Alexander E. Patrakov
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).