All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: Hari Bathini <hbathini@linux.ibm.com>
Cc: Pingfan Liu <piliu@redhat.com>,
	Kexec-ml <kexec@lists.infradead.org>,
	Petr Tesarik <ptesarik@suse.cz>,
	lkml <linux-kernel@vger.kernel.org>,
	Sourabh Jain <sourabhjain@linux.ibm.com>,
	Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
	linuxppc-dev <linuxppc-dev@ozlabs.org>,
	Vivek Goyal <vgoyal@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mimi Zohar <zohar@linux.ibm.com>,
	Thiago Jung Bauermann <bauerman@linux.ibm.com>,
	Eric Biederman <ebiederm@xmission.com>
Subject: Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions
Date: Thu, 2 Jul 2020 19:54:54 +0800	[thread overview]
Message-ID: <20200702115454.GB21026@dhcp-128-65.nay.redhat.com> (raw)
In-Reply-To: <6e96ae5a-91fd-726e-1eda-314f2317d8b4@linux.ibm.com>

On 07/01/20 at 11:48pm, Hari Bathini wrote:
> 
> 
> On 01/07/20 1:10 pm, Dave Young wrote:
> > Hi Hari,
> > On 06/27/20 at 12:35am, Hari Bathini wrote:
> >> crashkernel region could have an overlap with special memory regions
> >> like  opal, rtas, tce-table & such. These regions are referred to as
> >> exclude memory ranges. Setup this ranges during image probe in order
> >> to avoid them while finding the buffer for different kdump segments.
> >> Implement kexec_locate_mem_hole_ppc64() that locates a memory hole
> >> accounting for these ranges. Also, override arch_kexec_add_buffer()
> >> to locate a memory hole & later call __kexec_add_buffer() function
> >> with kbuf->mem set to skip the generic locate memory hole lookup.
> >>
> >> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> >> ---
> >>  arch/powerpc/include/asm/crashdump-ppc64.h |   10 +
> >>  arch/powerpc/include/asm/kexec.h           |    7 -
> >>  arch/powerpc/kexec/elf_64.c                |    7 +
> >>  arch/powerpc/kexec/file_load_64.c          |  292 ++++++++++++++++++++++++++++
> >>  4 files changed, 312 insertions(+), 4 deletions(-)
> >>  create mode 100644 arch/powerpc/include/asm/crashdump-ppc64.h
> >>
> > [snip]
> >>  /**
> >> + * get_exclude_memory_ranges - Get exclude memory ranges. This list includes
> >> + *                             regions like opal/rtas, tce-table, initrd,
> >> + *                             kernel, htab which should be avoided while
> >> + *                             setting up kexec load segments.
> >> + * @mem_ranges:                Range list to add the memory ranges to.
> >> + *
> >> + * Returns 0 on success, negative errno on error.
> >> + */
> >> +static int get_exclude_memory_ranges(struct crash_mem **mem_ranges)
> >> +{
> >> +	int ret;
> >> +
> >> +	ret = add_tce_mem_ranges(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_initrd_mem_range(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_htab_mem_range(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_kernel_mem_range(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_rtas_mem_range(mem_ranges, false);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_opal_mem_range(mem_ranges, false);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_reserved_ranges(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	/* exclude memory ranges should be sorted for easy lookup */
> >> +	sort_memory_ranges(*mem_ranges);
> >> +out:
> >> +	if (ret)
> >> +		pr_err("Failed to setup exclude memory ranges\n");
> >> +	return ret;
> >> +}
> > 
> > I'm confused about the "overlap with crashkernel memory", does that mean
> > those normal kernel used memory could be put in crashkernel reserved
> 
> There are regions that could overlap with crashkernel region but they are
> not normal kernel used memory though. These are regions that kernel and/or
> f/w chose to place at a particular address for real mode accessibility
> and/or memory layout between kernel & f/w kind of thing.
> 
> > memory range?  If so why can't just skip those areas while crashkernel
> > doing the reservation?
> 
> crashkernel region has a dependency to be in the first memory block for it
> to be accessible in real mode. Accommodating this requirement while addressing
> other requirements would mean something like what we have now. A list of
> possible special memory regions in crashkernel region to take care of.
> 
> I have plans to split crashkernel region into low & high to have exclusive
> regions for crashkernel, even if that means to have two of them. But that
> is for another day with its own set of complexities to deal with...

Ok, I was not aware the powerpc crashkernel reservation is not
dynamically reserved.  But seems powerpc need those tricks at least for
the time being like you said.

Thanks
Dave


WARNING: multiple messages have this Message-ID (diff)
From: Dave Young <dyoung@redhat.com>
To: Hari Bathini <hbathini@linux.ibm.com>
Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>,
	Pingfan Liu <piliu@redhat.com>,
	Kexec-ml <kexec@lists.infradead.org>,
	Petr Tesarik <ptesarik@suse.cz>,
	lkml <linux-kernel@vger.kernel.org>,
	Sourabh Jain <sourabhjain@linux.ibm.com>,
	Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
	linuxppc-dev <linuxppc-dev@ozlabs.org>,
	Mimi Zohar <zohar@linux.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vivek Goyal <vgoyal@redhat.com>,
	Eric Biederman <ebiederm@xmission.com>
Subject: Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions
Date: Thu, 2 Jul 2020 19:54:54 +0800	[thread overview]
Message-ID: <20200702115454.GB21026@dhcp-128-65.nay.redhat.com> (raw)
In-Reply-To: <6e96ae5a-91fd-726e-1eda-314f2317d8b4@linux.ibm.com>

On 07/01/20 at 11:48pm, Hari Bathini wrote:
> 
> 
> On 01/07/20 1:10 pm, Dave Young wrote:
> > Hi Hari,
> > On 06/27/20 at 12:35am, Hari Bathini wrote:
> >> crashkernel region could have an overlap with special memory regions
> >> like  opal, rtas, tce-table & such. These regions are referred to as
> >> exclude memory ranges. Setup this ranges during image probe in order
> >> to avoid them while finding the buffer for different kdump segments.
> >> Implement kexec_locate_mem_hole_ppc64() that locates a memory hole
> >> accounting for these ranges. Also, override arch_kexec_add_buffer()
> >> to locate a memory hole & later call __kexec_add_buffer() function
> >> with kbuf->mem set to skip the generic locate memory hole lookup.
> >>
> >> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> >> ---
> >>  arch/powerpc/include/asm/crashdump-ppc64.h |   10 +
> >>  arch/powerpc/include/asm/kexec.h           |    7 -
> >>  arch/powerpc/kexec/elf_64.c                |    7 +
> >>  arch/powerpc/kexec/file_load_64.c          |  292 ++++++++++++++++++++++++++++
> >>  4 files changed, 312 insertions(+), 4 deletions(-)
> >>  create mode 100644 arch/powerpc/include/asm/crashdump-ppc64.h
> >>
> > [snip]
> >>  /**
> >> + * get_exclude_memory_ranges - Get exclude memory ranges. This list includes
> >> + *                             regions like opal/rtas, tce-table, initrd,
> >> + *                             kernel, htab which should be avoided while
> >> + *                             setting up kexec load segments.
> >> + * @mem_ranges:                Range list to add the memory ranges to.
> >> + *
> >> + * Returns 0 on success, negative errno on error.
> >> + */
> >> +static int get_exclude_memory_ranges(struct crash_mem **mem_ranges)
> >> +{
> >> +	int ret;
> >> +
> >> +	ret = add_tce_mem_ranges(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_initrd_mem_range(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_htab_mem_range(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_kernel_mem_range(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_rtas_mem_range(mem_ranges, false);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_opal_mem_range(mem_ranges, false);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_reserved_ranges(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	/* exclude memory ranges should be sorted for easy lookup */
> >> +	sort_memory_ranges(*mem_ranges);
> >> +out:
> >> +	if (ret)
> >> +		pr_err("Failed to setup exclude memory ranges\n");
> >> +	return ret;
> >> +}
> > 
> > I'm confused about the "overlap with crashkernel memory", does that mean
> > those normal kernel used memory could be put in crashkernel reserved
> 
> There are regions that could overlap with crashkernel region but they are
> not normal kernel used memory though. These are regions that kernel and/or
> f/w chose to place at a particular address for real mode accessibility
> and/or memory layout between kernel & f/w kind of thing.
> 
> > memory range?  If so why can't just skip those areas while crashkernel
> > doing the reservation?
> 
> crashkernel region has a dependency to be in the first memory block for it
> to be accessible in real mode. Accommodating this requirement while addressing
> other requirements would mean something like what we have now. A list of
> possible special memory regions in crashkernel region to take care of.
> 
> I have plans to split crashkernel region into low & high to have exclusive
> regions for crashkernel, even if that means to have two of them. But that
> is for another day with its own set of complexities to deal with...

Ok, I was not aware the powerpc crashkernel reservation is not
dynamically reserved.  But seems powerpc need those tricks at least for
the time being like you said.

Thanks
Dave


WARNING: multiple messages have this Message-ID (diff)
From: Dave Young <dyoung@redhat.com>
To: Hari Bathini <hbathini@linux.ibm.com>
Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>,
	Pingfan Liu <piliu@redhat.com>,
	Kexec-ml <kexec@lists.infradead.org>,
	Petr Tesarik <ptesarik@suse.cz>,
	lkml <linux-kernel@vger.kernel.org>,
	Sourabh Jain <sourabhjain@linux.ibm.com>,
	Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
	linuxppc-dev <linuxppc-dev@ozlabs.org>,
	Mimi Zohar <zohar@linux.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vivek Goyal <vgoyal@redhat.com>,
	Eric Biederman <ebiederm@xmission.com>
Subject: Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions
Date: Thu, 2 Jul 2020 19:54:54 +0800	[thread overview]
Message-ID: <20200702115454.GB21026@dhcp-128-65.nay.redhat.com> (raw)
In-Reply-To: <6e96ae5a-91fd-726e-1eda-314f2317d8b4@linux.ibm.com>

On 07/01/20 at 11:48pm, Hari Bathini wrote:
> 
> 
> On 01/07/20 1:10 pm, Dave Young wrote:
> > Hi Hari,
> > On 06/27/20 at 12:35am, Hari Bathini wrote:
> >> crashkernel region could have an overlap with special memory regions
> >> like  opal, rtas, tce-table & such. These regions are referred to as
> >> exclude memory ranges. Setup this ranges during image probe in order
> >> to avoid them while finding the buffer for different kdump segments.
> >> Implement kexec_locate_mem_hole_ppc64() that locates a memory hole
> >> accounting for these ranges. Also, override arch_kexec_add_buffer()
> >> to locate a memory hole & later call __kexec_add_buffer() function
> >> with kbuf->mem set to skip the generic locate memory hole lookup.
> >>
> >> Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
> >> ---
> >>  arch/powerpc/include/asm/crashdump-ppc64.h |   10 +
> >>  arch/powerpc/include/asm/kexec.h           |    7 -
> >>  arch/powerpc/kexec/elf_64.c                |    7 +
> >>  arch/powerpc/kexec/file_load_64.c          |  292 ++++++++++++++++++++++++++++
> >>  4 files changed, 312 insertions(+), 4 deletions(-)
> >>  create mode 100644 arch/powerpc/include/asm/crashdump-ppc64.h
> >>
> > [snip]
> >>  /**
> >> + * get_exclude_memory_ranges - Get exclude memory ranges. This list includes
> >> + *                             regions like opal/rtas, tce-table, initrd,
> >> + *                             kernel, htab which should be avoided while
> >> + *                             setting up kexec load segments.
> >> + * @mem_ranges:                Range list to add the memory ranges to.
> >> + *
> >> + * Returns 0 on success, negative errno on error.
> >> + */
> >> +static int get_exclude_memory_ranges(struct crash_mem **mem_ranges)
> >> +{
> >> +	int ret;
> >> +
> >> +	ret = add_tce_mem_ranges(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_initrd_mem_range(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_htab_mem_range(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_kernel_mem_range(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_rtas_mem_range(mem_ranges, false);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_opal_mem_range(mem_ranges, false);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	ret = add_reserved_ranges(mem_ranges);
> >> +	if (ret)
> >> +		goto out;
> >> +
> >> +	/* exclude memory ranges should be sorted for easy lookup */
> >> +	sort_memory_ranges(*mem_ranges);
> >> +out:
> >> +	if (ret)
> >> +		pr_err("Failed to setup exclude memory ranges\n");
> >> +	return ret;
> >> +}
> > 
> > I'm confused about the "overlap with crashkernel memory", does that mean
> > those normal kernel used memory could be put in crashkernel reserved
> 
> There are regions that could overlap with crashkernel region but they are
> not normal kernel used memory though. These are regions that kernel and/or
> f/w chose to place at a particular address for real mode accessibility
> and/or memory layout between kernel & f/w kind of thing.
> 
> > memory range?  If so why can't just skip those areas while crashkernel
> > doing the reservation?
> 
> crashkernel region has a dependency to be in the first memory block for it
> to be accessible in real mode. Accommodating this requirement while addressing
> other requirements would mean something like what we have now. A list of
> possible special memory regions in crashkernel region to take care of.
> 
> I have plans to split crashkernel region into low & high to have exclusive
> regions for crashkernel, even if that means to have two of them. But that
> is for another day with its own set of complexities to deal with...

Ok, I was not aware the powerpc crashkernel reservation is not
dynamically reserved.  But seems powerpc need those tricks at least for
the time being like you said.

Thanks
Dave


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2020-07-02 11:55 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-26 19:04 [PATCH 00/11] ppc64: enable kdump support for kexec_file_load syscall Hari Bathini
2020-06-26 19:04 ` Hari Bathini
2020-06-26 19:04 ` Hari Bathini
2020-06-26 19:04 ` [PATCH 01/11] kexec_file: allow archs to handle special regions while locating memory hole Hari Bathini
2020-06-26 19:04   ` Hari Bathini
2020-06-26 19:04   ` Hari Bathini
2020-06-27  6:30   ` Christophe Leroy
2020-06-27  6:30     ` Christophe Leroy
2020-06-27  6:30     ` Christophe Leroy
2020-06-28  2:28   ` piliu
2020-06-28  2:28     ` piliu
2020-06-28  2:28     ` piliu
2020-06-29  6:00     ` Hari Bathini
2020-06-29  6:00       ` Hari Bathini
2020-06-29  6:00       ` Hari Bathini
2020-06-29 11:39   ` Petr Tesarik
2020-06-29 11:39     ` Petr Tesarik
2020-06-29 11:39     ` Petr Tesarik
2020-06-29 11:56     ` Hari Bathini
2020-06-29 11:56       ` Hari Bathini
2020-06-29 11:56       ` Hari Bathini
2020-07-01  7:46       ` Dave Young
2020-07-01  7:46         ` Dave Young
2020-07-01  7:46         ` Dave Young
2020-07-01 18:31         ` Hari Bathini
2020-07-01 18:31           ` Hari Bathini
2020-07-01 18:31           ` Hari Bathini
2020-07-02 11:47           ` Dave Young
2020-07-02 11:47             ` Dave Young
2020-07-02 11:47             ` Dave Young
2020-06-26 19:04 ` [PATCH 02/11] powerpc/kexec_file: mark PPC64 specific code Hari Bathini
2020-06-26 19:04   ` Hari Bathini
2020-06-26 19:04   ` Hari Bathini
2020-06-27  6:42   ` Christophe Leroy
2020-06-27  6:42     ` Christophe Leroy
2020-06-27  6:42     ` Christophe Leroy
2020-06-29  6:23     ` Hari Bathini
2020-06-29  6:23       ` Hari Bathini
2020-06-29  6:23       ` Hari Bathini
2020-06-26 19:05 ` [PATCH 03/11] powerpc/kexec_file: add helper functions for getting memory ranges Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05 ` [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-27 10:45   ` kernel test robot
2020-06-27 10:45     ` kernel test robot
2020-06-27 10:45     ` kernel test robot
2020-06-28  2:14   ` piliu
2020-06-28  2:14     ` piliu
2020-06-28  2:14     ` piliu
2020-06-29  5:55     ` Hari Bathini
2020-06-29  5:55       ` Hari Bathini
2020-06-29  5:55       ` Hari Bathini
2020-06-30  3:30       ` piliu
2020-06-30  3:30         ` piliu
2020-06-30  3:30         ` piliu
2020-06-30  6:10         ` Hari Bathini
2020-06-30  6:10           ` Hari Bathini
2020-06-30  6:10           ` Hari Bathini
2020-06-30  8:13           ` piliu
2020-06-30  8:13             ` piliu
2020-06-30  8:13             ` piliu
2020-07-01  7:40   ` Dave Young
2020-07-01  7:40     ` Dave Young
2020-07-01  7:40     ` Dave Young
2020-07-01 12:53     ` piliu
2020-07-01 12:53       ` piliu
2020-07-01 12:53       ` piliu
2020-07-02 11:59       ` Dave Young
2020-07-02 11:59         ` Dave Young
2020-07-02 11:59         ` Dave Young
2020-07-01 18:18     ` Hari Bathini
2020-07-01 18:18       ` Hari Bathini
2020-07-01 18:18       ` Hari Bathini
2020-07-02 11:54       ` Dave Young [this message]
2020-07-02 11:54         ` Dave Young
2020-07-02 11:54         ` Dave Young
2020-06-26 19:05 ` [PATCH 05/11] powerpc/drmem: make lmb walk a bit more flexible Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05 ` [PATCH 06/11] ppc64/kexec_file: restrict memory usage of kdump kernel Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05 ` [PATCH 07/11] ppc64/kexec_file: add support to relocate purgatory Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-27 11:52   ` kernel test robot
2020-06-27 11:52     ` kernel test robot
2020-06-27 11:52     ` kernel test robot
2020-06-26 19:05 ` [PATCH 08/11] ppc64/kexec_file: setup the stack for purgatory Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05 ` [PATCH 09/11] ppc64/kexec_file: setup backup region for kdump kernel Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-26 19:05   ` Hari Bathini
2020-06-27 13:02   ` kernel test robot
2020-06-27 13:02     ` kernel test robot
2020-06-27 13:02     ` kernel test robot
2020-06-26 19:06 ` [PATCH 10/11] ppc64/kexec_file: prepare elfcore header for crashing kernel Hari Bathini
2020-06-26 19:06   ` Hari Bathini
2020-06-26 19:06   ` Hari Bathini
2020-06-26 19:06 ` [PATCH 11/11] ppc64/kexec_file: add appropriate regions for memory reserve map Hari Bathini
2020-06-26 19:06   ` Hari Bathini
2020-06-26 19:06   ` Hari Bathini

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=20200702115454.GB21026@dhcp-128-65.nay.redhat.com \
    --to=dyoung@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bauerman@linux.ibm.com \
    --cc=ebiederm@xmission.com \
    --cc=hbathini@linux.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mahesh@linux.ibm.com \
    --cc=piliu@redhat.com \
    --cc=ptesarik@suse.cz \
    --cc=sourabhjain@linux.ibm.com \
    --cc=vgoyal@redhat.com \
    --cc=zohar@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.