All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <chris@cloudcar.com>
To: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org
Cc: Tony Lindgren <tony@atomide.com>,
	Christoffer Dall <chris@cloudcar.com>,
	"Jeremy C. Andrus" <jeremya@cs.columbia.edu>
Subject: [RFC PATCH] ARM: mm: Fix alloc_init_section bug on LPAE
Date: Fri, 25 Jan 2013 19:31:58 -0500	[thread overview]
Message-ID: <1359160318-27068-1-git-send-email-chris@cloudcar.com> (raw)

When using LPAE the call to alloc_init_pte is passed then end address
for the entire 1st level page table region, and the code unluckily ends
up going over the bounds of the single allocated PTE, which is sad.

This caused LPAE boot on omap5 to crash.

There may be some hidden mystery in the boot code that I'm unaware of
or it may be assumed that all mappings are always mappable as sections
on LPAE and therefore omap5 just does something bad, in which case this
patch isn't the right fix, but I'd be happy to be told the reason.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Signed-off-by: Christoffer Dall <chris@cloudcar.com>
---
 arch/arm/mm/mmu.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index ce328c7..1cecc99 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -603,11 +603,13 @@ static void __init alloc_init_section(pud_t *pud, unsigned long addr,
 
 		flush_pmd_entry(p);
 	} else {
-		/*
-		 * No need to loop; pte's aren't interested in the
-		 * individual L1 entries.
-		 */
-		alloc_init_pte(pmd, addr, end, __phys_to_pfn(phys), type);
+		unsigned long next;
+
+		do {
+			next = pmd_addr_end(addr, end);
+			alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys), type);
+			phys += next - addr;
+		} while (pmd++, addr = next, addr != end);
 	}
 }
 
-- 
1.7.9.5

WARNING: multiple messages have this Message-ID (diff)
From: chris@cloudcar.com (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] ARM: mm: Fix alloc_init_section bug on LPAE
Date: Fri, 25 Jan 2013 19:31:58 -0500	[thread overview]
Message-ID: <1359160318-27068-1-git-send-email-chris@cloudcar.com> (raw)

When using LPAE the call to alloc_init_pte is passed then end address
for the entire 1st level page table region, and the code unluckily ends
up going over the bounds of the single allocated PTE, which is sad.

This caused LPAE boot on omap5 to crash.

There may be some hidden mystery in the boot code that I'm unaware of
or it may be assumed that all mappings are always mappable as sections
on LPAE and therefore omap5 just does something bad, in which case this
patch isn't the right fix, but I'd be happy to be told the reason.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Signed-off-by: Christoffer Dall <chris@cloudcar.com>
---
 arch/arm/mm/mmu.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index ce328c7..1cecc99 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -603,11 +603,13 @@ static void __init alloc_init_section(pud_t *pud, unsigned long addr,
 
 		flush_pmd_entry(p);
 	} else {
-		/*
-		 * No need to loop; pte's aren't interested in the
-		 * individual L1 entries.
-		 */
-		alloc_init_pte(pmd, addr, end, __phys_to_pfn(phys), type);
+		unsigned long next;
+
+		do {
+			next = pmd_addr_end(addr, end);
+			alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys), type);
+			phys += next - addr;
+		} while (pmd++, addr = next, addr != end);
 	}
 }
 
-- 
1.7.9.5

             reply	other threads:[~2013-01-26  0:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-26  0:31 Christoffer Dall [this message]
2013-01-26  0:31 ` [RFC PATCH] ARM: mm: Fix alloc_init_section bug on LPAE Christoffer Dall
2013-01-26  4:50 ` Santosh Shilimkar
2013-01-26  4:50   ` Santosh Shilimkar
2013-01-26  6:15   ` Christoffer Dall
2013-01-26  6:15     ` Christoffer Dall
2013-02-01 17:55 ` Catalin Marinas
2013-02-01 17:55   ` Catalin Marinas

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=1359160318-27068-1-git-send-email-chris@cloudcar.com \
    --to=chris@cloudcar.com \
    --cc=jeremya@cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.