• Laurent Dufour's avatar
    pseries/drmem: update LMBs after LPM · d144f4d5
    Laurent Dufour authored
    After a LPM, the device tree node ibm,dynamic-reconfiguration-memory may be
    updated by the hypervisor in the case the NUMA topology of the LPAR's
    memory is updated.
    
    This is handled by the kernel, but the memory's node is not updated because
    there is no way to move a memory block between nodes from the Linux kernel
    point of view.
    
    If later a memory block is added or removed, drmem_update_dt() is called
    and it is overwriting the DT node ibm,dynamic-reconfiguration-memory to
    match the added or removed LMB. But the LMB's associativity node has not
    been updated after the DT node update and thus the node is overwritten by
    the Linux's topology instead of the hypervisor one.
    
    Introduce a hook called when the ibm,dynamic-reconfiguration-memory node is
    updated to force an update of the LMB's associativity. However, ignore the
    call to that hook when the update has been triggered by drmem_update_dt().
    Because, in that case, the LMB tree has been used to set the DT property
    and thus it doesn't need to be updated back. Since drmem_update_dt() is
    called under the protection of the device_hotplug_lock and the hook is
    called in the same context, use a simple boolean variable to detect that
    call.
    Signed-off-by: default avatarLaurent Dufour <ldufour@linux.ibm.com>
    Reviewed-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20210517090606.56930-1-ldufour@linux.ibm.com
    d144f4d5
hotplug-memory.c 21.6 KB