lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 28 Oct 2011 15:46:30 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	holzheu@...ux.vnet.ibm.com
Cc:	Heiko Carstens <heiko.carstens@...ibm.com>,
	Vivek Goyal <vgoyal@...hat.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	schwidefsky@...ibm.com, kexec@...ts.infradead.org,
	linux-kernel@...r.kernel.org, Kay Sievers <kay.sievers@...y.org>,
	Dave Hansen <haveblue@...ibm.com>
Subject: Re: [PATCH] kdump: Add udev events for memory online/offline

On Thu, 27 Oct 2011 11:32:45 +0200
Michael Holzheu <holzheu@...ux.vnet.ibm.com> wrote:

> From: Michael Holzheu <holzheu@...ux.vnet.ibm.com>
> 
> 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"
> 
> Signed-off-by: Michael Holzheu <holzheu@...ux.vnet.ibm.com>
> ---
>  drivers/base/memory.c |   10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -310,11 +310,15 @@ store_mem_state(struct sys_device *dev,
>  
>  	mem = container_of(dev, struct memory_block, sysdev);
>  
> -	if (!strncmp(buf, "online", min((int)count, 6)))
> +	if (!strncmp(buf, "online", min((int)count, 6))) {
>  		ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE);
> -	else if(!strncmp(buf, "offline", min((int)count, 7)))
> +		if (ret == 0)
> +			kobject_uevent(&dev->kobj, KOBJ_ONLINE);
> +	} else if (!strncmp(buf, "offline", min((int)count, 7))) {
>  		ret = memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE);
> -
> +		if (ret == 0)
> +			kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
> +	}
>  	if (ret)
>  		return ret;
>  	return count;

I think a safer place from which to send the uevent is
memory_block_change_state() or even memory_block_action().  Because if
either of those functions later gets new callers, those callers might
forget to send the uevent?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ