Commit c5e83e3f authored by Jack Steiner's avatar Jack Steiner Committed by Tony Luck

[IA64] Fix get_model_name() for mixed cpu type systems

If a system consists of mixed processor types, kmalloc()
can be called before the per-cpu data page is initialized.
If the slab contains sufficient memory, then kmalloc() works
ok. However, if the slabs are empty, slab calls the memory
allocator. This requires per-cpu data (NODE_DATA()) & the
cpu dies.

Also noted by Russ Anderson who had a very similar patch.
Signed-off-by: default avatarJack Steiner <steiner@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent a3f5c338
...@@ -692,12 +692,15 @@ struct seq_operations cpuinfo_op = { ...@@ -692,12 +692,15 @@ struct seq_operations cpuinfo_op = {
.show = show_cpuinfo .show = show_cpuinfo
}; };
static char brandname[128]; #define MAX_BRANDS 8
static char brandname[MAX_BRANDS][128];
static char * __cpuinit static char * __cpuinit
get_model_name(__u8 family, __u8 model) get_model_name(__u8 family, __u8 model)
{ {
static int overflow;
char brand[128]; char brand[128];
int i;
memcpy(brand, "Unknown", 8); memcpy(brand, "Unknown", 8);
if (ia64_pal_get_brand_info(brand)) { if (ia64_pal_get_brand_info(brand)) {
...@@ -709,12 +712,17 @@ get_model_name(__u8 family, __u8 model) ...@@ -709,12 +712,17 @@ get_model_name(__u8 family, __u8 model)
case 2: memcpy(brand, "Madison up to 9M cache", 23); break; case 2: memcpy(brand, "Madison up to 9M cache", 23); break;
} }
} }
if (brandname[0] == '\0') for (i = 0; i < MAX_BRANDS; i++)
return strcpy(brandname, brand); if (strcmp(brandname[i], brand) == 0)
else if (strcmp(brandname, brand) == 0) return brandname[i];
return brandname; for (i = 0; i < MAX_BRANDS; i++)
else if (brandname[i][0] == '\0')
return kstrdup(brand, GFP_KERNEL); return strcpy(brandname[i], brand);
if (overflow++ == 0)
printk(KERN_ERR
"%s: Table overflow. Some processor model information will be missing\n",
__FUNCTION__);
return "Unknown";
} }
static void __cpuinit static void __cpuinit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment