linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: Hari Bathini <hbathini@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	kexec@lists.infradead.org, lkml <linux-kernel@vger.kernel.org>,
	linuxppc-dev <linuxppc-dev@ozlabs.org>,
	ebiederm@xmission.com, Michael Ellerman <mpe@ellerman.id.au>,
	vgoyal@redhat.com
Subject: Re: [PATCH v3 2/2] powerpc/fadump: parse fadump reserve memory size based on memory range
Date: Fri, 26 Aug 2016 11:22:35 +0800	[thread overview]
Message-ID: <20160826032235.GA6377@dhcp-128-65.nay.redhat.com> (raw)
In-Reply-To: <05642bf1-6e46-bab0-f871-9391996ff264@linux.vnet.ibm.com>

On 08/25/16 at 11:00pm, Hari Bathini wrote:
> 
> 
> On Thursday 25 August 2016 12:31 PM, Dave Young wrote:
> > On 08/10/16 at 03:35pm, Hari Bathini wrote:
> > > When fadump is enabled, by default 5% of system RAM is reserved for
> > > fadump kernel. While that works for most cases, it is not good enough
> > > for every case.
> > > 
> > > Currently, to override the default value, fadump supports specifying
> > > memory to reserve with fadump_reserve_mem=size, where only a fixed size
> > > can be specified. This patch adds support to specify memory size to
> > > reserve for different memory ranges as below:
> > > 
> > > 	fadump_reserve_mem=<range1>:<size1>[,<range2>:<size2>,...]
> > Hi, Hari
> 
> Hi Dave,
> 
> > I do not understand why you need introduce the new cmdline param, what's
> > the difference between the "fadump reserved" memory and the memory
> 
> I am not introducing a new parameter but adding a new syntax for
> an existing parameter.

Apologize for that, I was not aware it because it is not documented in
kernel-parameters.txt

> 
> > reserved by "crashkernel="? Can fadump just use crashkernel= to reserve
> > memory?
> 
> Not all syntaxes supported by crashkernel apply for fadump_reserve_mem.
> Nonetheless, it is worth considering reuse of crashkernel parameter instead
> of fadump_reserve_mem. Let me see what I can do about this..

Thanks! I originally thought fadump will reserve memory in firmware
code, if it is in kernel then it will be better to just extend and reuse
crashkernel=.

Dave
> 
> Thanks
> Hari
> 
> > Thanks
> > Dave
> > 
> > > Supporting range based input for "fadump_reserve_mem" parameter 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>
> > > ---
> > > 
> > > Changes from v2:
> > > 1. Updated changelog
> > > 
> > > 
> > >   arch/powerpc/kernel/fadump.c |   63 ++++++++++++++++++++++++++++++++++++------
> > >   1 file changed, 54 insertions(+), 9 deletions(-)
> > > 
> > > diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> > > index b3a6633..7c01b5b 100644
> > > --- a/arch/powerpc/kernel/fadump.c
> > > +++ b/arch/powerpc/kernel/fadump.c
> > > @@ -193,6 +193,55 @@ 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_colon_in_param(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) {
> > > +		return -EINVAL;
> > > +	}
> > > +
> > > +	return 0;
> > > +}
> > > +
> > >   /**
> > >    * fadump_calculate_reserve_size(): reserve variable boot area 5% of System RAM
> > >    *
> > > @@ -212,12 +261,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 +402,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;
> > > 
> > _______________________________________________
> > kexec mailing list
> > kexec@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/kexec
> > 
> 

      reply	other threads:[~2016-08-26  3:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 10:04 [PATCH v3 0/2] powerpc/fadump: support memory range syntax for fadump memory reservation Hari Bathini
2016-08-10 10:05 ` [PATCH v3 1/2] kexec: refactor code parsing size based on memory range Hari Bathini
2016-08-10 10:05 ` [PATCH v3 2/2] powerpc/fadump: parse fadump reserve memory " Hari Bathini
2016-08-25  7:01   ` Dave Young
2016-08-25 17:30     ` Hari Bathini
2016-08-26  3:22       ` Dave Young [this message]

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=20160826032235.GA6377@dhcp-128-65.nay.redhat.com \
    --to=dyoung@redhat.com \
    --cc=ananth@in.ibm.com \
    --cc=ebiederm@xmission.com \
    --cc=hbathini@linux.vnet.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=vgoyal@redhat.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;
as well as URLs for NNTP newsgroup(s).