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:	Thu, 3 May 2012 15:16:54 -0700
From:	Arve Hjønnevåg <arve@...roid.com>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
Cc:	NeilBrown <neilb@...e.de>,
	Linux PM list <linux-pm@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Magnus Damm <magnus.damm@...il.com>, markgross@...gnar.org,
	Matthew Garrett <mjg@...hat.com>,
	Greg KH <gregkh@...uxfoundation.org>,
	John Stultz <john.stultz@...aro.org>,
	Brian Swetland <swetland@...gle.com>,
	Alan Stern <stern@...land.harvard.edu>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
Subject: Re: [RFC][PATCH 6/8] PM / Sleep: Implement opportunistic sleep

On Thu, May 3, 2012 at 3:20 PM, Rafael J. Wysocki <rjw@...k.pl> wrote:
> On Thursday, May 03, 2012, Arve Hjønnevåg wrote:
>> On Thu, May 3, 2012 at 6:28 AM, Rafael J. Wysocki <rjw@...k.pl> wrote:
>> > On Thursday, May 03, 2012, Arve Hjønnevåg wrote:
>> >> On Thu, Apr 26, 2012 at 2:52 PM, Rafael J. Wysocki <rjw@...k.pl> wrote:
>> >> ...
>> >> > From: Rafael J. Wysocki <rjw@...k.pl>
>> >> > Subject: PM / Sleep: Implement opportunistic sleep, v2
>> >> >
>> >> > Introduce a mechanism by which the kernel can trigger global
>> >> > transitions to a sleep state chosen by user space if there are no
>> >> > active wakeup sources.
>> >> >
>> >> > It consists of a new sysfs attribute, /sys/power/autosleep, that
>> >> > can be written one of the strings returned by reads from
>> >> > /sys/power/state, an ordered workqueue and a work item carrying out
>> >> > the "suspend" operations.  If a string representing the system's
>> >> > sleep state is written to /sys/power/autosleep, the work item
>> >> > triggering transitions to that state is queued up and it requeues
>> >> > itself after every execution until user space writes "off" to
>> >> > /sys/power/autosleep.
>> >> >
>> >>
>> >> This does not work. Writing something other than "off" disabled auto
>> >> suspend for me.
>> >
>> > My bad, sorry about that.
>> >
>> >> ...
>> >> > +static ssize_t autosleep_store(struct kobject *kobj,
>> >> > +                              struct kobj_attribute *attr,
>> >> > +                              const char *buf, size_t n)
>> >> > +{
>> >> > +       suspend_state_t state = decode_state(buf, n);
>> >> > +       int error;
>> >> > +
>> >> > +       if (state == PM_SUSPEND_ON
>> >> > +           && !(strncmp(buf, "off", 3) && strncmp(buf, "off\n", 4)))
>> >> > +               return -EINVAL;
>> >>
>> >> Did you mean:
>> >>       if (state == PM_SUSPEND_ON
>> >>           && strcmp(buf, "off") && strcmp(buf, "off\n"))
>> >>               return -EINVAL;
>> >
>> >
>> > Yes, I did.
>> >
>> > I'll add the following as an incremental patch on top of the series.
>> >
>> > Thanks,
>> > Rafael
>> >
>> > ---
>> >  kernel/power/main.c |    2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > Index: linux/kernel/power/main.c
>> > ===================================================================
>> > --- linux.orig/kernel/power/main.c
>> > +++ linux/kernel/power/main.c
>> > @@ -422,7 +422,7 @@ static ssize_t autosleep_store(struct ko
>> >        int error;
>> >
>> >        if (state == PM_SUSPEND_ON
>> > -           && !(strncmp(buf, "off", 3) && strncmp(buf, "off\n", 4)))
>> > +           && strncmp(buf, "off", 3) && strncmp(buf, "off\n", 4))
>> >                return -EINVAL;
>> >
>> >        error = pm_autosleep_set_state(state);
>>
>> You still use strncmp here, so anything that starts with "off" is
>> allowed (and the second strncmp is redundant).
>
> Good point.  So I'm going to add the patch below after all.
> OK to add your sign-off to it?
>

Yes.

-- 
Arve Hjønnevåg
--
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