From patchwork Thu Jan 31 10:39:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 2072221 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8AB293FD1A for ; Thu, 31 Jan 2013 10:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753241Ab3AaKjf (ORCPT ); Thu, 31 Jan 2013 05:39:35 -0500 Received: from mail-ee0-f52.google.com ([74.125.83.52]:35441 "EHLO mail-ee0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751954Ab3AaKje (ORCPT ); Thu, 31 Jan 2013 05:39:34 -0500 Received: by mail-ee0-f52.google.com with SMTP id b15so1351070eek.11 for ; Thu, 31 Jan 2013 02:39:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=zIvMZk85BxQBh4rf3dP2S5MQlaVlWWXg2BlONPR1zTo=; b=DSVLulaw5g8r6jjcMabO9KZeDGUEzCeKTdxdZNFzL2/JZemMrqBunsZAPz4m3j0x54 zOxWFEHYnADCKUmbTIlFPoEKO2O4VLDraCbji5nwuFk/PJNHZP6Qjb18OllTTdBBAdFr AOFaNbBEnxDxeqvbu6zGvhZBx/f6RIDi4F2n3ToZV+o4xHFjsrGSmvPnySSTPDlAtQFe mrozwUeurr+YAjckB0aNLk2fluN3vob+nIUhRKWVUuxnUX/fNtH8Mdil+1U12q0dsNw7 UK589L9XNjmWd9xdIWsZ73vWfokb3gON59DkuFfgRd+baWYUlw10HgJbMCIiu7Kzf+5W 3GGw== X-Received: by 10.14.220.1 with SMTP id n1mr25897540eep.16.1359628773642; Thu, 31 Jan 2013 02:39:33 -0800 (PST) Received: from localhost ([2a01:2003:1:1e91:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id f49sm6712160eep.12.2013.01.31.02.39.27 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 31 Jan 2013 02:39:32 -0800 (PST) From: Fabio Baltieri To: "Rafael J. Wysocki" , cpufreq@vger.kernel.org, linux-pm@vger.kernel.org Cc: Viresh Kumar , Linus Walleij , linaro-dev@lists.linaro.org, linux-kernel@vger.kernel.org, Fabio Baltieri Subject: [PATCH] cpufreq: governors: fix misuse of cdbs.cpu Date: Thu, 31 Jan 2013 11:39:19 +0100 Message-Id: <1359628759-15006-1-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.7.12.1 X-Gm-Message-State: ALoCoQk3x1ui2jpwitFNs1DRLRDDV/CxCnwMcyWtTEeT4ysEoTtrIW1ih/7AoslQoINlz1ZpGgrV Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Fix governors code to set all cpu's cdbs->cpu to the the actual cpu id and use cur_policy->cpu istead of cdbs->cpu to track current governor's leader cpu. Reported-by: Viresh Kumar Signed-off-by: Fabio Baltieri Acked-by: Viresh Kumar --- drivers/cpufreq/cpufreq_conservative.c | 5 +++-- drivers/cpufreq/cpufreq_governor.c | 2 +- drivers/cpufreq/cpufreq_ondemand.c | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 653fb06..c18a304 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -114,7 +114,7 @@ static void cs_check_cpu(int cpu, unsigned int load) static void cs_timer_update(struct cs_cpu_dbs_info_s *dbs_info, bool sample, struct delayed_work *dw) { - unsigned int cpu = dbs_info->cdbs.cpu; + unsigned int cpu = dbs_info->cdbs.cur_policy->cpu; int delay = delay_for_sampling_rate(cs_tuners.sampling_rate); if (sample) @@ -132,7 +132,8 @@ static void cs_timer_coordinated(struct cs_cpu_dbs_info_s *dbs_info_local, bool sample = true; /* use leader CPU's dbs_info */ - dbs_info = &per_cpu(cs_cpu_dbs_info, dbs_info_local->cdbs.cpu); + dbs_info = &per_cpu(cs_cpu_dbs_info, + dbs_info_local->cdbs.cur_policy->cpu); mutex_lock(&dbs_info->cdbs.timer_mutex); time_now = ktime_get(); diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 67e235a..46f1c78 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -208,11 +208,11 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, mutex_lock(&dbs_data->mutex); dbs_data->enable++; - cpu_cdbs->cpu = cpu; for_each_cpu(j, policy->cpus) { struct cpu_dbs_common_info *j_cdbs; j_cdbs = dbs_data->get_cpu_cdbs(j); + j_cdbs->cpu = j; j_cdbs->cur_policy = policy; j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, &j_cdbs->prev_cpu_wall); diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 5ae84ff..75efd5e 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -219,7 +219,7 @@ static void od_check_cpu(int cpu, unsigned int load_freq) static void od_timer_update(struct od_cpu_dbs_info_s *dbs_info, bool sample, struct delayed_work *dw) { - unsigned int cpu = dbs_info->cdbs.cpu; + unsigned int cpu = dbs_info->cdbs.cur_policy->cpu; int delay, sample_type = dbs_info->sample_type; /* Common NORMAL_SAMPLE setup */ @@ -255,7 +255,8 @@ static void od_timer_coordinated(struct od_cpu_dbs_info_s *dbs_info_local, bool sample = true; /* use leader CPU's dbs_info */ - dbs_info = &per_cpu(od_cpu_dbs_info, dbs_info_local->cdbs.cpu); + dbs_info = &per_cpu(od_cpu_dbs_info, + dbs_info_local->cdbs.cur_policy->cpu); mutex_lock(&dbs_info->cdbs.timer_mutex); time_now = ktime_get();