From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: John Stultz <john.stultz@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
"Linux PM list" <linux-pm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Magnus Damm" <magnus.damm@gmail.com>,
markgross@thegnar.org, "Matthew Garrett" <mjg@redhat.com>,
"Greg KH" <gregkh@linuxfoundation.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Brian Swetland" <swetland@google.com>,
"Neil Brown" <neilb@suse.de>,
"Alan Stern" <stern@rowland.harvard.edu>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Subject: Re: [RFC][PATCH 0/7] PM: Implement autosleep and "wake locks", take 2
Date: Wed, 22 Feb 2012 14:14:57 +0530 [thread overview]
Message-ID: <4F44AB09.9000606@linux.vnet.ibm.com> (raw)
In-Reply-To: <1329886179.2229.2.camel@js-netbook>
On 02/22/2012 10:19 AM, John Stultz wrote:
> On Wed, 2012-02-22 at 00:31 +0100, Rafael J. Wysocki wrote:
>> Hi all,
>>
>> After the feedback so far I've decided to follow up with a refreshed patchset.
>> The first two patches from the previous one went to linux-pm/linux-next
>> and I included the recent evdev patch from Arve (with some modifications)
>> to this patchset for completness.
>
> Hey Rafael,
> Thanks again for posting this! I've started playing around with it in a
> kvm environment, and got the following warning after echoing off >
> autosleep:
> ...
> PM: resume of devices complete after 185.615 msecs
> PM: Finishing wakeup.
> Restarting tasks ... done.
> PM: Syncing filesystems ... done.
> PM: Preparing system for mem sleep
> Freezing user space processes ...
> Freezing of tasks failed after 20.01 seconds (1 tasks refusing to freeze, wq_busy=0):
> bash D ffff880015714010
Ah.. I think I know what is the problem here..
The kernel was freezing userspace processes and meanwhile, you wrote "off"
to autosleep. So, as a result, this userspace process (bash) just now
entered kernel mode. Unfortunately, the autosleep_lock is held for too long,
that is, something like:
acquire autosleep_lock
modify autosleep_state
<============== "A"
pm_suspend or hibernate()
release autosleep_lock
At point marked "A", we should have released the autosleep lock and only then
entered pm_suspend or hibernate(). Since the current code holds the lock and
enters suspend/hibernate, the userspace process that wrote "off" to autosleep
(or even userspace process that writes to /sys/power/state will end up waiting
on autosleep_lock, thus failing the freezing operation.)
So the solution is to always release the autosleep lock before entering
suspend/hibernation.
Regards,
Srivatsa S. Bhat
> ===============================
> [ INFO: suspicious RCU usage. ]
> 3.3.0-rc3john+ #131 Not tainted
> -------------------------------
> kernel/sched/core.c:4784 suspicious rcu_dereference_check() usage!
>
> other info that might help us debug this:
>
>
> rcu_scheduler_active = 1, debug_locks = 0
> 5 locks held by kworker/u:1/10:
> #0: (autosleep){.+.+.+}, at: [<ffffffff81066db8>] process_one_work+0x2d8/0x8c0
> #1: (suspend_work){+.+.+.}, at: [<ffffffff81066db8>] process_one_work+0x2d8/0x8c0
> #2: (autosleep_lock){+.+.+.}, at: [<ffffffff810a2d3d>] try_to_suspend+0x2d/0xe0
> #3: (pm_mutex){+.+.+.}, at: [<ffffffff8109b9fc>] pm_suspend+0x8c/0x210
> #4: (tasklist_lock){.+.+..}, at: [<ffffffff8109b0f1>] try_to_freeze_tasks+0x2d1/0x400
>
> stack backtrace:
> Pid: 10, comm: kworker/u:1 Not tainted 3.3.0-rc3john+ #131
> Call Trace:
> [<ffffffff81040d82>] ? vprintk+0x242/0x530
> [<ffffffff810b0fdb>] lockdep_rcu_suspicious+0xeb/0x100
> [<ffffffff81083371>] sched_show_task+0x121/0x180
> [<ffffffff8109b1e5>] try_to_freeze_tasks+0x3c5/0x400
> [<ffffffff810a2d10>] ? pm_autosleep_set_state+0x80/0x80
> [<ffffffff8109b2eb>] freeze_processes+0x3b/0xb0
> [<ffffffff8109baad>] pm_suspend+0x13d/0x210
> [<ffffffff810a2d5d>] try_to_suspend+0x4d/0xe0
> [<ffffffff81066f02>] process_one_work+0x422/0x8c0
> [<ffffffff81066db8>] ? process_one_work+0x2d8/0x8c0
> [<ffffffff810b063e>] ? put_lock_stats+0xe/0x40
> [<ffffffff81067a16>] worker_thread+0x476/0x550
> [<ffffffff810675a0>] ? rescuer_thread+0x200/0x200
> [<ffffffff810706fe>] kthread+0xae/0xc0
> [<ffffffff81af4cb4>] kernel_thread_helper+0x4/0x10
> [<ffffffff81af3078>] ? retint_restore_args+0x13/0x13
> [<ffffffff81070650>] ? __init_kthread_worker+0x70/0x70
> [<ffffffff81af4cb0>] ? gs_change+0x13/0x13
> 0 1981 1980 0x00020004
> ffff880015715d88 0000000000000046 ffff880015715c88 ffffffff8102c22b
> ffff880015714010 ffff880015715fd8 ffff880015714010 ffff880015714000
> ffff880015715fd8 ffff880015714000 ffff880015c4e3c0 ffff88001342e540
> Call Trace:
> [<ffffffff8102c22b>] ? kvm_clock_read+0x6b/0x90
> [<ffffffff810b1f2d>] ? mark_held_locks+0xad/0x150
> [<ffffffff81af10bf>] schedule+0x3f/0x60
> [<ffffffff81aef33b>] mutex_lock_nested+0x1cb/0x4c0
> [<ffffffff810a2cae>] ? pm_autosleep_set_state+0x1e/0x80
> [<ffffffff810a2cae>] ? pm_autosleep_set_state+0x1e/0x80
> [<ffffffff810a2cae>] pm_autosleep_set_state+0x1e/0x80
> [<ffffffff8109a74b>] autosleep_store+0x3b/0x80
> [<ffffffff813856e7>] kobj_attr_store+0x17/0x20
> [<ffffffff81200dcc>] sysfs_write_file+0xec/0x170
> [<ffffffff8118085f>] vfs_write+0x11f/0x1b0
> [<ffffffff811809f4>] sys_write+0x54/0xa0
> [<ffffffff81af4e66>] sysenter_dispatch+0x7/0x26
> [<ffffffff8139238e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
>
> Restarting tasks ... done.
>
>
>
next prev parent reply other threads:[~2012-02-22 8:45 UTC|newest]
Thread overview: 129+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-07 1:00 [RFC][PATCH 0/8] PM: Implement autosleep and "wake locks" Rafael J. Wysocki
2012-02-07 1:01 ` [PATCH 1/8] PM / Sleep: Initialize wakeup source locks in wakeup_source_add() Rafael J. Wysocki
2012-02-07 22:29 ` John Stultz
2012-02-07 22:41 ` Rafael J. Wysocki
2012-02-07 1:03 ` [PATCH 2/8] PM / Sleep: Do not check wakeup too often in try_to_freeze_tasks() Rafael J. Wysocki
2012-02-07 1:03 ` [PATCH 3/8] PM / Sleep: Look for wakeup events in later stages of device suspend Rafael J. Wysocki
2012-02-07 1:04 ` [PATCH 4/8] PM / Sleep: Use wait queue to signal "no wakeup events in progress" Rafael J. Wysocki
2012-02-08 23:10 ` NeilBrown
2012-02-09 0:05 ` Rafael J. Wysocki
2012-02-12 1:27 ` mark gross
2012-02-07 1:05 ` [RFC][PATCH 5/8] PM / Sleep: Change wakeup statistics Rafael J. Wysocki
2012-02-15 6:15 ` Arve Hjønnevåg
2012-02-15 22:37 ` Rafael J. Wysocki
2012-02-17 2:11 ` Arve Hjønnevåg
2012-02-07 1:06 ` [RFC][PATCH 6/8] PM / Sleep: Implement opportunistic sleep Rafael J. Wysocki
2012-02-07 22:49 ` [Update][RFC][PATCH " Rafael J. Wysocki
2012-02-07 1:06 ` [RFC][PATCH 7/8] PM / Sleep: Add "prevent autosleep time" statistics to wakeup sources Rafael J. Wysocki
2012-02-07 1:07 ` [RFC][PATCH 8/8] PM / Sleep: Add user space interface for manipulating " Rafael J. Wysocki
2012-02-07 1:13 ` [RFC][PATCH 0/8] PM: Implement autosleep and "wake locks" Rafael J. Wysocki
2012-02-08 23:57 ` NeilBrown
2012-02-10 0:44 ` Rafael J. Wysocki
2012-02-12 2:05 ` mark gross
2012-02-12 21:32 ` Rafael J. Wysocki
2012-02-14 0:11 ` Arve Hjønnevåg
2012-02-15 15:28 ` mark gross
2012-02-12 1:54 ` mark gross
2012-02-12 1:19 ` mark gross
2012-02-14 2:07 ` Arve Hjønnevåg
2012-02-14 23:22 ` Rafael J. Wysocki
2012-02-15 5:57 ` Arve Hjønnevåg
2012-02-15 23:07 ` Rafael J. Wysocki
2012-02-16 22:22 ` Rafael J. Wysocki
2012-02-17 3:56 ` Arve Hjønnevåg
2012-02-17 23:02 ` [PATCH] PM / Sleep: Add more wakeup source initialization routines Rafael J. Wysocki
2012-02-18 23:50 ` [Update][PATCH] " Rafael J. Wysocki
2012-02-20 23:04 ` [Update 2x][PATCH] " Rafael J. Wysocki
2012-02-17 3:55 ` [RFC][PATCH 0/8] PM: Implement autosleep and "wake locks" Arve Hjønnevåg
2012-02-17 20:57 ` Rafael J. Wysocki
2012-02-21 23:31 ` [RFC][PATCH 0/7] PM: Implement autosleep and "wake locks", take 2 Rafael J. Wysocki
2012-02-21 23:32 ` [RFC][PATCH 1/7] PM / Sleep: Look for wakeup events in later stages of device suspend Rafael J. Wysocki
2012-02-21 23:33 ` [RFC][PATCH 2/7] PM / Sleep: Use wait queue to signal "no wakeup events in progress" Rafael J. Wysocki
2012-02-21 23:34 ` [RFC][PATCH 3/7] PM / Sleep: Change wakeup source statistics to follow Android Rafael J. Wysocki
2012-02-21 23:34 ` [RFC][PATCH 4/7] Input / PM: Add ioctl to block suspend while event queue is not empty Rafael J. Wysocki
2012-02-24 5:16 ` Matt Helsley
2012-02-25 4:25 ` Arve Hjønnevåg
2012-02-25 23:33 ` Rafael J. Wysocki
2012-02-28 0:19 ` Matt Helsley
2012-02-26 20:57 ` Rafael J. Wysocki
2012-02-27 22:18 ` Matt Helsley
2012-02-28 1:17 ` Rafael J. Wysocki
2012-02-28 5:58 ` Arve Hjønnevåg
2012-03-04 22:56 ` Rafael J. Wysocki
2012-03-06 1:04 ` [PATCH 1/2] epoll: Add a flag, EPOLLWAKEUP, to prevent suspend while epoll events are ready Arve Hjønnevåg
2012-03-06 1:04 ` [PATCH 2/2] PM / Sleep: Add wakeup_source_activate and wakeup_source_deactivate tracepoints Arve Hjønnevåg
2012-02-21 23:35 ` [RFC][PATCH 5/7] PM / Sleep: Implement opportunistic sleep Rafael J. Wysocki
2012-02-22 8:45 ` Srivatsa S. Bhat
2012-02-22 22:10 ` Rafael J. Wysocki
2012-02-23 5:35 ` Srivatsa S. Bhat
2012-02-21 23:36 ` [RFC][PATCH 6/7] PM / Sleep: Add "prevent autosleep time" statistics to wakeup sources Rafael J. Wysocki
2012-02-21 23:37 ` [RFC][PATCH 7/7] PM / Sleep: Add user space interface for manipulating " Rafael J. Wysocki
2012-02-22 4:49 ` [RFC][PATCH 0/7] PM: Implement autosleep and "wake locks", take 2 John Stultz
2012-02-22 8:44 ` Srivatsa S. Bhat [this message]
2012-02-22 22:10 ` [RFC][PATCH 0/7] PM: Implement autosleep and "wake locks", take2 Rafael J. Wysocki
2012-02-23 6:25 ` Srivatsa S. Bhat
2012-02-23 21:26 ` Rafael J. Wysocki
2012-02-23 21:32 ` Rafael J. Wysocki
2012-02-24 4:44 ` Srivatsa S. Bhat
2012-02-24 23:21 ` Rafael J. Wysocki
2012-02-25 4:43 ` Arve Hjønnevåg
2012-02-25 20:43 ` Rafael J. Wysocki
2012-02-25 19:20 ` Srivatsa S. Bhat
2012-02-25 21:01 ` Rafael J. Wysocki
2012-02-28 10:24 ` Srivatsa S. Bhat
2012-04-22 21:19 ` [RFC][PATCH 0/8] PM: Implement autosleep and "wake locks", take 3 Rafael J. Wysocki
2012-04-22 21:19 ` [PATCH 1/8] PM / Sleep: Look for wakeup events in later stages of device suspend Rafael J. Wysocki
2012-04-22 21:20 ` [PATCH 2/8] PM / Sleep: Use wait queue to signal "no wakeup events in progress" Rafael J. Wysocki
2012-04-23 4:01 ` mark gross
2012-04-22 21:21 ` [PATCH 3/8] PM / Sleep: Change wakeup source statistics to follow Android Rafael J. Wysocki
2012-04-22 21:21 ` [PATCH 4/8] PM / Sleep: Add wakeup_source_activate and wakeup_source_deactivate tracepoints Rafael J. Wysocki
2012-04-22 21:22 ` [RFC][PATCH 5/8] epoll: Add a flag, EPOLLWAKEUP, to prevent suspend while epoll events are ready Rafael J. Wysocki
2012-04-26 4:03 ` NeilBrown
2012-04-26 20:40 ` Rafael J. Wysocki
2012-04-27 3:49 ` Arve Hjønnevåg
2012-04-27 21:18 ` Rafael J. Wysocki
2012-04-27 23:26 ` [PATCH] " Arve Hjønnevåg
2012-04-30 1:58 ` [RFC][PATCH 5/8] " NeilBrown
2012-05-01 0:52 ` Arve Hjønnevåg
2012-05-01 2:18 ` NeilBrown
2012-05-01 5:33 ` [PATCH] " Arve Hjønnevåg
2012-05-01 6:28 ` NeilBrown
2012-05-01 13:51 ` Rafael J. Wysocki
2012-07-16 6:38 ` Michael Kerrisk
2012-07-16 11:00 ` Rafael J. Wysocki
2012-07-16 22:04 ` Arve Hjønnevåg
2012-07-17 5:14 ` Michael Kerrisk
2012-07-17 19:22 ` Rafael J. Wysocki
2012-07-17 19:36 ` Greg KH
2012-07-17 19:55 ` Rafael J. Wysocki
2012-07-18 6:41 ` Michael Kerrisk (man-pages)
2012-04-22 21:23 ` [RFC][PATCH 6/8] PM / Sleep: Implement opportunistic sleep Rafael J. Wysocki
2012-04-26 3:05 ` NeilBrown
2012-04-26 21:52 ` Rafael J. Wysocki
2012-04-27 0:39 ` NeilBrown
2012-04-27 21:22 ` Rafael J. Wysocki
2012-05-03 0:23 ` Arve Hjønnevåg
2012-05-03 13:28 ` Rafael J. Wysocki
2012-05-03 21:27 ` Arve Hjønnevåg
2012-05-03 22:20 ` Rafael J. Wysocki
2012-05-03 22:16 ` Arve Hjønnevåg
2012-05-03 22:24 ` Rafael J. Wysocki
2012-04-22 21:24 ` [RFC][PATCH 7/8] PM / Sleep: Add "prevent autosleep time" statistics to wakeup sources Rafael J. Wysocki
2012-04-22 21:24 ` [RFC][PATCH 8/8] PM / Sleep: Add user space interface for manipulating " Rafael J. Wysocki
2012-04-24 1:35 ` John Stultz
2012-04-24 21:27 ` Rafael J. Wysocki
2012-04-26 6:31 ` NeilBrown
2012-04-26 22:04 ` Rafael J. Wysocki
2012-04-27 0:07 ` NeilBrown
2012-04-27 21:15 ` Rafael J. Wysocki
2012-04-27 3:57 ` Arve Hjønnevåg
2012-04-27 21:14 ` Rafael J. Wysocki
2012-04-27 21:17 ` Arve Hjønnevåg
2012-04-27 21:34 ` Rafael J. Wysocki
2012-05-03 19:29 ` [PATCH 0/2]: Kconfig options for wakelocks limit and gc (was: Re: [RFC][PATCH 8/8] PM / Sleep: Add user space ...) Rafael J. Wysocki
2012-05-03 19:30 ` [PATCH 1/2] PM / Sleep: Make the limit of user space wakeup sources configurable Rafael J. Wysocki
2012-05-03 19:34 ` [PATCH 2/2] PM / Sleep: User space wakeup sources garbage collector Kconfig option Rafael J. Wysocki
2012-05-03 22:14 ` [PATCH 0/2]: Kconfig options for wakelocks limit and gc (was: Re: [RFC][PATCH 8/8] PM / Sleep: Add user space ...) Arve Hjønnevåg
2012-05-03 22:20 ` Rafael J. Wysocki
2012-04-23 16:49 ` [RFC][PATCH 0/8] PM: Implement autosleep and "wake locks", take 3 Greg KH
2012-04-23 19:51 ` 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=4F44AB09.9000606@linux.vnet.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=arve@android.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=markgross@thegnar.org \
--cc=mjg@redhat.com \
--cc=neilb@suse.de \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
--cc=swetland@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.