2002-11-01 03:24:39

by Dieter Nützel

[permalink] [raw]
Subject: 2.5.45: NTFS unresolved symbol

depmod: *** Unresolved symbols in /lib/modules/2.5.45/kernel/fs/ntfs/ntfs.o
depmod: page_states__per_cpu
/lib/modules/2.5.45/kernel/fs/ntfs/ntfs.o

x86 (Athlon)

-Dieter


2002-11-01 12:14:03

by Pawel Kot

[permalink] [raw]
Subject: Re: 2.5.45: NTFS unresolved symbol

On Fri, 1 Nov 2002, Dieter [iso-8859-15] N?tzel wrote:

> depmod: *** Unresolved symbols in /lib/modules/2.5.45/kernel/fs/ntfs/ntfs.o
> depmod: page_states__per_cpu
> /lib/modules/2.5.45/kernel/fs/ntfs/ntfs.o

Hi, The following patch should fix it:
--- kernel/ksyms.c~ Fri Nov 1 13:16:51 2002
+++ kernel/ksyms.c Fri Nov 1 13:16:51 2002
@@ -112,6 +112,7 @@
EXPORT_SYMBOL(vunmap);
EXPORT_SYMBOL(vmalloc_to_page);
EXPORT_SYMBOL(remap_page_range);
+EXPORT_SYMBOL(page_states__per_cpu);
#ifndef CONFIG_DISCONTIGMEM
EXPORT_SYMBOL(contig_page_data);
EXPORT_SYMBOL(mem_map);

pkot
--
mailto:[email protected] :: mailto:[email protected]
http://kt.linuxnews.pl/ :: Kernel Traffic po polsku

2002-11-01 19:42:34

by Andrew Morton

[permalink] [raw]
Subject: Re: 2.5.45: NTFS unresolved symbol

Pawel Kot wrote:
>
> On Fri, 1 Nov 2002, Dieter [iso-8859-15] N?tzel wrote:
>
> > depmod: *** Unresolved symbols in /lib/modules/2.5.45/kernel/fs/ntfs/ntfs.o
> > depmod: page_states__per_cpu
> > /lib/modules/2.5.45/kernel/fs/ntfs/ntfs.o
>
> Hi, The following patch should fix it:
> --- kernel/ksyms.c~ Fri Nov 1 13:16:51 2002
> +++ kernel/ksyms.c Fri Nov 1 13:16:51 2002
> @@ -112,6 +112,7 @@
> EXPORT_SYMBOL(vunmap);
> EXPORT_SYMBOL(vmalloc_to_page);
> EXPORT_SYMBOL(remap_page_range);
> +EXPORT_SYMBOL(page_states__per_cpu);
> #ifndef CONFIG_DISCONTIGMEM
> EXPORT_SYMBOL(contig_page_data);
> EXPORT_SYMBOL(mem_map);

Oh gawd. Here's what happened..

We have these magical symbols which describe the offset of
a member of the per-cpu storage, which need to be exposed
to modules. So I added an EXPORT_PER_CPU_SYMBOL() helper:

#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var##__per_cpu)
#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var##__per_cpu)

Which works OK without module versioning. But with module versioning,
genksyms goes looking through source files for "EXPORT_SYMBOL". Which
isn't there.

So sigh. Need to go back to the drawing board on that one. In
the meantime, this should work?


--- 25/mm/page_alloc.c~genksyms-hurts Fri Nov 1 11:47:42 2002
+++ 25-akpm/mm/page_alloc.c Fri Nov 1 11:47:53 2002
@@ -650,7 +650,7 @@ unsigned int nr_free_highpages (void)
* during and after execution of this function.
*/
DEFINE_PER_CPU(struct page_state, page_states) = {0};
-EXPORT_PER_CPU_SYMBOL(page_states);
+EXPORT_SYMBOL(page_states__per_cpu);

void __get_page_state(struct page_state *ret, int nr)
{

.

2002-11-01 19:58:06

by Sam Ravnborg

[permalink] [raw]
Subject: Re: 2.5.45: NTFS unresolved symbol

On Fri, Nov 01, 2002 at 11:48:48AM -0800, Andrew Morton wrote:
> We have these magical symbols which describe the offset of
> a member of the per-cpu storage, which need to be exposed
> to modules. So I added an EXPORT_PER_CPU_SYMBOL() helper:
>
> #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var##__per_cpu)
> #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var##__per_cpu)

I would expect the following to work:
#define EXPORT_SYMBOL_PER_CPU(var) EXPORT_SYMBOL(var##__per_cpu)
#define EXPORT_SYMBOL_PER_CPU_GPL(var) EXPORT_SYMBOL_GPL(var##__per_cpu)

In this case the magic "EXPORT_SYMBOL" is still present.

Sam

2002-11-01 22:18:23

by Rusty Russell

[permalink] [raw]
Subject: Re: 2.5.45: NTFS unresolved symbol

In message <[email protected]> you write:
> > +EXPORT_SYMBOL(page_states__per_cpu);

> Which works OK without module versioning. But with module versioning,
> genksyms goes looking through source files for "EXPORT_SYMBOL". Which
> isn't there.

Proper fix below. Linus please apply.

The source is run through CPP before hitting genksyms (which is why
the #define EXPORT_SYMBOL is under #ifndef __GENKSYMS__). So in fact,
"EXPORT_SYMBOL( page_states__per_cpu) ;" gets to kenksyms. But your
fix doesn't work either: genksyms can't handle the __typeof__ in the
definition it sees, and gives up.

Note, that this fix (almost certainly) breaks:
DEFINE_PER_CPU(int[3], myvar);
EXPORT_PER_CPU_SYMBOL(myvar);

But we'd need to teach genksyms about EXPORT_PER_CPU_SYMBOL or
__typeof__ for that[1]

Rusty.
[1] Proving the point about the separation of that from the kernel
source being wrong.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.45/include/asm-generic/percpu.h working-2.5.45-tmp/include/asm-generic/percpu.h
--- linux-2.5.45/include/asm-generic/percpu.h 2002-10-31 12:36:56.000000000 +1100
+++ working-2.5.45-tmp/include/asm-generic/percpu.h 2002-11-02 09:20:06.000000000 +1100
@@ -35,4 +35,10 @@ extern unsigned long __per_cpu_offset[NR
#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var##__per_cpu)
#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var##__per_cpu)

+/* Genksyms can't follow the percpu declaration. Give it a fake one. */
+#ifdef __GENKSYMS__
+#undef DEFINE_PER_CPU
+#define DEFINE_PER_CPU(type, name) type name##__per_cpu
+#endif /*__GENKSYMS__*/
+
#endif /* _ASM_GENERIC_PERCPU_H_ */