dmi_scan: exporting dmi_broken
Hi,
I'm having trouble understanding symbol exports :(
Some kernel modules, notably the ones from cpufreq, require an exported dmi_broken. The RH kernel sources I use as a base to patch i2c/lm_sensors 2.8.x upon, have a patch for exporting it, and dmi_scan.o/.ver have indeed the exported modversioned symbol.
After the i2c patch the symbol dissapears, although the source still has EXPORT_SYMBOL(dmi_broken)! Help! :)
RH kernel sources: linux-2.4.22-1.2163.nptl
ATrpms kernel sources with i2c/lm_sensors 2.8.2: linux-2.4.22-1.2163.nptl_32.rhfc1.at
# find linux-2.4.22-1.2163.nptl* -name dmi_scan.\* linux-2.4.22-1.2163.nptl/arch/i386/kernel/dmi_scan.c linux-2.4.22-1.2163.nptl/drivers/i2c/dmi_scan.c linux-2.4.22-1.2163.nptl/drivers/i2c/dmi_scan.h linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.stamp linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver linux-2.4.22-1.2163.nptl_32.rhfc1.at/arch/i386/kernel/dmi_scan.c linux-2.4.22-1.2163.nptl_32.rhfc1.at/drivers/i2c/dmi_scan.c linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/dmi_scan.h linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.stamp linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver # find linux-2.4.22-1.2163.nptl* -name dmi_scan.\* | xargs grep EXPORT linux-2.4.22-1.2163.nptl/arch/i386/kernel/dmi_scan.c:EXPORT_SYMBOL(dmi_broken); linux-2.4.22-1.2163.nptl/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL_GPL(dmi_ident); linux-2.4.22-1.2163.nptl/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL_GPL(dmi_scan_machine); linux-2.4.22-1.2163.nptl_32.rhfc1.at/arch/i386/kernel/dmi_scan.c:EXPORT_SYMBOL(dmi_broken); linux-2.4.22-1.2163.nptl_32.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_ident); linux-2.4.22-1.2163.nptl_32.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_scan_mach); # find linux-2.4.22-1.2163.nptl* -name dmi_scan.ver | xargs grep . linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver:#if defined(__module__smp) || defined(__module__up) || defined(__module__BOOT) linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver:#define __ver_dmi_broken _ver_str(565bcd17) linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver:#define dmi_broken _set_ver(dmi_broken) linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver:#endif linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver:#define __ver_dmi_ident _ver_str(b6e4b69b) linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver:#define dmi_ident _set_ver(dmi_ident) linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver:#define __ver_dmi_scan_mach _ver_str(0c5b4001) linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver:#define dmi_scan_mach _set_ver(dmi_scan_mach)
It looks as if the EXPORT_SYMBOLs of drivers/i2c/dmi_scan.c override the ones from arch/i386/kernel/dmi_scan.c. Previously drivers/i2c/dmi_scan.c had only EXPORT_SYMBOL_GPL.
Signature · 8 lines
[email protected] -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040119/8a823782/attachment.bin
Quoting Axel Thimm <[email protected]>:
Quoted 2 lines
What would an acceptable name be? The bugzilla reporter suggested prepending "i2c-" to the two files.
Sounds good to me.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 4 lines
Quoted 2 lines
What would an acceptable name be? The bugzilla reporter suggested prepending "i2c-" to the two files.
Sounds good to me.
Blah. I should have read the rest of the thread before replying. Mark's approch sounds much better (I really should have thought of it too, shame on me).
So, we have to make some changes to mkpatch so that it:
1* Doesn't include our dmi_scan.
2* Patches the kernel one.
1 is trivial, and 2 should not be too hard.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Hi,
Quoted 41 lines · Axel Thimm
I'm having trouble understanding symbol exports :(
Some kernel modules, notably the ones from cpufreq, require an exported
dmi_broken. The RH kernel sources I use as a base to patch i2c/lm_sensors 2.8.x upon, have a patch for exporting it, and dmi_scan.o/.ver have indeed the exported modversioned symbol.After the i2c patch the symbol dissapears, although the source still has
EXPORT_SYMBOL(dmi_broken)! Help! :)RH kernel sources: linux-2.4.22-1.2163.nptl
ATrpms kernel sources with i2c/lm_sensors 2.8.2: linux-2.4.22-1.2163.nptl_32.rhfc1.at# find linux-2.4.22-1.2163.nptl* -name dmi_scan.\* linux-2.4.22-1.2163.nptl/arch/i386/kernel/dmi_scan.c linux-2.4.22-1.2163.nptl/drivers/i2c/dmi_scan.c linux-2.4.22-1.2163.nptl/drivers/i2c/dmi_scan.h linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.stamp linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver linux-2.4.22-1.2163.nptl_32.rhfc1.at/arch/i386/kernel/dmi_scan.c linux-2.4.22-1.2163.nptl_32.rhfc1.at/drivers/i2c/dmi_scan.c linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/dmi_scan.h linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.stamp linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver # find linux-2.4.22-1.2163.nptl* -name dmi_scan.\* | xargs grep EXPORT linux-2.4.22-1.2163.nptl/arch/i386/kernel/dmi_scan.c:EXPORT_SYMBOL(dmi_broken); linux-2.4.22-1.2163.nptl/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL_GPL(dmi_ident); linux-2.4.22-1.2163.nptl/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL_GPL(dmi_scan_machine); linux-2.4.22-1.2163.nptl_32.rhfc1.at/arch/i386/kernel/dmi_scan.c:EXPORT_SYMBOL(dmi_broken); linux-2.4.22-1.2163.nptl_32.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_ident); linux-2.4.22-1.2163.nptl_32.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_scan_mach); # find linux-2.4.22-1.2163.nptl* -name dmi_scan.ver | xargs grep . linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver:#if defined(__module__smp) || defined(__module__up) || defined(__module__BOOT) linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver:#define __ver_dmi_broken _ver_str(565bcd17) linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver:#define dmi_broken _set_ver(dmi_broken) linux-2.4.22-1.2163.nptl/include/linux/modules/dmi_scan.ver:#endif linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver:#define __ver_dmi_ident _ver_str(b6e4b69b) linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver:#define dmi_ident _set_ver(dmi_ident) linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver:#define __ver_dmi_scan_mach _ver_str(0c5b4001) linux-2.4.22-1.2163.nptl_32.rhfc1.at/include/linux/modules/dmi_scan.ver:#define dmi_scan_mach _set_ver(dmi_scan_mach)
Quoted 3 lines
It looks as if the
EXPORT_SYMBOLsofdrivers/i2c/dmi_scan.coverride the ones fromarch/i386/kernel/dmi_scan.c. Previouslydrivers/i2c/dmi_scan.chad onlyEXPORT_SYMBOL_GPL.
What is the relation of drivers/i2c/dmi_scan.c and arch/i386/kernel/dmi_scan.c? It seems to be unhealthy to have two files of the same name, because they overwrite their symbol files. Should one of these be renamed, or the two files merged?
It just happened that on the day I originally posted the above some files a bug report at Red Hat:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id3192
But there is no response yet.
Signature · 8 lines
[email protected] -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040224/6155ba01/attachment.bin
Quoted 2 lines
What is the relation of
drivers/i2c/dmi_scan.candarch/i386/kernel/dmi_scan.c?
Ours is shamelessly ripped from the kernel. It was the quickest way to get it working with all kernels, although it was admittedly not nice.
Quoted 3 lines
It seems to be unhealthy to have two
files of the same name, because they overwrite their symbol files.
Even if you build the lm_sensors modules outside of the kernel? I never had a problem, and that's how I do it.
Quoted 1 line
Should one of these be renamed, or the two files merged?
It's a bit late to merge them (would mean that lm_sensors would only work with linux 2.4.26 and above, at best).
Renaming it is an option, although I can hear MDS complaining from here, because he doesn't like renaming files under the CVS repository.
I don't see any other way though.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 6 lines · Jean Delvare
Quoted 2 lines
What is the relation of
drivers/i2c/dmi_scan.candarch/i386/kernel/dmi_scan.c?Ours is shamelessly ripped from the kernel. It was the quickest way to get it working with all kernels, although it was admittedly not nice.
Quoted 6 lines
Quoted 3 lines
It seems to be unhealthy to have two
files of the same name, because they overwrite their symbol files.Even if you build the
lm_sensorsmodules outside of the kernel? I never had a problem, and that's how I do it.
Yes, you are right, I didn't think about that compile path. But I know that Red Hat for instance will only think about patching the kernel and not start building out of the tree. Other vendors will probably also follow the monolithic kernel rpm strategy. So it would be good to have the patching method well working, too.
Quoted 9 lines
Quoted 1 line
Should one of these be renamed, or the two files merged?
It's a bit late to merge them (would mean that
lm_sensorswould only work with linux 2.4.26 and above, at best).Renaming it is an option, although I can hear MDS complaining from here, because he doesn't like renaming files under the CVS repository.
I don't see any other way though.
What would an acceptable name be? The bugzilla reporter suggested prepending "i2c-" to the two files.
Signature · 8 lines
[email protected] -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040224/22e5aacf/attachment.bin
In the stock kernel everything in arch/i386/kernel/dmi_scan.c is static. So that we could have access to those functions when building outside the kernel, we copied what we needed and made dmi_ident non-static.
Why is there a problem with two files the same name
or two static symbols the same name?
If you're going to patch the kernel the correct method is to export dmi_ident from arch/i386/kernel/dmi_scan.c, not patch the whole i2c/busses/dmi_scan.c into drivers/i2c. We shouldn't have added dmi_scan to mkpatch; that was a hack (of mine). If Red Hat copied that hack, oh well.
So in short, there's no merge required. Get rid of a 'static' in arch/i386/kernel/dmi_scan.c and it's done.
I copied it to get a symbol I needed, not to change anything.
mds
Quoted 37 lines · Axel Thimm
Quoted 7 lines · Jean Delvare
Quoted 2 lines
What is the relation of
drivers/i2c/dmi_scan.candarch/i386/kernel/dmi_scan.c?Ours is shamelessly ripped from the kernel. It was the quickest way to get it working with all kernels, although it was admittedly not nice.
Quoted 6 lines
Quoted 3 lines
It seems to be unhealthy to have two
files of the same name, because they overwrite their symbol files.Even if you build the
lm_sensorsmodules outside of the kernel? I never had a problem, and that's how I do it.Yes, you are right, I didn't think about that compile path. But I know that Red Hat for instance will only think about patching the kernel and not start building out of the tree. Other vendors will probably also follow the monolithic kernel rpm strategy. So it would be good to have the patching method well working, too.
Quoted 9 lines
Quoted 1 line
Should one of these be renamed, or the two files merged?
It's a bit late to merge them (would mean that
lm_sensorswould only work with linux 2.4.26 and above, at best).Renaming it is an option, although I can hear MDS complaining from here, because he doesn't like renaming files under the CVS repository.
I don't see any other way though.
What would an acceptable name be? The bugzilla reporter suggested prepending "i2c-" to the two files.
Even better is a patch that adds exactly what was added in kernel 2.5.34; that is,
it puts all the detection logic in arch/i386/kernel/dmi_scan.c and simply exports is_unsafe_smbus.
Quoted 16 lines · Jean Delvare
Quoted 4 lines
Quoted 2 lines
What would an acceptable name be? The bugzilla reporter suggested prepending "i2c-" to the two files.
Sounds good to me.
Blah. I should have read the rest of the thread before replying. Mark's approch sounds much better (I really should have thought of it too, shame on me).
So, we have to make some changes to mkpatch so that it:
1* Doesn't include ourdmi_scan.
2* Patches the kernel one.1 is trivial, and 2 should not be too hard.
Quoted 7 lines · Mark Studebaker
In the stock kernel everything in
arch/i386/kernel/dmi_scan.cis static. So that we could have access to those functions when building outside the kernel,
we copied what we needed and madedmi_identnon-static.
Why is there a problem with two files the same name
or two static symbols the same name?
Quoted 5 lines
If you're going to patch the kernel the correct method is to export
dmi_ident
fromarch/i386/kernel/dmi_scan.c, not patch the wholei2c/busses/dmi_scan.cintodrivers/i2c. We shouldn't have addeddmi_scanto mkpatch; that was a hack (of mine). If Red Hat copied that hack, oh well.
It looks more like the cpufreq project adding EXPORTs to dmi_scan, which now get overridden (e.g. your hack works only as long as arch/i386/kernel/dmi_scan.c does not export anything).
Quoted 3 lines
So in short, there's no merge required. Get rid of a 'static' in
arch/i386/kernel/dmi_scan.cand it's done.
I copied it to get a symbol I needed, not to change anything.
Thanks, your explanation makes much sense. I'll fix the kernel source accordingly at the next kernel update, but perhaps these fixes will already be in 2.8.5 if I understand Jean correctly.
Quoted 42 lines
mds
Quoted 37 lines · Axel Thimm
Quoted 7 lines · Jean Delvare
Quoted 2 lines
What is the relation of
drivers/i2c/dmi_scan.candarch/i386/kernel/dmi_scan.c?Ours is shamelessly ripped from the kernel. It was the quickest way to get it working with all kernels, although it was admittedly not nice.
Quoted 6 lines
Quoted 3 lines
It seems to be unhealthy to have two
files of the same name, because they overwrite their symbol files.Even if you build the
lm_sensorsmodules outside of the kernel? I never had a problem, and that's how I do it.Yes, you are right, I didn't think about that compile path. But I know that Red Hat for instance will only think about patching the kernel and not start building out of the tree. Other vendors will probably also follow the monolithic kernel rpm strategy. So it would be good to have the patching method well working, too.
Quoted 9 lines
Quoted 1 line
Should one of these be renamed, or the two files merged?
It's a bit late to merge them (would mean that
lm_sensorswould only work with linux 2.4.26 and above, at best).Renaming it is an option, although I can hear MDS complaining from here, because he doesn't like renaming files under the CVS repository.
I don't see any other way though.
What would an acceptable name be? The bugzilla reporter suggested prepending "i2c-" to the two files.
Signature · 8 lines
[email protected] -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040226/fc270a47/attachment.bin
Hi,
Quoted 5 lines · Mark Studebaker
Even better is a patch that adds exactly what was added in kernel 2.5.34; that is,
it puts all the detection logic inarch/i386/kernel/dmi_scan.cand simply exportsis_unsafe_smbus.
Quoted 16 lines
Quoted 15 lines · Jean Delvare
Quoted 4 lines
Quoted 2 lines
What would an acceptable name be? The bugzilla reporter suggested prepending "i2c-" to the two files.
Sounds good to me.
Blah. I should have read the rest of the thread before replying. Mark's approch sounds much better (I really should have thought of it too, shame on me).
So, we have to make some changes to mkpatch so that it:
1* Doesn't include ourdmi_scan.
2* Patches the kernel one.1 is trivial, and 2 should not be too hard.
I'd like to reroll RHL & FC kernels (2.4.20 and 2.4.22 based), and fix also the dmi_scan issue. Has any of the above suggestions found its way into i2c CVS (I'd love a http://www.ensicaen.ismra.fr/~delvare/devel/i2c/
patch :)?
Or should I use one of the less favoured, but easier (for me) to implement solutions (renaming files)?
Signature · 8 lines
Axel.Thimm at ATrpms.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040404/85b994a8/attachment.bin
Hi Axel,
Quoted 10 lines
Quoted 4 lines
1* Doesn't include our
dmi_scan.
2* Patches the kernel one.1 is trivial, and 2 should not be too hard.
I'd like to reroll RHL & FC kernels (2.4.20 and 2.4.22 based), and fix also the
dmi_scanissue. Has any of the above suggestions found its way into i2c CVS (I'd love a
http://www.ensicaen.ismra.fr/~delvare/devel/i2c/
patch :)?
No, I have to admit I had completely forgotten about this issue and nothing was done.
I just took a look at the files and I think I missed a step in my first plan. The problem is that our dmi_scan module exports the whole DMI information and leaves it do i2c-piix4 to compare the strings, while the kernel's dmi_scan, once patched, would preferably export a simple flag.
So step 1 is to make our own dmi_scan compute and export that flag instead of the whole data, and change i2c-piix4 so that it always looks for the flag and doesn't try to access the whole data. I just did that, proposed patch to lm_sensors2 attached.
I do *not* want to apply it right now since we're about to release and this is a sensible change. You can still apply it before building your RPMs.
Step 2 is that lm_sensors2's mkpatch shouldn't include dmi_scan.c/.h. Easy, patch attached.
Step 3 is that lm_sensors2's mkpatch should include a patch to arch/i386/kernel/dmi_scan.c. This is the hardest part. Even before changing mkpatch so that it is able to dynamically create the patch (it must work with every kernel version), we have to make sure that we agree on what has to be done exactly.
Attached is my proposal for a kernel 2.4.22. It looks like we have to patch i386_ksyms.c as well.
Please note that these changes do not belong to the i2c package. For this reason, I don't think it would be a good idea to include them to the i2c patch, as you once suggested IIRC. This would make things even more complex in the end.
Quoted 2 lines
Or should I use one of the less favoured, but easier (for me) to implement solutions (renaming files)?
Well, I invite you to test the patches attached, and tell us how it is working for you. Note that I didn't test anything myself (except that it still compiles).
If it works OK and nobody objects, after 2.8.6 has been released, I'll apply the changes our CVS repository and hack mkpatch.pl so that it learns how to generate the kernel patch to dmi_scan regardless of the kernel version.
Thanks.
Signature · 196 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
-------------- next part --------------
Index: kernel/busses/dmi_scan.c
=================================RCS file: /home/cvs/lm_sensors2/kernel/busses/dmi_scan.c,v
retrieving revision 1.9
diff -u -r1.9 dmi_scan.c
--- kernel/busses/dmi_scan.c 31 Jul 2003 12:56:35 -0000 1.9
+++ kernel/busses/dmi_scan.c 4 Apr 2004 13:19:41 -0000
@@ -16,7 +16,9 @@
#include <asm/keyboard.h>
#include <asm/system.h>
#include "version.h"
-#include "dmi_scan.h"
+
+int is_unsafe_smbus;
+EXPORT_SYMBOL(is_unsafe_smbus);
struct dmi_header
{
@@ -25,6 +27,20 @@
u16 handle;
};
+enum
+{
+ DMI_BIOS_VENDOR,
+ DMI_BIOS_VERSION,
+ DMI_BIOS_DATE,
+ DMI_SYS_VENDOR,
+ DMI_PRODUCT_NAME,
+ DMI_PRODUCT_VERSION,
+ DMI_BOARD_VENDOR,
+ DMI_BOARD_NAME,
+ DMI_BOARD_VERSION,
+ DMI_STRING_MAX
+};
+
#define dmi_printk(x)
//#define dmi_printk(x) printk x
@@ -211,7 +227,7 @@
}
}
-void __init dmi_scan_mach(void)
+int __init dmi_scan_mach(void)
{
int err;
printk("dmi_scan.o version %s (%s)\n", LM_VERSION, LM_DATE);
@@ -220,9 +236,14 @@
printk("dmi_scan.o: SM BIOS not found\n");
else
printk("dmi_scan.o: SM BIOS found\n");
+
+ if(dmi_ident[DMI_SYS_VENDOR] != NULL
+ && strncmp(dmi_ident[DMI_SYS_VENDOR], "IBM", 3) = 0)
+ is_unsafe_smbus = 1;
+ return 0;
}
MODULE_DESCRIPTION("SM BIOS DMI Scanner");
MODULE_LICENSE("GPL");
-EXPORT_SYMBOL(dmi_ident);
-EXPORT_SYMBOL(dmi_scan_mach);
+
+module_init(dmi_scan_mach);
Index: kernel/busses/dmi_scan.h
=================================RCS file: /home/cvs/lm_sensors2/kernel/busses/dmi_scan.h,v
retrieving revision 1.1
diff -u -r1.1 dmi_scan.h
--- kernel/busses/dmi_scan.h 2 Aug 2002 01:56:56 -0000 1.1
+++ kernel/busses/dmi_scan.h 4 Apr 2004 13:19:41 -0000
@@ -1,15 +0,0 @@
-enum
-{
- DMI_BIOS_VENDOR,
- DMI_BIOS_VERSION,
- DMI_BIOS_DATE,
- DMI_SYS_VENDOR,
- DMI_PRODUCT_NAME,
- DMI_PRODUCT_VERSION,
- DMI_BOARD_VENDOR,
- DMI_BOARD_NAME,
- DMI_BOARD_VERSION,
- DMI_STRING_MAX
-};
-
-extern char *dmi_ident[DMI_STRING_MAX];
Index: kernel/busses/i2c-piix4.c
=================================RCS file: /home/cvs/lm_sensors2/kernel/busses/i2c-piix4.c,v
retrieving revision 1.62
diff -u -r1.62 i2c-piix4.c
--- kernel/busses/i2c-piix4.c 27 Jan 2004 02:47:35 -0000 1.62
+++ kernel/busses/i2c-piix4.c 4 Apr 2004 13:19:42 -0000
@@ -41,7 +41,6 @@
#include <linux/apm_bios.h>
#include <asm/io.h>
#include "version.h"
-#include "dmi_scan.h"
struct sd {
@@ -116,25 +115,11 @@
/*
* Get DMI information.
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,34)
-void dmi_scan_mach(void);
-#endif
static int __devinit ibm_dmi_probe(void)
{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34)
extern int is_unsafe_smbus;
return is_unsafe_smbus;
-#else
-#define IBM_SIGNATURE "IBM"
- dmi_scan_mach();
- if(dmi_ident[DMI_SYS_VENDOR] = NULL)
- return 0;
- if(strncmp(dmi_ident[DMI_SYS_VENDOR], IBM_SIGNATURE,
- strlen(IBM_SIGNATURE)) = 0)
- return 1;
- return 0;
-#endif
}
#endif
-------------- next part --------------
Index: mkpatch/FILES
=================================RCS file: /home/cvs/lm_sensors2/mkpatch/FILES,v
retrieving revision 1.26
diff -u -r1.26 FILES
--- mkpatch/FILES 23 Jan 2004 17:35:55 -0000 1.26
+++ mkpatch/FILES 4 Apr 2004 13:19:56 -0000
@@ -1,5 +1,3 @@
-kernel/busses/dmi_scan.c drivers/i2c/dmi_scan.c
-kernel/busses/dmi_scan.h include/linux/dmi_scan.h
kernel/busses/i2c-ali1535.c drivers/i2c/i2c-ali1535.c
kernel/busses/i2c-ali15x3.c drivers/i2c/i2c-ali15x3.c
kernel/busses/i2c-amd756.c drivers/i2c/i2c-amd756.c
-------------- next part --------------
--- linux-2.4.22/arch/i386/kernel/dmi_scan.c.orig Sun Apr 4 15:04:20 2004
+++ linux-2.4.22/arch/i386/kernel/dmi_scan.c Sun Apr 4 15:14:08 2004
@@ -15,6 +15,7 @@
unsigned long dmi_broken;
int is_sony_vaio_laptop;
+int is_unsafe_smbus;
struct dmi_header
{
@@ -406,6 +407,19 @@
return 0;
}
+/*
+ * Don't access SMBus on IBM systems which get corrupted eeproms
+ */
+
+static __init int disable_smbus(struct dmi_blacklist *d)
+{
+ if (is_unsafe_smbus = 0) {
+ is_unsafe_smbus = 1;
+ printk(KERN_INFO "%s machine detected. Disabling SMBus accesses.\n", d->ident);
+ }
+ return 0;
+}
+
/*
* Check for a Sony Vaio system
*
@@ -740,6 +754,10 @@
NO_MATCH, NO_MATCH,
} },
+ { disable_smbus, "IBM", {
+ MATCH(DMI_SYS_VENDOR, "IBM"),
+ NO_MATCH, NO_MATCH, NO_MATCH
+ } },
{ sony_vaio_laptop, "Sony Vaio", { /* This is a Sony Vaio laptop */
MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
MATCH(DMI_PRODUCT_NAME, "PCG-"),
--- linux-2.4.22/arch/i386/kernel/i386_ksyms.c.orig Sun Apr 4 15:16:55 2004
+++ linux-2.4.22/arch/i386/kernel/i386_ksyms.c Sun Apr 4 15:15:49 2004
@@ -177,6 +177,9 @@
extern int is_sony_vaio_laptop;
EXPORT_SYMBOL(is_sony_vaio_laptop);
+extern int is_unsafe_smbus;
+EXPORT_SYMBOL(is_unsafe_smbus);
+
#ifdef CONFIG_MULTIQUAD
EXPORT_SYMBOL(xquad_portio);
#endifHi,
Quoted 37 lines · Jean Delvare
Quoted 10 lines
Quoted 4 lines
1* Doesn't include our
dmi_scan.
2* Patches the kernel one.1 is trivial, and 2 should not be too hard.
I'd like to reroll RHL & FC kernels (2.4.20 and 2.4.22 based), and fix also the
dmi_scanissue. Has any of the above suggestions found its way into i2c CVS (I'd love a
http://www.ensicaen.ismra.fr/~delvare/devel/i2c/
patch :)?No, I have to admit I had completely forgotten about this issue and nothing was done.
I just took a look at the files and I think I missed a step in my first plan. The problem is that our
dmi_scanmodule exports the whole DMI information and leaves it do i2c-piix4 to compare the strings, while the kernel'sdmi_scan, once patched, would preferably export a simple flag.So step 1 is to make our own
dmi_scancompute and export that flag instead of the whole data, and change i2c-piix4 so that it always looks for the flag and doesn't try to access the whole data. I just did that, proposed patch tolm_sensors2attached.I do *not* want to apply it right now since we're about to release and this is a sensible change. You can still apply it before building your RPMs.
Step 2 is that lm_sensors2's mkpatch shouldn't include dmi_scan.c/.h. Easy, patch attached.
Step 3 is that lm_sensors2's mkpatch should include a patch to
arch/i386/kernel/dmi_scan.c. This is the hardest part. Even before changing mkpatch so that it is able to dynamically create the patch (it must work with every kernel version), we have to make sure that we agree on what has to be done exactly.
Quoted 7 lines
Attached is my proposal for a kernel 2.4.22. It looks like we have to patch
i386_ksyms.cas well.Please note that these changes do not belong to the i2c package. For this reason, I don't think it would be a good idea to include them to the i2c patch, as you once suggested IIRC. This would make things even more complex in the end.
Yes, my suggestion was for lm_sensors, i2c slipped into it by mistake.
Quoted 6 lines
Quoted 2 lines
Or should I use one of the less favoured, but easier (for me) to implement solutions (renaming files)?
Well, I invite you to test the patches attached, and tell us how it is working for you. Note that I didn't test anything myself (except that it still compiles).
I tried them and couldn't compile. I applied the patches to lm_sensors 2.8.5 and used its mkpatch to generate the kernel patch. I also applied the linux-2.4.22-dmi_scan.diff. Did I miss something?
gcc32 -D__KERNEL__
-I/var/tmp/bach-build/BUILD/kernel-2.4.22/linux-2.4.22/include -Wall
-Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer
-fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe
-mpreferred-stack-boundary=2 -march=i386 -nostdinc -iwithprefix
include -E -D__GENKSYMS
__ i2c-algo-ibm_ocp.c
| /sbin/genksyms -k 2.4.22 > /var/tmp/bach-build/BUILD/kernel-2.4.22/linux-2.4.22/include/linux/modules/i2c-algo-ibm_ocp.ver.tmp i2c-algo-ibm_ocp.c:63:21: asm/ocp.h: No such file or directory
mv/var/tmp/bach-build/BUILD/kernel-2.4.22/linux-2.4.22/include/linux/modules/i2c-algo-ibm_ocp.ver.tmp /var/tmp/bach-build/BUILD/kernel-2.4.22/linux
-2.4.22/include/linux/modules/i2c-algo-ibm_ocp.ver
make[4]: *** No rule to make target dmi_scan.c', needed by /var/tmp/bach-build/BUILD/kernel-2.4.22/linux-2.4.22/include/linux/modules/dmi_scan.ver
'. Stop.
make[3]: *** [_sfdep_i2c] Error 2
make[2]: *** [fastdep] Error 2
make[1]: *** [_sfdep_drivers] Error 2
make: *** [dep-files] Error 2
Quoted 4 lines
If it works OK and nobody objects, after 2.8.6 has been released, I'll apply the changes our CVS repository and hack mkpatch.pl so that it learns how to generate the kernel patch to
dmi_scanregardless of the kernel version.
Signature · 8 lines
Axel.Thimm at ATrpms.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040404/de077d7b/attachment.bin
Quoted 3 lines
I tried them and couldn't compile. I applied the patches to
lm_sensors2.8.5 and used its mkpatch to generate the kernel patch. I also applied the linux-2.4.22-dmi_scan.diff. Did I miss something?
Bad. That was the correct procedure...
Could you please try the kernel patch only, to start with? No lm_sensors, only the kernel dmi_scan patch. This is independant and should work.
Thanks.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
BTW my mkpatch patch was incomplete, this one should work better.
Thanks.
Signature · 48 lines
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
-------------- next part --------------
Index: mkpatch/FILES
=================================RCS file: /home/cvs/lm_sensors2/mkpatch/FILES,v
retrieving revision 1.26
diff -u -r1.26 FILES
--- mkpatch/FILES 23 Jan 2004 17:35:55 -0000 1.26
+++ mkpatch/FILES 4 Apr 2004 19:22:25 -0000
@@ -1,5 +1,3 @@
-kernel/busses/dmi_scan.c drivers/i2c/dmi_scan.c
-kernel/busses/dmi_scan.h include/linux/dmi_scan.h
kernel/busses/i2c-ali1535.c drivers/i2c/i2c-ali1535.c
kernel/busses/i2c-ali15x3.c drivers/i2c/i2c-ali15x3.c
kernel/busses/i2c-amd756.c drivers/i2c/i2c-amd756.c
Index: mkpatch/INCLUDES
=================================RCS file: /home/cvs/lm_sensors2/mkpatch/INCLUDES,v
retrieving revision 1.6
diff -u -r1.6 INCLUDES
--- mkpatch/INCLUDES 22 Jun 2003 16:28:45 -0000 1.6
+++ mkpatch/INCLUDES 4 Apr 2004 19:22:25 -0000
@@ -1,3 +1,2 @@
-"dmi_scan.h" <linux/dmi_scan.h>
"sensors_compat.h" <linux/sensors_compat.h>
"sensors_vid.h" <linux/sensors_vid.h>
Index: mkpatch/mkpatch.pl
=================================RCS file: /home/cvs/lm_sensors2/mkpatch/mkpatch.pl,v
retrieving revision 1.66
diff -u -r1.66 mkpatch.pl
--- mkpatch/mkpatch.pl 23 Jan 2004 17:35:55 -0000 1.66
+++ mkpatch/mkpatch.pl 4 Apr 2004 19:22:26 -0000
@@ -966,7 +966,7 @@
obj-$(CONFIG_I2C_I801) += i2c-i801.o
obj-$(CONFIG_I2C_I810) += i2c-i810.o
obj-$(CONFIG_I2C_ISA) += i2c-isa.o
-obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o dmi_scan.o
+obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o
obj-$(CONFIG_I2C_SIS5595) += i2c-sis5595.o
obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o
obj-$(CONFIG_I2C_SIS645) += i2c-sis645.o
@@ -975,7 +975,6 @@
obj-$(CONFIG_I2C_VIA) += i2c-via.o
obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o
obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o
-export-objs += dmi_scan.o
EOF
}
print OUTPUT;Hi Axel,
I've committed all the necessary changes to lm_sensors CVS. Hopefully it fix the issue. Please give it a try and confirm if you can.
Thanks.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Hi,
Quoted 2 lines · Jean Delvare
I've committed all the necessary changes to
lm_sensorsCVS. Hopefully it fix the issue. Please give it a try and confirm if you can.
I tried the fixes as you posted them here and the same issue persists :(
# depmod -ae depmod: *** Unresolved symbols in /lib/modules/2.4.22-1.2174.nptl_44.rhfc1.at/kernel/arch/i386/kernel/powernow-k7.o depmod: dmi_broken # find /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at -name dmi_scan.\* | xargs grep EXPORT /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at/arch/i386/kernel/dmi_scan.c:EXPORT_SYMBOL(dmi_broken); /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_ident); /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_scan_mach); # find /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at -name dmi_scan.ver | xargs grep . #define __ver_dmi_ident _ver_str(b6e4b69b) #define dmi_ident _set_ver(dmi_ident) #define __ver_dmi_scan_mach _ver_str(0c5b4001) #define dmi_scan_mach _set_ver(dmi_scan_mach)
I believe that two files may not have the same name and export the same type of symbols (normal vs GPL), they will overwrite each other. Note that the dmi_broken symbol is exported by the cpufreq patch, so there is no guarantee that the kernel's dmi_scan will be free of exports as currently assumed.
So maybe it is better to rename dmi_scan.* afterall? Or did I patch/understand something wrong?
Thanks!
(and Happy Easter, of course ;)
Signature · 8 lines
Axel.Thimm at ATrpms.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040410/0401d08e/attachment.bin
Quoted 10 lines · Jean Delvare
Quoted 7 lines
I tried the fixes as you posted them here and the same issue persists :(
# find /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at -name dmi_scan.\* | xargs grep EXPORT /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at/arch/i386/kernel/dmi_scan.c:EXPORT_SYMBOL(dmi_broken); /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_ident); /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_scan_mach);That can't be with mkpatch from CVS. We do *not* add our own
dmi_scan.cfile anymore.
No, I used the patches posted here. Does CVS have more changes applied than these?
At any rate I'll reiterate a build straight from the CVS, and check whether dmi_scan.c sneaks in again. ;)
Thanks.
Signature · 8 lines
Axel.Thimm at ATrpms.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040410/e43949da/attachment.bin
Quoted 7 lines
I tried the fixes as you posted them here and the same issue persists :(
# find /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at -name dmi_scan.\* | xargs grep EXPORT /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at/arch/i386/kernel/dmi_scan.c:EXPORT_SYMBOL(dmi_broken); /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_ident); /usr/src/linux-2.4.22-1.2174.nptl_44.rhfc1.at/drivers/i2c/dmi_scan.c:EXPORT_SYMBOL(dmi_scan_mach);
That can't be with mkpatch from CVS. We do *not* add our own dmi_scan.c file anymore.
Quoted 2 lines
So maybe it is better to rename dmi_scan.* afterall? Or did I patch/understand something wrong?
Yes, I think you did something wrong. Correct thing to do:
1* Start with your 2.4.22 kernel, including all the patches you want it
to have.
2* Apply the linux-2.4.22-i2c-2.8.4 patch.
3* Checkout the latest CVS version of lm_sensors2, use mkpatch to
generate a patch against your source tree, and apply this patch.
4* Go go go ;)
I don't expect the error above to possibly happen if you do that (although there may actually be other errors I wouldn't have thought of).
Thanks.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 2 lines
No, I used the patches posted here. Does CVS have more changes applied than these?
I actually sent two sets of patches. The initial mkpatch patch being broken, I sent a second a few hours after. Maybe you simply missed that one and are using the wrong one (it would actually produce the error you are encountering).
Quoted 2 lines
At any rate I'll reiterate a build straight from the CVS, and check whether
dmi_scan.csneaks in again. ;)
Yes please. The CVS stuff is supposed to do the same as the patches I sent, but in a different way: mkpatch now handles the additional kernel change to dmi_scan by itself, with no external patch needed. This is worth testing to ensure it works properly, especially since you do have many more patches applied to you tree, which could cause trouble.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 7 lines · Jean Delvare
Quoted 2 lines
No, I used the patches posted here. Does CVS have more changes applied than these?
I actually sent two sets of patches. The initial mkpatch patch being broken, I sent a second a few hours after. Maybe you simply missed that one and are using the wrong one (it would actually produce the error you are encountering).
Oh, well, I thought I had the second patch in, but I obviously had not. :)
Quoted 8 lines
Quoted 2 lines
At any rate I'll reiterate a build straight from the CVS, and check whether
dmi_scan.csneaks in again. ;)Yes please. The CVS stuff is supposed to do the same as the patches I sent, but in a different way: mkpatch now handles the additional kernel change to
dmi_scanby itself, with no external patch needed. This is worth testing to ensure it works properly, especially since you do have many more patches applied to you tree, which could cause trouble.
The latest ATrpms kernel for FC1 is patched that way and works great, i.e. I still get the sensors' readings and no more depmod warnings :)
Thanks a lot!
BTW the FC1 kernels can be found under
http://atrpms.physik.fu-berlin.de/name/kernel-testing/
(the "45" release has the CVS patches).
I'll move the kernel from the bleeding edge repo to the stable one in a couple of days, and will also prepare the RH9/8.0/7.3 kernels accordingly.
Signature · 8 lines
Axel.Thimm at ATrpms.net -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040412/41446ebe/attachment.bin