Commit 55548a86 authored by Bharata B Rao's avatar Bharata B Rao Committed by Michael Ellerman

powerpc/mm: Limit resize_hpt_for_hotplug() call to hash guests only

During memory hotplug and unplug, resize_hpt_for_hotplug() gets called
for both hash and radix guests but it should be called only for hash
guests. Though the call does nothing in the radix guest case, it is
cleaner to push this call into hash specific memory hotplug routines.
Reported-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: default avatarBharata B Rao <bharata@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200727095704.1432916-1-bharata@linux.ibm.com
parent 73da08f6
...@@ -17,12 +17,6 @@ extern int create_section_mapping(unsigned long start, unsigned long end, ...@@ -17,12 +17,6 @@ extern int create_section_mapping(unsigned long start, unsigned long end,
int nid, pgprot_t prot); int nid, pgprot_t prot);
extern int remove_section_mapping(unsigned long start, unsigned long end); extern int remove_section_mapping(unsigned long start, unsigned long end);
#ifdef CONFIG_PPC_BOOK3S_64
extern int resize_hpt_for_hotplug(unsigned long new_mem_size);
#else
static inline int resize_hpt_for_hotplug(unsigned long new_mem_size) { return 0; }
#endif
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
extern int hot_add_scn_to_nid(unsigned long scn_addr); extern int hot_add_scn_to_nid(unsigned long scn_addr);
#else #else
......
...@@ -785,7 +785,7 @@ static unsigned long __init htab_get_table_size(void) ...@@ -785,7 +785,7 @@ static unsigned long __init htab_get_table_size(void)
} }
#ifdef CONFIG_MEMORY_HOTPLUG #ifdef CONFIG_MEMORY_HOTPLUG
int resize_hpt_for_hotplug(unsigned long new_mem_size) static int resize_hpt_for_hotplug(unsigned long new_mem_size)
{ {
unsigned target_hpt_shift; unsigned target_hpt_shift;
...@@ -819,6 +819,8 @@ int hash__create_section_mapping(unsigned long start, unsigned long end, ...@@ -819,6 +819,8 @@ int hash__create_section_mapping(unsigned long start, unsigned long end,
return -1; return -1;
} }
resize_hpt_for_hotplug(memblock_phys_mem_size());
rc = htab_bolt_mapping(start, end, __pa(start), rc = htab_bolt_mapping(start, end, __pa(start),
pgprot_val(prot), mmu_linear_psize, pgprot_val(prot), mmu_linear_psize,
mmu_kernel_ssize); mmu_kernel_ssize);
...@@ -836,6 +838,10 @@ int hash__remove_section_mapping(unsigned long start, unsigned long end) ...@@ -836,6 +838,10 @@ int hash__remove_section_mapping(unsigned long start, unsigned long end)
int rc = htab_remove_mapping(start, end, mmu_linear_psize, int rc = htab_remove_mapping(start, end, mmu_linear_psize,
mmu_kernel_ssize); mmu_kernel_ssize);
WARN_ON(rc < 0); WARN_ON(rc < 0);
if (resize_hpt_for_hotplug(memblock_phys_mem_size()) == -ENOSPC)
pr_warn("Hash collision while resizing HPT\n");
return rc; return rc;
} }
#endif /* CONFIG_MEMORY_HOTPLUG */ #endif /* CONFIG_MEMORY_HOTPLUG */
......
...@@ -127,8 +127,6 @@ int __ref arch_add_memory(int nid, u64 start, u64 size, ...@@ -127,8 +127,6 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
unsigned long nr_pages = size >> PAGE_SHIFT; unsigned long nr_pages = size >> PAGE_SHIFT;
int rc; int rc;
resize_hpt_for_hotplug(memblock_phys_mem_size());
start = (unsigned long)__va(start); start = (unsigned long)__va(start);
rc = create_section_mapping(start, start + size, nid, rc = create_section_mapping(start, start + size, nid,
params->pgprot); params->pgprot);
...@@ -161,9 +159,6 @@ void __ref arch_remove_memory(int nid, u64 start, u64 size, ...@@ -161,9 +159,6 @@ void __ref arch_remove_memory(int nid, u64 start, u64 size,
* hit that section of memory * hit that section of memory
*/ */
vm_unmap_aliases(); vm_unmap_aliases();
if (resize_hpt_for_hotplug(memblock_phys_mem_size()) == -ENOSPC)
pr_warn("Hash collision while resizing HPT\n");
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment