Re: 3.15-rc2: longhaul cpufreq stalls tasks for 120s+

From: Viresh Kumar
Date: Thu Apr 24 2014 - 06:30:07 EST


On 24 April 2014 15:46, Meelis Roos <mroos@xxxxxxxx> wrote:
> I can add debug to where needed and try it.

I am quite sure below wouldn't fix it, but just wanted to check
for the corner case :(

Can you please try attached patch (mail's content would be
broken):

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index abda660..7198e23 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -355,10 +355,12 @@ void cpufreq_freq_transition_begin(struct
cpufreq_policy *policy,
struct cpufreq_freqs *freqs)
{
wait:
+ smp_mb();
wait_event(policy->transition_wait, !policy->transition_ongoing);

spin_lock(&policy->transition_lock);

+ smp_mb();
if (unlikely(policy->transition_ongoing)) {
spin_unlock(&policy->transition_lock);
goto wait;
@@ -380,8 +382,11 @@ void cpufreq_freq_transition_end(struct
cpufreq_policy *policy,

cpufreq_notify_post_transition(policy, freqs, transition_failed);

+ smp_mb();
+
policy->transition_ongoing = false;

+ smp_mb();
wake_up(&policy->transition_wait);
}
EXPORT_SYMBOL_GPL(cpufreq_freq_transition_end);
From 08d42f39fed326a74fa2062cfc663ca41ee71148 Mon Sep 17 00:00:00 2001
Message-Id: <08d42f39fed326a74fa2062cfc663ca41ee71148.1398335331.git.viresh.kumar@xxxxxxxxxx>
From: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Date: Thu, 24 Apr 2014 15:58:50 +0530
Subject: [PATCH] cpufreq: add smp_mb()s to cpufreq transitions

Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
---
drivers/cpufreq/cpufreq.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index abda660..7198e23 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -355,10 +355,12 @@ void cpufreq_freq_transition_begin(struct cpufreq_policy *policy,
struct cpufreq_freqs *freqs)
{
wait:
+ smp_mb();
wait_event(policy->transition_wait, !policy->transition_ongoing);

spin_lock(&policy->transition_lock);

+ smp_mb();
if (unlikely(policy->transition_ongoing)) {
spin_unlock(&policy->transition_lock);
goto wait;
@@ -380,8 +382,11 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy,

cpufreq_notify_post_transition(policy, freqs, transition_failed);

+ smp_mb();
+
policy->transition_ongoing = false;

+ smp_mb();
wake_up(&policy->transition_wait);
}
EXPORT_SYMBOL_GPL(cpufreq_freq_transition_end);
--
1.7.12.rc2.18.g61b472e