[FIX PATCH v0] powerpc: Fix memory unplug failure on radix guest
Reza Arbab
arbab at linux.vnet.ibm.com
Fri Aug 11 02:50:19 AEST 2017
On Thu, Aug 10, 2017 at 02:53:48PM +0530, Bharata B Rao wrote:
>diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
>index f830562..24ecf53 100644
>--- a/arch/powerpc/kernel/prom.c
>+++ b/arch/powerpc/kernel/prom.c
>@@ -524,6 +524,7 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
> size = 0x80000000ul - base;
> }
> memblock_add(base, size);
>+ memblock_mark_hotplug(base, size);
> } while (--rngs);
> }
> memblock_dump_all();
Doing this has the effect of putting all the affected memory into
ZONE_MOVABLE. See find_zone_movable_pfns_for_nodes(). This means no
kernel allocations can occur there. Is that okay?
>diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
>index 671a45d..180d25a 100644
>--- a/arch/powerpc/mm/pgtable-radix.c
>+++ b/arch/powerpc/mm/pgtable-radix.c
>@@ -12,6 +12,7 @@
> #include <linux/memblock.h>
> #include <linux/of_fdt.h>
> #include <linux/mm.h>
>+#include <linux/memory.h>
>
> #include <asm/pgtable.h>
> #include <asm/pgalloc.h>
>@@ -255,15 +256,25 @@ static void __init radix_init_pgtable(void)
> {
> unsigned long rts_field;
> struct memblock_region *reg;
>+ phys_addr_t addr;
>+ u64 lmb_size = memory_block_size_bytes();
>
> /* We don't support slb for radix */
> mmu_slb_size = 0;
> /*
> * Create the linear mapping, using standard page size for now
> */
>- for_each_memblock(memory, reg)
>- WARN_ON(create_physical_mapping(reg->base,
>- reg->base + reg->size));
>+ for_each_memblock(memory, reg) {
>+ if (memblock_is_hotpluggable(reg)) {
>+ for (addr = reg->base; addr < (reg->base + reg->size);
>+ addr += lmb_size)
>+ WARN_ON(create_physical_mapping(addr,
>+ addr + lmb_size));
>+ } else {
>+ WARN_ON(create_physical_mapping(reg->base,
>+ reg->base + reg->size));
>+ }
>+ }
>
> /* Find out how many PID bits are supported */
> if (cpu_has_feature(CPU_FTR_HVMODE)) {
>--
>2.7.4
>
--
Reza Arbab
More information about the Linuxppc-dev
mailing list