From patchwork Sat Nov 5 11:07:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 9413649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C7E5C60573 for ; Sat, 5 Nov 2016 11:10:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A530F29CEF for ; Sat, 5 Nov 2016 11:10:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8523829E7D; Sat, 5 Nov 2016 11:10:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E832129CEF for ; Sat, 5 Nov 2016 11:10:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c2ypS-0001L3-9T; Sat, 05 Nov 2016 11:08:06 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c2ypL-0001GM-Sg for linux-arm-kernel@lists.infradead.org; Sat, 05 Nov 2016 11:08:03 +0000 Received: from oxbaltgw06.schlund.de ([172.19.246.12]) by mrelayeu.kundenserver.de (mreue001) with ESMTPSA (Nemesis) id 0MSUzj-1cRToI2Vvn-00TX27; Sat, 05 Nov 2016 12:07:13 +0100 Date: Sat, 5 Nov 2016 12:07:10 +0100 (CET) From: Stefan Wahren To: Russell King - ARM Linux Message-ID: <322177156.158733.9867e3e7-5710-4844-a098-6f44bd852a6d.open-xchange@email.1und1.de> In-Reply-To: <20161101092304.GM1041@n2100.armlinux.org.uk> References: <315017958.66634.5d4fc19c-31cd-4900-8613-af4cadec5da4.open-xchange@email.1und1.de> <20161023133134.GI1041@n2100.armlinux.org.uk> <1709157673.85170.1cb53b4d-2805-48ea-aef1-dd282306d108.open-xchange@email.1und1.de> <20161031161700.GH1041@n2100.armlinux.org.uk> <847975190.29034.38a9c7fa-bdf8-4732-ac8b-cf15c21e3ce8.open-xchange@email.1und1.de> <20161101092304.GM1041@n2100.armlinux.org.uk> Subject: Re: [Bug] ARM: mxs: STI: console can't wake up from freeze MIME-Version: 1.0 X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.0-Rev40 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K0:aLvBt3NYu9pv7WbB2ExL2ypVyJ1hNmtNeoUEFY6ern7iFepIODM LiiaIIl90BnGzpk1FM0QzsrJFrrrkfY7syJbvG7IrmS4lqFXOxwZOe/okfJwAan5YMAtduw k2uBHZu6O8dM2tgD2g1u4KkuZ3i+Uz3SNabjFF1q/0UtvfIuYEs+BB7D2uREQ1tL5MT818l fRC5g8hJF0QgxFxg2VIUQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:xMLcE+ykXzo=:glRgFH7v0TYGSn/NMVZMG/ wPlVfeNB65XtDGTNNnXKVPoy/OpNNGGc3zmL4aGea8bPf7nFbHjHCEKAtOZ13k3mkcaT1U19N G1X+dTCWtRG06GnY5Rqsw8CqS3d5oVsW2FCvw59yArjttbwpJyYx1gpQ6bOItbeqE7vFKm9Dk rJ8p+0awADVL2Sd5Y+GAqcJDTYWUb0z4w1gWezr1gjTko4ZQ9/qRdtE9O1NdyhAkmY1PjGUD5 mOubwWC/kVmhq0oRskziJc0NLmG5ywchwVaJQ+ZN61hTU38yXp+DbdFLcwMGV1i9CDXVaFGwA zeFTp9exCPGDw4nFJqjeXim4lc+TpXsLoFhSVh39xhDzkEohJ3c/lA0PCqgFs5RhBeMEEOb4O LoBsOEAUlinBh6ETUN0txQTOduRxLELaZTWDrJVP/5vE0V9i1I6lPmk6geLJkzORTvK09D8h+ SboJ3/NWxZeNgdmWED5mCYdPUvdEGg/hn/i3INIzwKZtAth9UFgpagvGfgelnXEnrhm5K3kbW iWupXIS+a9S4ilv4iEBZPlf+0cEHFYm1ZQFuRa/YdyHuPwvCZp4kAAhzw1/eoBBRqEwqblMnD 0hjEMoBH4e9+DXYpRwWIZszUNRmEcBjJzrw4ayb+ih6OoWOJV6e14Fa+mI6pyRjlkv//tNKoX +PSFBYxLAxzn0dpFMs3gBhx6Cn1o/UYDMnqz/DxFdinNbpJsrwzOsAQ4nMa+qB0k3TB5No8uR HH5qyt4PlCQi3wWg X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161105_040800_362085_07D6F5AB X-CRM114-Status: GOOD ( 15.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Lezcano , linux-pm@vger.kernel.org, joerg.krause@embedded.rocks, "Rafael J. Wysocki" , Sascha Hauer , Fabio Estevam , Zhang Rui , Shawn Guo , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, [add Rui] > Russell King - ARM Linux hat am 1. November 2016 um > 10:23 geschrieben: > > > On Mon, Oct 31, 2016 at 08:54:33PM +0100, Stefan Wahren wrote: > > [ 366.696043] INFO: task ext4lazyinit:70 blocked for more than 120 seconds. > > [ 366.703046] Not tainted 4.9.0-rc1 #7 > > [ 366.707188] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables > > this > > message. > > [ 366.715161] ext4lazyinit D c05aa6ac 0 70 2 0x00000000 > > This looks like a very different problem - I guess one for ext4 people. > i investigated the issue more further. This trace wasn't representative, because the stacktrace is different in most cases. The "endless loop" is located in freeze_enter(). So i added some debug messages: -------------------------------->8------------------------------------ -------------------------------->8------------------------------------ and repeated the test cases for freeze which shows none the representative stacktraces: 1. cmdline contains no_console_suspend * echo freeze > /sys/power/state ... [ 139.371308] PM: suspend of devices complete after 1342.721 msecs [ 139.385203] PM: late suspend of devices complete after 7.668 msecs [ 139.399428] PM: noirq suspend of devices complete after 7.936 msecs [ 139.406639] PM: calling cpuidle_resume() [ 139.410619] PM: calling wake_up_all_idle_cpus() [ 139.415339] PM: suspend-to-idle >>> no reaction to input via Debug UART [ 366.683570] INFO: task bash:373 blocked for more than 120 seconds. [ 366.689814] Not tainted 4.9.0-rc1-dirty #14 [ 366.694705] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 366.702685] bash D c05aa6ec 0 373 275 0x00000000 [ 366.709227] [] (__schedule) from [] (schedule+0x3c/0xbc) [ 366.716495] [] (schedule) from [] (suspend_devices_and_enter+0x888/0xa78) [ 366.725228] [] (suspend_devices_and_enter) from [] (pm_suspend+0x72c/0x81c) [ 366.734150] [] (pm_suspend) from [] (state_store+0x80/0xcc) [ 366.741554] [] (state_store) from [] (kobj_attr_store+0x18/0x1c) [ 366.749515] [] (kobj_attr_store) from [] (sysfs_kf_write+0x48/0x4c) [ 366.757735] [] (sysfs_kf_write) from [] (kernfs_fop_write+0xfc/0x1d0) [ 366.766130] [] (kernfs_fop_write) from [] (__vfs_write+0x2c/0x124) [ 366.774255] [] (__vfs_write) from [] (vfs_write+0xb4/0x1a4) [ 366.781640] [] (vfs_write) from [] (SyS_write+0x44/0x88) [ 366.788890] [] (SyS_write) from [] (ret_fast_syscall+0x0/0x1c) [ 366.796627] [ 366.796627] Showing all locks held in the system: [ 366.803011] 2 locks held by khungtaskd/10: [ 366.807149] #0: [ 366.808931] ( rcu_read_lock[ 366.811784] ){......} , at: [ 366.814813] [] watchdog+0xb4/0x61c [ 366.819128] #1: [ 366.820902] ( tasklist_lock[ 366.823876] ){.+.+..} , at: [ 366.826765] [] debug_show_all_locks+0x28/0x1bc [ 366.832151] 4 locks held by bash/373: [ 366.835973] #0: [ 366.837765] ( sb_writers[ 366.840365] #4 ){.+.+.+}[ 366.842987] , at: [ 366.845079] [] vfs_write+0x194/0x1a4 [ 366.849551] #1: [ 366.851324] ( &of->mutex[ 366.854058] ){+.+.+.} , at: [ 366.856944] [] kernfs_fop_write+0xc0/0x1d0 [ 366.861941] #2: [ 366.863839] ( s_active[ 366.866288] #43 ){.+.+.+}[ 366.868877] , at: [ 366.870938] [] kernfs_fop_write+0xc8/0x1d0 [ 366.876053] #3: [ 366.877843] ( pm_mutex[ 366.880272] ){+.+.+.} , at: [ 366.883266] [] pm_suspend+0x90/0x81c [ 366.887757] [ 366.889268] ============================================= [ 366.889268] 2. cmdline contains no_console_suspend * echo enabled > /sys/class/tty/ttyAMA0/power/wakeup * echo freeze > /sys/power/state the same as in 1. 3. cmdline doesn't contains no_console_suspend * echo enabled > /sys/class/tty/ttyAMA0/power/wakeup * echo freeze > /sys/power/state [ 161.093187] PM: Syncing filesystems ... [ 161.734413] done. [ 161.793242] Freezing user space processes ... (elapsed 0.008 seconds) done. [ 161.809797] Freezing remaining freezable tasks ... (elapsed 0.004 seconds) done. [ 161.821953] Suspending console(s) (use no_console_suspend to debug) >>>> no reaction to Debug UART I expected that in all 3 cases freeze_wake() will be called. Why not? Here my config again: CONFIG_PM_SLEEP=y CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y CONFIG_PM=y CONFIG_CPU_IDLE is not set diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 1e7f5da..079c08d 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -67,17 +67,20 @@ static void freeze_enter(void) spin_unlock_irq(&suspend_freeze_lock); get_online_cpus(); + pr_info("PM: calling cpuidle_resume()\n"); cpuidle_resume(); /* Push all the CPUs into the idle loop. */ + pr_info("PM: calling wake_up_all_idle_cpus()\n"); wake_up_all_idle_cpus(); - pr_debug("PM: suspend-to-idle\n"); + pr_info("PM: suspend-to-idle\n"); /* Make the current CPU wait so it can enter the idle loop too. */ wait_event(suspend_freeze_wait_head, suspend_freeze_state == FREEZE_STATE_WAKE); - pr_debug("PM: resume from suspend-to-idle\n"); + pr_info("PM: resume from suspend-to-idle\n"); cpuidle_pause(); + pr_info("PM: called cpuidle_pause()\n"); put_online_cpus(); spin_lock_irq(&suspend_freeze_lock); @@ -91,6 +94,8 @@ void freeze_wake(void) { unsigned long flags; + pr_info("PM: freeze_wake()\n"); + spin_lock_irqsave(&suspend_freeze_lock, flags); if (suspend_freeze_state > FREEZE_STATE_NONE) { suspend_freeze_state = FREEZE_STATE_WAKE;