aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManish Ahuja <ahuja@austin.ibm.com>2008-04-11 19:31:52 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-16 17:46:14 -0400
commit37ddd5d053c57fee798d72fa9c18660f59a9299b (patch)
treebd00bfd30c7d934f26f8bb55a852ba03569e60c7
parentaf892e0f9fad390669494e389aed29b968ab7fdb (diff)
[POWERPC] pseries/phyp dump: Reserve a variable amount of space at boot
This changes the way we calculate how much space to reserve for the pHyp dump. Currently we reserve 256MB only. With this change, the code first checks to see if an amount has been specified on the boot command line with the "phyp_dump_reserve_size" option, and if so, uses that much. Otherwise it computes 5% of total ram and rounds it down to a multiple of 256MB, and uses the larger of that or 256MB. This is for large systems with a lot of memory (10GB or more). The aim is to have more space available for the kernel on reboot on machines with more resources. Although the dump will be collected pretty fast and the memory released really early on allowing the machine to have the full memory available, this alleviates any issues that can be caused by having way too little memory on very very large systems during those few minutes. Signed-off-by: Manish Ahuja <mahuja@us.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/prom.c35
-rw-r--r--arch/powerpc/platforms/pseries/phyp_dump.c9
-rw-r--r--include/asm-powerpc/phyp_dump.h4
3 files changed, 45 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 31d5b22c59a..8a9359ae471 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1043,6 +1043,33 @@ static void __init early_reserve_mem(void)
1043 1043
1044#ifdef CONFIG_PHYP_DUMP 1044#ifdef CONFIG_PHYP_DUMP
1045/** 1045/**
1046 * phyp_dump_calculate_reserve_size() - reserve variable boot area 5% or arg
1047 *
1048 * Function to find the largest size we need to reserve
1049 * during early boot process.
1050 *
1051 * It either looks for boot param and returns that OR
1052 * returns larger of 256 or 5% rounded down to multiples of 256MB.
1053 *
1054 */
1055static inline unsigned long phyp_dump_calculate_reserve_size(void)
1056{
1057 unsigned long tmp;
1058
1059 if (phyp_dump_info->reserve_bootvar)
1060 return phyp_dump_info->reserve_bootvar;
1061
1062 /* divide by 20 to get 5% of value */
1063 tmp = lmb_end_of_DRAM();
1064 do_div(tmp, 20);
1065
1066 /* round it down in multiples of 256 */
1067 tmp = tmp & ~0x0FFFFFFFUL;
1068
1069 return (tmp > PHYP_DUMP_RMR_END ? tmp : PHYP_DUMP_RMR_END);
1070}
1071
1072/**
1046 * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory 1073 * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory
1047 * 1074 *
1048 * This routine may reserve memory regions in the kernel only 1075 * This routine may reserve memory regions in the kernel only
@@ -1055,6 +1082,8 @@ static void __init early_reserve_mem(void)
1055static void __init phyp_dump_reserve_mem(void) 1082static void __init phyp_dump_reserve_mem(void)
1056{ 1083{
1057 unsigned long base, size; 1084 unsigned long base, size;
1085 unsigned long variable_reserve_size;
1086
1058 if (!phyp_dump_info->phyp_dump_configured) { 1087 if (!phyp_dump_info->phyp_dump_configured) {
1059 printk(KERN_ERR "Phyp-dump not supported on this hardware\n"); 1088 printk(KERN_ERR "Phyp-dump not supported on this hardware\n");
1060 return; 1089 return;
@@ -1065,9 +1094,11 @@ static void __init phyp_dump_reserve_mem(void)
1065 return; 1094 return;
1066 } 1095 }
1067 1096
1097 variable_reserve_size = phyp_dump_calculate_reserve_size();
1098
1068 if (phyp_dump_info->phyp_dump_is_active) { 1099 if (phyp_dump_info->phyp_dump_is_active) {
1069 /* Reserve *everything* above RMR.Area freed by userland tools*/ 1100 /* Reserve *everything* above RMR.Area freed by userland tools*/
1070 base = PHYP_DUMP_RMR_END; 1101 base = variable_reserve_size;
1071 size = lmb_end_of_DRAM() - base; 1102 size = lmb_end_of_DRAM() - base;
1072 1103
1073 /* XXX crashed_ram_end is wrong, since it may be beyond 1104 /* XXX crashed_ram_end is wrong, since it may be beyond
@@ -1079,7 +1110,7 @@ static void __init phyp_dump_reserve_mem(void)
1079 } else { 1110 } else {
1080 size = phyp_dump_info->cpu_state_size + 1111 size = phyp_dump_info->cpu_state_size +
1081 phyp_dump_info->hpte_region_size + 1112 phyp_dump_info->hpte_region_size +
1082 PHYP_DUMP_RMR_END; 1113 variable_reserve_size;
1083 base = lmb_end_of_DRAM() - size; 1114 base = lmb_end_of_DRAM() - size;
1084 lmb_reserve(base, size); 1115 lmb_reserve(base, size);
1085 phyp_dump_info->init_reserve_start = base; 1116 phyp_dump_info->init_reserve_start = base;
diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c
index 7ddd10526ce..edbc012c2eb 100644
--- a/arch/powerpc/platforms/pseries/phyp_dump.c
+++ b/arch/powerpc/platforms/pseries/phyp_dump.c
@@ -496,3 +496,12 @@ static int __init early_phyp_dump_enabled(char *p)
496} 496}
497early_param("phyp_dump", early_phyp_dump_enabled); 497early_param("phyp_dump", early_phyp_dump_enabled);
498 498
499/* Look for phyp_dump_reserve_size= cmdline option */
500static int __init early_phyp_dump_reserve_size(char *p)
501{
502 if (p)
503 phyp_dump_info->reserve_bootvar = memparse(p, &p);
504
505 return 0;
506}
507early_param("phyp_dump_reserve_size", early_phyp_dump_reserve_size);
diff --git a/include/asm-powerpc/phyp_dump.h b/include/asm-powerpc/phyp_dump.h
index 209a98913d9..fa74c6c3e10 100644
--- a/include/asm-powerpc/phyp_dump.h
+++ b/include/asm-powerpc/phyp_dump.h
@@ -24,8 +24,10 @@ struct phyp_dump {
24 /* Memory that is reserved during very early boot. */ 24 /* Memory that is reserved during very early boot. */
25 unsigned long init_reserve_start; 25 unsigned long init_reserve_start;
26 unsigned long init_reserve_size; 26 unsigned long init_reserve_size;
27 /* Check status during boot if dump supported, active & present*/ 27 /* cmd line options during boot */
28 unsigned long reserve_bootvar;
28 unsigned long phyp_dump_at_boot; 29 unsigned long phyp_dump_at_boot;
30 /* Check status during boot if dump supported, active & present*/
29 unsigned long phyp_dump_configured; 31 unsigned long phyp_dump_configured;
30 unsigned long phyp_dump_is_active; 32 unsigned long phyp_dump_is_active;
31 /* store cpu & hpte size */ 33 /* store cpu & hpte size */