From: Jack Steiner <steiner@sgi.com>
To: "H. Peter Anvin" <hpa@zytor.com>, mingo@elte.hu, tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v3] x86: UV SGI, Don't track GRU space in PAT
Date: Thu, 19 Nov 2009 14:23:41 -0600 [thread overview]
Message-ID: <20091119202341.GA4420@sgi.com> (raw)
In-Reply-To: <4B0321F9.5060308@zytor.com>
GRU space is always mapped as WB in the page table. There is
no need to track the mappings in the PAT. This also eliminates
the "freeing invalid memtype" messages when the GRU space is unmapped.
Signed-off-by: Jack Steiner <steiner@sgi.com>
---
Version 2 with changes suggested by Ingo (at least I think I understood what
he wanted).
Version 3 with changes suggested by Peter to make the new function
a member of the x86_platform structure.
arch/x86/include/asm/pat.h | 2 ++
arch/x86/include/asm/x86_init.h | 1 +
arch/x86/kernel/apic/x2apic_uv_x.c | 19 ++++++++++++++++++-
arch/x86/kernel/x86_init.c | 2 ++
arch/x86/mm/pat.c | 11 ++++++++---
5 files changed, 31 insertions(+), 4 deletions(-)
Index: linux/arch/x86/include/asm/pat.h
===================================================================
--- linux.orig/arch/x86/include/asm/pat.h 2009-11-19 01:39:52.000000000 -0600
+++ linux/arch/x86/include/asm/pat.h 2009-11-19 11:13:35.000000000 -0600
@@ -24,4 +24,6 @@ int io_reserve_memtype(resource_size_t s
void io_free_memtype(resource_size_t start, resource_size_t end);
+int default_is_untracked_pat_range(u64 start, u64 end);
+
#endif /* _ASM_X86_PAT_H */
Index: linux/arch/x86/include/asm/x86_init.h
===================================================================
--- linux.orig/arch/x86/include/asm/x86_init.h 2009-11-19 01:39:52.000000000 -0600
+++ linux/arch/x86/include/asm/x86_init.h 2009-11-19 11:19:38.000000000 -0600
@@ -131,6 +131,7 @@ struct x86_platform_ops {
unsigned long (*get_wallclock)(void);
int (*set_wallclock)(unsigned long nowtime);
void (*iommu_shutdown)(void);
+ int (*is_untracked_pat_range)(u64 start, u64 end);
};
extern struct x86_init_ops x86_init;
Index: linux/arch/x86/kernel/apic/x2apic_uv_x.c
===================================================================
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c 2009-11-19 11:09:47.000000000 -0600
+++ linux/arch/x86/kernel/apic/x2apic_uv_x.c 2009-11-19 11:21:09.000000000 -0600
@@ -30,10 +30,22 @@
#include <asm/apic.h>
#include <asm/ipi.h>
#include <asm/smp.h>
+#include <asm/x86_init.h>
DEFINE_PER_CPU(int, x2apic_extra_bits);
static enum uv_system_type uv_system_type;
+static u64 gru_start_paddr, gru_end_paddr;
+
+static int is_GRU_range(u64 start, u64 end)
+{
+ return start >= gru_start_paddr && end < gru_end_paddr;
+}
+
+static int uv_is_untracked_pat_range(u64 start, u64 end)
+{
+ return is_ISA_range(start, end) || is_GRU_range(start, end);
+}
static int early_get_nodeid(void)
{
@@ -49,6 +61,7 @@ static int early_get_nodeid(void)
static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
{
if (!strcmp(oem_id, "SGI")) {
+ x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range;
if (!strcmp(oem_table_id, "UVL"))
uv_system_type = UV_LEGACY_APIC;
else if (!strcmp(oem_table_id, "UVX"))
@@ -386,8 +399,12 @@ static __init void map_gru_high(int max_
int shift = UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_SHFT;
gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR);
- if (gru.s.enable)
+ if (gru.s.enable) {
map_high("GRU", gru.s.base, shift, max_pnode, map_wb);
+ gru_start_paddr = ((u64)gru.s.base << shift);
+ gru_end_paddr = gru_start_paddr + (1UL << shift) * (max_pnode + 1);
+
+ }
}
static __init void map_mmr_high(int max_pnode)
Index: linux/arch/x86/kernel/x86_init.c
===================================================================
--- linux.orig/arch/x86/kernel/x86_init.c 2009-11-19 01:39:52.000000000 -0600
+++ linux/arch/x86/kernel/x86_init.c 2009-11-19 11:12:45.000000000 -0600
@@ -15,6 +15,7 @@
#include <asm/irq.h>
#include <asm/tsc.h>
#include <asm/iommu.h>
+#include <asm/pat.h>
void __cpuinit x86_init_noop(void) { }
void __init x86_init_uint_noop(unsigned int unused) { }
@@ -80,4 +81,5 @@ struct x86_platform_ops x86_platform = {
.get_wallclock = mach_get_cmos_time,
.set_wallclock = mach_set_rtc_mmss,
.iommu_shutdown = iommu_shutdown_noop,
+ .is_untracked_pat_range = default_is_untracked_pat_range,
};
Index: linux/arch/x86/mm/pat.c
===================================================================
--- linux.orig/arch/x86/mm/pat.c 2009-11-19 11:09:47.000000000 -0600
+++ linux/arch/x86/mm/pat.c 2009-11-19 11:20:26.000000000 -0600
@@ -348,6 +348,11 @@ static int free_ram_pages_type(u64 start
return 0;
}
+int default_is_untracked_pat_range(u64 start, u64 end)
+{
+ return is_ISA_range(start, end);
+}
+
/*
* req_type typically has one of the:
* - _PAGE_CACHE_WB
@@ -383,7 +388,7 @@ int reserve_memtype(u64 start, u64 end,
}
/* Low ISA region is always mapped WB in page table. No need to track */
- if (is_ISA_range(start, end - 1)) {
+ if (x86_platform.is_untracked_pat_range(start, end - 1)) {
if (new_type)
*new_type = _PAGE_CACHE_WB;
return 0;
@@ -494,7 +499,7 @@ int free_memtype(u64 start, u64 end)
return 0;
/* Low ISA region is always mapped WB. No need to track */
- if (is_ISA_range(start, end - 1))
+ if (x86_platform.is_untracked_pat_range(start, end - 1))
return 0;
is_range_ram = pat_pagerange_is_ram(start, end);
@@ -577,7 +582,7 @@ static unsigned long lookup_memtype(u64
int rettype = _PAGE_CACHE_WB;
struct memtype *entry;
- if (is_ISA_range(paddr, paddr + PAGE_SIZE - 1))
+ if (x86_platform.is_untracked_pat_range(paddr, paddr + PAGE_SIZE - 1))
return rettype;
if (pat_pagerange_is_ram(paddr, paddr + PAGE_SIZE)) {
next prev parent reply other threads:[~2009-11-19 20:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-29 18:47 [PATCH] x86: UV SGI, Don't track GRU space in PAT Jack Steiner
2009-11-08 12:06 ` Ingo Molnar
2009-11-11 18:30 ` Jack Steiner
2009-11-17 21:23 ` [PATCH v2] " Jack Steiner
2009-11-17 22:21 ` H. Peter Anvin
2009-11-19 20:23 ` Jack Steiner [this message]
2009-11-23 18:25 ` [PATCH v3] " Ingo Molnar
2009-11-23 18:55 ` [tip:x86/mm] x86: UV SGI: " tip-bot for Jack Steiner
2009-11-24 1:12 ` [tip:x86/mm] x86, mm: Call is_untracked_pat_range() rather than is_ISA_range() tip-bot for H. Peter Anvin
2009-11-24 1:13 ` [tip:x86/mm] x86, mm: is_untracked_pat_range() takes a normal semiclosed range tip-bot for H. Peter Anvin
2009-11-24 1:13 ` [tip:x86/mm] x86: Change is_ISA_range() into an inline function tip-bot for H. Peter Anvin
2009-11-24 1:13 ` [tip:x86/mm] x86, platform: Change is_untracked_pat_range() to bool; cleanup init tip-bot for H. Peter Anvin
2009-12-01 7:36 ` [tip:x86/mm] x86, mm: Correct the implementation of is_untracked_pat_range() tip-bot for H. Peter Anvin
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=20091119202341.GA4420@sgi.com \
--to=steiner@sgi.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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