2002-09-26 20:20:11

by Tomas Szepe

[permalink] [raw]
Subject: sparc32 sunrpc.o

Since 2.4.20-pre2 or 3, sunrpc.o has had this problem on sparc32:

depmod: *** Unresolved symbols in /lib/modules/2.4.20-pre8/kernel/net/sunrpc/sunrpc.o
depmod: ___illegal_use_of_BTFIXUP_SETHI_in_module
depmod: ___f_set_pte
depmod: fix_kmap_begin
depmod: ___f_flush_cache_all
depmod: ___f_pte_clear
depmod: ___f_mk_pte
depmod: ___f_flush_tlb_all

I'd like to fix the breakage but have no idea where to start
looking. Any hints will be thoroughly appreciated.

T.


2002-09-26 21:11:03

by David Miller

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

From: Tomas Szepe <[email protected]>
Date: Thu, 26 Sep 2002 22:25:25 +0200

Since 2.4.20-pre2 or 3, sunrpc.o has had this problem on sparc32:

depmod: *** Unresolved symbols in /lib/modules/2.4.20-pre8/kernel/net/sunrpc/sunrpc.o
depmod: ___illegal_use_of_BTFIXUP_SETHI_in_module
depmod: ___f_set_pte
depmod: fix_kmap_begin
depmod: ___f_flush_cache_all
depmod: ___f_pte_clear
depmod: ___f_mk_pte
depmod: ___f_flush_tlb_all

I'd like to fix the breakage but have no idea where to start
looking. Any hints will be thoroughly appreciated.

Move all the kmap atomic routines from include/asm-sparc/highmem.h
into arch/sparc/mm/highmem.c, export them from ksyms in
arch/sparc/kernel/sparc_ksyms.c when CONFIG_HIGHMEM is defined.

2002-09-26 21:22:15

by Pete Zaitcev

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

> Since 2.4.20-pre2 or 3, sunrpc.o has had this problem on sparc32:
>
> depmod: *** Unresolved symbols in /lib/modules/2.4.20-pre8/kernel/net/sunrpc/sunrpc.o
> depmod: ___illegal_use_of_BTFIXUP_SETHI_in_module
> depmod: ___f_set_pte
> depmod: fix_kmap_begin
> depmod: ___f_flush_cache_all
> depmod: ___f_pte_clear
> depmod: ___f_mk_pte
> depmod: ___f_flush_tlb_all

Try these two things:

1. diff -urN -X dontdiff linux-2.4.19 linux-2.4.20-pre2 > x.diff
vi x.diff
I've got Tigran's dontdiff updated at
http://people.redhat.com/zaitcev/linux/dontdiff.fix

2. make vmlinux modules > build.out 2>&1 </dev/null
grep -i warning build.out

-- Pete

2002-09-26 21:30:16

by David Miller

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

From: Pete Zaitcev <[email protected]>
Date: Thu, 26 Sep 2002 17:27:24 -0400

> Since 2.4.20-pre2 or 3, sunrpc.o has had this problem on sparc32:
>
> depmod: *** Unresolved symbols in /lib/modules/2.4.20-pre8/kernel/net/sunrpc/sunrpc.o
> depmod: ___illegal_use_of_BTFIXUP_SETHI_in_module
> depmod: ___f_set_pte
> depmod: fix_kmap_begin
> depmod: ___f_flush_cache_all
> depmod: ___f_pte_clear
> depmod: ___f_mk_pte
> depmod: ___f_flush_tlb_all

Try these two things:

No Peter, it really does use kmap_atomic stuff from modules, and this
precludes providing those routines inline in highmem.h, they must
live statically in main kernel image so that flush/pte calls can
be properly BTFIXUP'd.

See my other email.

2002-09-28 12:23:11

by Tomas Szepe

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

> From: Pete Zaitcev <[email protected]>
> Date: Thu, 26 Sep 2002 17:27:24 -0400
>
> > Since 2.4.20-pre2 or 3, sunrpc.o has had this problem on sparc32:
> >
> > depmod: *** Unresolved symbols in /lib/modules/2.4.20-pre8/kernel/net/sunrpc/sunrpc.o
> > depmod: ___illegal_use_of_BTFIXUP_SETHI_in_module
> > depmod: ___f_set_pte
> > depmod: fix_kmap_begin
> > depmod: ___f_flush_cache_all
> > depmod: ___f_pte_clear
> > depmod: ___f_mk_pte
> > depmod: ___f_flush_tlb_all
>
> Try these two things:
>
> No Peter, it really does use kmap_atomic stuff from modules, and this
> precludes providing those routines inline in highmem.h, they must
> live statically in main kernel image so that flush/pte calls can
> be properly BTFIXUP'd.
>
> See my other email.

Ok, DaveM, could you have a look at this patch?

T.


diff -urN linux-2.4.20-pre8.vanilla/arch/sparc/kernel/sparc_ksyms.c linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c
--- linux-2.4.20-pre8.vanilla/arch/sparc/kernel/sparc_ksyms.c 2002-08-03 06:12:08.000000000 +0200
+++ linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c 2002-09-28 14:15:53.000000000 +0200
@@ -46,6 +46,9 @@
#include <asm/sbus.h>
#include <asm/dma.h>
#endif
+#ifdef CONFIG_HIGHMEM
+#include <asm/highmem.h>
+#endif
#include <asm/a.out.h>
#include <asm/io-unit.h>

@@ -204,6 +207,14 @@
EXPORT_SYMBOL(pci_dma_sync_single);
#endif

+/* Highmem helpers from arch/sparc/mm/highmem.c */
+#ifdef CONFIG_HIGHMEM
+EXPORT_SYMBOL(kmap);
+EXPORT_SYMBOL(kunmap);
+EXPORT_SYMBOL(kmap_atomic);
+EXPORT_SYMBOL(kunmap_atomic);
+#endif
+
/* Solaris/SunOS binary compatibility */
EXPORT_SYMBOL(svr4_setcontext);
EXPORT_SYMBOL(svr4_getcontext);
diff -urN linux-2.4.20-pre8.vanilla/arch/sparc/mm/Makefile linux-2.4.20-pre8/arch/sparc/mm/Makefile
--- linux-2.4.20-pre8.vanilla/arch/sparc/mm/Makefile 2000-12-29 23:07:21.000000000 +0100
+++ linux-2.4.20-pre8/arch/sparc/mm/Makefile 2002-09-28 13:33:55.000000000 +0200
@@ -11,7 +11,7 @@
$(CC) $(AFLAGS) -ansi -c -o $*.o $<

O_TARGET := mm.o
-obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o
+obj-y := fault.o init.o loadmmu.o generic.o extable.o highmem.o btfixup.o

ifeq ($(CONFIG_SUN4),y)
obj-y += nosrmmu.o
diff -urN linux-2.4.20-pre8.vanilla/arch/sparc/mm/highmem.c linux-2.4.20-pre8/arch/sparc/mm/highmem.c
--- linux-2.4.20-pre8.vanilla/arch/sparc/mm/highmem.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.20-pre8/arch/sparc/mm/highmem.c 2002-09-28 13:56:56.000000000 +0200
@@ -0,0 +1,101 @@
+/*
+ * highmem.c: virtual kernel memory mappings for high memory
+ *
+ * Uninlined versions of kmap(), kunmap(), kmap_atomic(),
+ * and kunmap_atomic() split from include/asm-sparc/highmem.h.
+ * -- Tomas Szepe <[email protected]>, September 2002
+ */
+
+#include <linux/mm.h>
+#include <linux/highmem.h>
+#include <asm/highmem.h>
+
+void *kmap(struct page *page)
+{
+ if (in_interrupt())
+ BUG();
+ if (page < highmem_start_page)
+ return page_address(page);
+ return kmap_high(page);
+}
+
+void kunmap(struct page *page)
+{
+ if (in_interrupt())
+ BUG();
+ if (page < highmem_start_page)
+ return;
+ kunmap_high(page);
+}
+
+/*
+ * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
+ * gives a more generic (and caching) interface. But kmap_atomic can
+ * be used in IRQ contexts, so in some (very limited) cases we need
+ * it.
+ */
+void *kmap_atomic(struct page *page, enum km_type type)
+{
+ unsigned long idx;
+ unsigned long vaddr;
+
+ if (page < highmem_start_page)
+ return page_address(page);
+
+ idx = type + KM_TYPE_NR*smp_processor_id();
+ vaddr = fix_kmap_begin + idx * PAGE_SIZE;
+
+/* XXX Fix - Anton */
+#if 0
+ __flush_cache_one(vaddr);
+#else
+ flush_cache_all();
+#endif
+
+#if HIGHMEM_DEBUG
+ if (!pte_none(*(kmap_pte+idx)))
+ BUG();
+#endif
+ set_pte(kmap_pte+idx, mk_pte(page, kmap_prot));
+/* XXX Fix - Anton */
+#if 0
+ __flush_tlb_one(vaddr);
+#else
+ flush_tlb_all();
+#endif
+
+ return (void*) vaddr;
+}
+
+void kunmap_atomic(void *kvaddr, enum km_type type)
+{
+ unsigned long vaddr = (unsigned long) kvaddr;
+ unsigned long idx = type + KM_TYPE_NR*smp_processor_id();
+
+ if (vaddr < fix_kmap_begin) // FIXME
+ return;
+
+ if (vaddr != fix_kmap_begin + idx * PAGE_SIZE)
+ BUG();
+
+/* XXX Fix - Anton */
+#if 0
+ __flush_cache_one(vaddr);
+#else
+ flush_cache_all();
+#endif
+
+#ifdef HIGHMEM_DEBUG
+ /*
+ * force other mappings to Oops if they'll try to access
+ * this pte without first remap it
+ */
+ pte_clear(kmap_pte+idx);
+/* XXX Fix - Anton */
+#if 0
+ __flush_tlb_one(vaddr);
+#else
+ flush_tlb_all();
+#endif
+#endif
+}
diff -urN linux-2.4.20-pre8.vanilla/include/asm-sparc/highmem.h linux-2.4.20-pre8/include/asm-sparc/highmem.h
--- linux-2.4.20-pre8.vanilla/include/asm-sparc/highmem.h 2002-09-28 14:18:17.000000000 +0200
+++ linux-2.4.20-pre8/include/asm-sparc/highmem.h 2002-09-28 14:10:12.000000000 +0200
@@ -29,6 +29,10 @@
/* undef for production */
#define HIGHMEM_DEBUG 1

+/* in mm/highmem.c */
+extern void *kmap_high(struct page *page);
+extern void kunmap_high(struct page *page);
+
/* declarations for highmem.c */
extern unsigned long highstart_pfn, highend_pfn;

@@ -55,98 +59,11 @@
#define PKMAP_NR(virt) ((virt - pkmap_base) >> PAGE_SHIFT)
#define PKMAP_ADDR(nr) (pkmap_base + ((nr) << PAGE_SHIFT))

-extern void *kmap_high(struct page *page);
-extern void kunmap_high(struct page *page);
-
-static inline void *kmap(struct page *page)
-{
- if (in_interrupt())
- BUG();
- if (page < highmem_start_page)
- return page_address(page);
- return kmap_high(page);
-}
-
-static inline void kunmap(struct page *page)
-{
- if (in_interrupt())
- BUG();
- if (page < highmem_start_page)
- return;
- kunmap_high(page);
-}
-
-/*
- * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
- * gives a more generic (and caching) interface. But kmap_atomic can
- * be used in IRQ contexts, so in some (very limited) cases we need
- * it.
- */
-static inline void *kmap_atomic(struct page *page, enum km_type type)
-{
- unsigned long idx;
- unsigned long vaddr;
-
- if (page < highmem_start_page)
- return page_address(page);
-
- idx = type + KM_TYPE_NR*smp_processor_id();
- vaddr = fix_kmap_begin + idx * PAGE_SIZE;
-
-/* XXX Fix - Anton */
-#if 0
- __flush_cache_one(vaddr);
-#else
- flush_cache_all();
-#endif
-
-#if HIGHMEM_DEBUG
- if (!pte_none(*(kmap_pte+idx)))
- BUG();
-#endif
- set_pte(kmap_pte+idx, mk_pte(page, kmap_prot));
-/* XXX Fix - Anton */
-#if 0
- __flush_tlb_one(vaddr);
-#else
- flush_tlb_all();
-#endif
-
- return (void*) vaddr;
-}
-
-static inline void kunmap_atomic(void *kvaddr, enum km_type type)
-{
- unsigned long vaddr = (unsigned long) kvaddr;
- unsigned long idx = type + KM_TYPE_NR*smp_processor_id();
-
- if (vaddr < fix_kmap_begin) // FIXME
- return;
-
- if (vaddr != fix_kmap_begin + idx * PAGE_SIZE)
- BUG();
-
-/* XXX Fix - Anton */
-#if 0
- __flush_cache_one(vaddr);
-#else
- flush_cache_all();
-#endif
-
-#ifdef HIGHMEM_DEBUG
- /*
- * force other mappings to Oops if they'll try to access
- * this pte without first remap it
- */
- pte_clear(kmap_pte+idx);
-/* XXX Fix - Anton */
-#if 0
- __flush_tlb_one(vaddr);
-#else
- flush_tlb_all();
-#endif
-#endif
-}
+/* in arch/sparc/mm/highmem.c */
+void *kmap(struct page *page);
+void kunmap(struct page *page);
+void *kmap_atomic(struct page *page, enum km_type type);
+void kunmap_atomic(void *kvaddr, enum km_type type);

#endif /* __KERNEL__ */

2002-09-28 16:08:00

by Tomas Szepe

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

> > From: Pete Zaitcev <[email protected]>
> > Date: Thu, 26 Sep 2002 17:27:24 -0400
> >
> > > Since 2.4.20-pre2 or 3, sunrpc.o has had this problem on sparc32:
> > >
> > > depmod: *** Unresolved symbols in /lib/modules/2.4.20-pre8/kernel/net/sunrpc/sunrpc.o
> > > depmod: ___illegal_use_of_BTFIXUP_SETHI_in_module
> > > depmod: ___f_set_pte
> > > depmod: fix_kmap_begin
> > > depmod: ___f_flush_cache_all
> > > depmod: ___f_pte_clear
> > > depmod: ___f_mk_pte
> > > depmod: ___f_flush_tlb_all
> >
> > Try these two things:
> >
> > No Peter, it really does use kmap_atomic stuff from modules, and this
> > precludes providing those routines inline in highmem.h, they must
> > live statically in main kernel image so that flush/pte calls can
> > be properly BTFIXUP'd.
> >
> > See my other email.
>
> Ok, DaveM, could you have a look at this patch?

Please disregard, highmem.c unreasonably included linux/highmem.h.
I'll be looking into this some more.

T.

2002-09-29 06:25:10

by David Miller

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

From: Tomas Szepe <[email protected]>
Date: Sat, 28 Sep 2002 18:13:16 +0200

> Ok, DaveM, could you have a look at this patch?

Please disregard, highmem.c unreasonably included linux/highmem.h.
I'll be looking into this some more.

Let us know when new working patch is available :-)

2002-09-29 10:17:26

by Tomas Szepe

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

> From: Tomas Szepe <[email protected]>
> Date: Sat, 28 Sep 2002 18:13:16 +0200
>
> > Ok, DaveM, could you have a look at this patch?
>
> Please disregard, highmem.c unreasonably included linux/highmem.h.
> I'll be looking into this some more.
>
> Let us know when new working patch is available :-)

Right. :)
This took a bit longer cos I had to leave for the night.

Patch against 2.4.20-pre8.

T.


diff -urN 2.4.20-pre8.vanilla/arch/sparc/kernel/sparc_ksyms.c linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c
--- 2.4.20-pre8.vanilla/arch/sparc/kernel/sparc_ksyms.c 2002-08-03 06:12:08.000000000 +0200
+++ linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c 2002-09-29 11:45:33.000000000 +0200
@@ -46,6 +46,9 @@
#include <asm/sbus.h>
#include <asm/dma.h>
#endif
+#ifdef CONFIG_HIGHMEM
+#include <asm/highmem.h>
+#endif
#include <asm/a.out.h>
#include <asm/io-unit.h>

@@ -204,6 +207,12 @@
EXPORT_SYMBOL(pci_dma_sync_single);
#endif

+/* in arch/sparc/mm/highmem.c */
+#ifdef CONFIG_HIGHMEM
+EXPORT_SYMBOL(kmap_atomic);
+EXPORT_SYMBOL(kunmap_atomic);
+#endif
+
/* Solaris/SunOS binary compatibility */
EXPORT_SYMBOL(svr4_setcontext);
EXPORT_SYMBOL(svr4_getcontext);
diff -urN 2.4.20-pre8.vanilla/arch/sparc/mm/Makefile linux-2.4.20-pre8/arch/sparc/mm/Makefile
--- 2.4.20-pre8.vanilla/arch/sparc/mm/Makefile 2000-12-29 23:07:21.000000000 +0100
+++ linux-2.4.20-pre8/arch/sparc/mm/Makefile 2002-09-29 11:45:33.000000000 +0200
@@ -11,7 +11,7 @@
$(CC) $(AFLAGS) -ansi -c -o $*.o $<

O_TARGET := mm.o
-obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o
+obj-y := fault.o init.o loadmmu.o generic.o extable.o highmem.o btfixup.o

ifeq ($(CONFIG_SUN4),y)
obj-y += nosrmmu.o
diff -urN 2.4.20-pre8.vanilla/arch/sparc/mm/highmem.c linux-2.4.20-pre8/arch/sparc/mm/highmem.c
--- 2.4.20-pre8.vanilla/arch/sparc/mm/highmem.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.20-pre8/arch/sparc/mm/highmem.c 2002-09-29 11:46:38.000000000 +0200
@@ -0,0 +1,84 @@
+/*
+ * highmem.c: virtual kernel memory mappings for high memory
+ *
+ * Provides kernel-static versions of atomic kmap functions originally
+ * found as inlines in include/asm-sparc/highmem.h. These became
+ * needed as kmap_atomic() and kunmap_atomic() started getting
+ * called from within modules.
+ * -- Tomas Szepe <[email protected]>, September 2002
+ */
+
+#include <linux/mm.h>
+#include <asm/highmem.h>
+#include <asm/pgalloc.h>
+
+/*
+ * The use of kmap_atomic/kunmap_atomic is discouraged -- kmap()/kunmap()
+ * gives a more generic (and caching) interface. But kmap_atomic() can
+ * be used in IRQ contexts, so in some (very limited) cases we need it.
+ */
+void *kmap_atomic(struct page *page, enum km_type type)
+{
+ unsigned long idx;
+ unsigned long vaddr;
+
+ if (page < highmem_start_page)
+ return page_address(page);
+
+ idx = type + KM_TYPE_NR * smp_processor_id();
+ vaddr = fix_kmap_begin + idx * PAGE_SIZE;
+
+/* XXX Fix - Anton */
+#if 0
+ __flush_cache_one(vaddr);
+#else
+ flush_cache_all();
+#endif
+
+#if HIGHMEM_DEBUG
+ if (!pte_none(*(kmap_pte + idx)))
+ BUG();
+#endif
+ set_pte(kmap_pte + idx, mk_pte(page, kmap_prot));
+/* XXX Fix - Anton */
+#if 0
+ __flush_tlb_one(vaddr);
+#else
+ flush_tlb_all();
+#endif
+
+ return (void *) vaddr;
+}
+
+void kunmap_atomic(void *kvaddr, enum km_type type)
+{
+ unsigned long vaddr = (unsigned long) kvaddr;
+ unsigned long idx = type + KM_TYPE_NR * smp_processor_id();
+
+ if (vaddr < fix_kmap_begin) /* FIXME */
+ return;
+
+ if (vaddr != fix_kmap_begin + idx * PAGE_SIZE)
+ BUG();
+
+/* XXX Fix - Anton */
+#if 0
+ __flush_cache_one(vaddr);
+#else
+ flush_cache_all();
+#endif
+
+#ifdef HIGHMEM_DEBUG
+ /*
+ * Force other mappings to oops if they try to access
+ * this pte without first remapping it.
+ */
+ pte_clear(kmap_pte + idx);
+/* XXX Fix - Anton */
+#if 0
+ __flush_tlb_one(vaddr);
+#else
+ flush_tlb_all();
+#endif
+#endif
+}
diff -urN 2.4.20-pre8.vanilla/include/asm-sparc/highmem.h linux-2.4.20-pre8/include/asm-sparc/highmem.h
--- 2.4.20-pre8.vanilla/include/asm-sparc/highmem.h 2002-09-29 11:36:45.000000000 +0200
+++ linux-2.4.20-pre8/include/asm-sparc/highmem.h 2002-09-29 11:48:13.000000000 +0200
@@ -29,6 +29,13 @@
/* undef for production */
#define HIGHMEM_DEBUG 1

+/* in mm/highmem.c */
+extern void *kmap_high(struct page *page);
+extern void kunmap_high(struct page *page);
+
+/* in mm/memory.c */
+extern struct page *highmem_start_page;
+
/* declarations for highmem.c */
extern unsigned long highstart_pfn, highend_pfn;

@@ -51,12 +58,13 @@
*/
#define LAST_PKMAP 1024

-#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
-#define PKMAP_NR(virt) ((virt - pkmap_base) >> PAGE_SHIFT)
-#define PKMAP_ADDR(nr) (pkmap_base + ((nr) << PAGE_SHIFT))
-
-extern void *kmap_high(struct page *page);
-extern void kunmap_high(struct page *page);
+#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
+#define PKMAP_NR(virt) ((virt - pkmap_base) >> PAGE_SHIFT)
+#define PKMAP_ADDR(nr) (pkmap_base + ((nr) << PAGE_SHIFT))
+
+/* in arch/sparc/mm/highmem.c */
+void *kmap_atomic(struct page *page, enum km_type type);
+void kunmap_atomic(void *kvaddr, enum km_type type);

static inline void *kmap(struct page *page)
{
@@ -76,78 +84,6 @@
kunmap_high(page);
}

-/*
- * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
- * gives a more generic (and caching) interface. But kmap_atomic can
- * be used in IRQ contexts, so in some (very limited) cases we need
- * it.
- */
-static inline void *kmap_atomic(struct page *page, enum km_type type)
-{
- unsigned long idx;
- unsigned long vaddr;
-
- if (page < highmem_start_page)
- return page_address(page);
-
- idx = type + KM_TYPE_NR*smp_processor_id();
- vaddr = fix_kmap_begin + idx * PAGE_SIZE;
-
-/* XXX Fix - Anton */
-#if 0
- __flush_cache_one(vaddr);
-#else
- flush_cache_all();
-#endif
-
-#if HIGHMEM_DEBUG
- if (!pte_none(*(kmap_pte+idx)))
- BUG();
-#endif
- set_pte(kmap_pte+idx, mk_pte(page, kmap_prot));
-/* XXX Fix - Anton */
-#if 0
- __flush_tlb_one(vaddr);
-#else
- flush_tlb_all();
-#endif
-
- return (void*) vaddr;
-}
-
-static inline void kunmap_atomic(void *kvaddr, enum km_type type)
-{
- unsigned long vaddr = (unsigned long) kvaddr;
- unsigned long idx = type + KM_TYPE_NR*smp_processor_id();
-
- if (vaddr < fix_kmap_begin) // FIXME
- return;
-
- if (vaddr != fix_kmap_begin + idx * PAGE_SIZE)
- BUG();
-
-/* XXX Fix - Anton */
-#if 0
- __flush_cache_one(vaddr);
-#else
- flush_cache_all();
-#endif
-
-#ifdef HIGHMEM_DEBUG
- /*
- * force other mappings to Oops if they'll try to access
- * this pte without first remap it
- */
- pte_clear(kmap_pte+idx);
-/* XXX Fix - Anton */
-#if 0
- __flush_tlb_one(vaddr);
-#else
- flush_tlb_all();
-#endif
-#endif
-}
-
#endif /* __KERNEL__ */

#endif /* _ASM_HIGHMEM_H */

2002-09-29 23:52:10

by Pete Zaitcev

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

> Date: Sun, 29 Sep 2002 12:22:39 +0200
> From: Tomas Szepe <[email protected]>

> +++ linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c 2002-09-29 11:45:33.000000000 +0200
> +#ifdef CONFIG_HIGHMEM
> +#include <asm/highmem.h>
> +#endif

OK, this is actually correct, I think. Looks funny. :)

> +++ linux-2.4.20-pre8/arch/sparc/mm/Makefile 2002-09-29 11:45:33.000000000 +0200
> @@ -11,7 +11,7 @@
> $(CC) $(AFLAGS) -ansi -c -o $*.o $<
>
> O_TARGET := mm.o
> -obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o
> +obj-y := fault.o init.o loadmmu.o generic.o extable.o highmem.o btfixup.o

Why is this not obj-$(CONFIG_HIGHMEM) ?

> +/* in mm/memory.c */
> +extern struct page *highmem_start_page;
> +

I would not do this. I would try to include <linux/highmem.h>
into arch/sparc/mm/highmem.c (instead of <asm/highmem.h> as you did).

Also, now that you moved a bunch of implementation out of inlines,
try to trim the #include list at the top of <asm-sparc/highmem.h>.
For instance, asm/vaddrs.h is a suspect.

The rest of the patch is sane, as far as I can tell. I do not
have a ready to run 2.4 sparc box, sorry. Please ask [email protected]
people to test, especially Uzi.

-- Pete

2002-09-30 00:51:47

by David Miller

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

From: Pete Zaitcev <[email protected]>
Date: Sun, 29 Sep 2002 19:56:12 -0400

The rest of the patch is sane, as far as I can tell. I do not
have a ready to run 2.4 sparc box, sorry. Please ask [email protected]
people to test, especially Uzi.

Let me know when new acceptable and tested patch is available.

2002-09-30 02:00:09

by Horst H. von Brand

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

Pete Zaitcev <[email protected]> said:
> > Date: Sun, 29 Sep 2002 12:22:39 +0200
> > From: Tomas Szepe <[email protected]>
>
> > +++ linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c 2002-09-29 11:45:33.000
> 000000 +0200
> > +#ifdef CONFIG_HIGHMEM
> > +#include <asm/highmem.h>
> > +#endif
>
> OK, this is actually correct, I think. Looks funny. :)

Do it inside the included file then?
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513

2002-09-30 02:04:34

by Tomas Szepe

[permalink] [raw]
Subject: Re: sparc32 sunrpc.o

Hi,

> > +++ linux-2.4.20-pre8/arch/sparc/mm/Makefile 2002-09-29 11:45:33.000000000 +0200
> > @@ -11,7 +11,7 @@
> > $(CC) $(AFLAGS) -ansi -c -o $*.o $<
> >
> > O_TARGET := mm.o
> > -obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o
> > +obj-y := fault.o init.o loadmmu.o generic.o extable.o highmem.o btfixup.o
>
> Why is this not obj-$(CONFIG_HIGHMEM) ?

My bad. I took the liberty of fixing up the formatting of the makefile
when I was at changing this.

> > +/* in mm/memory.c */
> > +extern struct page *highmem_start_page;
> > +
>
> I would not do this. I would try to include <linux/highmem.h>
> into arch/sparc/mm/highmem.c (instead of <asm/highmem.h> as you did).

Ok. linux/highmem.h initially looked suspicious to me. Also if this
extern isn't put in asm-sparc/highmem.h, linux/highmem.h has to be
included everywhere instead (which is not really a problem I think).

> Also, now that you moved a bunch of implementation out of inlines,
> try to trim the #include list at the top of <asm-sparc/highmem.h>.
> For instance, asm/vaddrs.h is a suspect.

Indeed! And linux/init.h and asm/pgtable.h aren't needed either.

> The rest of the patch is sane, as far as I can tell. I do not
> have a ready to run 2.4 sparc box, sorry. Please ask [email protected]
> people to test, especially Uzi.

Will do. Hopefully aurora people will have a go with the patch too.
v3 as per your comments follows.

T.


diff -urN 2.4.20-pre8.vanilla/arch/sparc/kernel/sparc_ksyms.c linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c
--- 2.4.20-pre8.vanilla/arch/sparc/kernel/sparc_ksyms.c 2002-08-03 06:12:08.000000000 +0200
+++ linux-2.4.20-pre8/arch/sparc/kernel/sparc_ksyms.c 2002-09-30 03:44:37.000000000 +0200
@@ -46,6 +46,9 @@
#include <asm/sbus.h>
#include <asm/dma.h>
#endif
+#ifdef CONFIG_HIGHMEM
+#include <linux/highmem.h>
+#endif
#include <asm/a.out.h>
#include <asm/io-unit.h>

@@ -204,6 +207,12 @@
EXPORT_SYMBOL(pci_dma_sync_single);
#endif

+/* in arch/sparc/mm/highmem.c */
+#ifdef CONFIG_HIGHMEM
+EXPORT_SYMBOL(kmap_atomic);
+EXPORT_SYMBOL(kunmap_atomic);
+#endif
+
/* Solaris/SunOS binary compatibility */
EXPORT_SYMBOL(svr4_setcontext);
EXPORT_SYMBOL(svr4_getcontext);
diff -urN 2.4.20-pre8.vanilla/arch/sparc/mm/Makefile linux-2.4.20-pre8/arch/sparc/mm/Makefile
--- 2.4.20-pre8.vanilla/arch/sparc/mm/Makefile 2000-12-29 23:07:21.000000000 +0100
+++ linux-2.4.20-pre8/arch/sparc/mm/Makefile 2002-09-30 03:23:25.000000000 +0200
@@ -10,19 +10,24 @@
.S.o:
$(CC) $(AFLAGS) -ansi -c -o $*.o $<

-O_TARGET := mm.o
-obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o
+O_TARGET := mm.o
+obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o

ifeq ($(CONFIG_SUN4),y)
-obj-y += nosrmmu.o
+obj-y += nosrmmu.o
else
-obj-y += srmmu.o iommu.o io-unit.o hypersparc.o viking.o tsunami.o swift.o
+obj-y += srmmu.o iommu.o io-unit.o hypersparc.o viking.o \
+ tsunami.o swift.o
+endif
+
+ifdef CONFIG_HIGHMEM
+obj-y += highmem.o
endif

ifdef CONFIG_SMP
-obj-y += nosun4c.o
+obj-y += nosun4c.o
else
-obj-y += sun4c.o
+obj-y += sun4c.o
endif

include $(TOPDIR)/Rules.make
diff -urN 2.4.20-pre8.vanilla/arch/sparc/mm/highmem.c linux-2.4.20-pre8/arch/sparc/mm/highmem.c
--- 2.4.20-pre8.vanilla/arch/sparc/mm/highmem.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.20-pre8/arch/sparc/mm/highmem.c 2002-09-30 03:27:54.000000000 +0200
@@ -0,0 +1,84 @@
+/*
+ * highmem.c: virtual kernel memory mappings for high memory
+ *
+ * Provides kernel-static versions of atomic kmap functions originally
+ * found as inlines in include/asm-sparc/highmem.h. These became
+ * needed as kmap_atomic() and kunmap_atomic() started getting
+ * called from within modules.
+ * -- Tomas Szepe <[email protected]>, September 2002
+ */
+
+#include <linux/mm.h>
+#include <linux/highmem.h>
+#include <asm/pgalloc.h>
+
+/*
+ * The use of kmap_atomic/kunmap_atomic is discouraged -- kmap()/kunmap()
+ * gives a more generic (and caching) interface. But kmap_atomic() can
+ * be used in IRQ contexts, so in some (very limited) cases we need it.
+ */
+void *kmap_atomic(struct page *page, enum km_type type)
+{
+ unsigned long idx;
+ unsigned long vaddr;
+
+ if (page < highmem_start_page)
+ return page_address(page);
+
+ idx = type + KM_TYPE_NR * smp_processor_id();
+ vaddr = fix_kmap_begin + idx * PAGE_SIZE;
+
+/* XXX Fix - Anton */
+#if 0
+ __flush_cache_one(vaddr);
+#else
+ flush_cache_all();
+#endif
+
+#if HIGHMEM_DEBUG
+ if (!pte_none(*(kmap_pte + idx)))
+ BUG();
+#endif
+ set_pte(kmap_pte + idx, mk_pte(page, kmap_prot));
+/* XXX Fix - Anton */
+#if 0
+ __flush_tlb_one(vaddr);
+#else
+ flush_tlb_all();
+#endif
+
+ return (void *) vaddr;
+}
+
+void kunmap_atomic(void *kvaddr, enum km_type type)
+{
+ unsigned long vaddr = (unsigned long) kvaddr;
+ unsigned long idx = type + KM_TYPE_NR * smp_processor_id();
+
+ if (vaddr < fix_kmap_begin) /* FIXME */
+ return;
+
+ if (vaddr != fix_kmap_begin + idx * PAGE_SIZE)
+ BUG();
+
+/* XXX Fix - Anton */
+#if 0
+ __flush_cache_one(vaddr);
+#else
+ flush_cache_all();
+#endif
+
+#ifdef HIGHMEM_DEBUG
+ /*
+ * Force other mappings to oops if they try to access
+ * this pte without first remapping it.
+ */
+ pte_clear(kmap_pte + idx);
+/* XXX Fix - Anton */
+#if 0
+ __flush_tlb_one(vaddr);
+#else
+ flush_tlb_all();
+#endif
+#endif
+}
diff -urN 2.4.20-pre8.vanilla/include/asm-sparc/highmem.h linux-2.4.20-pre8/include/asm-sparc/highmem.h
--- 2.4.20-pre8.vanilla/include/asm-sparc/highmem.h 2002-09-30 03:32:26.000000000 +0200
+++ linux-2.4.20-pre8/include/asm-sparc/highmem.h 2002-09-30 03:56:59.000000000 +0200
@@ -20,15 +20,16 @@

#ifdef __KERNEL__

-#include <linux/init.h>
#include <linux/interrupt.h>
-#include <asm/vaddrs.h>
#include <asm/kmap_types.h>
-#include <asm/pgtable.h>

/* undef for production */
#define HIGHMEM_DEBUG 1

+/* in mm/highmem.c */
+extern void *kmap_high(struct page *page);
+extern void kunmap_high(struct page *page);
+
/* declarations for highmem.c */
extern unsigned long highstart_pfn, highend_pfn;

@@ -51,12 +52,13 @@
*/
#define LAST_PKMAP 1024

-#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
-#define PKMAP_NR(virt) ((virt - pkmap_base) >> PAGE_SHIFT)
-#define PKMAP_ADDR(nr) (pkmap_base + ((nr) << PAGE_SHIFT))
-
-extern void *kmap_high(struct page *page);
-extern void kunmap_high(struct page *page);
+#define LAST_PKMAP_MASK (LAST_PKMAP - 1)
+#define PKMAP_NR(virt) ((virt - pkmap_base) >> PAGE_SHIFT)
+#define PKMAP_ADDR(nr) (pkmap_base + ((nr) << PAGE_SHIFT))
+
+/* in arch/sparc/mm/highmem.c */
+void *kmap_atomic(struct page *page, enum km_type type);
+void kunmap_atomic(void *kvaddr, enum km_type type);

static inline void *kmap(struct page *page)
{
@@ -76,78 +78,6 @@
kunmap_high(page);
}

-/*
- * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
- * gives a more generic (and caching) interface. But kmap_atomic can
- * be used in IRQ contexts, so in some (very limited) cases we need
- * it.
- */
-static inline void *kmap_atomic(struct page *page, enum km_type type)
-{
- unsigned long idx;
- unsigned long vaddr;
-
- if (page < highmem_start_page)
- return page_address(page);
-
- idx = type + KM_TYPE_NR*smp_processor_id();
- vaddr = fix_kmap_begin + idx * PAGE_SIZE;
-
-/* XXX Fix - Anton */
-#if 0
- __flush_cache_one(vaddr);
-#else
- flush_cache_all();
-#endif
-
-#if HIGHMEM_DEBUG
- if (!pte_none(*(kmap_pte+idx)))
- BUG();
-#endif
- set_pte(kmap_pte+idx, mk_pte(page, kmap_prot));
-/* XXX Fix - Anton */
-#if 0
- __flush_tlb_one(vaddr);
-#else
- flush_tlb_all();
-#endif
-
- return (void*) vaddr;
-}
-
-static inline void kunmap_atomic(void *kvaddr, enum km_type type)
-{
- unsigned long vaddr = (unsigned long) kvaddr;
- unsigned long idx = type + KM_TYPE_NR*smp_processor_id();
-
- if (vaddr < fix_kmap_begin) // FIXME
- return;
-
- if (vaddr != fix_kmap_begin + idx * PAGE_SIZE)
- BUG();
-
-/* XXX Fix - Anton */
-#if 0
- __flush_cache_one(vaddr);
-#else
- flush_cache_all();
-#endif
-
-#ifdef HIGHMEM_DEBUG
- /*
- * force other mappings to Oops if they'll try to access
- * this pte without first remap it
- */
- pte_clear(kmap_pte+idx);
-/* XXX Fix - Anton */
-#if 0
- __flush_tlb_one(vaddr);
-#else
- flush_tlb_all();
-#endif
-#endif
-}
-
#endif /* __KERNEL__ */

#endif /* _ASM_HIGHMEM_H */