From: Ingo Molnar <mingo@elte.hu>
To: Andi Kleen <andi@firstfloor.org>
Cc: torvalds@osdl.org, tglx@linutronix.de,
linux-kernel@vger.kernel.org, ying.huang@intel.com
Subject: Re: [PATCH] Fix left over EFI cache mapping problems
Date: Thu, 14 Feb 2008 17:12:18 +0100 [thread overview]
Message-ID: <20080214161218.GA28152@elte.hu> (raw)
In-Reply-To: <20080214131317.GA27769@basil.nowhere.org>
* Andi Kleen <andi@firstfloor.org> wrote:
> --- linux.orig/arch/x86/kernel/efi.c
> +++ linux/arch/x86/kernel/efi.c
> @@ -413,17 +413,31 @@ void __init efi_enter_virtual_mode(void)
>
> efi.systab = NULL;
> for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
> + int cached;
> + unsigned numpages;
> +
> md = p;
> if (!(md->attribute & EFI_MEMORY_RUNTIME))
> continue;
>
> + /*
> + * RED-PEN The spec (and ia64) has a lot more memory
> + * attribute flags should we handle those too?
> + */
> + cached = !!(md->attribute & EFI_MEMORY_WB);
> size = md->num_pages << EFI_PAGE_SHIFT;
> end = md->phys_addr + size;
> + numpages = ALIGN(size, PAGE_SIZE) >> PAGE_SHIFT;
>
> - if ((end >> PAGE_SHIFT) <= max_pfn_mapped)
> + /* RED-PEN does not handle overlapping */
> + if ((end >> PAGE_SHIFT) <= max_pfn_mapped) {
> va = __va(md->phys_addr);
> - else
> - va = efi_ioremap(md->phys_addr, size);
> + /* RED-PEN someone else could UCed it. */
> + if (!cached)
> + set_memory_uc((unsigned long)va, numpages);
> + } else {
> + va = efi_ioremap(md->phys_addr, size, cached);
> + }
>
> md->virt_addr = (u64) (unsigned long) va;
this is indeed a bug (we change the attributes for a larger area than
needed), but your fix is unclean. Find below a cleaner solution.
Ying, if you agree with this fix could you please test and ACK it before
we push it to Linus? (this fix is also in the latest x86.git#mm)
Thanks,
Ingo
----------------->
Subject: x86: EFI set_memory_x()/set_memory_uc() fixes
From: Ingo Molnar <mingo@elte.hu>
Date: Thu Feb 14 14:21:32 CET 2008
The EFI-runtime mapping code changed a larger memory area than it
should have, due to a pages/bytes parameter mixup.
noticed by Andi Kleen.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/efi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-x86.q/arch/x86/kernel/efi.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/efi.c
+++ linux-x86.q/arch/x86/kernel/efi.c
@@ -391,7 +391,7 @@ static void __init runtime_code_page_mke
if (md->type != EFI_RUNTIME_SERVICES_CODE)
continue;
- set_memory_x(md->virt_addr, md->num_pages << EFI_PAGE_SHIFT);
+ set_memory_x(md->virt_addr, md->num_pages);
}
}
@@ -434,7 +434,7 @@ void __init efi_enter_virtual_mode(void)
}
if (!(md->attribute & EFI_MEMORY_WB))
- set_memory_uc(md->virt_addr, size);
+ set_memory_uc(md->virt_addr, md->num_pages);
systab = (u64) (unsigned long) efi_phys.systab;
if (md->phys_addr <= systab && systab < end) {
next prev parent reply other threads:[~2008-02-14 16:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-14 13:13 [PATCH] Fix left over EFI cache mapping problems Andi Kleen
2008-02-14 16:12 ` Ingo Molnar [this message]
2008-02-14 17:16 ` Andi Kleen
2008-02-14 18:38 ` Ingo Molnar
2008-02-14 21:42 ` Andi Kleen
2008-02-14 22:08 ` Arjan van de Ven
2008-02-14 23:01 ` Andi Kleen
2008-02-15 2:52 ` Huang, Ying
2008-02-15 8:55 ` Andi Kleen
2008-02-15 9:16 ` Huang, Ying
2008-02-15 4:48 ` Huang, Ying
2008-02-15 5:44 ` Linus Torvalds
2008-02-15 6:24 ` Huang, Ying
2008-02-15 7:30 ` Ingo Molnar
2008-02-15 7:08 ` Ingo Molnar
2008-02-15 7:32 ` Huang, Ying
2008-02-18 1:53 ` Huang, Ying
2008-02-18 11:26 ` Andi Kleen
2008-02-18 14:05 ` Ingo Molnar
2008-02-15 8:48 ` Andi Kleen
2008-02-15 9:21 ` Huang, Ying
2008-02-15 9:43 ` Andi Kleen
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=20080214161218.GA28152@elte.hu \
--to=mingo@elte.hu \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@osdl.org \
--cc=ying.huang@intel.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.