From: tip-bot for Mike Travis <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, peterz@infradead.org, tglx@linutronix.de,
gfk@sgi.com, brgerst@gmail.com, linux-kernel@vger.kernel.org,
sivanich@sgi.com, rja@sgi.com, nzimmer@sgi.com,
luto@amacapital.net, akpm@linux-foundation.org, travis@sgi.com,
abanman@sgi.com, dvlasenk@redhat.com, bp@alien8.de,
len.brown@intel.com, estabrook@sgi.com, mingo@kernel.org,
torvalds@linux-foundation.org
Subject: [tip:x86/platform] x86/platform/UV: Allocate common per node hub info structs on local node
Date: Wed, 4 May 2016 00:19:36 -0700 [thread overview]
Message-ID: <tip-3edcf2ff7ae50d1096030fab9a1bafb421e07d4c@git.kernel.org> (raw)
In-Reply-To: <20160429215404.813051625@asylum.americas.sgi.com>
Commit-ID: 3edcf2ff7ae50d1096030fab9a1bafb421e07d4c
Gitweb: http://git.kernel.org/tip/3edcf2ff7ae50d1096030fab9a1bafb421e07d4c
Author: Mike Travis <travis@sgi.com>
AuthorDate: Fri, 29 Apr 2016 16:54:15 -0500
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 4 May 2016 08:48:49 +0200
x86/platform/UV: Allocate common per node hub info structs on local node
Allocate and setup per node hub info structs. CPU 0/Node 0 hub info
is statically allocated to be accessible early in system startup. The
remaining hub info structs are allocated on the node's local memory,
and shared among the CPU's on that node. This leaves the small amount
of info unique to each CPU in the per CPU info struct.
Memory is saved by combining the common per node info fields to common
node local structs. In addtion, since the info is read only only after
setup, it should stay in the L3 cache of the local processor socket.
This should therefore improve the cache hit rate when a group of cpus
on a node are all interrupted for a common task.
Tested-by: John Estabrook <estabrook@sgi.com>
Tested-by: Gary Kroening <gfk@sgi.com>
Tested-by: Nathan Zimmer <nzimmer@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Dimitri Sivanich <sivanich@sgi.com>
Reviewed-by: Andrew Banman <abanman@sgi.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Russ Anderson <rja@sgi.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160429215404.813051625@asylum.americas.sgi.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/uv/uv_hub.h | 36 ++++++++++++++++++++---
arch/x86/kernel/apic/x2apic_uv_x.c | 59 ++++++++++++++++++++++++++++----------
2 files changed, 76 insertions(+), 19 deletions(-)
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index 4a6f02a..35987d9 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -163,10 +163,6 @@ struct uv_hub_info_s {
unsigned char n_val;
};
-DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
-#define uv_hub_info this_cpu_ptr(&__uv_hub_info)
-#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu))
-
/* CPU specific info with a pointer to the hub common info struct */
struct uv_cpu_info_s {
void *p_uv_hub_info;
@@ -181,6 +177,38 @@ DECLARE_PER_CPU(struct uv_cpu_info_s, __uv_cpu_info);
#define uv_scir_info (&uv_cpu_info->scir)
#define uv_cpu_scir_info(cpu) (&uv_cpu_info_per(cpu)->scir)
+/* Node specific hub common info struct */
+extern void **__uv_hub_info_list;
+static inline struct uv_hub_info_s *uv_hub_info_list(int node)
+{
+ return (struct uv_hub_info_s *)__uv_hub_info_list[node];
+}
+
+static inline struct uv_hub_info_s *_uv_hub_info(void)
+{
+ return (struct uv_hub_info_s *)uv_cpu_info->p_uv_hub_info;
+}
+#define uv_hub_info _uv_hub_info()
+
+static inline struct uv_hub_info_s *uv_cpu_hub_info(int cpu)
+{
+ return (struct uv_hub_info_s *)uv_cpu_info_per(cpu)->p_uv_hub_info;
+}
+
+#define UV_HUB_INFO_VERSION 0x7150
+extern int uv_hub_info_version(void);
+static inline int uv_hub_info_check(int version)
+{
+ if (uv_hub_info_version() == version)
+ return 0;
+
+ pr_crit("UV: uv_hub_info version(%x) mismatch, expecting(%x)\n",
+ uv_hub_info_version(), version);
+
+ BUG(); /* Catastrophic - cannot continue on unknown UV system */
+}
+#define _uv_hub_info_check() uv_hub_info_check(UV_HUB_INFO_VERSION)
+
/*
* HUB revision ranges for each UV HUB architecture.
* This is a software convention - NOT the hardware revision numbers in
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 69aa2a9..35c9610 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -54,6 +54,7 @@ unsigned int uv_apicid_hibits;
EXPORT_SYMBOL_GPL(uv_apicid_hibits);
static struct apic apic_x2apic_uv_x;
+static struct uv_hub_info_s uv_hub_info_node0;
/* Set this to use hardware error handler instead of kernel panic */
static int disable_uv_undefined_panic = 1;
@@ -165,6 +166,9 @@ static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
if (strncmp(oem_id, "SGI", 3) != 0)
return 0;
+ /* Setup early hub type field in uv_hub_info for Node 0 */
+ uv_cpu_info->p_uv_hub_info = &uv_hub_info_node0;
+
/*
* Determine UV arch type.
* SGI: UV100/1000
@@ -228,8 +232,8 @@ int is_uv_system(void)
}
EXPORT_SYMBOL_GPL(is_uv_system);
-DEFINE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
-EXPORT_PER_CPU_SYMBOL_GPL(__uv_hub_info);
+void **__uv_hub_info_list;
+EXPORT_SYMBOL_GPL(__uv_hub_info_list);
DEFINE_PER_CPU(struct uv_cpu_info_s, __uv_cpu_info);
EXPORT_PER_CPU_SYMBOL_GPL(__uv_cpu_info);
@@ -249,6 +253,12 @@ EXPORT_SYMBOL_GPL(uv_possible_blades);
unsigned long sn_rtc_cycles_per_second;
EXPORT_SYMBOL(sn_rtc_cycles_per_second);
+extern int uv_hub_info_version(void)
+{
+ return UV_HUB_INFO_VERSION;
+}
+EXPORT_SYMBOL(uv_hub_info_version);
+
static int uv_wakeup_secondary(int phys_apicid, unsigned long start_rip)
{
unsigned long val;
@@ -988,9 +998,15 @@ void __init uv_system_init(void)
uv_init_hub_info(&hub_info);
- for(i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++)
- uv_possible_blades +=
- hweight64(uv_read_local_mmr( UVH_NODE_PRESENT_TABLE + i * 8));
+ pr_info("UV: NODE_PRESENT_DEPTH = %d\n", UVH_NODE_PRESENT_TABLE_DEPTH);
+ for (i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++) {
+ unsigned long np;
+
+ np = uv_read_local_mmr(UVH_NODE_PRESENT_TABLE + i * 8);
+ if (np)
+ pr_info("UV: NODE_PRESENT(%d) = 0x%016lx\n", i, np);
+ uv_possible_blades += hweight64(np);
+ }
/* uv_num_possible_blades() is really the hub count */
pr_info("UV: Found %d hubs, %d nodes, %d cpus\n",
@@ -1016,6 +1032,10 @@ void __init uv_system_init(void)
BUG_ON(!uv_cpu_to_blade);
memset(uv_cpu_to_blade, 255, bytes);
+ bytes = sizeof(void *) * uv_num_possible_blades();
+ __uv_hub_info_list = kzalloc(bytes, GFP_KERNEL);
+ BUG_ON(!__uv_hub_info_list);
+
blade = 0;
for (i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++) {
unsigned long present =
@@ -1040,28 +1060,37 @@ void __init uv_system_init(void)
uv_rtc_init();
for_each_present_cpu(cpu) {
+ struct uv_hub_info_s *new_hub = NULL;
int apicid = per_cpu(x86_cpu_to_apicid, cpu);
int nodeid = cpu_to_node(cpu);
- int lcpu;
- *uv_cpu_hub_info(cpu) = hub_info; /* common hub values */
- pnode = uv_apicid_to_pnode(apicid);
- blade = boot_pnode_to_blade(pnode);
- lcpu = uv_blade_info[blade].nr_possible_cpus;
- uv_blade_info[blade].nr_possible_cpus++;
+ /* Allocate new per hub info list */
+ if (uv_hub_info_list(nodeid) == NULL) {
+ if (cpu == 0)
+ __uv_hub_info_list[0] = &uv_hub_info_node0;
+ else
+ __uv_hub_info_list[nodeid] =
+ kzalloc_node(bytes, GFP_KERNEL, nodeid);
+
+ new_hub = uv_hub_info_list(nodeid);
+ BUG_ON(!new_hub);
+ *new_hub = hub_info;
+ blade = boot_pnode_to_blade(new_hub->pnode);
+ new_hub->pnode = uv_apicid_to_pnode(apicid);
+ new_hub->numa_blade_id = blade;
+ }
/* Any node on the blade, else will contain -1. */
uv_blade_info[blade].memory_nid = nodeid;
- uv_cpu_hub_info(cpu)->numa_blade_id = blade;
- uv_cpu_hub_info(cpu)->pnode = pnode;
uv_node_to_blade[nodeid] = blade;
uv_cpu_to_blade[cpu] = blade;
/* Initialize per cpu info list */
- uv_cpu_info_per(cpu)->p_uv_hub_info = uv_cpu_hub_info(cpu);
- uv_cpu_info_per(cpu)->blade_cpu_id = lcpu;
+ uv_cpu_info_per(cpu)->p_uv_hub_info = uv_hub_info_list(nodeid);
uv_cpu_info_per(cpu)->scir.offset = uv_scir_offset(apicid);
+ uv_cpu_info_per(cpu)->blade_cpu_id =
+ uv_blade_info[blade].nr_possible_cpus++;
}
/* Add blade/pnode info for nodes without cpus */
next prev parent reply other threads:[~2016-05-04 7:20 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 21:54 [PATCH 00/21] X86_64, UV: Update kernel for SGI UV4 support Mike Travis
2016-04-29 21:54 ` [PATCH 01/21] X86_64, UV: Add Initial UV4 definitions Mike Travis
2016-05-04 7:15 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 02/21] X86_64, UV: Add UV Architecture Defines Mike Travis
2016-05-04 7:15 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 03/21] X86_64, UV: Add UV4 Specific Defines Mike Travis
2016-05-04 7:16 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 04/21] X86_64, UV: Add UV MMR Illegal Access Function Mike Travis
2016-05-04 7:16 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 05/21] X86_64, UV: Prep for UV4 MMR updates Mike Travis
2016-05-04 7:16 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 06/21] X86_64, UV: Add UV4 Specific MMR definitions Mike Travis
2016-05-04 7:17 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 07/21] X86_64, UV: Disable Obsolete APIC ID fixup code used only on UV1 Mike Travis
2016-05-03 7:35 ` Ingo Molnar
2016-05-03 14:43 ` Mike Travis
2016-04-29 21:54 ` [PATCH 08/21] X86_64, UV: Clean up redunduncies after merge of UV4 MMR definitions Mike Travis
2016-05-04 7:17 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 09/21] X86_64, UV: Update MMIOH setup function to work for both UV3 and UV4 Mike Travis
2016-05-04 7:18 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 10/21] X86_64, UV: Create per cpu info structs to replace per hub info structs Mike Travis
2016-05-04 7:18 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 11/21] X86_64, UV: Move scir info to the per cpu info struct Mike Travis
2016-05-04 7:18 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 12/21] X86_64, UV: Move blade local processor ID " Mike Travis
2016-05-04 7:19 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 13/21] X86_64, UV: Allocate common per node hub info structs on local node Mike Travis
2016-05-04 7:19 ` tip-bot for Mike Travis [this message]
2016-04-29 21:54 ` [PATCH 14/21] X86_64, UV: Fold blade info into per node hub info structs Mike Travis
2016-05-04 7:19 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 15/21] X86_64, UV: Add UV4 addressing discovery function Mike Travis
2016-05-04 7:20 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 16/21] X86_64, UV: Add obtaining GAM Range Table from UV BIOS Mike Travis
2016-05-04 7:20 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 17/21] X86_64, UV: Support UV4 socket address changes Mike Travis
2016-05-04 7:21 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 18/21] X86_64, UV: Build GAM reference tables Mike Travis
2016-05-04 7:21 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 19/21] X86_64, UV: Update physical address conversions for UV4 Mike Travis
2016-05-04 7:21 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Mike Travis
2016-04-29 21:54 ` [PATCH 20/21] X86_64, UV: Remove Obsolete GRU MMR address translation Mike Travis
2016-05-04 7:22 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Dimitri Sivanich
2016-04-29 21:54 ` [PATCH 21/21] X86_64, UV: Fix incorrect nodes and pnodes for cpuless and memoryless nodes Mike Travis
2016-05-04 7:22 ` [tip:x86/platform] x86/platform/UV: " tip-bot for Dimitri Sivanich
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=tip-3edcf2ff7ae50d1096030fab9a1bafb421e07d4c@git.kernel.org \
--to=tipbot@zytor.com \
--cc=abanman@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=estabrook@sgi.com \
--cc=gfk@sgi.com \
--cc=hpa@zytor.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=nzimmer@sgi.com \
--cc=peterz@infradead.org \
--cc=rja@sgi.com \
--cc=sivanich@sgi.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=travis@sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox