Skip to contentSkip to conversation

modular IDE in 2.4.23

DISCUSSION Marcelo Tosatti 4 participants 10 messages Nov 23, 2003 – Nov 24, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 12 lines · Arkadiusz Miskiewicz
Quoted 1 line · Arkadiusz Miskiewicz

Could you give more specific hints how to fix ,,other stuff''?

Did this in not the right way probably but it works fine for me (just modular ide tested):

http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/linux-2.4.23-modular-ide.patch?rev=1.9

[misiek@arm ~]$ lsmod | grep ide

ide-scsi                9904   0
scsi_mod               93888   2 [sg ide-scsi]
ide-cd                 30944   0
cdrom                  29248   0 [ide-cd]
Quoted 7 lines

ide-disk 16076 13
ide-core 104504 13 [ide-scsi ide-cd ide-disk pdc202xx_new
via82cxxx]

Thanks for hint (now only cmd640 isse left for me).

Quoted 1 line
Quoted 1 line

Alan

Arkadiusz,

I agree with you that modular IDE (I dont care that much about the cmd640 really) should work on 2.4.23.

I dont think the "ide-probe-mini" is required though. Just calling the ide-probe.o init functions from IDE init should work right?

Does the attached patch work for you (it moves ide-probe into ide-core, as Alan mentioned) ?

drivers/ide/Makefile +3 -3
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.23-rc4/drivers/ide/Makefile linux-2.4.23-rc3/drivers/ide/Makefile
@@ -9,7 +9,7 @@
 #
 
 
-export-objs := ide-iops.o ide-taskfile.o ide-proc.o ide.o ide-probe.o ide-dma.o ide-lib.o setup-pci.o ide-io.o ide-disk.o
+export-objs := ide-iops.o ide-taskfile.o ide-proc.o ide.o ide-dma.o ide-lib.o setup-pci.o ide-io.o ide-disk.o ide-probe.o
 
 all-subdirs	:= arm legacy pci ppc raid
 mod-subdirs	:= arm legacy pci ppc raid
@@ -28,8 +28,8 @@
 
 # Core IDE code - must come before legacy
 
-ide-core-objs	:= ide-iops.o ide-taskfile.o ide.o ide-lib.o ide-io.o ide-default.o ide-proc.o
-ide-detect-objs	:= ide-probe.o ide-geometry.o
+ide-core-objs	:= ide-iops.o ide-taskfile.o ide.o ide-lib.o ide-io.o ide-default.o ide-proc.o ide-probe.o
+ide-detect-objs	:= ide-geometry.o 
 
 
 ifeq ($(CONFIG_BLK_DEV_IDEPCI),y)
drivers/ide/ide-probe.c +6 -2
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.23-rc4/drivers/ide/ide-probe.c linux-2.4.23-rc3/drivers/ide/ide-probe.c
@@ -1416,7 +1416,7 @@
 #ifdef MODULE
 extern int (*ide_xlate_1024_hook)(kdev_t, int, int, const char *);
 
-int init_module (void)
+int ideprobe_init_module(void)
 {
 	unsigned int index;
 	
@@ -1428,10 +1428,14 @@
 	return 0;
 }
 
-void cleanup_module (void)
+void ideprobe_cleanup_module (void)
 {
 	ide_probe = NULL;
 	ide_xlate_1024_hook = 0;
 }
+
+EXPORT_SYMBOL(ideprobe_init_module);
+EXPORT_SYMBOL(ideprobe_cleanup_module);
 MODULE_LICENSE("GPL");
+
 #endif /* MODULE */
drivers/ide/ide.c +2 -0
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.23-rc4/drivers/ide/ide.c linux-2.4.23-rc3/drivers/ide/ide.c
@@ -3059,6 +3059,7 @@
 
 int init_module (void)
 {
+	ideprobe_init_module();
 	parse_options(options);
 	return ide_init();
 }
@@ -3080,6 +3081,7 @@
 	proc_ide_destroy();
 #endif
 	devfs_unregister (ide_devfs_handle);
+	ideprobe_cleanup_module();
 }
 
 #else /* !MODULE */
include/linux/ide.h +3 -0
diff -Naur -X /home/marcelo/lib/dontdiff linux-2.4.23-rc4/include/linux/ide.h linux-2.4.23-rc3/include/linux/ide.h
@@ -1615,6 +1615,9 @@
 extern int idescsi_attach(ide_drive_t *);
 extern int idescsi_init(void);
 
+extern int ideprobe_init_module(void);
+extern void ideprobe_cleanup_module(void);
+
 extern void ide_scan_pcibus(int scan_direction) __init;
 extern int ide_pci_register_driver(struct pci_driver *driver);
 extern void ide_pci_unregister_driver(struct pci_driver *driver);
#2 lore raw
Quoted 19 lines · Marcelo Tosatti
Quoted 18 lines · Arkadiusz Miskiewicz
Quoted 1 line · Arkadiusz Miskiewicz

Could you give more specific hints how to fix ,,other stuff''?

Did this in not the right way probably but it works fine for me (just modular ide tested):

http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/linux-2.4.23-modular-ide.
patch?rev=1.9

[misiek@arm ~]$ lsmod | grep ide

ide-scsi                9904   0
scsi_mod               93888   2 [sg ide-scsi]
ide-cd                 30944   0
cdrom                  29248   0 [ide-cd]

ide-disk 16076 13
ide-core 104504 13 [ide-scsi ide-cd ide-disk pdc202xx_new
via82cxxx]

Quoted 5 lines
Quoted 3 lines

Thanks for hint (now only cmd640 isse left for me).

Quoted 1 line
Quoted 1 line

Alan

Arkadiusz,

Unfortunately this patch is not sufficient.

Quoted 2 lines

I agree with you that modular IDE (I dont care that much about the cmd640 really) should work on 2.4.23.

Some people want cmd640 fixes in 2.4.23, really!

Quoted 2 lines

I dont think the "ide-probe-mini" is required though. Just calling the ide-probe.o init functions from IDE init should work right?

"ide-probe-mini" is not required and just calling init functions from IDE init won't work (will break modular chipsets).

Quoted 2 lines

Does the attached patch work for you (it moves ide-probe into ide-core, as Alan mentioned) ?

It will break drives probing for all modular chipset drivers.

Uh. Oh. 2.4.23 IDE changes are obscure... Modular IDE breakage is caused by Alan's hotplug changes and is not easy to fix properly.

I would like to have these changes removed:
(a) they break modular IDE
(b) such changes should be first added to 2.6 and then backported to 2.4 (otherwise you are magically creating regression in 2.6)
(c) they are ugly and will cause much maintaining headache (and it seems it won't be Alan who will suffer ;))

Anyway it is up to you :-).

cheers,
--bart

#3 lore raw
Quoted 2 lines

Uh. Oh. 2.4.23 IDE changes are obscure... Modular IDE breakage is caused by Alan's hotplug changes and is not easy to fix properly.

The fixing is simply a matter of linkage ordering and function execution.

Simple thought experiment

Merge ide-probe into ide-core
Export a symbol for the second initializer function if used modular Create a mini module that just invokes the exported function on init

You now have the same execution sequence but with the link problem removed.

Quoted 4 lines

I would like to have these changes removed:
(a) they break modular IDE
(b) such changes should be first added to 2.6 and then backported to 2.4 (otherwise you are magically creating regression in 2.6)

Its not my fault the 2.6 code is lagging badly, and I wrote the code because people using laptops, and people using ATA and SATA for business expect basic functionality like hotplug to work. For most of them 2.6 doesn't really matter and won't for another 6 months, but 2.4 matters right now.

The cmd640 stuff is the only hard to fix bit, and its unrelated to the modular IDE stuff.

#4 lore raw
Quoted 10 lines · Alan Cox
Quoted 2 lines

Uh. Oh. 2.4.23 IDE changes are obscure... Modular IDE breakage is caused by Alan's hotplug changes and is not easy to fix properly.

The fixing is simply a matter of linkage ordering and function execution.

Simple thought experiment

Merge ide-probe into ide-core
Export a symbol for the second initializer function if used modular Create a mini module that just invokes the exported function on init

Update ide_probe_module() for new name of probe module.

Quoted 1 line

You now have the same execution sequence but with the link problem removed.

Hmm, actually you are right. Sorry :-).

Quoted 6 lines
Quoted 4 lines

I would like to have these changes removed:
(a) they break modular IDE
(b) such changes should be first added to 2.6 and then backported to 2.4 (otherwise you are magically creating regression in 2.6)

Its not my fault the 2.6 code is lagging badly, and I wrote the code

2.6 is not "lagging badly", this is a false statement.

Quoted 4 lines

because people using laptops, and people using ATA and SATA for business expect basic functionality like hotplug to work. For most of them 2.6 doesn't really matter and won't for another 6 months, but 2.4 matters right now.

I assume you will fix it 6 months from now in 2.6, right? :-)

--bart

#5 lore raw
Quoted 3 lines
Quoted 1 line

Its not my fault the 2.6 code is lagging badly, and I wrote the code

2.6 is not "lagging badly", this is a false statement.

Ok.

Quoted 4 lines
Quoted 2 lines

doesn't really matter and won't for another 6 months, but 2.4 matters right now.

I assume you will fix it 6 months from now in 2.6, right? :-)

If it hasn't already been ported over I suspect I will get considerable demand to fix that, and yes I intend to do so if nobody else has - although I'm not sure I'm going to go back to kernel stuff paticularly after the course. I've been having way too much fun with stuff like X drivers and its time for something different.

Alan

#6 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 12 lines · Bartlomiej Zolnierkiewicz
Quoted 10 lines · Alan Cox
Quoted 2 lines

Uh. Oh. 2.4.23 IDE changes are obscure... Modular IDE breakage is caused by Alan's hotplug changes and is not easy to fix properly.

The fixing is simply a matter of linkage ordering and function execution.

Simple thought experiment

Merge ide-probe into ide-core
Export a symbol for the second initializer function if used modular Create a mini module that just invokes the exported function on init

Quoted 5 lines

Update ide_probe_module() for new name of probe module.

Quoted 1 line

You now have the same execution sequence but with the link problem removed.

Hmm, actually you are right. Sorry :-).

So mind you or Alan write a patch for me, please?

#7 lore raw
Quoted 3 lines
Quoted 1 line

Hmm, actually you are right. Sorry :-).

So mind you or Alan write a patch for me, please?

If I have time. I can't guarantee that.

If you do pull the hotplug out instead, remember to carefully reverse the relevant PPC changes too or you'll break all the PPC spin up stuff

#8 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 48 lines · Bartlomiej Zolnierkiewicz
Quoted 19 lines · Marcelo Tosatti
Quoted 18 lines · Arkadiusz Miskiewicz
Quoted 1 line · Arkadiusz Miskiewicz

Could you give more specific hints how to fix ,,other stuff''?

Did this in not the right way probably but it works fine for me (just modular ide tested):

http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/linux-2.4.23-modular-ide.
patch?rev=1.9

[misiek@arm ~]$ lsmod | grep ide

ide-scsi                9904   0
scsi_mod               93888   2 [sg ide-scsi]
ide-cd                 30944   0
cdrom                  29248   0 [ide-cd]

ide-disk 16076 13
ide-core 104504 13 [ide-scsi ide-cd ide-disk pdc202xx_new
via82cxxx]

Quoted 5 lines
Quoted 3 lines

Thanks for hint (now only cmd640 isse left for me).

Quoted 1 line
Quoted 1 line

Alan

Arkadiusz,

Unfortunately this patch is not sufficient.

Quoted 2 lines

I agree with you that modular IDE (I dont care that much about the cmd640 really) should work on 2.4.23.

Some people want cmd640 fixes in 2.4.23, really!

Quoted 2 lines

I dont think the "ide-probe-mini" is required though. Just calling the ide-probe.o init functions from IDE init should work right?

"ide-probe-mini" is not required and just calling init functions from IDE init won't work (will break modular chipsets).

Quoted 2 lines

Does the attached patch work for you (it moves ide-probe into ide-core, as Alan mentioned) ?

It will break drives probing for all modular chipset drivers.

Uh. Oh. 2.4.23 IDE changes are obscure... Modular IDE breakage is caused by Alan's hotplug changes and is not easy to fix properly.

Quoted 8 lines

I would like to have these changes removed:
(a) they break modular IDE
(b) such changes should be first added to 2.6 and then backported to 2.4 (otherwise you are magically creating regression in 2.6)
(c) they are ugly and will cause much maintaining headache (and it seems it won't be Alan who will suffer ;))

Anyway it is up to you :-).

Hum I think the saner approach is to remove the hotplugging indeed.

Mind writting me a patch Bart? :)

#9 lore raw
Quoted 3 lines · Marcelo Tosatti

Hum I think the saner approach is to remove the hotplugging indeed.

Mind writting me a patch Bart? :)

Hm, maybe for 2.4.23 it is sane but then reapply it again + merge ide-core and ide-detect since solution with ide-probe-mini works well.

Right now I've cleaned up a bit my old patch and it is attached bellow. I'm currently compiling kernel with it (so all my tests were done with old (uglier, #include "ide-probe.c" ) version of this patch).

Also probably most of #includes from ide-probe-mini.c could be removed, too.

ps. is there some magic way to avoid need of extern int ideprobe_init_module(void); etc in ide-probe-mini.c?

drivers/ide/ide-probe.c +10 -2
diff -urN linux-2.4.22.org/drivers/ide/ide-probe.c linux-2.4.22/drivers/ide/ide-probe.c
@@ -1416,22 +1416,30 @@
 #ifdef MODULE
 extern int (*ide_xlate_1024_hook)(kdev_t, int, int, const char *);
 
-int init_module (void)
+static int ideprobe_done = 0;
+
+int ideprobe_init_module (void)
 {
 	unsigned int index;
+
+	if (ideprobe_done)
+    		return -EBUSY;
 	
 	for (index = 0; index < MAX_HWIFS; ++index)
 		ide_unregister(index);
 	ideprobe_init();
 	create_proc_ide_interfaces();
 	ide_xlate_1024_hook = ide_xlate_1024;
+	ideprobe_done++;
 	return 0;
 }
 
-void cleanup_module (void)
+void ideprobe_cleanup_module (void)
 {
 	ide_probe = NULL;
 	ide_xlate_1024_hook = 0;
 }
+EXPORT_SYMBOL(ideprobe_init_module);
+EXPORT_SYMBOL(ideprobe_cleanup_module);
 MODULE_LICENSE("GPL");
 #endif /* MODULE */
drivers/ide/ide-probe-mini.c +29 -0
diff -urN linux-2.4.22.org/drivers/ide/ide-probe-mini.c linux-2.4.22/drivers/ide/ide-probe-mini.c
@@ -0,0 +1,29 @@
+/*
+ *  linux/drivers/ide/ide-probe-mini.c	Version 1
+ *
+ *  Copyright (C) 1994-1998  Linus Torvalds & authors (see below)
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/string.h>
+#include <linux/kernel.h>
+#include <linux/kmod.h>
+
+#ifdef MODULE
+extern int ideprobe_init_module(void);
+
+int init_module (void)
+{
+    return ideprobe_init_module();
+}
+
+extern void ideprobe_cleanup_module(void);
+
+void cleanup_module (void)
+{
+    ideprobe_cleanup_module();
+}
+MODULE_LICENSE("GPL");
+#endif /* MODULE */
drivers/ide/Makefile +3 -4
diff -urN linux-2.4.22.org/drivers/ide/Makefile linux-2.4.22/drivers/ide/Makefile
@@ -9,7 +9,7 @@
 #
 
 
-export-objs := ide-iops.o ide-taskfile.o ide-proc.o ide.o ide-probe.o ide-dma.o ide-lib.o setup-pci.o ide-io.o ide-disk.o
+export-objs := ide-iops.o ide-taskfile.o ide-proc.o ide.o ide-probe.o ide-probe-mini.o ide-dma.o ide-lib.o setup-pci.o ide-io.o ide-disk.o
 
 all-subdirs	:= arm legacy pci ppc raid
 mod-subdirs	:= arm legacy pci ppc raid
@@ -28,9 +28,8 @@
 
 # Core IDE code - must come before legacy
 
-ide-core-objs	:= ide-iops.o ide-taskfile.o ide.o ide-lib.o ide-io.o ide-default.o ide-proc.o
-ide-detect-objs	:= ide-probe.o ide-geometry.o
-
+ide-core-objs	:= ide-iops.o ide-taskfile.o ide.o ide-lib.o ide-io.o ide-default.o ide-proc.o ide-probe.o ide-geometry.o
+ide-detect-objs	:= ide-probe-mini.o
 
 ifeq ($(CONFIG_BLK_DEV_IDEPCI),y)
 ide-core-objs += setup-pci.o
Signature · 2 lines
Arkadiusz Miśkiewicz    CS at FoE, Wroclaw University of Technology
arekm.pld-linux.org AM2-6BONE, 1024/3DB19BBD, arekm(at)ircnet, PLD/Linux
#10 lore raw
Quoted 4 lines

Also probably most of #includes from ide-probe-mini.c could be removed, too.

ps. is there some magic way to avoid need of extern int ideprobe_init_module(void); etc in ide-probe-mini.c?

Other than pushing them into a header file, not really.

Looks good.