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: <4F17217E.5040805@linux.vnet.ibm.com>
Date:	Thu, 19 Jan 2012 01:16:06 +0530
From:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
To:	Tejun Heo <tj@...nel.org>
CC:	"Rafael J. Wysocki" <rjw@...k.pl>,
	Linux PM list <linux-pm@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>, horms@...ge.net.au,
	"pavel@....cz" <pavel@....cz>, Len Brown <lenb@...nel.org>
Subject: Re: [Update][PATCH] PM / Hibernate: Fix s2disk regression related
 to unlock_system_sleep()

On 01/19/2012 01:00 AM, Tejun Heo wrote:

> Hello,
> 
> On Thu, Jan 19, 2012 at 12:52:32AM +0530, Srivatsa S. Bhat wrote:
>> Somehow I don't think its a hack, based on my perception as described
>> above. But feel free to prove me wrong :-)
> 
> Thanks for the explanation.  Yeah, I agree and it's much simpler this
> way, which is nice.  So, in short, because freezing state can't change
> across lock_system_sleep(), there's no reason to check for freezing
> state on unlock and this nicely resolves the freezer problem together.
> 


Absolutely!

> The only thing to be careful is, then, we need to set and clear SKIP
> inside pm_mutex.
> 


Not exactly. We need to set SKIP before grabbing pm_mutex and clear it
inside pm_mutex. The reason is that we decided to set SKIP in the first
place just to avoid the freezer from declaring failure when we are
blocked on pm_mutex. If we move it to *after* mutex_lock(&pm_mutex), that
original intention itself is not satisfied, and we will hit freezing
failures - IOW making the set and clear exercise useless!

So, something like this should work perfectly:

lock_system_sleep()
{
	freezer_do_not_count();
	mutex_lock(&pm_mutex);
	current->flags &= ~PF_FREEZER_SKIP;
}

But in the interest of making the code look a bit symmetric, we can do:

lock_system_sleep()
{
	freezer_do_not_count();
	mutex_lock(&pm_mutex);
}

unlock_system_sleep()
{
	current->flags &= ~PF_FREEZER_SKIP;
	mutex_unlock(&pm_mutex);
}
 
Regards,
Srivatsa S. Bhat
IBM Linux Technology Center

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