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]
Message-ID: <544660F5.1070306@roeck-us.net>
Date:	Tue, 21 Oct 2014 06:34:45 -0700
From:	Guenter Roeck <linux@...ck-us.net>
To:	Johan Hovold <johan@...nel.org>
CC:	linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
	Alan Cox <gnomes@...rguk.ukuu.org.uk>,
	Alexander Graf <agraf@...e.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Geert Uytterhoeven <geert@...ux-m68k.org>,
	Heiko Stuebner <heiko@...ech.de>,
	Lee Jones <lee.jones@...aro.org>,
	Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
	Philippe Rétornaz 
	<philippe.retornaz@...il.com>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Romain Perier <romain.perier@...il.com>
Subject: Re: [PATCH v2 01/47] kernel: Add support for poweroff handler call
 chain

On 10/21/2014 02:34 AM, Johan Hovold wrote:
> On Mon, Oct 20, 2014 at 09:12:17PM -0700, Guenter Roeck wrote:
>
>> v2:
>> - poweroff -> power_off
>
> Do you want to stick to power[-_ ]off consistently throughout?
>
>> - Add defines for default priorities
>> - Use raw notifiers protected by spinlocks instead of atomic notifiers
>> - Add register_poweroff_handler_simple
>> - Add devm_register_power_off_handler
>>
>>   include/linux/pm.h              |  22 ++++
>>   kernel/power/Makefile           |   1 +
>>   kernel/power/poweroff_handler.c | 252 ++++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 275 insertions(+)
>>   create mode 100644 kernel/power/poweroff_handler.c
>>
>> diff --git a/include/linux/pm.h b/include/linux/pm.h
>> index 383fd68..7e0cb36 100644
>> --- a/include/linux/pm.h
>> +++ b/include/linux/pm.h
>> @@ -34,7 +34,29 @@
>>   extern void (*pm_power_off)(void);
>>   extern void (*pm_power_off_prepare)(void);
>>
>> +/*
>> + * Callbacks to manage poweroff handlers
>
> power-off
>
>> + */
>> +
>> +struct notifier_block;
>>   struct device; /* we have a circular dep with device.h */
>> +
>> +int register_power_off_handler(struct notifier_block *);
>> +int devm_register_power_off_handler(struct device *, struct notifier_block *);
>> +int register_power_off_handler_simple(void (*function)(void), int priority);
>> +int unregister_power_off_handler(struct notifier_block *);
>> +void do_kernel_power_off(void);
>> +bool have_kernel_power_off(void);
>> +
>> +/*
>> + * Pre-defined poweroff handler priorities
>
> power-off
>
>> + */
>> +#define POWEROFF_PRIORITY_FALLBACK	0
>> +#define POWEROFF_PRIORITY_LOW		64
>> +#define POWEROFF_PRIORITY_DEFAULT	128
>> +#define POWEROFF_PRIORITY_HIGH		192
>> +#define POWEROFF_PRIORITY_HIGHEST	255
>
> I think at least these ones should match the interface function and have
> a POWER_OFF_PRIORITY_ prefix.
>
>> +
>>   #ifdef CONFIG_VT_CONSOLE_SLEEP
>>   extern void pm_vt_switch_required(struct device *dev, bool required);
>>   extern void pm_vt_switch_unregister(struct device *dev);
>> diff --git a/kernel/power/Makefile b/kernel/power/Makefile
>> index 29472bf..4d9f0c7 100644
>> --- a/kernel/power/Makefile
>> +++ b/kernel/power/Makefile
>> @@ -2,6 +2,7 @@
>>   ccflags-$(CONFIG_PM_DEBUG)	:= -DDEBUG
>>
>>   obj-y				+= qos.o
>> +obj-y				+= poweroff_handler.o
>>   obj-$(CONFIG_PM)		+= main.o
>>   obj-$(CONFIG_VT_CONSOLE_SLEEP)	+= console.o
>>   obj-$(CONFIG_FREEZER)		+= process.o
>> diff --git a/kernel/power/poweroff_handler.c b/kernel/power/poweroff_handler.c
>> new file mode 100644
>> index 0000000..aeb4736
>> --- /dev/null
>> +++ b/kernel/power/poweroff_handler.c
>
> power_off_handler.c?
>
>> @@ -0,0 +1,252 @@
>> +/*
>> + * linux/kernel/power/poweroff_handler.c - Poweroff handling functions
>> + *
>> + * Copyright (c) 2014 Guenter Roeck
>> + *
>> + * This program is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU General Public Licence
>> + * as published by the Free Software Foundation; either version
>> + * 2 of the Licence, or (at your option) any later version.
>> + */
>> +
>> +#define pr_fmt(fmt)	"poweroff: " fmt
>
> power-off:?
>
> There's a bunch of these introduced by the driver patches as well (e.g.
> poweroff_nb).
>

I personally don't see a value in those changes, but sure, I can change
all of it. Just hope that this won't cause someone else to request it
to be changed back ;-).

Guenter

--
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