diff options
author | Michael Holzheu <holzheu@linux.vnet.ibm.com> | 2012-01-12 20:20:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-12 23:13:11 -0500 |
commit | f5138e42211d4e8bfbd6ac5b3816348da1533433 (patch) | |
tree | c9d246be208547ded5dece81c57353f54d61ffd3 | |
parent | 1f536b9e9f85456df93614b3c2f6a1a2b7d7cb9b (diff) |
kdump: add udev events for memory online/offline
Currently no udev events for memory hotplug "online" and "offline" are
generated:
# 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"
[sfr@canb.auug.org.au: fixups for class to subsystem conversion]
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/base/memory.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index f17e3ea041c0..ed5de58c340f 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -295,11 +295,22 @@ static int memory_block_change_state(struct memory_block *mem, | |||
295 | 295 | ||
296 | ret = memory_block_action(mem->start_section_nr, to_state); | 296 | ret = memory_block_action(mem->start_section_nr, to_state); |
297 | 297 | ||
298 | if (ret) | 298 | if (ret) { |
299 | mem->state = from_state_req; | 299 | mem->state = from_state_req; |
300 | else | 300 | goto out; |
301 | mem->state = to_state; | 301 | } |
302 | 302 | ||
303 | mem->state = to_state; | ||
304 | switch (mem->state) { | ||
305 | case MEM_OFFLINE: | ||
306 | kobject_uevent(&mem->dev.kobj, KOBJ_OFFLINE); | ||
307 | break; | ||
308 | case MEM_ONLINE: | ||
309 | kobject_uevent(&mem->dev.kobj, KOBJ_ONLINE); | ||
310 | break; | ||
311 | default: | ||
312 | break; | ||
313 | } | ||
303 | out: | 314 | out: |
304 | mutex_unlock(&mem->state_mutex); | 315 | mutex_unlock(&mem->state_mutex); |
305 | return ret; | 316 | return ret; |