linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Linux PM list <linux-pm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	horms@verge.net.au, "pavel@ucw.cz" <pavel@ucw.cz>,
	Len Brown <lenb@kernel.org>
Subject: Re: [Update][PATCH] PM / Hibernate: Fix s2disk regression related to unlock_system_sleep()
Date: Wed, 18 Jan 2012 09:30:37 -0800	[thread overview]
Message-ID: <20120118173037.GE30664@google.com> (raw)
In-Reply-To: <4F16FF0D.1030606@linux.vnet.ibm.com>

Hello, Srivatsa.

On Wed, Jan 18, 2012 at 10:49:09PM +0530, Srivatsa S. Bhat wrote:
> I agree, but I was trying to keep the comment from growing too long ;)

It doesn't have to be long.  It just has to give some meaning to the
decision.  AFAICS, it is correct to call try_to_freeze() on
unlock_system_sleep() regardless of 20sec window.  There's no
guarantee the unlocking task is gonna hit try_to_freeze() elsewhere
and not calling it actually makes the interface buggy.

That said, it causes a problem because unlock_system_sleep() is called
in a special context during later stage of hibernation where the usual
expectation - that a freezable task which sees a freezing condition
should freeze - doesn't hold.

The correct solution would be somehow marking that condition so that
either try_to_freeze() doesn't get invoked or gets nullified -
e.g. making the SKIP thing a counter and ensure the hibernating task
has it elevated throughout the whole process.  Alternatively, if the
code path is limited enough, using a different version of the unlock
function, unlock_system_sleep_nofreeze() or whatever, would work too -
this is a popular approach for synchronization functions which
interacts with scheduler and preemption.

For now, as a quick fix, maybe not calling try_to_freeze()
unconditionally is okay, I don't know, but it's a hack.

Thanks.

-- 
tejun

  reply	other threads:[~2012-01-18 17:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17 22:45 [PATCH] PM / Hibernate: Fix s2disk regression related to unlock_system_sleep() Rafael J. Wysocki
2012-01-17 23:15 ` [Update][PATCH] " Rafael J. Wysocki
2012-01-18 12:59   ` Srivatsa S. Bhat
2012-01-18 15:42     ` Tejun Heo
2012-01-18 16:54       ` Srivatsa S. Bhat
2012-01-18 16:58         ` Tejun Heo
2012-01-18 17:19           ` Srivatsa S. Bhat
2012-01-18 17:30             ` Tejun Heo [this message]
2012-01-18 17:33               ` Tejun Heo
2012-01-19 10:37                 ` Pavel Machek
2012-01-19 10:55                   ` Srivatsa S. Bhat
2012-01-19 17:40                     ` Pavel Machek
2012-01-19 18:10                       ` Srivatsa S. Bhat
2012-01-18 19:22               ` Srivatsa S. Bhat
2012-01-18 19:30                 ` Tejun Heo
2012-01-18 19:46                   ` Srivatsa S. Bhat
2012-01-18 20:29                     ` Srivatsa S. Bhat
2012-01-18 22:04                       ` Tejun Heo
2012-01-18 22:22                       ` Rafael J. Wysocki
2012-01-19 14:40                         ` Srivatsa S. Bhat
2012-01-19 22:35                           ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120118173037.GE30664@google.com \
    --to=tj@kernel.org \
    --cc=horms@verge.net.au \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).