Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1455988 > unrolled thread
| Started by | Hari Bathini <hbathini@linux.vnet.ibm.com> |
|---|---|
| First post | 2016-08-03 21:40 +0200 |
| Last post | 2016-08-08 11:30 +0200 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range Hari Bathini <hbathini@linux.vnet.ibm.com> - 2016-08-03 21:40 +0200
Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range Michael Ellerman <mpe@ellerman.id.au> - 2016-08-04 11:50 +0200
Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range Hari Bathini <hbathini@linux.vnet.ibm.com> - 2016-08-04 21:00 +0200
Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range Hari Bathini <hbathini@linux.vnet.ibm.com> - 2016-08-08 10:20 +0200
Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range Michael Ellerman <mpe@ellerman.id.au> - 2016-08-08 11:00 +0200
Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range Hari Bathini <hbathini@linux.vnet.ibm.com> - 2016-08-08 11:30 +0200
| From | Hari Bathini <hbathini@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-08-03 21:40 +0200 |
| Subject | [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range |
| Message-ID | <s2abg-6TC-7@gated-at.bofh.it> |
Currently, memory for fadump can be specified with fadump_reserve_mem=size,
where only a fixed size can be specified. Add the below syntax as well, to
support conditional reservation based on system memory size:
fadump_reserve_mem=<range1>:<size1>[,<range2>:<size2>,...]
This syntax helps using the same commandline parameter for different system
memory sizes.
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
Reviewed-by: Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>
---
arch/powerpc/kernel/fadump.c | 64 ++++++++++++++++++++++++++++++++++++------
1 file changed, 55 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index b3a6633..4661ae6 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -193,6 +193,56 @@ static unsigned long init_fadump_mem_struct(struct fadump_mem_struct *fdm,
return addr;
}
+/*
+ * This function parses command line for fadump_reserve_mem=
+ *
+ * Supports the below two syntaxes:
+ * 1. fadump_reserve_mem=size
+ * 2. fadump_reserve_mem=ramsize-range:size[,...]
+ *
+ * Sets fw_dump.reserve_bootvar with the memory size
+ * provided, 0 otherwise
+ *
+ * The function returns -EINVAL on failure, 0 otherwise.
+ */
+static int __init parse_fadump_reserve_mem(void)
+{
+ char *name = "fadump_reserve_mem=";
+ char *fadump_cmdline = NULL, *cur;
+
+ fw_dump.reserve_bootvar = 0;
+
+ /* find fadump_reserve_mem and use the last one if there are many */
+ cur = strstr(boot_command_line, name);
+ while (cur) {
+ fadump_cmdline = cur;
+ cur = strstr(cur+1, name);
+ }
+
+ /* when no fadump_reserve_mem= cmdline option is provided */
+ if (!fadump_cmdline)
+ return 0;
+
+ fadump_cmdline += strlen(name);
+
+ /* for fadump_reserve_mem=size cmdline syntax */
+ if (!is_param_range_based(fadump_cmdline)) {
+ fw_dump.reserve_bootvar = memparse(fadump_cmdline, NULL);
+ return 0;
+ }
+
+ /* for fadump_reserve_mem=ramsize-range:size[,...] cmdline syntax */
+ cur = fadump_cmdline;
+ fw_dump.reserve_bootvar = parse_mem_range_size("fadump_reserve_mem",
+ &cur, memblock_phys_mem_size());
+ if (cur == fadump_cmdline) {
+ printk(KERN_INFO "fadump_reserve_mem: Invaild syntax!\n");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
/**
* fadump_calculate_reserve_size(): reserve variable boot area 5% of System RAM
*
@@ -212,12 +262,17 @@ static inline unsigned long fadump_calculate_reserve_size(void)
{
unsigned long size;
+ /* sets fw_dump.reserve_bootvar */
+ parse_fadump_reserve_mem();
+
/*
* Check if the size is specified through fadump_reserve_mem= cmdline
* option. If yes, then use that.
*/
if (fw_dump.reserve_bootvar)
return fw_dump.reserve_bootvar;
+ else
+ printk(KERN_INFO "fadump: calculating default boot size\n");
/* divide by 20 to get 5% of value */
size = memblock_end_of_DRAM() / 20;
@@ -348,15 +403,6 @@ static int __init early_fadump_param(char *p)
}
early_param("fadump", early_fadump_param);
-/* Look for fadump_reserve_mem= cmdline option */
-static int __init early_fadump_reserve_mem(char *p)
-{
- if (p)
- fw_dump.reserve_bootvar = memparse(p, &p);
- return 0;
-}
-early_param("fadump_reserve_mem", early_fadump_reserve_mem);
-
static void register_fw_dump(struct fadump_mem_struct *fdm)
{
int rc;
[toc] | [next] | [standalone]
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Date | 2016-08-04 11:50 +0200 |
| Subject | Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range |
| Message-ID | <s2nrQ-76H-17@gated-at.bofh.it> |
| In reply to | #1455988 |
Hari Bathini <hbathini@linux.vnet.ibm.com> writes:
...
> /**
> * fadump_calculate_reserve_size(): reserve variable boot area 5% of System RAM
> *
> @@ -212,12 +262,17 @@ static inline unsigned long fadump_calculate_reserve_size(void)
> {
> unsigned long size;
>
> + /* sets fw_dump.reserve_bootvar */
> + parse_fadump_reserve_mem();
> +
> /*
> * Check if the size is specified through fadump_reserve_mem= cmdline
> * option. If yes, then use that.
> */
> if (fw_dump.reserve_bootvar)
> return fw_dump.reserve_bootvar;
> + else
> + printk(KERN_INFO "fadump: calculating default boot size\n");
>
> /* divide by 20 to get 5% of value */
> size = memblock_end_of_DRAM() / 20;
The code already knows how to reserve 5% based on the size of the machine's
memory, as long as no commandline parameter is passed. So why can't we
just use that logic?
cheers
[toc] | [prev] | [next] | [standalone]
| From | Hari Bathini <hbathini@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-08-04 21:00 +0200 |
| Subject | Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range |
| Message-ID | <s2w25-4Tj-11@gated-at.bofh.it> |
| In reply to | #1456280 |
On Thursday 04 August 2016 03:15 PM, Michael Ellerman wrote:
> Hari Bathini <hbathini@linux.vnet.ibm.com> writes:
> ...
>> /**
>> * fadump_calculate_reserve_size(): reserve variable boot area 5% of System RAM
>> *
>> @@ -212,12 +262,17 @@ static inline unsigned long fadump_calculate_reserve_size(void)
>> {
>> unsigned long size;
>>
>> + /* sets fw_dump.reserve_bootvar */
>> + parse_fadump_reserve_mem();
>> +
>> /*
>> * Check if the size is specified through fadump_reserve_mem= cmdline
>> * option. If yes, then use that.
>> */
>> if (fw_dump.reserve_bootvar)
>> return fw_dump.reserve_bootvar;
>> + else
>> + printk(KERN_INFO "fadump: calculating default boot size\n");
>>
>> /* divide by 20 to get 5% of value */
>> size = memblock_end_of_DRAM() / 20;
> The code already knows how to reserve 5% based on the size of the machine's
> memory, as long as no commandline parameter is passed. So why can't we
> just use that logic?
Hi Michael,
That is the default value reserved but not a good enough value for
every case. It is a bit difficult to come up with a robust formula
that works for every case as new kernel changes could make the
values obsolete. But it won't be all that difficult to find values that
work for different memory ranges for a given kernel version.
Passing that as range based input with "fadump_reserve_mem"
parameter would work for every memory configuration on a
given system, which is what this patch is trying to provide..
Thanks
Hari
> cheers
>
[toc] | [prev] | [next] | [standalone]
| From | Hari Bathini <hbathini@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-08-08 10:20 +0200 |
| Subject | Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range |
| Message-ID | <s3NWW-7is-11@gated-at.bofh.it> |
| In reply to | #1456633 |
On Friday 05 August 2016 12:23 AM, Hari Bathini wrote:
>
> On Thursday 04 August 2016 03:15 PM, Michael Ellerman wrote:
>> Hari Bathini <hbathini@linux.vnet.ibm.com> writes:
>> ...
>>> /**
>>> * fadump_calculate_reserve_size(): reserve variable boot area 5%
>>> of System RAM
>>> *
>>> @@ -212,12 +262,17 @@ static inline unsigned long
>>> fadump_calculate_reserve_size(void)
>>> {
>>> unsigned long size;
>>> + /* sets fw_dump.reserve_bootvar */
>>> + parse_fadump_reserve_mem();
>>> +
>>> /*
>>> * Check if the size is specified through fadump_reserve_mem=
>>> cmdline
>>> * option. If yes, then use that.
>>> */
>>> if (fw_dump.reserve_bootvar)
>>> return fw_dump.reserve_bootvar;
>>> + else
>>> + printk(KERN_INFO "fadump: calculating default boot size\n");
>>> /* divide by 20 to get 5% of value */
>>> size = memblock_end_of_DRAM() / 20;
>> The code already knows how to reserve 5% based on the size of the
>> machine's
>> memory, as long as no commandline parameter is passed. So why can't we
>> just use that logic?
>
> Hi Michael,
>
> That is the default value reserved but not a good enough value for
> every case. It is a bit difficult to come up with a robust formula
> that works for every case as new kernel changes could make the
> values obsolete. But it won't be all that difficult to find values that
> work for different memory ranges for a given kernel version.
> Passing that as range based input with "fadump_reserve_mem"
> parameter would work for every memory configuration on a
> given system, which is what this patch is trying to provide..
>
Hi Michael,
You want me to add this to the changelog on respin?
Thanks
Hari
> Thanks
> Hari
>
>
>> cheers
>>
>
[toc] | [prev] | [next] | [standalone]
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Date | 2016-08-08 11:00 +0200 |
| Subject | Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range |
| Message-ID | <s3OzE-7xb-23@gated-at.bofh.it> |
| In reply to | #1457601 |
Hari Bathini <hbathini@linux.vnet.ibm.com> writes: > On Friday 05 August 2016 12:23 AM, Hari Bathini wrote: >> On Thursday 04 August 2016 03:15 PM, Michael Ellerman wrote: >>> The code already knows how to reserve 5% based on the size of the >>> machine's >>> memory, as long as no commandline parameter is passed. So why can't we >>> just use that logic? >> >> That is the default value reserved but not a good enough value for >> every case. It is a bit difficult to come up with a robust formula >> that works for every case as new kernel changes could make the >> values obsolete. But it won't be all that difficult to find values that >> work for different memory ranges for a given kernel version. >> Passing that as range based input with "fadump_reserve_mem" >> parameter would work for every memory configuration on a >> given system, which is what this patch is trying to provide.. > > You want me to add this to the changelog on respin? I'm not really convinced. Distros are going to want to specify a fixed set of values for different memory sizes, at least that's what I've seen in the past with kdump. So I don't see why we can't just do that in the kernel with a formula based on memory size, and maybe some other information. Maybe the formula is more complicated than 5% of RAM, but it shouldn't be *that* much more complicated. cheers
[toc] | [prev] | [next] | [standalone]
| From | Hari Bathini <hbathini@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-08-08 11:30 +0200 |
| Subject | Re: [RESEND][PATCH v2 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range |
| Message-ID | <s3P2F-7YV-15@gated-at.bofh.it> |
| In reply to | #1457627 |
On Monday 08 August 2016 02:26 PM, Michael Ellerman wrote: > Hari Bathini <hbathini@linux.vnet.ibm.com> writes: >> On Friday 05 August 2016 12:23 AM, Hari Bathini wrote: >>> On Thursday 04 August 2016 03:15 PM, Michael Ellerman wrote: >>>> The code already knows how to reserve 5% based on the size of the >>>> machine's >>>> memory, as long as no commandline parameter is passed. So why can't we >>>> just use that logic? >>> That is the default value reserved but not a good enough value for >>> every case. It is a bit difficult to come up with a robust formula >>> that works for every case as new kernel changes could make the >>> values obsolete. But it won't be all that difficult to find values that >>> work for different memory ranges for a given kernel version. >>> Passing that as range based input with "fadump_reserve_mem" >>> parameter would work for every memory configuration on a >>> given system, which is what this patch is trying to provide.. >> You want me to add this to the changelog on respin? Hi Michael, > I'm not really convinced. > > Distros are going to want to specify a fixed set of values for different > memory sizes, at least that's what I've seen in the past with kdump. So > I don't see why we can't just do that in the kernel with a formula based > on memory size, and maybe some other information. Agreed. Such support would be great but this patch is adding support for a new syntax for an existing parameter which should still be good to have? > Maybe the formula is more complicated than 5% of RAM, but it shouldn't > be *that* much more complicated. Depending on what all kernel versions that need support, this can get ugly? I could be completely wrong though.. Thanks Hari > cheers > > _______________________________________________ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web