powerpc/mm: move warning from resize_hpt_for_hotplug()
PATCH v3 1/1 powerpc/mm: move warning from resize_hpt_for_hotplug()
resize_hpt_for_hotplug() reports a warning when it cannot resize the hash page table ("Unable to resize hash page table to target order") but in some cases it's not a problem and can make user thinks something has not worked properly.
This patch moves the warning to arch_remove_memory() to only report the problem when it is needed.
---
Notes:
v3: move "||" to above line and remove parenthesis
v2: add warning messages for H_PARAMETER and H_RESOURCE
arch/powerpc/include/asm/sparsemem.h | 4 ++-- arch/powerpc/mm/hash_utils_64.c | 19 +++++++------------ arch/powerpc/mm/mem.c | 3 ++- arch/powerpc/platforms/pseries/lpar.c | 3 ++- 4 files changed, 13 insertions(+), 16 deletions(-)
arch/powerpc/include/asm/sparsemem.h +2 -2
@@ -17,9 +17,9 @@ extern int create_section_mapping(unsigned long start, unsigned long end, int niextern int remove_section_mapping (unsigned long start,unsigned long end);#ifdef CONFIG_PPC_BOOK3S_64 -extern void resize_hpt_for_hotplug (unsigned long new_mem_size); +extern int resize_hpt_for_hotplug (unsigned long new_mem_size);#else -static inline void resize_hpt_for_hotplug (unsigned long new_mem_size) { } +static inline int resize_hpt_for_hotplug (unsigned long new_mem_size) {return 0 ; }#endif #ifdef CONFIG_NUMA
arch/powerpc/mm/hash_utils_64.c +7 -12
@@ -755,12 +755,12 @@ static unsigned long __init htab_get_table_size(void) }#ifdef CONFIG_MEMORY_HOTPLUG -void resize_hpt_for_hotplug (unsigned long new_mem_size) +int resize_hpt_for_hotplug (unsigned long new_mem_size) {unsigned target_hpt_shift;if (!mmu_hash_ops.resize_hpt) -return ; +return 0 ; target_hpt_shift =htab_shift_for_mem_size (new_mem_size);
@@ -772,16 +772,11 @@ void resize_hpt_for_hotplug(unsigned long new_mem_size)* reduce unless the target shift is at least 2 below the * current shift */ -if ((target_hpt_shift > ppc64_pft_size) - || (target_hpt_shift < (ppc64_pft_size -1 ))) { -int rc; - - rc = mmu_hash_ops.resize_hpt (target_hpt_shift); -if (rc && (rc != -ENODEV )) -printk (KERN_WARNING -"Unable to resize hash page table to target order %d: %d\n" , - target_hpt_shift, rc); - } +if (target_hpt_shift > ppc64_pft_size || + target_hpt_shift < ppc64_pft_size -1 ) +return mmu_hash_ops.resize_hpt (target_hpt_shift); + +return 0 ; }int hash__create_section_mapping (unsigned long start,unsigned long end,int nid)
arch/powerpc/mm/mem.c +2 -1
@@ -169,7 +169,8 @@ int __meminit arch_remove_memory(int nid, u64 start, u64 size,*/ vm_unmap_aliases (); -resize_hpt_for_hotplug (memblock_phys_mem_size ()); +if (resize_hpt_for_hotplug (memblock_phys_mem_size ()) == -ENOSPC ) +pr_warn ("Hash collision while resizing HPT\n" );return ret; }
arch/powerpc/platforms/pseries/lpar.c +2 -1
@@ -901,8 +901,10 @@ static int pseries_lpar_resize_hpt(unsigned long shift)break ;case H_PARAMETER : +pr_warn ("Invalid argument from H_RESIZE_HPT_PREPARE\n" );return -EINVAL ;case H_RESOURCE : +pr_warn ("Operation not permitted from H_RESIZE_HPT_PREPARE\n" );return -EPERM ;default :pr_warn ("Unexpected error %d from H_RESIZE_HPT_PREPARE\n" , rc);
@@ -918,7 +920,6 @@ static int pseries_lpar_resize_hpt(unsigned long shift)if (rc !=0 ) {switch (state.commit_rc) {case H_PTEG_FULL : -pr_warn ("Hash collision while resizing HPT\n" );return -ENOSPC ;default :
Signature · 1 line
2.20.1
Le 13/03/2019 à 11:25, Laurent Vivier a écrit :
Quoted 10 lines
resize_hpt_for_hotplug()reports a warning when it cannot resize the hash page table ("Unable to resize hash page table to target order") but in some cases it's not a problem and can make user thinks something has not worked properly.This patch moves the warning to
arch_remove_memory()to only report the problem when it is needed.Reviewed-by David Gibson <[email protected]>Signed-off-by Laurent Vivier <[email protected]>
Quoted 107 lines
---
Notes:
v3: move "||" to above line and remove parenthesis
v2: add warning messages forH_PARAMETERandH_RESOURCEarch/powerpc/include/asm/sparsemem.h | 4 ++-- arch/powerpc/mm/hash_utils_64.c | 19 +++++++------------ arch/powerpc/mm/mem.c | 3 ++- arch/powerpc/platforms/pseries/lpar.c | 3 ++- 4 files changed, 13 insertions(+), 16 deletions(-)arch/powerpc/include/asm/sparsemem.h +2
-2@@ -17,9 +17,9 @@ extern int create_section_mapping(unsigned long start, unsigned long end, int niextern int remove_section_mapping (unsigned long start,unsigned long end);#ifdef CONFIG_PPC_BOOK3S_64 -extern void resize_hpt_for_hotplug (unsigned long new_mem_size); +extern int resize_hpt_for_hotplug (unsigned long new_mem_size);#else -static inline void resize_hpt_for_hotplug (unsigned long new_mem_size) { } +static inline int resize_hpt_for_hotplug (unsigned long new_mem_size) {return 0 ; }#endif #ifdef CONFIG_NUMA arch/powerpc/mm/hash_utils_64.c +7
-12@@ -755,12 +755,12 @@ static unsigned long __init htab_get_table_size(void) }#ifdef CONFIG_MEMORY_HOTPLUG -void resize_hpt_for_hotplug (unsigned long new_mem_size) +int resize_hpt_for_hotplug (unsigned long new_mem_size) {unsigned target_hpt_shift;if (!mmu_hash_ops.resize_hpt) -return ; +return 0 ; target_hpt_shift =htab_shift_for_mem_size (new_mem_size);@@ -772,16 +772,11 @@ void resize_hpt_for_hotplug(unsigned long new_mem_size)* reduce unless the target shift is at least 2 below the * current shift */ -if ((target_hpt_shift > ppc64_pft_size) - || (target_hpt_shift < (ppc64_pft_size -1 ))) { -int rc; - - rc = mmu_hash_ops.resize_hpt (target_hpt_shift); -if (rc && (rc != -ENODEV )) -printk (KERN_WARNING -"Unable to resize hash page table to target order %d: %d\n" , - target_hpt_shift, rc); - } +if (target_hpt_shift > ppc64_pft_size || + target_hpt_shift < ppc64_pft_size -1 ) +return mmu_hash_ops.resize_hpt (target_hpt_shift); + +return 0 ; }int hash__create_section_mapping (unsigned long start,unsigned long end,int nid)arch/powerpc/mm/mem.c +2
-1@@ -169,7 +169,8 @@ int __meminit arch_remove_memory(int nid, u64 start, u64 size,*/ vm_unmap_aliases (); -resize_hpt_for_hotplug (memblock_phys_mem_size ()); +if (resize_hpt_for_hotplug (memblock_phys_mem_size ()) == -ENOSPC ) +pr_warn ("Hash collision while resizing HPT\n" );return ret; }arch/powerpc/platforms/pseries/lpar.c +2
-1@@ -901,8 +901,10 @@ static int pseries_lpar_resize_hpt(unsigned long shift)break ;case H_PARAMETER : +pr_warn ("Invalid argument from H_RESIZE_HPT_PREPARE\n" );return -EINVAL ;case H_RESOURCE : +pr_warn ("Operation not permitted from H_RESIZE_HPT_PREPARE\n" );return -EPERM ;default :pr_warn ("Unexpected error %d from H_RESIZE_HPT_PREPARE\n" , rc);@@ -918,7 +920,6 @@ static int pseries_lpar_resize_hpt(unsigned long shift)if (rc !=0 ) {switch (state.commit_rc) {case H_PTEG_FULL : -pr_warn ("Hash collision while resizing HPT\n" );return -ENOSPC ;default :
Hi Michael,
as it seems good now, could you pick up this patch for merging?
Thanks,
Laurent
Quoted 117 lines · Laurent Vivier
resize_hpt_for_hotplug()reports a warning when it cannot resize the hash page table ("Unable to resize hash page table to target order") but in some cases it's not a problem and can make user thinks something has not worked properly.This patch moves the warning to
arch_remove_memory()to only report the problem when it is needed.Reviewed-by David Gibson <[email protected]>Signed-off-by Laurent Vivier <[email protected]>---
Notes:
v3: move "||" to above line and remove parenthesis
v2: add warning messages forH_PARAMETERandH_RESOURCEarch/powerpc/include/asm/sparsemem.h | 4 ++-- arch/powerpc/mm/hash_utils_64.c | 19 +++++++------------ arch/powerpc/mm/mem.c | 3 ++- arch/powerpc/platforms/pseries/lpar.c | 3 ++- 4 files changed, 13 insertions(+), 16 deletions(-)arch/powerpc/include/asm/sparsemem.h +2
-2@@ -17,9 +17,9 @@ extern int create_section_mapping(unsigned long start, unsigned long end, int niextern int remove_section_mapping (unsigned long start,unsigned long end);#ifdef CONFIG_PPC_BOOK3S_64 -extern void resize_hpt_for_hotplug (unsigned long new_mem_size); +extern int resize_hpt_for_hotplug (unsigned long new_mem_size);#else -static inline void resize_hpt_for_hotplug (unsigned long new_mem_size) { } +static inline int resize_hpt_for_hotplug (unsigned long new_mem_size) {return 0 ; }#endif #ifdef CONFIG_NUMA arch/powerpc/mm/hash_utils_64.c +7
-12@@ -755,12 +755,12 @@ static unsigned long __init htab_get_table_size(void) }#ifdef CONFIG_MEMORY_HOTPLUG -void resize_hpt_for_hotplug (unsigned long new_mem_size) +int resize_hpt_for_hotplug (unsigned long new_mem_size) {unsigned target_hpt_shift;if (!mmu_hash_ops.resize_hpt) -return ; +return 0 ; target_hpt_shift =htab_shift_for_mem_size (new_mem_size);@@ -772,16 +772,11 @@ void resize_hpt_for_hotplug(unsigned long new_mem_size)* reduce unless the target shift is at least 2 below the * current shift */ -if ((target_hpt_shift > ppc64_pft_size) - || (target_hpt_shift < (ppc64_pft_size -1 ))) { -int rc; - - rc = mmu_hash_ops.resize_hpt (target_hpt_shift); -if (rc && (rc != -ENODEV )) -printk (KERN_WARNING -"Unable to resize hash page table to target order %d: %d\n" , - target_hpt_shift, rc); - } +if (target_hpt_shift > ppc64_pft_size || + target_hpt_shift < ppc64_pft_size -1 ) +return mmu_hash_ops.resize_hpt (target_hpt_shift); + +return 0 ; }int hash__create_section_mapping (unsigned long start,unsigned long end,int nid)arch/powerpc/mm/mem.c +2
-1@@ -169,7 +169,8 @@ int __meminit arch_remove_memory(int nid, u64 start, u64 size,*/ vm_unmap_aliases (); -resize_hpt_for_hotplug (memblock_phys_mem_size ()); +if (resize_hpt_for_hotplug (memblock_phys_mem_size ()) == -ENOSPC ) +pr_warn ("Hash collision while resizing HPT\n" );return ret; }arch/powerpc/platforms/pseries/lpar.c +2
-1@@ -901,8 +901,10 @@ static int pseries_lpar_resize_hpt(unsigned long shift)break ;case H_PARAMETER : +pr_warn ("Invalid argument from H_RESIZE_HPT_PREPARE\n" );return -EINVAL ;case H_RESOURCE : +pr_warn ("Operation not permitted from H_RESIZE_HPT_PREPARE\n" );return -EPERM ;default :pr_warn ("Unexpected error %d from H_RESIZE_HPT_PREPARE\n" , rc);@@ -918,7 +920,6 @@ static int pseries_lpar_resize_hpt(unsigned long shift)if (rc !=0 ) {switch (state.commit_rc) {case H_PTEG_FULL : -pr_warn ("Hash collision while resizing HPT\n" );return -ENOSPC ;default :
Michael Ellerman
reviewerQuoted 3 lines · Laurent Vivier
Hi Michael,
as it seems good now, could you pick up this patch for merging?
I'll start picking up patches for next starting after rc2, so next week.
If you think it's a bug fix I can put it into fixes now, but I don't think it's a bug fix is it?
cheers
Quoted 9 lines · Michael Ellerman
Quoted 3 lines · Laurent Vivier
Hi Michael,
as it seems good now, could you pick up this patch for merging?
I'll start picking up patches for next starting after rc2, so next week.
If you think it's a bug fix I can put it into fixes now, but I don't think it's a bug fix is it?
No, it's only cosmetic.
Thanks,
Laurent
Quoted 9 lines · Michael Ellerman
Quoted 3 lines · Laurent Vivier
Hi Michael,
as it seems good now, could you pick up this patch for merging?
I'll start picking up patches for next starting after rc2, so next week.
If you think it's a bug fix I can put it into fixes now, but I don't think it's a bug fix is it?
Any news about this patch?
Thanks,
Laurent
Michael Ellerman
AppliedQuoted 11 lines · Laurent Vivier
resize_hpt_for_hotplug()reports a warning when it cannot resize the hash page table ("Unable to resize hash page table to target order") but in some cases it's not a problem and can make user thinks something has not worked properly.This patch moves the warning to
arch_remove_memory()to only report the problem when it is needed.Reviewed-by David Gibson <[email protected]>Signed-off-by Laurent Vivier <[email protected]>Reviewed-by Christophe Leroy <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/f172acbfae1a78b1a3c775f78e8d0dcd
cheers