From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Hilman Subject: Re: [PATCH] PM / Domains: Restore lock-less behaviour for the genpd syscore APIs Date: Tue, 07 Feb 2017 10:29:02 -0800 Message-ID: References: <1486482784-31734-1-git-send-email-ulf.hansson@linaro.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from mail-pg0-f44.google.com ([74.125.83.44]:34062 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754490AbdBGS3E (ORCPT ); Tue, 7 Feb 2017 13:29:04 -0500 Received: by mail-pg0-f44.google.com with SMTP id 14so40813076pgg.1 for ; Tue, 07 Feb 2017 10:29:04 -0800 (PST) In-Reply-To: <1486482784-31734-1-git-send-email-ulf.hansson@linaro.org> (Ulf Hansson's message of "Tue, 7 Feb 2017 16:53:04 +0100") Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Ulf Hansson Cc: "Rafael J. Wysocki" , linux-pm@vger.kernel.org, Len Brown , Pavel Machek , Geert Uytterhoeven , Lina Iyer , Jon Hunter , Marek Szyprowski , Brian Norris Ulf Hansson writes: > The commit ef4f7e2c8335 ("PM / Domains: Fix asynchronous execution of > *noirq() callbacks") went too far, as it not only changed to use locks for > the *noirq callbacks, but also for the genpd syscore APIs. > > This cause the following error, reported by Geert Uytterhoeven: > > "This causes the following BUG on all my Renesas arm32 boards, where the > system timer is an IRQ safe device: > > BUG: sleeping function called from invalid context at > kernel/locking/mutex.c:232 > in_atomic(): 0, irqs_disabled(): 128, pid: 1751, name: s2ram > CPU: 0 PID: 1751 Comm: s2ram Not tainted > 4.10.0-rc7-koelsch-05643-g27f4c73972a614fe #3354 > Hardware name: Generic R8A7791 (Flattened Device Tree) > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (dump_stack+0x7c/0x9c) > [] (dump_stack) from [] (___might_sleep+0x124/0x160) > [] (___might_sleep) from [] (mutex_lock+0x18/0x60) > [] (mutex_lock) from [] > (genpd_syscore_switch+0x2c/0x7c) > [] (genpd_syscore_switch) from [] > (sh_cmt_clock_event_suspend+0x18/0x28) > [] (sh_cmt_clock_event_suspend) from [] > (clockevents_suspend+0x40/0x54) > [] (clockevents_suspend) from [] > (timekeeping_suspend+0x23c/0x278) > [] (timekeeping_suspend) from [] > (syscore_suspend+0x88/0x138) > [] (syscore_suspend) from [] > (suspend_devices_and_enter+0x290/0x470) > [] (suspend_devices_and_enter) from [] > (pm_suspend+0x228/0x280) > [] (pm_suspend) from [] (state_store+0xac/0xcc) > [] (state_store) from [] (kernfs_fop_write+0x160/0x19c) > [] (kernfs_fop_write) from [] (__vfs_write+0x20/0x108) > [] (__vfs_write) from [] (vfs_write+0xb8/0x144) > [] (vfs_write) from [] (SyS_write+0x40/0x80) > [] (SyS_write) from [] (ret_fast_syscall+0x0/0x34)" > > To fix this problem, restore the lock-less behaviour. However only for the > genpd syscore APIs. > > Reported-by: Geert Uytterhoeven > Fixes: ef4f7e2c8335 ("PM / Domains: Fix asynchronous execution of *noirq() callbacks") > Signed-off-by: Ulf Hansson It's up to Rafael, but IMO, since this isn't yet in mainline, it would be cleaner for the git history to revert the original, and rework the patch to have just the relevant parts Kevin