All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Chandru <chandru@in.ibm.com>
Cc: linuxppc-dev@ozlabs.org, Michael Neuling <mikey@neuling.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH 1/4][V2] powerpc : add support for linux, usable-memory properties for drconf memory
Date: Tue, 22 Jul 2008 19:12:06 +1000	[thread overview]
Message-ID: <1216717926.11027.197.camel@pasglop> (raw)
In-Reply-To: <200807221431.49268.chandru@in.ibm.com>

On Tue, 2008-07-22 at 14:31 +0530, Chandru wrote:
> Scan for linux,usable-memory properties in case of dynamic reconfiguration 
> memory . Support for kexec/kdump.
> 
> Signed-off-by: Chandru Siddalingappa <chandru@in.ibm.com>
> ---
> 
> Patch applies on powerpc tree. Patch was reviewed by Nathan Fontenot, Stephen 
> Rothwell, Michael Neuling.  

Any reason why there's no acks there then ? I don't have an objection to
the patch per-se and I was planning to review it this week too, but if
you had positive reviews and you addressed whatever comments the people
had, there should be Acked-by: lines in your patch (ie, don't invent
them, only put them there if you actually got that from the reviewers).

Cheers,
Ben.

>  arch/powerpc/kernel/prom.c |   40 +++++++++++++++++++++++------
>  arch/powerpc/mm/numa.c     |   48 ++++++++++++++++++++++++-----------
>  2 files changed, 65 insertions(+), 23 deletions(-)
> 
> diff -Naurp powerpc-orig/arch/powerpc/kernel/prom.c 
> powerpc/arch/powerpc/kernel/prom.c
> --- powerpc-orig/arch/powerpc/kernel/prom.c	2008-07-22 14:11:53.000000000 
> +0530
> +++ powerpc/arch/powerpc/kernel/prom.c	2008-07-22 14:12:17.000000000 +0530
> @@ -888,9 +888,10 @@ static u64 __init dt_mem_next_cell(int s
>   */
>  static int __init early_init_dt_scan_drconf_memory(unsigned long node)
>  {
> -	cell_t *dm, *ls;
> -	unsigned long l, n, flags;
> +	cell_t *dm, *ls, *usm;
> +	unsigned long l, n, flags, ranges;
>  	u64 base, size, lmb_size;
> +	char buf[32];
>  
>  	ls = (cell_t *)of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
>  	if (ls == NULL || l < dt_root_size_cells * sizeof(cell_t))
> @@ -914,14 +915,37 @@ static int __init early_init_dt_scan_drc
>  		   or if the block is not assigned to this partition (0x8) */
>  		if ((flags & 0x80) || !(flags & 0x8))
>  			continue;
> -		size = lmb_size;
> -		if (iommu_is_off) {
> +		if (iommu_is_off)
>  			if (base >= 0x80000000ul)
>  				continue;
> -			if ((base + size) > 0x80000000ul)
> -				size = 0x80000000ul - base;
> -		}
> -		lmb_add(base, size);
> +		size = lmb_size;
> +
> +		/*
> +		 * Append 'n' to 'linux,usable-memory' to get special
> +		 * properties passed in by tools like kexec-tools. Relevant
> +		 * only if this is a kexec/kdump kernel.
> +		 */
> +		sprintf(buf, "linux,usable-memory%d", (int)n);
> +		usm = of_get_flat_dt_prop(node, buf, &l);
> +		ranges = 1;
> +		if (usm != NULL)
> +			ranges = (l >> 2)/(dt_root_addr_cells
> +						+ dt_root_size_cells);
> +		do {
> +			if (usm != NULL) {
> +				base = dt_mem_next_cell(dt_root_addr_cells,
> +							 &usm);
> +				size = dt_mem_next_cell(dt_root_size_cells,
> +							 &usm);
> +				if (size == 0)
> +					break;
> +			}
> +			if (iommu_is_off)
> +				if ((base + size) > 0x80000000ul)
> +					size = 0x80000000ul - base;
> +
> +			lmb_add(base, size);
> +		} while (--ranges);
>  	}
>  	lmb_dump_all();
>  	return 0;
> diff -Naurp powerpc-orig/arch/powerpc/mm/numa.c powerpc/arch/powerpc/mm/numa.c
> --- powerpc-orig/arch/powerpc/mm/numa.c	2008-07-22 14:11:53.000000000 +0530
> +++ powerpc/arch/powerpc/mm/numa.c	2008-07-22 14:12:17.000000000 +0530
> @@ -493,11 +493,13 @@ static unsigned long __init numa_enforce
>   */
>  static void __init parse_drconf_memory(struct device_node *memory)
>  {
> -	const u32 *dm;
> -	unsigned int n, rc;
> -	unsigned long lmb_size, size;
> +	const u32 *dm, *usm;
> +	unsigned int n, rc, len, ranges;
> +	unsigned long lmb_size, size, sz;
>  	int nid;
>  	struct assoc_arrays aa;
> +	char buf[32];
> +	u64 base;
>  
>  	n = of_get_drconf_memory(memory, &dm);
>  	if (!n)
> @@ -524,19 +526,35 @@ static void __init parse_drconf_memory(s
>  
>  		nid = of_drconf_to_nid_single(&drmem, &aa);
>  
> -		fake_numa_create_new_node(
> -				((drmem.base_addr + lmb_size) >> PAGE_SHIFT),
> -					   &nid);
> -
> -		node_set_online(nid);
> -
> -		size = numa_enforce_memory_limit(drmem.base_addr, lmb_size);
> -		if (!size)
> -			continue;
> +		/*
> +		 * Append 'n' to 'linux,usable-memory' to get special
> +		 * properties passed in by tools like kexec-tools. Relevant
> +		 * only if this is a kexec/kdump kernel.
> +		 */
> +		sprintf(buf, "linux,usable-memory%d", (int)n);
> +		usm = of_get_property(memory, buf, &len);
> +		ranges = 1;
> +		if (usm != NULL)
> +			ranges = (len >> 2) /
> +					 (n_mem_addr_cells + n_mem_size_cells);
> +
> +		base = drmem.base_addr;
> +		size = lmb_size;
> +		do {
> +			if (usm != NULL) {
> +				base = read_n_cells(n_mem_addr_cells, &usm);
> +				size = read_n_cells(n_mem_size_cells, &usm);
> +			}
>  
> -		add_active_range(nid, drmem.base_addr >> PAGE_SHIFT,
> -				 (drmem.base_addr >> PAGE_SHIFT)
> -				 + (size >> PAGE_SHIFT));
> +			fake_numa_create_new_node(((base + size) >> PAGE_SHIFT),
> +							 &nid);
> +			node_set_online(nid);
> +			sz = numa_enforce_memory_limit(base, size);
> +			if (sz)
> +				add_active_range(nid, base >> PAGE_SHIFT,
> +						 (base >> PAGE_SHIFT)
> +						+ (sz >> PAGE_SHIFT));
> +		} while (--ranges);
>  	}
>  }

  reply	other threads:[~2008-07-22  9:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-07 18:44 [PATCH 1/4] kdump : add support for ibm, dynamic-reconfiguration-memory for kexec/kdump Chandru
2008-07-07 18:44 ` Chandru
2008-07-08  1:36 ` Stephen Rothwell
2008-07-08  1:36   ` Stephen Rothwell
2008-07-08 10:58   ` Chandru
2008-07-08 10:58     ` Chandru
2008-07-08  1:56 ` Michael Neuling
2008-07-08  1:56   ` Michael Neuling
2008-07-10 22:27 ` [PATCH 1/4] kdump : add support for ibm, dynamic-reconfiguration-memory for kexec/kdump Nathan Fontenot
2008-07-10 22:27   ` Nathan Fontenot
2008-07-11 11:09   ` Chandru
2008-07-11 11:09     ` Chandru
2008-07-11 13:49     ` [PATCH 1/4][V2] powerpc : add support for linux, usable-memory properties for drconf memory Chandru
2008-07-11 13:49       ` Chandru
2008-07-22  9:01       ` Chandru
2008-07-22  9:12         ` Benjamin Herrenschmidt [this message]
2008-07-22  9:16         ` Paul Mackerras
2008-07-25 16:51           ` Chandru

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=1216717926.11027.197.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=chandru@in.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=sfr@canb.auug.org.au \
    /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.