* [PATCH] x86: UV SGI, Don't track GRU space in PAT
@ 2009-09-09 15:45 Jack Steiner
0 siblings, 0 replies; 4+ messages in thread
From: Jack Steiner @ 2009-09-09 15:45 UTC (permalink / raw)
To: mingo, tglx; +Cc: linux-kernel
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>
---
arch/x86/include/asm/uv/uv.h | 2 ++
arch/x86/kernel/apic/x2apic_uv_x.c | 11 ++++++++++-
arch/x86/mm/pat.c | 5 +++--
3 files changed, 15 insertions(+), 3 deletions(-)
Index: linux/arch/x86/include/asm/uv/uv.h
===================================================================
--- linux.orig/arch/x86/include/asm/uv/uv.h 2009-09-01 08:27:46.000000000 -0500
+++ linux/arch/x86/include/asm/uv/uv.h 2009-09-01 16:34:00.000000000 -0500
@@ -8,6 +8,7 @@ struct mm_struct;
#ifdef CONFIG_X86_UV
+extern int is_GRU_range(u64 start, u64 end);
extern enum uv_system_type get_uv_system_type(void);
extern int is_uv_system(void);
extern void uv_cpu_init(void);
@@ -19,6 +20,7 @@ extern const struct cpumask *uv_flush_tl
#else /* X86_UV */
+static inline int is_GRU_range(u64 start, u64 end) { return 0; }
static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
static inline int is_uv_system(void) { return 0; }
static inline void uv_cpu_init(void) { }
Index: linux/arch/x86/kernel/apic/x2apic_uv_x.c
===================================================================
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c 2009-09-01 16:33:39.000000000 -0500
+++ linux/arch/x86/kernel/apic/x2apic_uv_x.c 2009-09-01 16:34:00.000000000 -0500
@@ -34,6 +34,7 @@
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 early_get_nodeid(void)
{
@@ -68,6 +69,11 @@ enum uv_system_type get_uv_system_type(v
return uv_system_type;
}
+int is_GRU_range(u64 start, u64 end)
+{
+ return start >= gru_start_paddr && end < gru_end_paddr;
+}
+
int is_uv_system(void)
{
return uv_system_type != UV_NONE;
@@ -386,8 +392,11 @@ 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/mm/pat.c
===================================================================
--- linux.orig/arch/x86/mm/pat.c 2009-09-01 08:27:47.000000000 -0500
+++ linux/arch/x86/mm/pat.c 2009-09-01 16:34:00.000000000 -0500
@@ -27,6 +27,7 @@
#include <asm/msr.h>
#include <asm/pat.h>
#include <asm/io.h>
+#include <asm/uv/uv.h>
#ifdef CONFIG_X86_PAT
int __read_mostly pat_enabled = 1;
@@ -346,7 +347,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 (is_ISA_range(start, end - 1) || is_GRU_range(start, end - 1)) {
if (new_type)
*new_type = _PAGE_CACHE_WB;
return 0;
@@ -462,7 +463,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 (is_ISA_range(start, end - 1) || is_GRU_range(start, end - 1))
return 0;
is_range_ram = pat_pagerange_is_ram(start, end);
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH] x86: UV SGI, Don't track GRU space in PAT
@ 2009-10-29 18:47 Jack Steiner
2009-11-08 12:06 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: Jack Steiner @ 2009-10-29 18:47 UTC (permalink / raw)
To: mingo, tglx; +Cc: linux-kernel
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>
---
(resend of patch sent on 9/9. Seems to have fallen thru the cracks...)
arch/x86/include/asm/uv/uv.h | 2 ++
arch/x86/kernel/apic/x2apic_uv_x.c | 11 ++++++++++-
arch/x86/mm/pat.c | 5 +++--
3 files changed, 15 insertions(+), 3 deletions(-)
Index: linux/arch/x86/include/asm/uv/uv.h
===================================================================
--- linux.orig/arch/x86/include/asm/uv/uv.h 2009-10-05 08:12:09.000000000 -0500
+++ linux/arch/x86/include/asm/uv/uv.h 2009-10-05 08:36:59.000000000 -0500
@@ -8,6 +8,7 @@ struct mm_struct;
#ifdef CONFIG_X86_UV
+extern int is_GRU_range(u64 start, u64 end);
extern enum uv_system_type get_uv_system_type(void);
extern int is_uv_system(void);
extern void uv_cpu_init(void);
@@ -19,6 +20,7 @@ extern const struct cpumask *uv_flush_tl
#else /* X86_UV */
+static inline int is_GRU_range(u64 start, u64 end) { return 0; }
static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
static inline int is_uv_system(void) { return 0; }
static inline void uv_cpu_init(void) { }
Index: linux/arch/x86/kernel/apic/x2apic_uv_x.c
===================================================================
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c 2009-10-05 08:12:09.000000000 -0500
+++ linux/arch/x86/kernel/apic/x2apic_uv_x.c 2009-10-05 08:36:59.000000000 -0500
@@ -34,6 +34,7 @@
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 early_get_nodeid(void)
{
@@ -68,6 +69,11 @@ enum uv_system_type get_uv_system_type(v
return uv_system_type;
}
+int is_GRU_range(u64 start, u64 end)
+{
+ return start >= gru_start_paddr && end < gru_end_paddr;
+}
+
int is_uv_system(void)
{
return uv_system_type != UV_NONE;
@@ -385,8 +391,11 @@ 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/mm/pat.c
===================================================================
--- linux.orig/arch/x86/mm/pat.c 2009-10-05 08:12:09.000000000 -0500
+++ linux/arch/x86/mm/pat.c 2009-10-05 08:36:59.000000000 -0500
@@ -28,6 +28,7 @@
#include <asm/msr.h>
#include <asm/pat.h>
#include <asm/io.h>
+#include <asm/uv/uv.h>
#ifdef CONFIG_X86_PAT
int __read_mostly pat_enabled = 1;
@@ -388,7 +389,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 (is_ISA_range(start, end - 1) || is_GRU_range(start, end - 1)) {
if (new_type)
*new_type = _PAGE_CACHE_WB;
return 0;
@@ -499,7 +500,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 (is_ISA_range(start, end - 1) || is_GRU_range(start, end - 1))
return 0;
is_range_ram = pat_pagerange_is_ram(start, end);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] x86: UV SGI, Don't track GRU space in PAT
2009-10-29 18:47 Jack Steiner
@ 2009-11-08 12:06 ` Ingo Molnar
2009-11-11 18:30 ` Jack Steiner
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-11-08 12:06 UTC (permalink / raw)
To: Jack Steiner, H. Peter Anvin; +Cc: tglx, linux-kernel
* Jack Steiner <steiner@sgi.com> wrote:
>
> 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>
>
> ---
>
> (resend of patch sent on 9/9. Seems to have fallen thru the cracks...)
>
>
> arch/x86/include/asm/uv/uv.h | 2 ++
> arch/x86/kernel/apic/x2apic_uv_x.c | 11 ++++++++++-
> arch/x86/mm/pat.c | 5 +++--
> 3 files changed, 15 insertions(+), 3 deletions(-)
>
> Index: linux/arch/x86/include/asm/uv/uv.h
> ===================================================================
> --- linux.orig/arch/x86/include/asm/uv/uv.h 2009-10-05 08:12:09.000000000 -0500
> +++ linux/arch/x86/include/asm/uv/uv.h 2009-10-05 08:36:59.000000000 -0500
> @@ -8,6 +8,7 @@ struct mm_struct;
>
> #ifdef CONFIG_X86_UV
>
> +extern int is_GRU_range(u64 start, u64 end);
> extern enum uv_system_type get_uv_system_type(void);
> extern int is_uv_system(void);
> extern void uv_cpu_init(void);
> @@ -19,6 +20,7 @@ extern const struct cpumask *uv_flush_tl
>
> #else /* X86_UV */
>
> +static inline int is_GRU_range(u64 start, u64 end) { return 0; }
> static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; }
> static inline int is_uv_system(void) { return 0; }
> static inline void uv_cpu_init(void) { }
> Index: linux/arch/x86/kernel/apic/x2apic_uv_x.c
> ===================================================================
> --- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c 2009-10-05 08:12:09.000000000 -0500
> +++ linux/arch/x86/kernel/apic/x2apic_uv_x.c 2009-10-05 08:36:59.000000000 -0500
> @@ -34,6 +34,7 @@
> 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 early_get_nodeid(void)
> {
> @@ -68,6 +69,11 @@ enum uv_system_type get_uv_system_type(v
> return uv_system_type;
> }
>
> +int is_GRU_range(u64 start, u64 end)
> +{
> + return start >= gru_start_paddr && end < gru_end_paddr;
> +}
> +
> int is_uv_system(void)
> {
> return uv_system_type != UV_NONE;
> @@ -385,8 +391,11 @@ 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/mm/pat.c
> ===================================================================
> --- linux.orig/arch/x86/mm/pat.c 2009-10-05 08:12:09.000000000 -0500
> +++ linux/arch/x86/mm/pat.c 2009-10-05 08:36:59.000000000 -0500
> @@ -28,6 +28,7 @@
> #include <asm/msr.h>
> #include <asm/pat.h>
> #include <asm/io.h>
> +#include <asm/uv/uv.h>
>
> #ifdef CONFIG_X86_PAT
> int __read_mostly pat_enabled = 1;
> @@ -388,7 +389,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 (is_ISA_range(start, end - 1) || is_GRU_range(start, end - 1)) {
> if (new_type)
> *new_type = _PAGE_CACHE_WB;
> return 0;
> @@ -499,7 +500,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 (is_ISA_range(start, end - 1) || is_GRU_range(start, end - 1))
> return 0;
Hm, that's quite ugly - we used to have is_ISA_range() exceptions, now
is_GRU_range() is added too.
We should instead have an x86_platform vector for PAT exceptions, which
SGI/UV (and ISA) would fill in automatically, agreed?
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] x86: UV SGI, Don't track GRU space in PAT
2009-11-08 12:06 ` Ingo Molnar
@ 2009-11-11 18:30 ` Jack Steiner
0 siblings, 0 replies; 4+ messages in thread
From: Jack Steiner @ 2009-11-11 18:30 UTC (permalink / raw)
To: Ingo Molnar; +Cc: H. Peter Anvin, tglx, linux-kernel
...
> > /* Low ISA region is always mapped WB. No need to track */
> > - if (is_ISA_range(start, end - 1))
> > + if (is_ISA_range(start, end - 1) || is_GRU_range(start, end - 1))
> > return 0;
>
> Hm, that's quite ugly - we used to have is_ISA_range() exceptions, now
> is_GRU_range() is added too.
>
> We should instead have an x86_platform vector for PAT exceptions, which
> SGI/UV (and ISA) would fill in automatically, agreed?
Could you point me to some code to clone - I'm not sure exactly what you
have in mind.
Is this close (untested)?? If so, I'll clean it up,test it & post a real patch.
--- jack
Index: linux/arch/x86/mm/pat.c
===================================================================
--- linux.orig/arch/x86/mm/pat.c 2009-11-11 12:09:59.000000000 -0600
+++ linux/arch/x86/mm/pat.c 2009-11-11 12:25:50.000000000 -0600
@@ -353,6 +353,12 @@ static int free_ram_pages_type(u64 start
return 0;
}
+static int default_is_untracked_pat_range(u64 start, u64 end)
+{
+ return is_ISA_range(start, end);
+}
+int (*is_untracked_pat_range)(u64 start, u64 end) = default_is_untracked_pat_range;
+
/*
* req_type typically has one of the:
* - _PAGE_CACHE_WB
@@ -393,7 +399,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 (is_untracked_pat_range(start, end - 1)) {
if (new_type)
*new_type = _PAGE_CACHE_WB;
return 0;
@@ -504,7 +510,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 (default_is_untracked_pat_range(start, end - 1))
return 0;
is_range_ram = pat_pagerange_is_ram(start, end);
@@ -587,7 +593,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 (is_untracked_pat_range(paddr, paddr + PAGE_SIZE - 1))
return rettype;
if (pat_pagerange_is_ram(paddr, paddr + PAGE_SIZE)) {
Index: linux/arch/x86/include/asm/pat.h
===================================================================
--- linux.orig/arch/x86/include/asm/pat.h 2009-10-26 19:39:06.000000000 -0500
+++ linux/arch/x86/include/asm/pat.h 2009-11-11 12:19:26.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);
+extern int (*is_untracked_pat_range)(u64 start, u64 end);
+
#endif /* _ASM_X86_PAT_H */
Index: linux/arch/x86/kernel/apic/x2apic_uv_x.c
===================================================================
--- linux.orig/arch/x86/kernel/apic/x2apic_uv_x.c 2009-11-11 12:09:59.000000000 -0600
+++ linux/arch/x86/kernel/apic/x2apic_uv_x.c 2009-11-11 12:24:26.000000000 -0600
@@ -30,10 +30,22 @@
#include <asm/apic.h>
#include <asm/ipi.h>
#include <asm/smp.h>
+#include <asm/pat.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")) {
+ 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"))
@@ -388,8 +401,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)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-11-11 18:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-09 15:45 [PATCH] x86: UV SGI, Don't track GRU space in PAT Jack Steiner
-- strict thread matches above, loose matches on Subject: below --
2009-10-29 18:47 Jack Steiner
2009-11-08 12:06 ` Ingo Molnar
2009-11-11 18:30 ` Jack Steiner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox