Skip to contentSkip to conversation

kobject.c changes in -mm

PATCH Christoph Hellwig 3 participants 6 messages Jan 8, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
lib/kobject.c 2007-01-04 21:13:21.000000000 -0800 renamed from lib/kobject.c 2007-01-01 23:04:49.000000000 -0800 +4 -0
@@ -15,6 +15,8 @@
 #include <linux/module.h>
 #include <linux/stat.h>
 #include <linux/slab.h>
+#include <linux/kallsyms.h>
+#include <asm-generic/sections.h>
 
+#ifdef CONFIG_X86_32
+static int ptr_in_range(void *ptr, void *start, void *end)

+{
+ /*

+        * This should hopefully get rid of causing warnings
+        * if the architecture did not set one of the section
+        * variables up.
+        */ 

+ if (start >= end)
+ return 0;
+
+ if ((ptr >= start) && (ptr < end))
+ return 1;
+ return 0;
+}

Can anyone explain WTF is going on here? Including asm-generic headers in core code definitly is not okay. As are random CONFIG_X86_32 ifdefs in said code.

#1 lore raw
Quoted 26 lines · Christoph Hellwig
lib/kobject.c 2007-01-04 21:13:21.000000000 -0800 renamed from lib/kobject.c 2007-01-01 23:04:49.000000000 -0800 +17 -0
@@ -15,6 +15,8 @@
 #include <linux/module.h>
 #include <linux/stat.h>
 #include <linux/slab.h>
+#include <linux/kallsyms.h>
+#include <asm-generic/sections.h>
 
+#ifdef CONFIG_X86_32
+static int ptr_in_range(void *ptr, void *start, void *end)
+{
+       /*
+        * This should hopefully get rid of causing warnings
+        * if the architecture did not set one of the section
+        * variables up.
+        */ 
+       if (start >= end)
+               return 0;
+
+       if ((ptr >= start) && (ptr < end))
+               return 1;
+       return 0;
+}      
Quoted 3 lines

Can anyone explain WTF is going on here? Including asm-generic headers in core code definitly is not okay. As are random CONFIG_X86_32 ifdefs in said code.

It's a hack for debugging. See the full patch at:
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/driver/warn-when-statically-allocated-kobjects-are-used.patch

It is never going to go to mainline, due to the arch-specific hacks as you have noted. But is good to have for debugging and getting error reports from users of -mm.

thanks,

greg k-h

#2 lore raw
Quoted 34 lines · Greg KH
Quoted 26 lines · Christoph Hellwig
lib/kobject.c 2007-01-04 21:13:21.000000000 -0800 renamed from lib/kobject.c 2007-01-01 23:04:49.000000000 -0800 +17 -0
@@ -15,6 +15,8 @@
 #include <linux/module.h>
 #include <linux/stat.h>
 #include <linux/slab.h>
+#include <linux/kallsyms.h>
+#include <asm-generic/sections.h>
 
+#ifdef CONFIG_X86_32
+static int ptr_in_range(void *ptr, void *start, void *end)
+{
+       /*
+        * This should hopefully get rid of causing warnings
+        * if the architecture did not set one of the section
+        * variables up.
+        */ 
+       if (start >= end)
+               return 0;
+
+       if ((ptr >= start) && (ptr < end))
+               return 1;
+       return 0;
+}      
Quoted 3 lines

Can anyone explain WTF is going on here? Including asm-generic headers in core code definitly is not okay. As are random CONFIG_X86_32 ifdefs in said code.

It's a hack for debugging. See the full patch at:
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/driver/warn-when-statically-allocated-kobjects-are-used.patch

Quoted 4 lines

It is never going to go to mainline, due to the arch-specific hacks as you have noted. But is good to have for debugging and getting error reports from users of -mm.

Could a CONFIG_{MM,HACK} option be added for this kind of hacks? It could help clarify what the aim of the code is.

Regards,
Frederik

#3 lore raw
Quoted 35 lines · Frederik Deweerdt
Quoted 34 lines · Greg KH
Quoted 26 lines · Christoph Hellwig
lib/kobject.c 2007-01-04 21:13:21.000000000 -0800 renamed from lib/kobject.c 2007-01-01 23:04:49.000000000 -0800 +17 -0
@@ -15,6 +15,8 @@
 #include <linux/module.h>
 #include <linux/stat.h>
 #include <linux/slab.h>
+#include <linux/kallsyms.h>
+#include <asm-generic/sections.h>
 
+#ifdef CONFIG_X86_32
+static int ptr_in_range(void *ptr, void *start, void *end)
+{
+       /*
+        * This should hopefully get rid of causing warnings
+        * if the architecture did not set one of the section
+        * variables up.
+        */ 
+       if (start >= end)
+               return 0;
+
+       if ((ptr >= start) && (ptr < end))
+               return 1;
+       return 0;
+}      
Quoted 3 lines

Can anyone explain WTF is going on here? Including asm-generic headers in core code definitly is not okay. As are random CONFIG_X86_32 ifdefs in said code.

It's a hack for debugging. See the full patch at:
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/driver/warn-when-statically-allocated-kobjects-are-used.patch

Quoted 6 lines
Quoted 4 lines

It is never going to go to mainline, due to the arch-specific hacks as you have noted. But is good to have for debugging and getting error reports from users of -mm.

Could a CONFIG_{MM,HACK} option be added for this kind of hacks? It could help clarify what the aim of the code is.

How would that help here? I don't think we want to #ifdef all patches in the -mm tree that are of this type, that would be a bit nasty.

thanks,

greg k-h

#4 lore raw
Quoted 40 lines · Greg KH
Quoted 39 lines · Frederik Deweerdt
Quoted 38 lines · Greg KH
Quoted 26 lines · Christoph Hellwig
lib/kobject.c 2007-01-04 21:13:21.000000000 -0800 renamed from lib/kobject.c 2007-01-01 23:04:49.000000000 -0800 +17 -0
@@ -15,6 +15,8 @@
 #include <linux/module.h>
 #include <linux/stat.h>
 #include <linux/slab.h>
+#include <linux/kallsyms.h>
+#include <asm-generic/sections.h>
 
+#ifdef CONFIG_X86_32
+static int ptr_in_range(void *ptr, void *start, void *end)
+{
+       /*
+        * This should hopefully get rid of causing warnings
+        * if the architecture did not set one of the section
+        * variables up.
+        */ 
+       if (start >= end)
+               return 0;
+
+       if ((ptr >= start) && (ptr < end))
+               return 1;
+       return 0;
+}      
Quoted 3 lines

Can anyone explain WTF is going on here? Including asm-generic headers in core code definitly is not okay. As are random CONFIG_X86_32 ifdefs in said code.

It's a hack for debugging. See the full patch at:
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/driver/warn-when-statically-allocated-kobjects-are-used.patch

It is never going to go to mainline, due to the arch-specific hacks as you have noted. But is good to have for debugging and getting error reports from users of -mm.

Quoted 5 lines
Quoted 2 lines

Could a CONFIG_{MM,HACK} option be added for this kind of hacks? It could help clarify what the aim of the code is.

How would that help here? I don't think we want to #ifdef all patches in the -mm tree that are of this type, that would be a bit nasty.

I see how this would be messy, but this could help advertising the fact that the patch is not going to mainline, if only because mainline wouldn't have that CONFIG_HACK thing.
Another alternative would a mm-only- prefix to the name of the patches, a simple grep in broken-out would the be enough...

Regards,
Frederik

Quoted 4 lines

thanks,

greg k-h

#5 lore raw
Quoted 44 lines · Frederik Deweerdt
Quoted 43 lines · Greg KH
Quoted 41 lines · Frederik Deweerdt
Quoted 34 lines · Greg KH
Quoted 26 lines · Christoph Hellwig
lib/kobject.c 2007-01-04 21:13:21.000000000 -0800 renamed from lib/kobject.c 2007-01-01 23:04:49.000000000 -0800 +17 -0
@@ -15,6 +15,8 @@
 #include <linux/module.h>
 #include <linux/stat.h>
 #include <linux/slab.h>
+#include <linux/kallsyms.h>
+#include <asm-generic/sections.h>
 
+#ifdef CONFIG_X86_32
+static int ptr_in_range(void *ptr, void *start, void *end)
+{
+       /*
+        * This should hopefully get rid of causing warnings
+        * if the architecture did not set one of the section
+        * variables up.
+        */ 
+       if (start >= end)
+               return 0;
+
+       if ((ptr >= start) && (ptr < end))
+               return 1;
+       return 0;
+}      
Quoted 3 lines

Can anyone explain WTF is going on here? Including asm-generic headers in core code definitly is not okay. As are random CONFIG_X86_32 ifdefs in said code.

It's a hack for debugging. See the full patch at:
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/driver/warn-when-statically-allocated-kobjects-are-used.patch

Quoted 4 lines

It is never going to go to mainline, due to the arch-specific hacks as you have noted. But is good to have for debugging and getting error reports from users of -mm.

Could a CONFIG_{MM,HACK} option be added for this kind of hacks? It could help clarify what the aim of the code is.

Quoted 7 lines
Quoted 2 lines

How would that help here? I don't think we want to #ifdef all patches in the -mm tree that are of this type, that would be a bit nasty.

I see how this would be messy, but this could help advertising the fact that the patch is not going to mainline, if only because mainline wouldn't have that CONFIG_HACK thing.
Another alternative would a mm-only- prefix to the name of the patches, a simple grep in broken-out would the be enough...

That's a good idea, I can rename some of these patches...

thanks,

greg k-h