Kernel-testers Development Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: a.beregalov@gmail.com
Cc: mikpe@it.uu.se, kernel-testers@vger.kernel.org,
	sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: 2.6.26-rc: SPARC: Sun Ultra 10 can not boot
Date: Wed, 13 Aug 2008 20:53:33 -0700 (PDT)	[thread overview]
Message-ID: <20080813.205333.202202181.davem@davemloft.net> (raw)
In-Reply-To: <a4423d670808080452u2833418agc8027dfc33c9bb18@mail.gmail.com>

From: "Alexander Beregalov" <a.beregalov@gmail.com>
Date: Fri, 8 Aug 2008 15:52:53 +0400

> 2008/8/8 David Miller <davem@davemloft.net>:
> > This will allow you to see the crash message.
> Yes, I saw it.
> There were few WARNINGS at lib/list_debug.c:__list_add
> That messages went fast, I can not see it now.
> Now I see call trace:
> __free_pages_ok
> __free_pages
> __free_pages_bootmem
> free_all_bootmem_core
> free_all_bootmem
> mem_init
> start_kernel
> tlb_fixup_done
> 
> Can it be helpful?

Mikulas Patocka is seeing the same bug (see thread "Re: console
handover badness") I just posted the following patch there that can
help track this down.

Please try it out on your machine too.

BTW, how much ram is in your system?

Thanks.

diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 217de3e..26b018f 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -1643,6 +1643,8 @@ void __init setup_per_cpu_areas(void)
 {
 }
 
+extern void sparse_validate_usemap(const char *file, int line);
+
 void __init paging_init(void)
 {
 	unsigned long end_pfn, shift, phys_base;
@@ -1788,7 +1790,9 @@ void __init paging_init(void)
 #ifndef CONFIG_NEED_MULTIPLE_NODES
 	max_mapnr = last_valid_pfn;
 #endif
+	sparse_validate_usemap(__FILE__, __LINE__);
 	kernel_physical_mapping_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 
 	{
 		unsigned long max_zone_pfns[MAX_NR_ZONES];
@@ -1798,12 +1802,15 @@ void __init paging_init(void)
 		max_zone_pfns[ZONE_NORMAL] = end_pfn;
 
 		free_area_init_nodes(max_zone_pfns);
+		sparse_validate_usemap(__FILE__, __LINE__);
 	}
 
 	printk("Booting Linux...\n");
 
 	central_probe();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	cpu_probe();
+	sparse_validate_usemap(__FILE__, __LINE__);
 }
 
 int __init page_in_phys_avail(unsigned long paddr)
diff --git a/init/main.c b/init/main.c
index 0bc7e16..80771f5 100644
--- a/init/main.c
+++ b/init/main.c
@@ -536,6 +536,8 @@ void __init __weak thread_info_cache_init(void)
 {
 }
 
+extern void sparse_validate_usemap(const char *file, int line);
+
 asmlinkage void __init start_kernel(void)
 {
 	char * command_line;
@@ -567,12 +569,19 @@ asmlinkage void __init start_kernel(void)
 	printk(KERN_NOTICE);
 	printk(linux_banner);
 	setup_arch(&command_line);
+	sparse_validate_usemap(__FILE__, __LINE__);
 	mm_init_owner(&init_mm, &init_task);
+	sparse_validate_usemap(__FILE__, __LINE__);
 	setup_command_line(command_line);
+	sparse_validate_usemap(__FILE__, __LINE__);
 	unwind_setup();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	setup_per_cpu_areas();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	setup_nr_cpu_ids();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	smp_prepare_boot_cpu();	/* arch-specific boot-cpu hooks */
+	sparse_validate_usemap(__FILE__, __LINE__);
 
 	/*
 	 * Set up the scheduler prior starting any interrupts (such as the
@@ -580,35 +589,52 @@ asmlinkage void __init start_kernel(void)
 	 * time - but meanwhile we still have a functioning scheduler.
 	 */
 	sched_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	/*
 	 * Disable preemption - early bootup scheduling is extremely
 	 * fragile until we cpu_idle() for the first time.
 	 */
 	preempt_disable();
 	build_all_zonelists();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	page_alloc_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
 	parse_early_param();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	parse_args("Booting kernel", static_command_line, __start___param,
 		   __stop___param - __start___param,
 		   &unknown_bootoption);
+	sparse_validate_usemap(__FILE__, __LINE__);
 	if (!irqs_disabled()) {
 		printk(KERN_WARNING "start_kernel(): bug: interrupts were "
 				"enabled *very* early, fixing it\n");
 		local_irq_disable();
 	}
 	sort_main_extable();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	trap_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	rcu_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	init_IRQ();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	pidhash_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	init_timers();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	hrtimers_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	softirq_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	timekeeping_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	time_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	sched_clock_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	profile_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	if (!irqs_disabled())
 		printk("start_kernel(): bug: interrupts were enabled early\n");
 	early_boot_irqs_on();
@@ -620,10 +646,12 @@ asmlinkage void __init start_kernel(void)
 	 * this. But we do want output early, in case something goes wrong.
 	 */
 	console_init();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	if (panic_later)
 		panic(panic_later, panic_param);
 
 	lockdep_info();
+	sparse_validate_usemap(__FILE__, __LINE__);
 
 	/*
 	 * Need to run this when irqs are enabled, because it wants
@@ -631,6 +659,7 @@ asmlinkage void __init start_kernel(void)
 	 * too:
 	 */
 	locking_selftest();
+	sparse_validate_usemap(__FILE__, __LINE__);
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	if (initrd_start && !initrd_below_start_ok &&
@@ -643,7 +672,9 @@ asmlinkage void __init start_kernel(void)
 	}
 #endif
 	vfs_caches_init_early();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	cpuset_init_early();
+	sparse_validate_usemap(__FILE__, __LINE__);
 	mem_init();
 	enable_debug_pagealloc();
 	cpu_hotplug_init();
diff --git a/mm/sparse.c b/mm/sparse.c
index 5d9dbbb..116559c 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -262,6 +262,52 @@ unsigned long usemap_size(void)
 	return size_bytes;
 }
 
+#if 1
+static int check_one_blockval(unsigned long *bitmap, unsigned long off, unsigned long nbits)
+{
+	unsigned long i, value = 1, flags = 0;
+
+	for (i = 0; i < nbits; i++, value <<= 1)
+		if (test_bit(off + i, bitmap))
+			flags |= value;
+
+	if (flags >= MIGRATE_TYPES) {
+		printk(KERN_ERR "BUG: Bogus migrate type %lu\n", flags);
+		return 1;
+	}
+	return 0;
+}
+
+void sparse_validate_usemap(const char *file, int line)
+{
+	void *caller = __builtin_return_address(0);
+	unsigned long size = usemap_size();
+	unsigned long pnum;
+	static int reported = 0;
+
+	if (reported)
+		return;
+
+	for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
+		struct mem_section *ms;
+		unsigned long *bitmap;
+		unsigned long off;
+
+		if (!present_section_nr(pnum))
+			continue;
+		ms = __nr_to_section(pnum);
+		bitmap = ms->pageblock_flags;
+		for (off = 0; off < size; off += 3) {
+			if (check_one_blockval(bitmap, off, 3)) {
+				printk(KERN_ERR "BUG: Usemap for section %lu corrupted at %pS[%s:%d]\n",
+				       pnum, caller, file, line);
+				reported = 1;
+				break;
+			}
+		}
+	}
+}
+#endif
 #ifdef CONFIG_MEMORY_HOTPLUG
 static unsigned long *__kmalloc_section_usemap(void)
 {
@@ -445,10 +491,16 @@ void __init sparse_init(void)
 		sparse_init_one_section(__nr_to_section(pnum), pnum, map,
 								usemap);
 	}
+#if 1
+	sparse_validate_usemap(__FILE__, __LINE__);
+#endif
 
 	vmemmap_populate_print_last();
 
 	free_bootmem(__pa(usemap_map), size);
+#if 1
+	sparse_validate_usemap(__FILE__, __LINE__);
+#endif
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG

  parent reply	other threads:[~2008-08-14  3:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19 14:07 2.6.26-rc: SPARC: Sun Ultra 10 can not boot Alexander Beregalov
2008-06-19 16:02 ` Alexander Beregalov
     [not found]   ` <a4423d670806190902l48c542e0i6a7380a2d3e7f520-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-06-19 23:10     ` David Miller
2008-06-20  2:00   ` David Miller
     [not found]     ` <20080619.190048.193701955.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-06-20 21:19       ` Alexander Beregalov
2008-06-20 21:21         ` David Miller
     [not found]           ` <a4423d670806201542o5415cad7p6b9a38b67252cee1@mail.gmail.com>
2008-06-20 22:51             ` David Miller
2008-06-20 23:12               ` Alexander Beregalov
2008-06-20 23:21                 ` David Miller
     [not found]                   ` <20080620.162135.203810660.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-06-20 23:36                     ` Alexander Beregalov
     [not found]                       ` <a4423d670806201636n4f3d107bk290ed831eb5eefb4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-07  9:19                         ` Alexander Beregalov
     [not found]                           ` <a4423d670807070219s2dd43aaia29713f5076ecd0d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-07 11:01                             ` David Miller
     [not found]                               ` <20080707.040126.178187777.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-07-07 13:05                                 ` Mikael Pettersson
     [not found]                                   ` <18546.5247.797478.66373-gq7oiAaKCbRt3AgVzhmPzw@public.gmane.org>
2008-07-07 15:59                                     ` Alexander Beregalov
2008-08-08  6:01                                       ` David Miller
2008-08-08  9:31                                         ` Alexander Beregalov
2008-08-08  9:40                                           ` David Miller
     [not found]                                             ` <20080808.024024.205614839.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-08-08 10:14                                               ` Alexander Beregalov
     [not found]                                                 ` <a4423d670808080314weed9178o9f9ef52803a68501-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-08 10:38                                                   ` David Miller
     [not found]                                                     ` <20080808.033811.129671951.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-08-08 10:56                                                       ` Alexander Beregalov
     [not found]                                                         ` <a4423d670808080356r6573102am8a1eb9dcc83910c8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-08 11:18                                                           ` David Miller
2008-08-08 11:52                                                             ` Alexander Beregalov
2008-08-08 23:17                                                               ` David Miller
2008-08-14  3:53                                                               ` David Miller [this message]
     [not found]                                                                 ` <20080813.205333.202202181.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-08-14 10:19                                                                   ` Alexander Beregalov
     [not found]                                                             ` <20080808.041814.41687650.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-08-08 14:28                                                               ` Alexander Beregalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080813.205333.202202181.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=a.beregalov@gmail.com \
    --cc=kernel-testers@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@it.uu.se \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox