From patchwork Mon Dec 2 05:34:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21910 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F397320DB9 for ; Mon, 2 Dec 2013 05:34:34 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id p10sf32070861pdj.11 for ; Sun, 01 Dec 2013 21:34:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=MsmPtjC704hbqNC1bOU3pg2GizONTY0skC+dAyAJ/9E=; b=gZlwNVo76On/B0sErS2SXZm0RDksllg1hwJQTDqbwsRFzzpOS1cR5bBgjh9rpETS2P jtuEOthKNFCsbFpjr3cTDq5eBwIp2x0Ioux4dhCAUH+9Azovj+AY1f73Ee6Gf4ZhCYrh h8Guf07PIKGJj64vsK5BrEHgpi2jqlGwdXWV0v5dSwE9r2iT6fI3bzpid0vzehnPURzX 9PV1+H6jGG2jHGuhrAErK5fMvXUPCR/H2QV3kdra+CefGutIxQAnLSokkhPk99QQGY3+ rxATwHsBlMIGylF1WhMSO87i0zd/iaZoc7CYw0jyq6IyckvkLR1OQmXDNHicn/vDD3QM RSTQ== X-Gm-Message-State: ALoCoQkl1C6nVnE3cvK3rRAtG2rAEQ2IHNyVUfc8TTzHmo4N0txZQMMs+1trzoYcpwxGL9Fe71nr X-Received: by 10.68.237.37 with SMTP id uz5mr9665104pbc.0.1385962473908; Sun, 01 Dec 2013 21:34:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.61.229 with SMTP id t5ls1632172qer.53.gmail; Sun, 01 Dec 2013 21:34:33 -0800 (PST) X-Received: by 10.220.123.6 with SMTP id n6mr152373vcr.28.1385962473796; Sun, 01 Dec 2013 21:34:33 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id a6si28946511vdp.52.2013.12.01.21.34.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 01 Dec 2013 21:34:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oz11so8389304veb.18 for ; Sun, 01 Dec 2013 21:34:33 -0800 (PST) X-Received: by 10.52.171.79 with SMTP id as15mr43398871vdc.1.1385962473729; Sun, 01 Dec 2013 21:34:33 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp91879vcz; Sun, 1 Dec 2013 21:34:33 -0800 (PST) X-Received: by 10.49.131.5 with SMTP id oi5mr68928516qeb.38.1385962473396; Sun, 01 Dec 2013 21:34:33 -0800 (PST) Received: from mail-qe0-f44.google.com (mail-qe0-f44.google.com [209.85.128.44]) by mx.google.com with ESMTPS id lc9si26196755qeb.62.2013.12.01.21.34.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 01 Dec 2013 21:34:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.44 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.128.44; Received: by mail-qe0-f44.google.com with SMTP id nd7so12221357qeb.3 for ; Sun, 01 Dec 2013 21:34:33 -0800 (PST) X-Received: by 10.49.53.66 with SMTP id z2mr67758111qeo.45.1385962473263; Sun, 01 Dec 2013 21:34:33 -0800 (PST) Received: from localhost (git.linaro.org. [54.235.93.228]) by mx.google.com with ESMTPSA id g10sm2672183qaf.9.2013.12.01.21.34.32 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 01 Dec 2013 21:34:32 -0800 (PST) From: Viresh Kumar To: rjw@rjwysocki.net Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 4/5] cpufreq: powernow-k8: send new set of notification for transition failures Date: Mon, 2 Dec 2013 11:04:15 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In the current code, if we fail during a frequency transition we simply send the POSTCHANGE notification with old frequency. This isn't enough. One of the core user of these notifications is the code responsible for keeping loops_per_jiffy aligned with frequency change. And mostly it is written as: if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) { update-loops-per-jiffy... } So, suppose we are changing to a higher frequency and failed during transition, then following will happen: - CPUFREQ_PRECHANGE notification with freq-new > freq-old - CPUFREQ_POSTCHANGE notification with freq-new == freq-old The first one will update loops_per_jiffy and second one will do nothing. Even if we send the 2nd notification by exchanging values of freq-new and old, some users of these notifications might get unstable. This can be fixed by simply calling cpufreq_notify_post_transition() with error code and this routine will take care of sending notifications in correct order. Signed-off-by: Viresh Kumar --- drivers/cpufreq/powernow-k8.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 0023c7d..e10b646 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c @@ -964,14 +964,9 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, cpufreq_cpu_put(policy); cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); - res = transition_fid_vid(data, fid, vid); - if (res) - freqs.new = freqs.old; - else - freqs.new = find_khz_freq_from_fid(data->currfid); + cpufreq_notify_post_transition(policy, &freqs, res); - cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); return res; }