Re: 2.6.0-test7 DEBUG_PAGEALLOC oops

From: Manfred Spraul
Date: Sun Oct 12 2003 - 01:59:31 EST


Could you try the attached patch?
It updates the end of stack detection to handle unaligned stacks.

--
Manfred
// $Header$
// Kernel Version:
// VERSION = 2
// PATCHLEVEL = 6
// SUBLEVEL = 0
// EXTRAVERSION = -test7
--- 2.6/include/asm-i386/thread_info.h 2003-10-09 21:20:00.000000000 +0200
+++ build-2.6/include/asm-i386/thread_info.h 2003-10-12 08:50:12.000000000 +0200
@@ -101,6 +101,16 @@

#endif

+static inline int kstack_end(void *addr)
+{
+ unsigned long offset = (unsigned long)addr & (THREAD_SIZE-1);
+
+ /* Some APM bios versions misalign the stack */
+ if (offset == 0 || offset > (THREAD_SIZE-sizeof(void*)))
+ return 1;
+ return 0;
+}
+
/*
* thread information flags
* - these are process state flags that various assembly files may need to access
--- 2.6/mm/slab.c 2003-10-09 21:23:19.000000000 +0200
+++ build-2.6/mm/slab.c 2003-10-12 08:51:13.000000000 +0200
@@ -862,7 +862,7 @@
unsigned long *sptr = &caller;
unsigned long svalue;

- while (((long) sptr & (THREAD_SIZE-1)) != 0) {
+ while (!kstack_end(sptr)) {
svalue = *sptr++;
if (kernel_text_address(svalue)) {
*addr++=svalue;
--- 2.6/arch/i386/kernel/traps.c 2003-10-09 21:23:03.000000000 +0200
+++ build-2.6/arch/i386/kernel/traps.c 2003-10-12 08:50:41.000000000 +0200
@@ -104,7 +104,7 @@
#ifdef CONFIG_KALLSYMS
printk("\n");
#endif
- while (((long) stack & (THREAD_SIZE-1)) != 0) {
+ while (!kstack_end(stack)) {
addr = *stack++;
if (kernel_text_address(addr)) {
printk(" [<%08lx>] ", addr);
@@ -138,7 +138,7 @@

stack = esp;
for(i = 0; i < kstack_depth_to_print; i++) {
- if (((long) stack & (THREAD_SIZE-1)) == 0)
+ if (kstack_end(stack))
break;
if (i && ((i % 8) == 0))
printk("\n ");