• Akinobu Mita's avatar
    cpu-hotplug: return better errno on cpu hotplug failure · e6bde73b
    Akinobu Mita authored
    Currently, onlining or offlining a CPU failure by one of the cpu notifiers
    error always cause -EINVAL error.  (i.e.  writing 0 or 1 to
    /sys/devices/system/cpu/cpuX/online gets EINVAL)
    
    To get better error reporting rather than always getting -EINVAL, This
    changes cpu_notify() to return -errno value with notifier_to_errno() and
    fix the callers.  Now that cpu notifiers can return encapsulate errno
    value.
    
    Currently, all cpu hotplug notifiers return NOTIFY_OK, NOTIFY_BAD, or
    NOTIFY_DONE.  So cpu_notify() can returns 0 or -EPERM with this change for
    now.
    
    (notifier_to_errno(NOTIFY_OK) == 0, notifier_to_errno(NOTIFY_DONE) == 0,
    notifier_to_errno(NOTIFY_BAD) == -EPERM)
    
    Forthcoming patches convert several cpu notifiers to return encapsulate
    errno value with notifier_from_errno().
    Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    e6bde73b
cpu.c 13.7 KB