Skip to contentSkip to conversation

microblaze: Fix pfn_valid() for noMMU

PATCH In review [email protected] 4 participants 5 messages Nov 13, 2009 – Nov 18, 2009 Microblaze architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 microblaze: Fix pfn_valid() for noMMU

Configuring DEBUG_SLAB causes a noMMU kernel to die during initialization with an invalid virtual address panic in kfree_debugcheck(). The panic is due to an improper definition of pfn_valid().

---

arch/microblaze/include/asm/page.h +2 -1
diff -uprN a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
@@ -161,7 +161,8 @@ extern int page_is_ram(unsigned long pfn
 #  endif /* CONFIG_MMU */
 
 #  ifndef CONFIG_MMU
-#  define pfn_valid(pfn)	((pfn) >= min_low_pfn && (pfn) <= max_mapnr)
+#  define pfn_valid(pfn)	(((pfn) >= min_low_pfn) && \
+				((pfn) <= (min_low_pfn + max_mapnr)))
 #  define ARCH_PFN_OFFSET	(PAGE_OFFSET >> PAGE_SHIFT)
 #  else /* CONFIG_MMU */
 #  define ARCH_PFN_OFFSET	(memory_start >> PAGE_SHIFT)
maintainer
#1 lore raw
Quoted 5 lines · [email protected] wrote:

Configuring DEBUG_SLAB causes a noMMU kernel to die during initialization with an invalid virtual address panic in kfree_debugcheck(). The panic is due to an improper definition of pfn_valid().

Added to next branch.

Thanks,
Michal

Quoted 15 lines

---
diff -uprN a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h

arch/microblaze/include/asm/page.h +2 -1
@@ -161,7 +161,8 @@ extern int page_is_ram(unsigned long pfn
 #  endif /* CONFIG_MMU */
 
 #  ifndef CONFIG_MMU
-#  define pfn_valid(pfn)	((pfn) >= min_low_pfn && (pfn) <= max_mapnr)
+#  define pfn_valid(pfn)	(((pfn) >= min_low_pfn) && \
+				((pfn) <= (min_low_pfn + max_mapnr)))
 #  define ARCH_PFN_OFFSET	(PAGE_OFFSET >> PAGE_SHIFT)
 #  else /* CONFIG_MMU */
 #  define ARCH_PFN_OFFSET	(memory_start >> PAGE_SHIFT)
Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#2 lore raw
In reply to [email protected]
Quoted 10 lines · On Fri, 13 Nov 2009 16:08:29 -0600 [email protected] wrote:

Configuring DEBUG_SLAB causes a noMMU kernel to die during initialization with an invalid virtual address panic in kfree_debugcheck(). The panic is due to an improper definition of pfn_valid().

---
diff -uprN a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h

arch/microblaze/include/asm/page.h extern int page_is_ram(unsigned long pfn · line 168

Quoted 9 lines
arch/microblaze/include/asm/page.h +2 -1
@@ -161,7 +161,8 @@ extern int page_is_ram(unsigned long pfn
 #  endif /* CONFIG_MMU */
 
 #  ifndef CONFIG_MMU
-#  define pfn_valid(pfn)	((pfn) >= min_low_pfn && (pfn) <= max_mapnr)
+#  define pfn_valid(pfn)	(((pfn) >= min_low_pfn) && \
+				((pfn) <= (min_low_pfn + max_mapnr)))
 #  define ARCH_PFN_OFFSET	(PAGE_OFFSET >> PAGE_SHIFT)
 #  else /* CONFIG_MMU */
 #  define ARCH_PFN_OFFSET	(memory_start >> PAGE_SHIFT)

Is arch/score/include/asm/page.h buggy also?

#3 lore raw
Quoted 10 lines · Andrew Morton
Quoted 5 lines · On Fri, 13 Nov 2009 16:08:29 -0600 [email protected] wrote:

Configuring DEBUG_SLAB causes a noMMU kernel to die during initialization with an invalid virtual address panic in kfree_debugcheck(). The panic is due to an improper definition of pfn_valid().

...

Is arch/score/include/asm/page.h buggy also?

I don't believe so, but only because MEMORY_START is defined as zero for that arch, making min_low_pfn zero.

------------------------------------------------------------------------
Steven J. Magnani "I claim this network for MARS!
www.digidescorp.com Earthling, return my space modulator!"

#include <standard.disclaimer>

#4 lore raw

"Steven J. Magnani" <[email protected]> 写于 2009-11-17 22:27:54:

Quoted 5 lines · Andrew Morton
Quoted 4 lines
Quoted 1 line · On Fri, 13 Nov 2009 16:08:29 -0600 [email protected] wrote:

Configuring DEBUG_SLAB causes a noMMU kernel to die during

initialization

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

with an invalid virtual address panic in kfree_debugcheck(). The panic is due to an improper definition of pfn_valid().

...

Is arch/score/include/asm/page.h buggy also?

I don't believe so, but only because MEMORY_START is defined as zero for that arch, making min_low_pfn zero.

Yes, it's right because MEMORY_START is defined as 0, make min_low_pfn to zero and max_mapnr equal max_low_pfn.

We will fix it to make code more clear.

liqin

�翳簕.n�+壏煯壄�+%娝�遍荻w�簕.n�+壏{炳G珴�妠ay�蕠跈�,jf"穐殢飦�戧鐉_璁(殠娸"濟�m���G珴�⒏?櫒璀�&x忈秈O曟瑉窔v豝�m��� �鹅�⒏?朓�