Skip to contentSkip to conversation

HPET regression in 2.6.26 versus 2.6.25 -- found another user with the same regression

DISCUSSION David Witbrodt 2 participants 3 messages Aug 20, 2008 – Aug 21, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

*** FINALLY FOUND THE EXACT PROBLEM ***

I woke up this morning with a new idea. I wish I had thought of this TWO WEEKS AGO!

Commit 3def3d6d essentially involves 2 different changes:

1. request_resource () is replaced by insert_resource()

2. code to add {code,data,bss}_resource to the iomem_resource tree is moved out of e820_reserve_resources() and into setup_arch() directly. [The actual call of e820_reserve_resources() is also located in setup_arch().]

Since this is 2 separate changes, I went back to 700efc1b, just before the commit introducing the regression (3def3d6d).

When I applied change #2 alone, and GOT A WORKING KERNEL! ===== BEGIN DIFF ================

arch/x86/kernel/e820_64.c +1 -16
index a8694a3..e452bea 100644
@@ -229,8 +229,7 @@ unsigned long __init e820_end_of_ram(void)
 /*
  * Mark e820 reserved areas as busy for the resource manager.
  */
-void __init e820_reserve_resources(struct resource *code_resource,
-        struct resource *data_resource, struct resource *bss_resource)
+void __init e820_reserve_resources(void)
 {
     int i;
     for (i = 0; i < e820.nr_map; i++) {
@@ -246,20 +245,6 @@ void __init e820_reserve_resources(struct resource *code_resource,
         res->end = res->start + e820.map[i].size - 1;
         res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
         request_resource(&iomem_resource, res);
-        if (e820.map[i].type == E820_RAM) {
-            /*
-             * We don't know which RAM region contains kernel data,
-             * so we try it repeatedly and let the resource manager
-             * test it.
-             */
-            request_resource(res, code_resource);
-            request_resource(res, data_resource);
-            request_resource(res, bss_resource);
-#ifdef CONFIG_KEXEC
-            if (crashk_res.start != crashk_res.end)
-                request_resource(res, &crashk_res);
-#endif
-        }
     }
 }
 
arch/x86/kernel/setup_64.c +6 -1
index 187f084..a0584ac 100644
@@ -322,6 +322,11 @@ void __init setup_arch(char **cmdline_p)
 
     finish_e820_parsing();
 
+    /* after parse_early_param, so could debug it */
+    insert_resource(&iomem_resource, &code_resource);
+    insert_resource(&iomem_resource, &data_resource);
+    insert_resource(&iomem_resource, &bss_resource);
+
     early_gart_iommu_check();
 
     e820_register_active_regions(0, 0, -1UL);
@@ -454,7 +459,7 @@ void __init setup_arch(char **cmdline_p)
     /*
      * We trust e820 completely. No explicit ROM probing in memory.
      */
-    e820_reserve_resources(&code_resource, &data_resource, &bss_resource);
+    e820_reserve_resources();
     e820_mark_nosave_regions();
 
     /* request I/O space for devices used on all i[345]86 PCs */
include/asm-x86/e820_64.h +1 -2
index 9e06c6e..ef653a4 100644
@@ -23,8 +23,7 @@ extern void update_memory_range(u64 start, u64 size, unsigned old_type,
 extern void setup_memory_region(void);
 extern void contig_e820_setup(void); 
 extern unsigned long e820_end_of_ram(void);
-extern void e820_reserve_resources(struct resource *code_resource,
-        struct resource *data_resource, struct resource *bss_resource);
+extern void e820_reserve_resources(void);
 extern void e820_mark_nosave_regions(void);
 extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
 extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);

===== END DIFF ================

As a separate experiment, I started over with a clean version of 700efc1b, then introduced the change from request_resource() to insert_resource():
===== BEGIN DIFF ================

arch/x86/kernel/e820_64.c +1 -1
index a8694a3..988195d 100644
@@ -245,7 +245,7 @@ void __init e820_reserve_resources(struct resource *code_resource,
         res->start = e820.map[i].addr;
         res->end = res->start + e820.map[i].size - 1;
         res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-        request_resource(&iomem_resource, res);
+        insert_resource(&iomem_resource, res);
         if (e820.map[i].type == E820_RAM) {
             /*
              * We don't know which RAM region contains kernel data,

===== END DIFF ================

The kernel produced from the change HANGS!

I am very late for work, but just couldn't leave home until I posted these results. My conclusion is that, somehow, the reordering of adding {code,data,bss}_resource to the iomem_resource tree is doing funky things to certain people's machines!

HTH!!!
Dave W.

#1 lore raw
Quoted 117 lines · David Witbrodt

*** FINALLY FOUND THE EXACT PROBLEM ***

I woke up this morning with a new idea. I wish I had thought of this TWO WEEKS AGO!

Commit 3def3d6d essentially involves 2 different changes:

1. request_resource () is replaced by insert_resource()

2. code to add {code,data,bss}_resource to the iomem_resource tree is moved out of e820_reserve_resources() and into setup_arch() directly. [The actual call of e820_reserve_resources() is also located in setup_arch().]

Since this is 2 separate changes, I went back to 700efc1b, just before the commit introducing the regression (3def3d6d).

When I applied change #2 alone, and GOT A WORKING KERNEL! ===== BEGIN DIFF ================

arch/x86/kernel/e820_64.c +1 -16
index a8694a3..e452bea 100644
@@ -229,8 +229,7 @@ unsigned long __init e820_end_of_ram(void)
 /*
 * Mark e820 reserved areas as busy for the resource manager.
 */
-void __init e820_reserve_resources(struct resource *code_resource,
-        struct resource *data_resource, struct resource *bss_resource)
+void __init e820_reserve_resources(void)
 {
    int i;
    for (i = 0; i < e820.nr_map; i++) {
@@ -246,20 +245,6 @@ void __init e820_reserve_resources(struct resource *code_resource,
        res->end = res->start + e820.map[i].size - 1;
        res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
        request_resource(&iomem_resource, res);
-        if (e820.map[i].type == E820_RAM) {
-            /*
-             * We don't know which RAM region contains kernel data,
-             * so we try it repeatedly and let the resource manager
-             * test it.
-             */
-            request_resource(res, code_resource);
-            request_resource(res, data_resource);
-            request_resource(res, bss_resource);
-#ifdef CONFIG_KEXEC
-            if (crashk_res.start != crashk_res.end)
-                request_resource(res, &crashk_res);
-#endif
-        }
    }
 }
 
arch/x86/kernel/setup_64.c +6 -1
index 187f084..a0584ac 100644
@@ -322,6 +322,11 @@ void __init setup_arch(char **cmdline_p)
 
    finish_e820_parsing();
 
+    /* after parse_early_param, so could debug it */
+    insert_resource(&iomem_resource, &code_resource);
+    insert_resource(&iomem_resource, &data_resource);
+    insert_resource(&iomem_resource, &bss_resource);
+
    early_gart_iommu_check();
 
    e820_register_active_regions(0, 0, -1UL);
@@ -454,7 +459,7 @@ void __init setup_arch(char **cmdline_p)
    /*
     * We trust e820 completely. No explicit ROM probing in memory.
     */
-    e820_reserve_resources(&code_resource, &data_resource, &bss_resource);
+    e820_reserve_resources();
    e820_mark_nosave_regions();
 
    /* request I/O space for devices used on all i[345]86 PCs */
include/asm-x86/e820_64.h +1 -2
index 9e06c6e..ef653a4 100644
@@ -23,8 +23,7 @@ extern void update_memory_range(u64 start, u64 size, unsigned old_type,
 extern void setup_memory_region(void);
 extern void contig_e820_setup(void);
 extern unsigned long e820_end_of_ram(void);
-extern void e820_reserve_resources(struct resource *code_resource,
-        struct resource *data_resource, struct resource *bss_resource);
+extern void e820_reserve_resources(void);
 extern void e820_mark_nosave_regions(void);
 extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
 extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);

===== END DIFF ================

As a separate experiment, I started over with a clean version of 700efc1b, then introduced the change from request_resource() to insert_resource():
===== BEGIN DIFF ================

arch/x86/kernel/e820_64.c +1 -1
index a8694a3..988195d 100644
@@ -245,7 +245,7 @@ void __init e820_reserve_resources(struct resource *code_resource,
        res->start = e820.map[i].addr;
        res->end = res->start + e820.map[i].size - 1;
        res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-        request_resource(&iomem_resource, res);
+        insert_resource(&iomem_resource, res);
        if (e820.map[i].type == E820_RAM) {
            /*
             * We don't know which RAM region contains kernel data,

===== END DIFF ================

Quoted 1 line

The kernel produced from the change HANGS!

because code/data/bss/crashk is inserted at first

in e820_reserve_resource if you call request_resource instead of insert_resource. the entries from e820 tables that has conflict to entries already added will not show in
resource list /proc/iomem.

please send out /proc/iomem when it happens to boot.

YH

#2 lore raw

please apply attached patch to see if insert_resource/request resource works on your conf

YH

kernel/resource.c +10 -2
Index: linux-2.6/kernel/resource.c
===================================================================
@@ -201,6 +201,7 @@ int request_resource(struct resource *ro
 	write_lock(&resource_lock);
 	conflict = __request_resource(root, new);
 	write_unlock(&resource_lock);
+	printk(KERN_DEBUG "request_resource: root: (%s) [%llx, %llx], new: (%s) [%llx, %llx] conflict %d\n", root->name, root->start, root->end, new->name, new->start, new->end, !!conflict);
 	return conflict ? -EBUSY : 0;
 }
 
@@ -382,16 +383,20 @@ int insert_resource(struct resource *par
 
 	write_lock(&resource_lock);
 
+	printk(KERN_DEBUG "insert_resource: parent: (%s) [%llx, %llx], new: (%s) [%llx, %llx]\n", parent->name, parent->start, parent->end, new->name, new->start, new->end);
 	for (;; parent = first) {
 	 	result = 0;
 		first = __request_resource(parent, new);
-		if (!first)
+		if (!first) {
+			printk(KERN_DEBUG "    insert_resource: good with request direct parent: (%s) [%llx, %llx], new: (%s) [%llx, %llx]\n", parent->name, parent->start, parent->end, new->name, new->start, new->end);
 			goto out;
+		}
 
 		result = -EBUSY;
 		if (first == parent)
 			goto out;
 
+		printk(KERN_DEBUG "  insert_resource: first: (%s) [%llx, %llx], new: (%s) [%llx, %llx]\n", first->name, first->start, first->end, new->name, new->start, new->end);
 		if ((first->start > new->start) || (first->end < new->end))
 			break;
 		if ((first->start == new->start) && (first->end == new->end))
@@ -413,10 +418,13 @@ int insert_resource(struct resource *par
 	new->parent = parent;
 	new->sibling = next->sibling;
 	new->child = first;
+	printk(KERN_DEBUG "  insert_resource: direct parent: (%s) [%llx, %llx], new: (%s) [%llx, %llx]\n", parent->name, parent->start, parent->end, new->name, new->start, new->end);
 
 	next->sibling = NULL;
-	for (next = first; next; next = next->sibling)
+	for (next = first; next; next = next->sibling) {
 		next->parent = new;
+		printk(KERN_DEBUG "    insert_resource: child: (%s) [%llx, %llx], new: (%s) [%llx, %llx]\n", next->name, next->start, next->end, new->name, new->start, new->end);
+	}
 
 	if (parent->child == first) {
 		parent->child = new;