From patchwork Sat Nov 30 15:56:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21905 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 737E620DB9 for ; Sat, 30 Nov 2013 15:56:55 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 1sf20052082qec.4 for ; Sat, 30 Nov 2013 07:56:55 -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=eJ3giKwAu67CjT8tcjsbzWfwGx6OWj39xfchZfF7VkRAHJ/m4Jjfj+ZcmgJ4OhBekS q5wY4jUylDTISOFoW8hG6IMPN1EVuessAU7YkffG0fyzWl6OplNi9z73Y+2MUChuPlQp RU4RqiLKaLLCJbG3iHj9eICpF+WhofPLt48s9uoEHK7nIh3/6Vj3h4B0EG69wCHZJVD1 a9Vx2LOU9lz5aC68+XDCjOTEH4HFFz4N1oyENjBvUU24fIRtVvmd3Os6QTwxJGO66qBx FmLA+jw0ZQSpzKH3saJ1tP5a1JYmhuBP1hoEw5tMFIbJEpkGv80UEl3YC4smeI3hWAtE Cl8Q== X-Gm-Message-State: ALoCoQnX3TSrB2CofU096MaNiJyrgLTYNNJ6/EFACafdIZTUasF1f2VxiTZUoXWdOyaVIxVNXk+s X-Received: by 10.58.88.2 with SMTP id bc2mr805624veb.37.1385827014919; Sat, 30 Nov 2013 07:56:54 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.12.176 with SMTP id z16ls4144469qeb.16.gmail; Sat, 30 Nov 2013 07:56:54 -0800 (PST) X-Received: by 10.52.52.137 with SMTP id t9mr25845219vdo.22.1385827014819; Sat, 30 Nov 2013 07:56:54 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id xn8si1856579vdc.126.2013.11.30.07.56.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 30 Nov 2013 07:56:54 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.176 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.176; Received: by mail-ve0-f176.google.com with SMTP id oz11so7504901veb.7 for ; Sat, 30 Nov 2013 07:56:54 -0800 (PST) X-Received: by 10.220.74.69 with SMTP id t5mr31157139vcj.18.1385827014733; Sat, 30 Nov 2013 07:56:54 -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 u4csp3808vcz; Sat, 30 Nov 2013 07:56:54 -0800 (PST) X-Received: by 10.66.149.135 with SMTP id ua7mr38305698pab.124.1385827013958; Sat, 30 Nov 2013 07:56:53 -0800 (PST) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) by mx.google.com with ESMTPS id pj7si9630997pbc.279.2013.11.30.07.56.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 30 Nov 2013 07:56:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.173 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.173; Received: by mail-pd0-f173.google.com with SMTP id p10so15354900pdj.4 for ; Sat, 30 Nov 2013 07:56:53 -0800 (PST) X-Received: by 10.66.138.40 with SMTP id qn8mr2075606pab.154.1385827013488; Sat, 30 Nov 2013 07:56:53 -0800 (PST) Received: from localhost ([122.167.133.207]) by mx.google.com with ESMTPSA id qv8sm109911527pbc.31.2013.11.30.07.56.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 30 Nov 2013 07:56:52 -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 4/5] cpufreq: powernow-k8: send new set of notification for transition failures Date: Sat, 30 Nov 2013 21:26:22 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <0d635c6701654a75f6d25dd435705dc1ede3e19c.1385826776.git.viresh.kumar@linaro.org> References: <0d635c6701654a75f6d25dd435705dc1ede3e19c.1385826776.git.viresh.kumar@linaro.org> In-Reply-To: <0d635c6701654a75f6d25dd435705dc1ede3e19c.1385826776.git.viresh.kumar@linaro.org> References: <0d635c6701654a75f6d25dd435705dc1ede3e19c.1385826776.git.viresh.kumar@linaro.org> 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.176 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; }