All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] sh: fix cpuidle on sh7724, possibly others
Date: Fri, 09 Dec 2011 08:54:15 +0000	[thread overview]
Message-ID: <20111209085415.GA19960@linux-sh.org> (raw)
In-Reply-To: <Pine.LNX.4.64.1112061704300.10715@axis700.grange>

On Wed, Dec 07, 2011 at 09:38:13AM +0100, Guennadi Liakhovetski wrote:
> cpuidle has been broken on sh7724 and, possibly, other SuperH SoCs since 
> 
> commit f533c3d340536198a4889a42a68d6c0d79a504e7
> Author: Paul Mundt <lethal@linux-sh.org>
> Date:   Fri Oct 16 17:20:58 2009 +0900
> 
>     sh: Idle loop chainsawing for SMP-based light sleep.
> 
> i.e., since 2.6.33-rc1. The reason is a missing local_irq_enable() on the 
> path, actually entering a sleep mode. This patch adds the missing call.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> 
> This fixes one of the problem with cpuidle on sh. When applied (suitably 
> adjusted) directly after f533c3d340536198a4889a42a68d6c0d79a504e7, it does 
> fix the problem. However, since that commit cpuidle has been broken (at 
> least for my configuration) at least once more. This time bisection points 
> out at
> 
> commit 03625e7107cde46e2851557ec06426799e6ae7f2
> Author: Magnus Damm <damm@opensource.se>
> Date:   Fri Oct 30 04:24:32 2009 +0000
> 
>     sh: Use RSMEM for sleep code on sh7724
> 
> Still investigating.
> 
> diff --git a/arch/sh/kernel/cpu/shmobile/cpuidle.c b/arch/sh/kernel/cpu/shmobile/cpuidle.c
> index 1cc257c..e58640a 100644
> --- a/arch/sh/kernel/cpu/shmobile/cpuidle.c
> +++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c
> @@ -48,6 +48,7 @@ static int cpuidle_sleep_enter(struct cpuidle_device *dev,
>  	 */
>  	k = min_t(int, allowed_state, requested_state);
>  
> +	local_irq_enable();
>  	before = ktime_get();
>  	sh_mobile_call_standby(cpuidle_mode[k]);
>  	after = ktime_get();

Thanks for debugging this. This looks like a simple imbalance to me, but
the changeset you cite doesn't do any SR toggling that would account for
it, so that makes me suspect something else.

Looking at the code in question, perhaps this is the culprit?

---

diff --git a/arch/sh/kernel/cpu/shmobile/pm.c b/arch/sh/kernel/cpu/shmobile/pm.c
index a6f95ae..55b9024 100644
--- a/arch/sh/kernel/cpu/shmobile/pm.c
+++ b/arch/sh/kernel/cpu/shmobile/pm.c
@@ -136,7 +136,7 @@ static int sh_pm_enter(suspend_state_t state)
 	local_irq_disable();
 	set_bl_bit();
 	sh_mobile_call_standby(SUSP_MODE_STANDBY_SF);
-	local_irq_disable();
+	local_irq_enable();
 	clear_bl_bit();
 	return 0;
 }

  parent reply	other threads:[~2011-12-09  8:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-07  8:38 [PATCH] sh: fix cpuidle on sh7724, possibly others Guennadi Liakhovetski
2011-12-07 11:12 ` Guennadi Liakhovetski
2011-12-09  8:54 ` Paul Mundt [this message]
2011-12-09  9:27 ` Guennadi Liakhovetski

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=20111209085415.GA19960@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-sh@vger.kernel.org \
    /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.