mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Watson <cjwatson@canonical.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] x86-64: fix mapping updates across pmd boundary
Date: Wed, 15 Sep 2010 13:47:12 +0100	[thread overview]
Message-ID: <20100915124712.GP21862@riva.ucam.org> (raw)

A Dell Precision M4500 booted in UEFI mode shows the following warning
at boot:

[    0.040003] init_memory_mapping: 00000000bb5df000-00000000bb637000
[    0.046182] EFI: ioremap of 0xBB5DF000 failed!

The range in question corresponds to an entry in the UEFI memory map,
which is always aligned on 4096-byte pages but not necessarily any more
than that.  init_memory_mapping passes the start address to
kernel_physical_mapping_init which passes it on to phys_pud_update, etc.
phys_pud_init takes care that if the address crosses a pud boundary then
it's set to the start of the pud, but phys_pmd_init simply increased the
address by PMD_SIZE, which in this case meant that it would jump from
0xbb600000 to 0xbb7df000 and immediately stop since that was after the
end address, not setting any of the remaining pte entries.

Bringing phys_pmd_init into line with phys_pud_init fixes this.

Signed-off-by: Colin Watson <cjwatson@canonical.com>
---
 arch/x86/mm/init_64.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 9a66746..2f386de 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -368,7 +368,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
 
 	int i = pmd_index(address);
 
-	for (; i < PTRS_PER_PMD; i++, address += PMD_SIZE) {
+	for (; i < PTRS_PER_PMD;
+	     i++, address = (address & PMD_MASK) + PMD_SIZE) {
 		unsigned long pte_phys;
 		pmd_t *pmd = pmd_page + pmd_index(address);
 		pte_t *pte;
-- 
1.7.1

                 reply	other threads:[~2010-09-15 12:47 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=20100915124712.GP21862@riva.ucam.org \
    --to=cjwatson@canonical.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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

all inboxes | Powered by JetHome®