linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Real Name <enjoymindful@gmail.com>
To: linux@roeck-us.net
Cc: tj@kernel.org, starvik@axis.com, jesper.nilsson@axis.com,
	linux-cris-kernel@axis.com, linux-kernel@vger.kernel.org
Subject: why commit 3189eddbcafc cause crisv32 panic
Date: Tue, 14 Oct 2014 18:48:55 +0800	[thread overview]
Message-ID: <20141014104855.GA1813@name> (raw)

[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]

hi, Guenter
 
http://www.gossamer-threads.com/lists/linux/kernel/2011061

>[PATCH] Revert "percpu: free percpu allocation info for uniprocessor system"
>
> The commit causes a hang with a crisv32 image. This may be an architecture
> problem, but at least for now the revert is necessary to be able to boot a
> crisv32 image. 

Yes, it is a crisv32 specific issue. The crisv32 was paniced on the BUG() macro
in function mark_bootmem. The call path is :

pcpu_free_alloc_info
	-> memblock_free_early
		-> free_bootmem
			-> mark_bootmem
				-> BUG()

The root source is that arch/cris/kernel/setup.c:setup_arch compute start_pfn
and max_pfn from *virtual* address.

|---------- arch/cris/kernel/setup.c:setup_arch -----------------------
|	start_pfn = PFN_UP(memory_start);  /* usually c0000000 + kernel + romfs */
|	max_pfn =   PFN_DOWN((unsigned long)high_memory); /* usually c0000000 + dram size */
|---------- arch/cris/kernel/setup.c:setup_arch -----------------------

So, when memblock_free_early pass the *physical* address of ai to mark_bootmem.
The first if statement of mark_bootmem become ture. And then hit the BUG() macro.

After applied the attached patch, pcpu_free_alloc_info works as expect. It had
been test with your toolchain and patches you provided to me.
http://server.roeck-us.net/qemu/crisv32/

cc'ed Mikael and Jesper, as they are Axis staff.

thanks

[-- Attachment #2: why_3189eddbcafc_cause_crisv32_panic.patch --]
[-- Type: text/x-diff, Size: 838 bytes --]

diff --git a/mm/percpu.c b/mm/percpu.c
index 2139e30..cbbc946 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1097,7 +1097,12 @@ struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
  */
 void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai)
 {
-	memblock_free_early(__pa(ai), ai->__ai_size);
+	/* This patch is unacceptable, as it broken other arch.
+	* It was created to explain why commit 3189eddbcafc ("percpu:
+	* free percpu allocation info for uniprocessor system") cause
+	* crisv32 panic. PLEASE DO NOT APPLY THIS PATCH.
+	*/
+	memblock_free_early((unsigned long)(ai), ai->__ai_size);
 }
 
 /**
@@ -1932,6 +1937,8 @@ void __init setup_per_cpu_areas(void)
 
 	if (pcpu_setup_first_chunk(ai, fc) < 0)
 		panic("Failed to initialize percpu areas.");
+
+	pcpu_free_alloc_info(ai);
 }
 
 #endif	/* CONFIG_SMP */

                 reply	other threads:[~2014-10-14 10:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20141014104855.GA1813@name \
    --to=enjoymindful@gmail.com \
    --cc=jesper.nilsson@axis.com \
    --cc=linux-cris-kernel@axis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=starvik@axis.com \
    --cc=tj@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;
as well as URLs for NNTP newsgroup(s).