Bug 78478

Summary: Please add CPU and memory hotplug udev rules
Product: systemd Reporter: Benjamin Drung <benjamin.drung>
Component: generalAssignee: systemd-bugs
Status: RESOLVED NOTOURBUG QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Benjamin Drung 2014-05-09 09:25:28 UTC
Hi,

please add udev rules to enable hotplugged CPUs and memory. I propose following two rules:

ACTION=="add", SUBSYSTEM=="cpu", ATTR{online}=="0", ATTR{online}="1"
ACTION=="add", SUBSYSTEM=="memory", ATTR{state}=="offline", ATTR{state}="online"

These rules are tested (without the ATTR online/state checks) on Debian 7/testing, Fedora 19/20/21, and Ubuntu 12.04/13.10/14.04.

Some distributions already ship CPU and memory hotplug rules. openSUSE 13.1 has 80-hotplug-cpu-mem.rules:

SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
SUBSYSTEM=="memory", ACTION=="add", TEST=="state", ATTR{state}=="offline", ATTR{state}="online"

CentOS 6 modified the acpi_memhotplug kernel module to automatically online memory (configurable with CONFIG_ACPI_HOTPLUG_MEMORY_AUTO_ONLINE). This patch is not mainlined (yet). They ship one rule for CPU hotplugging in /lib/udev/rules.d/40-redhat.rules:

ACTION=="add", KERNEL=="cpu[0-9]*", RUN+="/bin/bash -c 'echo 1 > /sys/devices/system/cpu/%k/online'"
Comment 1 Kay Sievers 2014-05-09 09:33:05 UTC
This is just a job for the kernel, it makes no sense to loop the kernel's
events through userspace/udev, just to push the same information
_unconditonally_ back into to the kernel.

This needs to be sorted out in the kernel and not in userspace. At a general
level, it is the very wrong model to do things, udev is not meant to do things
like that.

Even when some distributions ship this weird stuff, it does not make this
right, and it cannot be the reason to copy this to upstream udev.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.