From patchwork Tue Apr 25 10:27:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 98182 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1879485qgf; Tue, 25 Apr 2017 03:27:38 -0700 (PDT) X-Received: by 10.84.239.8 with SMTP id w8mr37702687plk.73.1493116058395; Tue, 25 Apr 2017 03:27:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g185si21856638pfb.57.2017.04.25.03.27.38; Tue, 25 Apr 2017 03:27:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1176669AbdDYK1a (ORCPT + 14 others); Tue, 25 Apr 2017 06:27:30 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:33321 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S980695AbdDYK13 (ORCPT ); Tue, 25 Apr 2017 06:27:29 -0400 Received: by mail-pg0-f45.google.com with SMTP id 63so26527193pgh.0 for ; Tue, 25 Apr 2017 03:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=h63gnbXFETiOs1pjfSW+gitpKuqd+E9NVyloh83jD+4=; b=VoAvWOd0LjpIWPJ0kScQ40ITW0wiEbJzYd6Pq85BRVAehKn/uAmjpkHUXBiDoqR7FM rUv1nQlFtgFfPJrWLFu7JGEHKaVK/ccuqILjlxDcVBHG8gzoBau/3d8HKaOYhJBxH4vz b1VWqlEopzeTiMVXAXdqb5xcExr6LCYRkcY8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=h63gnbXFETiOs1pjfSW+gitpKuqd+E9NVyloh83jD+4=; b=Q5KJCu3wj4RMiHMyjgdAnAeIcruurxSt3JJR8YA4KkagJoEI49/ppbojuEJ5g1Y6z1 Ku21Ap108QrcamI2QuD9dPoYyjSM+iR+e7hR7mi27943KogNwHRUWRg+L8UmO2E2hC2f EP13orZIRBe8LkD6fUgCEo7kVHfuLKvDajA5zrf7K7OQJF6eIIXHRNub6z3fqBOUTwTB d7skUdd7NZkLozEIIQ53L6+DVJsjLxlMroUd+wtFR/w3yaYZ943+QiCSDCjroPmuoSA7 tu6VTV0MJJW2JY7wFADFeoQoN/1CPo/G4pIrqnjBRJBk01czpHkmDG1Jmt3VvGj9jGN/ b8PQ== X-Gm-Message-State: AN3rC/4O59YiTCFWSgFuII65o93l61LMLzlUukJfH+K7LO70hYH6We5O fcyRoZBAQY9xd1sB X-Received: by 10.98.36.202 with SMTP id k71mr2505318pfk.156.1493116048424; Tue, 25 Apr 2017 03:27:28 -0700 (PDT) Received: from localhost ([122.172.121.5]) by smtp.gmail.com with ESMTPSA id p62sm35774132pfi.7.2017.04.25.03.27.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Apr 2017 03:27:27 -0700 (PDT) From: Viresh Kumar To: Javi Merino , Zhang Rui , Eduardo Valentin , Lukasz Luba Cc: linaro-kernel@lists.linaro.org, Amit Daniel Kachhap , Rafael Wysocki , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , Punit Agrawal , Viresh Kumar Subject: [PATCH V4 00/17] thermal: cpu_cooling: improve interaction with cpufreq core Date: Tue, 25 Apr 2017 15:57:07 +0530 Message-Id: X-Mailer: git-send-email 2.12.0.432.g71c3a4f4ba37 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hi Guys, The cpu_cooling driver is designed to use CPU frequency scaling to avoid high thermal states for a platform. But it wasn't glued really well with cpufreq core. For example clipped-cpus is copied from the policy structure and its much better to use the policy->cpus (or related_cpus) fields directly as they may have got updated. Not that things were broken before this series, but they can be optimized a bit more. This series tries to improve interactions between cpufreq core and cpu_cooling driver and does some fixes/cleanups to the cpu_cooling driver. I have tested it on ARM 32 (exynos) and 64 bit (hikey) boards (haven't tested the power specific bits). Lukasz from ARM has been very generous in testing and finding out few bugs in the earlier versions and getting those fixed. He has successfully tested the new version on his ARM big LITTLE Juno board. Pushed here as well: git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git thermal/cooling V3->V4: - The pointer to policy in the cpufreq notifier will have a different address and so that address can't be used for comparison. Compare policy->cpu instead. - max_level field was used for the newly created power-freq table, but few places I have used < max_level instead of <= max_level and that caused the trouble. - Added Tested-by from Lukasz. V2->V3: - Additional check to guarantee that policy is valid. - Initialize freq-table and cpufreq_cdev->policy fields before they are used by the power-cooling functionality. - Thanks Lukasz for testing out and suggesting these changes. V1->V2: - Name cpufreq cooling dev as cpufreq_cdev everywhere (Eduardo). -- viresh Viresh Kumar (17): thermal: cpu_cooling: Avoid accessing potentially freed structures thermal: cpu_cooling: rearrange globals thermal: cpu_cooling: Name cpufreq cooling devices as cpufreq_cdev thermal: cpu_cooling: replace cool_dev with cdev thermal: cpu_cooling: remove cpufreq_cooling_get_level() thermal: cpu_cooling: get rid of a variable in cpufreq_set_cur_state() thermal: cpu_cooling: use cpufreq_policy to register cooling device cpufreq: create cpufreq_table_count_valid_entries() thermal: cpu_cooling: store cpufreq policy thermal: cpu_cooling: OPPs are registered for all CPUs thermal: cpu_cooling: get rid of 'allowed_cpus' thermal: cpu_cooling: merge frequency and power tables thermal: cpu_cooling: create structure for idle time stats thermal: cpu_cooling: get_level() can't fail thermal: cpu_cooling: don't store cpu_dev in cpufreq_cdev thermal: cpu_cooling: 'freq' can't be zero in cpufreq_state2power() thermal: cpu_cooling: Rearrange struct cpufreq_cooling_device drivers/cpufreq/arm_big_little.c | 2 +- drivers/cpufreq/cpufreq-dt.c | 2 +- drivers/cpufreq/cpufreq_stats.c | 13 +- drivers/cpufreq/dbx500-cpufreq.c | 2 +- drivers/cpufreq/mt8173-cpufreq.c | 4 +- drivers/cpufreq/qoriq-cpufreq.c | 3 +- drivers/thermal/cpu_cooling.c | 606 +++++++++------------ drivers/thermal/imx_thermal.c | 22 +- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 22 +- include/linux/cpu_cooling.h | 32 +- include/linux/cpufreq.h | 14 + 11 files changed, 315 insertions(+), 407 deletions(-) -- 2.12.0.432.g71c3a4f4ba37 Reviewed-by: Lukasz Luba