From patchwork Fri Jul 19 09:29:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Lo X-Patchwork-Id: 2830433 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5FBB2C0319 for ; Fri, 19 Jul 2013 10:06:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 25C5C20357 for ; Fri, 19 Jul 2013 10:06:09 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AEC3120401 for ; Fri, 19 Jul 2013 10:06:07 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0720-0002wl-DM; Fri, 19 Jul 2013 09:31:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V070Q-0002Qn-5e; Fri, 19 Jul 2013 09:29:42 +0000 Received: from hqemgate04.nvidia.com ([216.228.121.35]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V070N-0002QA-Hl for linux-arm-kernel@lists.infradead.org; Fri, 19 Jul 2013 09:29:40 +0000 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Fri, 19 Jul 2013 02:29:36 -0700 Received: from hqemhub02.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Fri, 19 Jul 2013 02:28:19 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Fri, 19 Jul 2013 02:28:19 -0700 Received: from hkemhub02.nvidia.com (10.18.67.13) by hqemhub02.nvidia.com (172.20.150.31) with Microsoft SMTP Server (TLS) id 8.3.298.1; Fri, 19 Jul 2013 02:29:16 -0700 Received: from [10.19.108.105] (10.18.67.5) by hkemhub02.nvidia.com (10.18.67.13) with Microsoft SMTP Server id 8.3.298.1; Fri, 19 Jul 2013 17:29:13 +0800 Subject: Re: [PATCH] ARM: tegra: cpuidle: use CPUIDLE_FLAG_TIMER_STOP flag From: Joseph Lo To: Daniel Lezcano In-Reply-To: <51E7E27B.9090605@linaro.org> References: <1372152228-16199-1-git-send-email-josephl@nvidia.com> <51E439BC.9030608@wwwdotorg.org> <1373973447.8538.80.camel@jlo-ubuntu-64.nvidia.com> <51E5A438.10004@wwwdotorg.org> <1374056130.10997.16.camel@jlo-ubuntu-64.nvidia.com> <51E6FF0B.5000708@wwwdotorg.org> <1374145726.5610.73.camel@jlo-ubuntu-64.nvidia.com> <51E7E27B.9090605@linaro.org> Date: Fri, 19 Jul 2013 17:29:12 +0800 Message-ID: <1374226153.24607.3.camel@jlo-ubuntu-64.nvidia.com> MIME-Version: 1.0 X-Mailer: Evolution 2.28.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130719_052939_750472_5C76A59E X-CRM114-Status: GOOD ( 18.28 ) X-Spam-Score: -7.2 (-------) Cc: "linux-tegra@vger.kernel.org" , Peter De Schrijver , "linux-arm-kernel@lists.infradead.org" , Stephen Warren X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, 2013-07-18 at 20:41 +0800, Daniel Lezcano wrote: > On 07/18/2013 01:08 PM, Joseph Lo wrote: > > On Thu, 2013-07-18 at 04:31 +0800, Stephen Warren wrote: > >> On 07/17/2013 04:15 AM, Joseph Lo wrote: > >>> On Wed, 2013-07-17 at 03:51 +0800, Stephen Warren wrote: > >>>> On 07/16/2013 05:17 AM, Joseph Lo wrote: > >>>>> On Tue, 2013-07-16 at 02:04 +0800, Stephen Warren wrote: > >>>>>> On 06/25/2013 03:23 AM, Joseph Lo wrote: > >>>>>>> Use the CPUIDLE_FLAG_TIMER_STOP and let the cpuidle framework > >>>>>>> to handle the CLOCK_EVT_NOTIFY_BROADCAST_ENTER/EXIT when entering > >>>>>>> this state. > >> ... [ discussion of issues with Joesph's patches applied] > >>> > >> 2) If I run the hotplug test script, leaving CPU 0 always present, I > >> sometimes see: > >> > >>> root@localhost:~# for i in `seq 1 50`; do echo ITERATION $i; ./cpuonline.py; done > >>> ITERATION 1 > >>> echo 0 > /sys/devices/system/cpu/cpu2/online > >>> [ 458.910054] CPU2: shutdown > >>> echo 0 > /sys/devices/system/cpu/cpu1/online > >>> [ 461.004371] CPU1: shutdown > >>> echo 0 > /sys/devices/system/cpu/cpu3/online > >>> [ 463.027341] CPU3: shutdown > >>> echo 1 > /sys/devices/system/cpu/cpu1/online > >>> [ 465.061412] CPU1: Booted secondary processor > >>> echo 1 > /sys/devices/system/cpu/cpu2/online > >>> [ 467.095313] CPU2: Booted secondary processor > >>> [ 467.113243] ------------[ cut here ]------------ > >>> [ 467.117948] WARNING: CPU: 2 PID: 0 at kernel/time/tick-broadcast.c:667 tick_broadcast_oneshot_control+0x19c/0x1c4() > >>> [ 467.128352] Modules linked in: > >>> [ 467.131455] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 3.11.0-rc1-00022-g7487363-dirty #49 > >>> [ 467.139678] [] (unwind_backtrace+0x0/0xf8) from [] (show_stack+0x10/0x14) > >>> [ 467.148228] [] (show_stack+0x10/0x14) from [] (dump_stack+0x80/0xc4) > >>> [ 467.156336] [] (dump_stack+0x80/0xc4) from [] (warn_slowpath_common+0x64/0x88) > >>> [ 467.165300] [] (warn_slowpath_common+0x64/0x88) from [] (warn_slowpath_null+0x1c/0x24) > >>> [ 467.174959] [] (warn_slowpath_null+0x1c/0x24) from [] (tick_broadcast_oneshot_control+0x19c/0x1c4) > >>> [ 467.185659] [] (tick_broadcast_oneshot_control+0x19c/0x1c4) from [] (clockevents_notify+0x1b0/0x1dc) > >>> [ 467.196538] [] (clockevents_notify+0x1b0/0x1dc) from [] (cpuidle_idle_call+0x11c/0x168) > >>> [ 467.206292] [] (cpuidle_idle_call+0x11c/0x168) from [] (arch_cpu_idle+0x8/0x38) > >>> [ 467.215359] [] (arch_cpu_idle+0x8/0x38) from [] (cpu_startup_entry+0x60/0x134) > >>> [ 467.224325] [] (cpu_startup_entry+0x60/0x134) from [<800083d8>] (0x800083d8) > >>> [ 467.232227] ---[ end trace ea579be22a00e7fb ]--- > >>> echo 0 > /sys/devices/system/cpu/cpu1/online > >>> [ 469.126682] CPU1: shutdown > > > > Hmm. It's hard to reproduce. But finally, I also can repro with CPU > > hotplug stress test. And some strange issues after apply > > CPUIDLE_FLAG_TIMER_STOP on Tegra20, can we postpone to apply this? > > I need more time to investigate how does this flag impact system. > > > Daniel, How do you think about this fix? local_irq_enable(); @@ -144,20 +152,12 @@ int cpuidle_idle_call(void) trace_cpu_idle_rcuidle(next_state, dev->cpu); - if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP) - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, - &dev->cpu); - if (cpuidle_state_is_coupled(dev, drv, next_state)) entered_state = cpuidle_enter_state_coupled(dev, drv, next_state); else entered_state = cpuidle_enter_state(dev, drv, next_state); - if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP) - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, - &dev->cpu); - trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); /* give the governor an opportunity to reflect on the outcome */ diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index d75040d..0b8878b 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -81,8 +81,16 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, time_start = ktime_get(); + if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP) + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, + &dev->cpu); + entered_state = target_state->enter(dev, drv, index); + if (drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP) + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, + &dev->cpu); + time_end = ktime_get();