• Nathan Fontenot's avatar
    powerpc/pseries: Use stop machine to update cpu maps · 30c05350
    Nathan Fontenot authored
    The new PRRN firmware feature allows CPU and memory resources to be
    transparently reassigned across NUMA boundaries. When this happens, the
    kernel must update the node maps to reflect the new affinity information.
    
    Although the NUMA maps can be protected by locking primitives during the
    update itself, this is insufficient to prevent concurrent accesses to these
    structures. Since cpumask_of_node() hands out a pointer to these
    structures, they can still be modified outside of the lock. Furthermore,
    tracking down each usage of these pointers and adding locks would be quite
    invasive and difficult to maintain.
    
    The approach used is to make a list of affected cpus and call stop_machine
    to have the update routine run on each of the affected cpus allowing them
    to update themselves. Each cpu finds itself in the list of cpus and makes
    the appropriate updates. We need to have each cpu do this for themselves to
    handle calls to vdso_getcpu_init() added in a subsequent patch.
    
    Situations like these are best handled using stop_machine(). Since the NUMA
    affinity updates are exceptionally rare events, this approach has the
    benefit of not adding any overhead while accessing the NUMA maps during
    normal operation.
    Signed-off-by: default avatarNathan Fontenot <nfont@linux.vnet.ibm.com>
    Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    30c05350
numa.c 38.5 KB