Commit f5138e42 authored by Michael Holzheu's avatar Michael Holzheu Committed by Linus Torvalds
Browse files

kdump: add udev events for memory online/offline

Currently no udev events for memory hotplug "online" and "offline" are

  # udevadm monitor
  # echo offline > /sys/devices/system/memory/memory4/state
  ==> No event

When kdump is loaded, kexec detects the current memory configuration and
stores it in the pre-allocated ELF core header.  Therefore, for kdump it
is necessary to reload the kdump kernel with kexec when the memory
configuration changes (e.g.  for online/offline hotplug memory).

In order to do this automatically, udev rules should be used.  This kernel
patch adds udev events for "online" and "offline".  Together with this
kernel patch, the following udev rules for online/offline have to be added
to "/etc/udev/rules.d/98-kexec.rules":

  SUBSYSTEM=="memory", ACTION=="online", PROGRAM="/etc/init.d/kdump restart"
  SUBSYSTEM=="memory", ACTION=="offline", PROGRAM="/etc/init.d/kdump restart"

[ fixups for class to subsystem conversion]
Signed-off-by: default avatarMichael Holzheu <>
Cc: Heiko Carstens <>
Cc: Vivek Goyal <>
Cc: "Eric W. Biederman" <>
Cc: Kay Sievers <>
Cc: Dave Hansen <>
Cc: Martin Schwidefsky <>
Cc: Greg KH <>
Signed-off-by: default avatarStephen Rothwell <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 1f536b9e
...@@ -295,11 +295,22 @@ static int memory_block_change_state(struct memory_block *mem, ...@@ -295,11 +295,22 @@ static int memory_block_change_state(struct memory_block *mem,
ret = memory_block_action(mem->start_section_nr, to_state); ret = memory_block_action(mem->start_section_nr, to_state);
if (ret) if (ret) {
mem->state = from_state_req; mem->state = from_state_req;
else goto out;
mem->state = to_state; }
mem->state = to_state;
switch (mem->state) {
kobject_uevent(&mem->dev.kobj, KOBJ_OFFLINE);
kobject_uevent(&mem->dev.kobj, KOBJ_ONLINE);
out: out:
mutex_unlock(&mem->state_mutex); mutex_unlock(&mem->state_mutex);
return ret; return ret;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment