• Nathan Lynch's avatar
    powerpc/pseries/cpuhp: delete add/remove_by_count code · fa2a5dfe
    Nathan Lynch authored
    The core DLPAR code supports two actions (add and remove) and three
    subtypes of action:
    
    * By DRC index: the action is attempted on a single specified resource.
      This is the usual case for processors.
    * By indexed count: the action is attempted on a range of resources
      beginning at the specified index. This is implemented only by the memory
      DLPAR code.
    * By count: the lower layer (CPU or memory) is responsible for locating the
      specified number of resources to which the action can be applied.
    
    I cannot find any evidence of the "by count" subtype being used by drmgr or
    qemu for processors. And when I try to exercise this code, the add case
    does not work:
    
      $ ppc64_cpu --smt ; nproc
      SMT=8
      24
      $ printf "cpu remove count 2" > /sys/kernel/dlpar
      $ nproc
      8
      $ printf "cpu add count 2" > /sys/kernel/dlpar
      -bash: printf: write error: Invalid argument
      $ dmesg | tail -2
      pseries-hotplug-cpu: Failed to find enough CPUs (1 of 2) to add
      dlpar: Could not handle DLPAR request "cpu add count 2"
      $ nproc
      8
      $ drmgr -c cpu -a -q 2         # this uses the by-index method
      Validating CPU DLPAR capability...yes.
      CPU 1
      CPU 17
      $ nproc
      24
    
    This is because find_drc_info_cpus_to_add() does not increment drc_index
    appropriately during its search.
    
    This is not hard to fix. But the _by_count() functions also have the
    property that they attempt to roll back all prior operations if the entire
    request cannot be satisfied, even though the rollback itself can encounter
    errors. It's not possible to provide transaction-like behavior at this
    level, and it's undesirable to have code that can only pretend to do that.
    Any users of these functions cannot know what the state of the system is in
    the error case. And the error paths are, to my knowledge, impossible to
    test without adding custom error injection code.
    
    Summary:
    
    * This code has not worked reliably since its introduction.
    * There is no evidence that it is used.
    * It contains questionable rollback behaviors in error paths which are
      difficult to test.
    
    So let's remove it.
    
    Fixes: ac713800 ("powerpc/pseries: Add CPU dlpar remove functionality")
    Fixes: 90edf184 ("powerpc/pseries: Add CPU dlpar add functionality")
    Fixes: b015f6bc ("powerpc/pseries: Add cpu DLPAR support for drc-info property")
    Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
    Tested-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
    Reviewed-by: default avatarDaniel Henrique Barboza <danielhb413@gmail.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20210927201933.76786-4-nathanl@linux.ibm.com
    fa2a5dfe
hotplug-cpu.c 19.5 KB