linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [-mm PATCH] updates for hotplug memory remove
@ 2008-01-29  0:31 Badari Pulavarty
  2008-01-29  0:35 ` Badari Pulavarty
  0 siblings, 1 reply; 5+ messages in thread
From: Badari Pulavarty @ 2008-01-29  0:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linuxppc-dev, pbadari

Hi Andrew,

Here are the updates for hotplug memory remove code currently in -mm.

1) Please don't push this patch to mainline (for the merge window).

memory-hotplug-add-removable-to-sysfs-to-show-memblock-removability.patch

I didn't find this consistently useful - even though memory is marked
removable, I found cases where I can't move it. When we get it right,
we can push it at that time. Please leave this in -mm.

2) Can you replace the following patch with this ?

add-remove_memory-for-ppc64-2.patch

I found that, I do need arch-specific hooks to get the memory remove
working on ppc64 LPAR. Earlier, I tried to make remove_memory() arch
neutral, but we do need arch specific hooks.

Thanks,
Badari

Supply ppc64 remove_memory() function. Arch specific is still
being reviewed by Paul Mackerras.

From: Badari Pulavarty <pbadari@us.ibm.com>
---
 arch/powerpc/mm/mem.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Index: linux-2.6.24-rc8/arch/powerpc/mm/mem.c
===================================================================
--- linux-2.6.24-rc8.orig/arch/powerpc/mm/mem.c	2008-01-25 08:04:32.000000000 -0800
+++ linux-2.6.24-rc8/arch/powerpc/mm/mem.c	2008-01-25 08:16:37.000000000 -0800
@@ -145,6 +145,22 @@ walk_memory_resource(unsigned long start
 	return  (*func)(start_pfn, nr_pages, arg);
 }
 
+#ifdef CONFIG_MEMORY_HOTREMOVE
+int remove_memory(u64 start, u64 size)
+{
+	unsigned long start_pfn, end_pfn;
+	int ret;
+
+	start_pfn = start >> PAGE_SHIFT;
+	end_pfn = start_pfn + (size >> PAGE_SHIFT);
+	ret = offline_pages(start_pfn, end_pfn, 120 * HZ);
+	if (ret)
+		goto out;
+	/* Arch-specific calls go here - next patch */
+out:
+	return ret;
+}
+#endif /* CONFIG_MEMORY_HOTREMOVE */
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
 void show_mem(void)


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [-mm PATCH] updates for hotplug memory remove
  2008-01-29  0:31 [-mm PATCH] updates for hotplug memory remove Badari Pulavarty
@ 2008-01-29  0:35 ` Badari Pulavarty
  2008-01-29  5:18   ` Yasunori Goto
  0 siblings, 1 reply; 5+ messages in thread
From: Badari Pulavarty @ 2008-01-29  0:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linuxppc-dev

On Mon, 2008-01-28 at 16:31 -0800, Badari Pulavarty wrote:


> 2) Can you replace the following patch with this ?
> 
> add-remove_memory-for-ppc64-2.patch
> 
> I found that, I do need arch-specific hooks to get the memory remove
> working on ppc64 LPAR. Earlier, I tried to make remove_memory() arch
> neutral, but we do need arch specific hooks.
> 
> Thanks,
> Badari

Andrew,

Here is the patch which provides arch-specific code to complete memory
remove on ppc64 LPAR. So far, it works fine in my testing - but waiting
for ppc-experts for review and completeness. 

FYI.

Thanks,
Badari

For memory remove, we need to clean up htab mappings for the
section of the memory we are removing.

This patch implements support for removing htab bolted mappings
for ppc64 lpar. Other sub-archs, may need to implement similar
functionality for the hotplug memory remove to work. 

Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
---
 arch/powerpc/mm/hash_utils_64.c       |   23 +++++++++++++++++++++++
 arch/powerpc/mm/mem.c                 |    4 +++-
 arch/powerpc/platforms/pseries/lpar.c |   15 +++++++++++++++
 include/asm-powerpc/machdep.h         |    2 ++
 include/asm-powerpc/sparsemem.h       |    1 +
 5 files changed, 44 insertions(+), 1 deletion(-)

Index: linux-2.6.24-rc8/arch/powerpc/mm/hash_utils_64.c
===================================================================
--- linux-2.6.24-rc8.orig/arch/powerpc/mm/hash_utils_64.c	2008-01-25 08:04:32.000000000 -0800
+++ linux-2.6.24-rc8/arch/powerpc/mm/hash_utils_64.c	2008-01-28 11:45:40.000000000 -0800
@@ -191,6 +191,24 @@ int htab_bolt_mapping(unsigned long vsta
 	return ret < 0 ? ret : 0;
 }
 
+static void htab_remove_mapping(unsigned long vstart, unsigned long vend,
+		      int psize, int ssize)
+{
+	unsigned long vaddr;
+	unsigned int step, shift;
+
+	shift = mmu_psize_defs[psize].shift;
+	step = 1 << shift;
+
+	if (!ppc_md.hpte_removebolted) {
+		printk("Sub-arch doesn't implement hpte_removebolted\n");
+		return;
+	}
+
+	for (vaddr = vstart; vaddr < vend; vaddr += step)
+		ppc_md.hpte_removebolted(vaddr, psize, ssize);
+}
+
 static int __init htab_dt_scan_seg_sizes(unsigned long node,
 					 const char *uname, int depth,
 					 void *data)
@@ -436,6 +454,11 @@ void create_section_mapping(unsigned lon
 			_PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX,
 			mmu_linear_psize, mmu_kernel_ssize));
 }
+
+void remove_section_mapping(unsigned long start, unsigned long end)
+{
+	htab_remove_mapping(start, end, mmu_linear_psize, mmu_kernel_ssize);
+}
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
 static inline void make_bl(unsigned int *insn_addr, void *func)
Index: linux-2.6.24-rc8/include/asm-powerpc/sparsemem.h
===================================================================
--- linux-2.6.24-rc8.orig/include/asm-powerpc/sparsemem.h	2008-01-15 20:22:48.000000000 -0800
+++ linux-2.6.24-rc8/include/asm-powerpc/sparsemem.h	2008-01-25 08:18:11.000000000 -0800
@@ -20,6 +20,7 @@
 
 #ifdef CONFIG_MEMORY_HOTPLUG
 extern void create_section_mapping(unsigned long start, unsigned long end);
+extern void remove_section_mapping(unsigned long start, unsigned long end);
 #ifdef CONFIG_NUMA
 extern int hot_add_scn_to_nid(unsigned long scn_addr);
 #else
Index: linux-2.6.24-rc8/arch/powerpc/mm/mem.c
===================================================================
--- linux-2.6.24-rc8.orig/arch/powerpc/mm/mem.c	2008-01-25 08:16:37.000000000 -0800
+++ linux-2.6.24-rc8/arch/powerpc/mm/mem.c	2008-01-25 08:20:33.000000000 -0800
@@ -156,7 +156,9 @@ int remove_memory(u64 start, u64 size)
 	ret = offline_pages(start_pfn, end_pfn, 120 * HZ);
 	if (ret)
 		goto out;
-	/* Arch-specific calls go here - next patch */
+
+	start = (unsigned long)__va(start);
+	remove_section_mapping(start, start + size);
 out:
 	return ret;
 }
Index: linux-2.6.24-rc8/arch/powerpc/platforms/pseries/lpar.c
===================================================================
--- linux-2.6.24-rc8.orig/arch/powerpc/platforms/pseries/lpar.c	2008-01-15 20:22:48.000000000 -0800
+++ linux-2.6.24-rc8/arch/powerpc/platforms/pseries/lpar.c	2008-01-28 14:10:58.000000000 -0800
@@ -520,6 +520,20 @@ static void pSeries_lpar_hpte_invalidate
 	BUG_ON(lpar_rc != H_SUCCESS);
 }
 
+static void pSeries_lpar_hpte_removebolted(unsigned long ea,
+					   int psize, int ssize)
+{
+	unsigned long slot, vsid, va;
+
+	vsid = get_kernel_vsid(ea, ssize);
+	va = hpt_va(ea, vsid, ssize);
+
+	slot = pSeries_lpar_hpte_find(va, psize, ssize);
+	BUG_ON(slot == -1);
+
+	pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0);
+}
+
 /* Flag bits for H_BULK_REMOVE */
 #define HBR_REQUEST	0x4000000000000000UL
 #define HBR_RESPONSE	0x8000000000000000UL
@@ -597,6 +611,7 @@ void __init hpte_init_lpar(void)
 	ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp;
 	ppc_md.hpte_insert	= pSeries_lpar_hpte_insert;
 	ppc_md.hpte_remove	= pSeries_lpar_hpte_remove;
+	ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted;
 	ppc_md.flush_hash_range	= pSeries_lpar_flush_hash_range;
 	ppc_md.hpte_clear_all   = pSeries_lpar_hptab_clear;
 }
Index: linux-2.6.24-rc8/include/asm-powerpc/machdep.h
===================================================================
--- linux-2.6.24-rc8.orig/include/asm-powerpc/machdep.h	2008-01-25 08:04:41.000000000 -0800
+++ linux-2.6.24-rc8/include/asm-powerpc/machdep.h	2008-01-28 11:45:17.000000000 -0800
@@ -68,6 +68,8 @@ struct machdep_calls {
 				       unsigned long vflags,
 				       int psize, int ssize);
 	long		(*hpte_remove)(unsigned long hpte_group);
+	void            (*hpte_removebolted)(unsigned long ea,
+					     int psize, int ssize);
 	void		(*flush_hash_range)(unsigned long number, int local);
 
 	/* special for kexec, to be called in real mode, linar mapping is


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [-mm PATCH] updates for hotplug memory remove
  2008-01-29  0:35 ` Badari Pulavarty
@ 2008-01-29  5:18   ` Yasunori Goto
  2008-01-30  0:31     ` Badari Pulavarty
  0 siblings, 1 reply; 5+ messages in thread
From: Yasunori Goto @ 2008-01-29  5:18 UTC (permalink / raw)
  To: Badari Pulavarty; +Cc: Andrew Morton, linux-mm, linuxppc-dev

Hello. Badari-san.

Is your patch for notification the event of removing to firmware, right?

Have you ever tested hotadd(probe) of the removed memory?
I'm afraid there are some differences of the status between pre hot-add
section and the removed section by this patch. I think the mem_section of
removed memory should be invalidated at least.

But anyway, this is a great first step for physical memory remove.

Thanks.


> On Mon, 2008-01-28 at 16:31 -0800, Badari Pulavarty wrote:
> 
> 
> > 2) Can you replace the following patch with this ?
> > 
> > add-remove_memory-for-ppc64-2.patch
> > 
> > I found that, I do need arch-specific hooks to get the memory remove
> > working on ppc64 LPAR. Earlier, I tried to make remove_memory() arch
> > neutral, but we do need arch specific hooks.
> > 
> > Thanks,
> > Badari
> 
> Andrew,
> 
> Here is the patch which provides arch-specific code to complete memory
> remove on ppc64 LPAR. So far, it works fine in my testing - but waiting
> for ppc-experts for review and completeness. 
> 
> FYI.
> 
> Thanks,
> Badari
> 
> For memory remove, we need to clean up htab mappings for the
> section of the memory we are removing.
> 
> This patch implements support for removing htab bolted mappings
> for ppc64 lpar. Other sub-archs, may need to implement similar
> functionality for the hotplug memory remove to work. 
> 
> Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
> ---
>  arch/powerpc/mm/hash_utils_64.c       |   23 +++++++++++++++++++++++
>  arch/powerpc/mm/mem.c                 |    4 +++-
>  arch/powerpc/platforms/pseries/lpar.c |   15 +++++++++++++++
>  include/asm-powerpc/machdep.h         |    2 ++
>  include/asm-powerpc/sparsemem.h       |    1 +
>  5 files changed, 44 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6.24-rc8/arch/powerpc/mm/hash_utils_64.c
> ===================================================================
> --- linux-2.6.24-rc8.orig/arch/powerpc/mm/hash_utils_64.c	2008-01-25 08:04:32.000000000 -0800
> +++ linux-2.6.24-rc8/arch/powerpc/mm/hash_utils_64.c	2008-01-28 11:45:40.000000000 -0800
> @@ -191,6 +191,24 @@ int htab_bolt_mapping(unsigned long vsta
>  	return ret < 0 ? ret : 0;
>  }
>  
> +static void htab_remove_mapping(unsigned long vstart, unsigned long vend,
> +		      int psize, int ssize)
> +{
> +	unsigned long vaddr;
> +	unsigned int step, shift;
> +
> +	shift = mmu_psize_defs[psize].shift;
> +	step = 1 << shift;
> +
> +	if (!ppc_md.hpte_removebolted) {
> +		printk("Sub-arch doesn't implement hpte_removebolted\n");
> +		return;
> +	}
> +
> +	for (vaddr = vstart; vaddr < vend; vaddr += step)
> +		ppc_md.hpte_removebolted(vaddr, psize, ssize);
> +}
> +
>  static int __init htab_dt_scan_seg_sizes(unsigned long node,
>  					 const char *uname, int depth,
>  					 void *data)
> @@ -436,6 +454,11 @@ void create_section_mapping(unsigned lon
>  			_PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX,
>  			mmu_linear_psize, mmu_kernel_ssize));
>  }
> +
> +void remove_section_mapping(unsigned long start, unsigned long end)
> +{
> +	htab_remove_mapping(start, end, mmu_linear_psize, mmu_kernel_ssize);
> +}
>  #endif /* CONFIG_MEMORY_HOTPLUG */
>  
>  static inline void make_bl(unsigned int *insn_addr, void *func)
> Index: linux-2.6.24-rc8/include/asm-powerpc/sparsemem.h
> ===================================================================
> --- linux-2.6.24-rc8.orig/include/asm-powerpc/sparsemem.h	2008-01-15 20:22:48.000000000 -0800
> +++ linux-2.6.24-rc8/include/asm-powerpc/sparsemem.h	2008-01-25 08:18:11.000000000 -0800
> @@ -20,6 +20,7 @@
>  
>  #ifdef CONFIG_MEMORY_HOTPLUG
>  extern void create_section_mapping(unsigned long start, unsigned long end);
> +extern void remove_section_mapping(unsigned long start, unsigned long end);
>  #ifdef CONFIG_NUMA
>  extern int hot_add_scn_to_nid(unsigned long scn_addr);
>  #else
> Index: linux-2.6.24-rc8/arch/powerpc/mm/mem.c
> ===================================================================
> --- linux-2.6.24-rc8.orig/arch/powerpc/mm/mem.c	2008-01-25 08:16:37.000000000 -0800
> +++ linux-2.6.24-rc8/arch/powerpc/mm/mem.c	2008-01-25 08:20:33.000000000 -0800
> @@ -156,7 +156,9 @@ int remove_memory(u64 start, u64 size)
>  	ret = offline_pages(start_pfn, end_pfn, 120 * HZ);
>  	if (ret)
>  		goto out;
> -	/* Arch-specific calls go here - next patch */
> +
> +	start = (unsigned long)__va(start);
> +	remove_section_mapping(start, start + size);
>  out:
>  	return ret;
>  }
> Index: linux-2.6.24-rc8/arch/powerpc/platforms/pseries/lpar.c
> ===================================================================
> --- linux-2.6.24-rc8.orig/arch/powerpc/platforms/pseries/lpar.c	2008-01-15 20:22:48.000000000 -0800
> +++ linux-2.6.24-rc8/arch/powerpc/platforms/pseries/lpar.c	2008-01-28 14:10:58.000000000 -0800
> @@ -520,6 +520,20 @@ static void pSeries_lpar_hpte_invalidate
>  	BUG_ON(lpar_rc != H_SUCCESS);
>  }
>  
> +static void pSeries_lpar_hpte_removebolted(unsigned long ea,
> +					   int psize, int ssize)
> +{
> +	unsigned long slot, vsid, va;
> +
> +	vsid = get_kernel_vsid(ea, ssize);
> +	va = hpt_va(ea, vsid, ssize);
> +
> +	slot = pSeries_lpar_hpte_find(va, psize, ssize);
> +	BUG_ON(slot == -1);
> +
> +	pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0);
> +}
> +
>  /* Flag bits for H_BULK_REMOVE */
>  #define HBR_REQUEST	0x4000000000000000UL
>  #define HBR_RESPONSE	0x8000000000000000UL
> @@ -597,6 +611,7 @@ void __init hpte_init_lpar(void)
>  	ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp;
>  	ppc_md.hpte_insert	= pSeries_lpar_hpte_insert;
>  	ppc_md.hpte_remove	= pSeries_lpar_hpte_remove;
> +	ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted;
>  	ppc_md.flush_hash_range	= pSeries_lpar_flush_hash_range;
>  	ppc_md.hpte_clear_all   = pSeries_lpar_hptab_clear;
>  }
> Index: linux-2.6.24-rc8/include/asm-powerpc/machdep.h
> ===================================================================
> --- linux-2.6.24-rc8.orig/include/asm-powerpc/machdep.h	2008-01-25 08:04:41.000000000 -0800
> +++ linux-2.6.24-rc8/include/asm-powerpc/machdep.h	2008-01-28 11:45:17.000000000 -0800
> @@ -68,6 +68,8 @@ struct machdep_calls {
>  				       unsigned long vflags,
>  				       int psize, int ssize);
>  	long		(*hpte_remove)(unsigned long hpte_group);
> +	void            (*hpte_removebolted)(unsigned long ea,
> +					     int psize, int ssize);
>  	void		(*flush_hash_range)(unsigned long number, int local);
>  
>  	/* special for kexec, to be called in real mode, linar mapping is
> 
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Yasunori Goto 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [-mm PATCH] updates for hotplug memory remove
  2008-01-29  5:18   ` Yasunori Goto
@ 2008-01-30  0:31     ` Badari Pulavarty
  2008-01-30  1:13       ` Yasunori Goto
  0 siblings, 1 reply; 5+ messages in thread
From: Badari Pulavarty @ 2008-01-30  0:31 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: Andrew Morton, linux-mm, linuxppc-dev

On Tue, 2008-01-29 at 14:18 +0900, Yasunori Goto wrote:
> Hello. Badari-san.
> 
> Is your patch for notification the event of removing to firmware, right?

Correct. 

> 
> Have you ever tested hotadd(probe) of the removed memory?

Yes. I did. In my touch testing, I was able to remove memory and add
it back to the system without any issues. But again, I didn't force
the system to use that memory :(

> I'm afraid there are some differences of the status between pre hot-add
> section and the removed section by this patch. I think the mem_section of
> removed memory should be invalidated at least.

I think its a generic issue. Nothing specific for ppc64. Isn't it ? 

Thanks,
Badari

> 
> But anyway, this is a great first step for physical memory remove.
> 
> Thanks.
> 
> 
> > On Mon, 2008-01-28 at 16:31 -0800, Badari Pulavarty wrote:
> > 
> > 
> > > 2) Can you replace the following patch with this ?
> > > 
> > > add-remove_memory-for-ppc64-2.patch
> > > 
> > > I found that, I do need arch-specific hooks to get the memory remove
> > > working on ppc64 LPAR. Earlier, I tried to make remove_memory() arch
> > > neutral, but we do need arch specific hooks.
> > > 
> > > Thanks,
> > > Badari
> > 
> > Andrew,
> > 
> > Here is the patch which provides arch-specific code to complete memory
> > remove on ppc64 LPAR. So far, it works fine in my testing - but waiting
> > for ppc-experts for review and completeness. 
> > 
> > FYI.
> > 
> > Thanks,
> > Badari
> > 
> > For memory remove, we need to clean up htab mappings for the
> > section of the memory we are removing.
> > 
> > This patch implements support for removing htab bolted mappings
> > for ppc64 lpar. Other sub-archs, may need to implement similar
> > functionality for the hotplug memory remove to work. 
> > 
> > Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
> > ---
> >  arch/powerpc/mm/hash_utils_64.c       |   23 +++++++++++++++++++++++
> >  arch/powerpc/mm/mem.c                 |    4 +++-
> >  arch/powerpc/platforms/pseries/lpar.c |   15 +++++++++++++++
> >  include/asm-powerpc/machdep.h         |    2 ++
> >  include/asm-powerpc/sparsemem.h       |    1 +
> >  5 files changed, 44 insertions(+), 1 deletion(-)
> > 
> > Index: linux-2.6.24-rc8/arch/powerpc/mm/hash_utils_64.c
> > ===================================================================
> > --- linux-2.6.24-rc8.orig/arch/powerpc/mm/hash_utils_64.c	2008-01-25 08:04:32.000000000 -0800
> > +++ linux-2.6.24-rc8/arch/powerpc/mm/hash_utils_64.c	2008-01-28 11:45:40.000000000 -0800
> > @@ -191,6 +191,24 @@ int htab_bolt_mapping(unsigned long vsta
> >  	return ret < 0 ? ret : 0;
> >  }
> >  
> > +static void htab_remove_mapping(unsigned long vstart, unsigned long vend,
> > +		      int psize, int ssize)
> > +{
> > +	unsigned long vaddr;
> > +	unsigned int step, shift;
> > +
> > +	shift = mmu_psize_defs[psize].shift;
> > +	step = 1 << shift;
> > +
> > +	if (!ppc_md.hpte_removebolted) {
> > +		printk("Sub-arch doesn't implement hpte_removebolted\n");
> > +		return;
> > +	}
> > +
> > +	for (vaddr = vstart; vaddr < vend; vaddr += step)
> > +		ppc_md.hpte_removebolted(vaddr, psize, ssize);
> > +}
> > +
> >  static int __init htab_dt_scan_seg_sizes(unsigned long node,
> >  					 const char *uname, int depth,
> >  					 void *data)
> > @@ -436,6 +454,11 @@ void create_section_mapping(unsigned lon
> >  			_PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX,
> >  			mmu_linear_psize, mmu_kernel_ssize));
> >  }
> > +
> > +void remove_section_mapping(unsigned long start, unsigned long end)
> > +{
> > +	htab_remove_mapping(start, end, mmu_linear_psize, mmu_kernel_ssize);
> > +}
> >  #endif /* CONFIG_MEMORY_HOTPLUG */
> >  
> >  static inline void make_bl(unsigned int *insn_addr, void *func)
> > Index: linux-2.6.24-rc8/include/asm-powerpc/sparsemem.h
> > ===================================================================
> > --- linux-2.6.24-rc8.orig/include/asm-powerpc/sparsemem.h	2008-01-15 20:22:48.000000000 -0800
> > +++ linux-2.6.24-rc8/include/asm-powerpc/sparsemem.h	2008-01-25 08:18:11.000000000 -0800
> > @@ -20,6 +20,7 @@
> >  
> >  #ifdef CONFIG_MEMORY_HOTPLUG
> >  extern void create_section_mapping(unsigned long start, unsigned long end);
> > +extern void remove_section_mapping(unsigned long start, unsigned long end);
> >  #ifdef CONFIG_NUMA
> >  extern int hot_add_scn_to_nid(unsigned long scn_addr);
> >  #else
> > Index: linux-2.6.24-rc8/arch/powerpc/mm/mem.c
> > ===================================================================
> > --- linux-2.6.24-rc8.orig/arch/powerpc/mm/mem.c	2008-01-25 08:16:37.000000000 -0800
> > +++ linux-2.6.24-rc8/arch/powerpc/mm/mem.c	2008-01-25 08:20:33.000000000 -0800
> > @@ -156,7 +156,9 @@ int remove_memory(u64 start, u64 size)
> >  	ret = offline_pages(start_pfn, end_pfn, 120 * HZ);
> >  	if (ret)
> >  		goto out;
> > -	/* Arch-specific calls go here - next patch */
> > +
> > +	start = (unsigned long)__va(start);
> > +	remove_section_mapping(start, start + size);
> >  out:
> >  	return ret;
> >  }
> > Index: linux-2.6.24-rc8/arch/powerpc/platforms/pseries/lpar.c
> > ===================================================================
> > --- linux-2.6.24-rc8.orig/arch/powerpc/platforms/pseries/lpar.c	2008-01-15 20:22:48.000000000 -0800
> > +++ linux-2.6.24-rc8/arch/powerpc/platforms/pseries/lpar.c	2008-01-28 14:10:58.000000000 -0800
> > @@ -520,6 +520,20 @@ static void pSeries_lpar_hpte_invalidate
> >  	BUG_ON(lpar_rc != H_SUCCESS);
> >  }
> >  
> > +static void pSeries_lpar_hpte_removebolted(unsigned long ea,
> > +					   int psize, int ssize)
> > +{
> > +	unsigned long slot, vsid, va;
> > +
> > +	vsid = get_kernel_vsid(ea, ssize);
> > +	va = hpt_va(ea, vsid, ssize);
> > +
> > +	slot = pSeries_lpar_hpte_find(va, psize, ssize);
> > +	BUG_ON(slot == -1);
> > +
> > +	pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0);
> > +}
> > +
> >  /* Flag bits for H_BULK_REMOVE */
> >  #define HBR_REQUEST	0x4000000000000000UL
> >  #define HBR_RESPONSE	0x8000000000000000UL
> > @@ -597,6 +611,7 @@ void __init hpte_init_lpar(void)
> >  	ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp;
> >  	ppc_md.hpte_insert	= pSeries_lpar_hpte_insert;
> >  	ppc_md.hpte_remove	= pSeries_lpar_hpte_remove;
> > +	ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted;
> >  	ppc_md.flush_hash_range	= pSeries_lpar_flush_hash_range;
> >  	ppc_md.hpte_clear_all   = pSeries_lpar_hptab_clear;
> >  }
> > Index: linux-2.6.24-rc8/include/asm-powerpc/machdep.h
> > ===================================================================
> > --- linux-2.6.24-rc8.orig/include/asm-powerpc/machdep.h	2008-01-25 08:04:41.000000000 -0800
> > +++ linux-2.6.24-rc8/include/asm-powerpc/machdep.h	2008-01-28 11:45:17.000000000 -0800
> > @@ -68,6 +68,8 @@ struct machdep_calls {
> >  				       unsigned long vflags,
> >  				       int psize, int ssize);
> >  	long		(*hpte_remove)(unsigned long hpte_group);
> > +	void            (*hpte_removebolted)(unsigned long ea,
> > +					     int psize, int ssize);
> >  	void		(*flush_hash_range)(unsigned long number, int local);
> >  
> >  	/* special for kexec, to be called in real mode, linar mapping is
> > 
> > 
> > --
> > To unsubscribe, send a message with 'unsubscribe linux-mm' in
> > the body to majordomo@kvack.org.  For more info on Linux MM,
> > see: http://www.linux-mm.org/ .
> > Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [-mm PATCH] updates for hotplug memory remove
  2008-01-30  0:31     ` Badari Pulavarty
@ 2008-01-30  1:13       ` Yasunori Goto
  0 siblings, 0 replies; 5+ messages in thread
From: Yasunori Goto @ 2008-01-30  1:13 UTC (permalink / raw)
  To: Badari Pulavarty; +Cc: Andrew Morton, linux-mm, linuxppc-dev

> > Have you ever tested hotadd(probe) of the removed memory?
> 
> Yes. I did. In my touch testing, I was able to remove memory and add
> it back to the system without any issues.

Oh, really!?

> But again, I didn't force
> the system to use that memory :(

Ah..OK.

> 
> > I'm afraid there are some differences of the status between pre hot-add
> > section and the removed section by this patch. I think the mem_section of
> > removed memory should be invalidated at least.
> 
> I think its a generic issue. Nothing specific for ppc64. Isn't it ? 

Right.
Currently, our machine doesn't have real physical remove feature yet.
(only add).
So, I think testing is not enough around physical removing.
Probably, your box will be first one which can remove physical memory
with Linux. It is good for testing. 
If you notice anything, please let me know. :-)


Bye.

-- 
Yasunori Goto 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-01-30  1:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-29  0:31 [-mm PATCH] updates for hotplug memory remove Badari Pulavarty
2008-01-29  0:35 ` Badari Pulavarty
2008-01-29  5:18   ` Yasunori Goto
2008-01-30  0:31     ` Badari Pulavarty
2008-01-30  1:13       ` Yasunori Goto

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).