From patchwork Tue Jul 23 06:14:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169476 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8446486ilk; Mon, 22 Jul 2019 23:14:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEhyPz4EZ5Mdv2RZoogf3oVkwl8IphpV4hv8OJnTQh1M84YiaeUxKsziKWl6TLXH/HgqZp X-Received: by 2002:a17:90a:d80b:: with SMTP id a11mr76954503pjv.53.1563862468317; Mon, 22 Jul 2019 23:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563862468; cv=none; d=google.com; s=arc-20160816; b=rc6eHbmVN0d9rH0UThe6Q2OydvlntQ3v/yYZQRuxa/XZ6eKR1vaIZTCrqhWY/rBjau G0vU8LHuThUhyF+EyjIKylGUEe72Ns1X85Hn02gBHrAlXHxkBZOjNU6Ub98/xZpyR4f7 lSddY2z9TLZ/A2GZC7eBUMVc07R0dgAPa+97m4p3s8QtwBlqPN8WnmTbPOhmoifwoh2B QMEETUvMW3Yon4AJr+axltORSrYbqKOiV3XNSJcNMVTS2nFdODheSk3L+50jroVh3HrO WGw4ROEZbp79/0+Eu6ZM9l0PSMfp5XxPlRhpfivyvFnQHGhMEWK954sA3I+RAXefRX3v TmEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nSry5tHM9RfBOmIKpr9LmoQMa70G9y55/xkG15xZ4dM=; b=aLa0FaHuresR8DC7ZxSwyeArFKI4+uE8FZHych/whiT7dGGmGvfXx0ynnPJHG3q9uy AR0uGxSpVSbnwhAFewpVwTcU62nudt3jcfFnLg/llw63hCWssZBdOwoI4vKCJ3eyc07X Wu2NzxkG2q1tQdvpbiaKcwen/Pn3CCRwFJs4BILBBJjeIFlPOT7h9ANpfOlfQBa+QrqB orqmFqde/htAvRcoG5kCue5+iJFpmmERygLpWpsOvQF0t/7GkkkGl9HZ7EvwtQsGxmLR YOrKkJNWCm2hnu32WEsh1p81kSY5eHaTehXB1sUcOiWFxUdETe1Qh4aETSfanlVqzwU/ 00sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=acOECtFz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si10370170plb.205.2019.07.22.23.14.28; Mon, 22 Jul 2019 23:14:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 header.s=google header.b=acOECtFz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S2388084AbfGWGO0 (ORCPT + 29 others); Tue, 23 Jul 2019 02:14:26 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37888 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731307AbfGWGOZ (ORCPT ); Tue, 23 Jul 2019 02:14:25 -0400 Received: by mail-pl1-f195.google.com with SMTP id az7so20162193plb.5 for ; Mon, 22 Jul 2019 23:14:25 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=nSry5tHM9RfBOmIKpr9LmoQMa70G9y55/xkG15xZ4dM=; b=acOECtFzXcNr8wH91jVpU+QCAxg4f02keJtwJpfZ71lbvRGloj62uIAu74gaAy0Bo0 S51fFMkXeSB0ABaR8PMZ7u9iHNj7/Jxegy3RYT5dfp4kHfGC4FhBI2jZYsu6PiDQRssw jhswXrVHzcxqk5BriDTnks0Nsemh2eF6IPFFso9iPH4hdvv6SJQ0JoeKrgOoXctaclcD 7oExmNPhSNYCLwoj9Ku6ftzNhW7eyqdJfhCnrHfFVT2jqHYxT5Roj5+jvEvWAO9+9k58 RvPxHt+csJ4SL0bHacKFmdRa2jFNzLobeo29CPPIlpdnqM3GCqJba/1uH61dfhtylHsQ pu8Q== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=nSry5tHM9RfBOmIKpr9LmoQMa70G9y55/xkG15xZ4dM=; b=WanozS06YleopqKu9R2ND8H+eGpKgV+kuq1W+apvwXAKXAV3FoVPu73dRR6+JR/wgx mOKX9qoyAd9E7WTcUpq0dD/ubKh98wYsaDS6H1SKNaBLE549XwrP5+ocXJHbqY1qjBiZ 1oVeMQHDXyhoJVfHznevQwRC21TQd9inNDMtXyvfqJYtNp9hg3sZCqzAKmgx06nqvO/a b6zje72sll8FDIFCVA6YoeKQOIvBdSiTTPjubn7y04+q03S8hzvxrD+1jFwK68/7BigD noJOkMLO1LkR7oQIvf24KU9f1XTt4X0wKhsivDEP47rp+lpOW0nZow6q5iIBnAMVJaaL Z6RA== X-Gm-Message-State: APjAAAXtWKAlZMANRuYDxXzsBRj4Vx357ow9k4FGmduAh89O4NOlULdR sB6BWZjaA01FafofjM/eQtay1A== X-Received: by 2002:a17:902:b702:: with SMTP id d2mr81525584pls.259.1563862464605; Mon, 22 Jul 2019 23:14:24 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id a3sm38023673pfl.145.2019.07.22.23.14.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 23:14:24 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH V2 01/10] cpufreq: Add policy create/remove notifiers Date: Tue, 23 Jul 2019 11:44:01 +0530 Message-Id: <1b93721f076ec9006b99c92e8a7045d01630cf4b.1563862014.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit f9f41e3ef99ac9d4e91b07634362e393fb929aad. We have a new use case for policy create/remove notifiers (for allocating/freeing QoS requests per policy), lets add them back. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 15 ++++++++++++++- include/linux/cpufreq.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 8dda62367816..c13dcb59b30c 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1266,7 +1266,17 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) DEV_PM_QOS_MAX_FREQUENCY); dev_pm_qos_remove_notifier(dev, &policy->nb_min, DEV_PM_QOS_MIN_FREQUENCY); - dev_pm_qos_remove_request(policy->max_freq_req); + + if (policy->max_freq_req) { + /* + * CPUFREQ_CREATE_POLICY notification is sent only after + * successfully adding max_freq_req request. + */ + blocking_notifier_call_chain(&cpufreq_policy_notifier_list, + CPUFREQ_REMOVE_POLICY, policy); + dev_pm_qos_remove_request(policy->max_freq_req); + } + dev_pm_qos_remove_request(policy->min_freq_req); kfree(policy->min_freq_req); @@ -1391,6 +1401,9 @@ static int cpufreq_online(unsigned int cpu) ret); goto out_destroy_policy; } + + blocking_notifier_call_chain(&cpufreq_policy_notifier_list, + CPUFREQ_CREATE_POLICY, policy); } if (cpufreq_driver->get && has_target()) { diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 536a049d7ecc..afc10384a681 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -458,6 +458,8 @@ static inline void cpufreq_resume(void) {} /* Policy Notifiers */ #define CPUFREQ_ADJUST (0) #define CPUFREQ_NOTIFY (1) +#define CPUFREQ_CREATE_POLICY (2) +#define CPUFREQ_REMOVE_POLICY (3) #ifdef CONFIG_CPU_FREQ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); From patchwork Tue Jul 23 06:14:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169477 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8446549ilk; Mon, 22 Jul 2019 23:14:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfErOVDe3IPBMNMv/g+x/8enqDIXRDt3fj6YQvSqeUhmLjwo3icNgX6NMm4Kis9uxTj8T0 X-Received: by 2002:a63:9e54:: with SMTP id r20mr40257085pgo.64.1563862471738; Mon, 22 Jul 2019 23:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563862471; cv=none; d=google.com; s=arc-20160816; b=EQm4zU8hMekf7SeSu9YU7SUsNuAaa8zM7DW13a0zje8ycfcoZ56SqkRf5SSOiB7EEW kPFfDH7E0hyFt4+AwX1oajBtboc6cZ7foucYnqXlkXlo9/NKnYcUQqapmIZoTwqepaSu oYbAaKwKd4jKUNbOoyvFOWjhQKGvTkQQxbJbhQm1KSRFw70Do6NUcUi3rdf9e7HUvxpM kQo/IcnMWnM+ZJQ0/r6iFKLTqudjmeBFzTyxVESfuKMhUS/TjDVdsz0WBlXc2rl/JhG4 /8gry1Skm1Qq91gEzx5pKEnU/nrt/Hc91+4iUKJBKASIUKcUfB1WrjwHGOwobChxg9uR AEMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=T27u9AQsojQ674GAmNKFLMWAOrQITFIdhdVL3SNGHa0=; b=zAwmEe28hSkrFT+9nQyknCSG9W+Hft6x0P/pmM5NzkAsWLBUoZloeqXdPeKT4BoLLH myavlED/Puw8YP6IvLKXfIHH/JVJGo83jbK2Yo/CHGP1/a/Y0rXKN9/ZcibSMc5LM2Ke EAXN6qhdP9nyMCHevfTPV6jZgFMuxOrvgNNfJyTE0NN+LmH145t5wD0WsQbOvnqhcxTi fIB0hWTQ5QJAVuHr+j945hqCa2tmc3PZrJrn9BCrKze8WbR2ShLN2yhLBQCcACJdofNN 7XNujnins1sGErGeD/lYNJ8eMT8vfASC84iUgvef8am8FdN4/V3DFS4jQ76xs8oMEO6A yfSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=obC10n73; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si10370170plb.205.2019.07.22.23.14.31; Mon, 22 Jul 2019 23:14:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 header.s=google header.b=obC10n73; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S2388094AbfGWGOa (ORCPT + 29 others); Tue, 23 Jul 2019 02:14:30 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:43067 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728505AbfGWGO2 (ORCPT ); Tue, 23 Jul 2019 02:14:28 -0400 Received: by mail-pl1-f193.google.com with SMTP id 4so13191643pld.10 for ; Mon, 22 Jul 2019 23:14:27 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=T27u9AQsojQ674GAmNKFLMWAOrQITFIdhdVL3SNGHa0=; b=obC10n73Pw4AyLlrcsn5/50+eeV/qQEk85Cbw+xZkhbh4MPjLohj3d/ZOmCp8DseMu DitCeDke4pM/cf4uAG6ZPAG4Do9GZbJDeG5DQuXKlWl15ugwrxGSJhlTWQrkZyjV0KVw n2T357xJC5QCIPCbb7yDlZxIhLILw/zLfI2L75eRSvXWbqU03EBwL/3js1hFD66A+iBN JCVhOzwIiklzKhDvdvVQU9NcUp8FSTOQgTl1ycy6/V++FHd4Wkd060jTFegArCstZ/S7 WKRaMntXZbUSP6dr6P9EXhYmV7kbmNNvUqiE0+5mwuq0BN/uB4rMvsJvAKbRlQ+iyY7J pcKA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=T27u9AQsojQ674GAmNKFLMWAOrQITFIdhdVL3SNGHa0=; b=DSl76pltgegJNUWk3urMzBauvy36S7Dpnq2/PLVRpWuEYoOppoKGjfMfqw8QdJDs6/ JoMFhTlfqN9Fr/KbAFlclNzrfQVnQtWYAa/0cI/4d9ryjS/jcnQ9cTGJlyer3rHz4crU TtscCv+LM7ycV0rDgKrQfML8YwBmRxGrMtqLVXmrmRvB6HjLF5Tr4cWnS2A9nZyYtUpe h/iU5Qud67/laMTLx3FHb4j5JdxJbPuW0rWDEy4xcM/GwFm5Li3eJokXXm4GsWwBynRV Lxx/9bZyPppMXPfAmWzxeQV5DgaZM9Dch7Clv62CX6j/m08OKf1rDFW151BhIXs+z+PO qJ6g== X-Gm-Message-State: APjAAAXo+IbMn65uN6UG34uBBNRkDFmGdMbXSyGK6oigeyfq7jsojwZK lXwYg8JQ5h/NPi/xUJ5SyqzEZg== X-Received: by 2002:a17:902:e306:: with SMTP id cg6mr79006572plb.263.1563862467328; Mon, 22 Jul 2019 23:14:27 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id o11sm70597491pfh.114.2019.07.22.23.14.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 23:14:26 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Amit Daniel Kachhap , Viresh Kumar , Javi Merino , Zhang Rui , Eduardo Valentin , Daniel Lezcano Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH V2 02/10] thermal: cpu_cooling: Switch to QoS requests instead of cpufreq notifier Date: Tue, 23 Jul 2019 11:44:02 +0530 Message-Id: <22a22cba8855c914056dec8f8173c885b870f7a4.1563862014.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpufreq core now takes the min/max frequency constraints via QoS requests and the CPUFREQ_ADJUST notifier shall get removed later on. Switch over to using the QoS request for maximum frequency constraint for cpu_cooling driver. Signed-off-by: Viresh Kumar --- drivers/thermal/cpu_cooling.c | 110 ++++++++-------------------------- 1 file changed, 26 insertions(+), 84 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 4c5db59a619b..391f39776c6a 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -66,8 +67,6 @@ struct time_in_idle { * @last_load: load measured by the latest call to cpufreq_get_requested_power() * @cpufreq_state: integer value representing the current state of cpufreq * cooling devices. - * @clipped_freq: integer value representing the absolute value of the clipped - * frequency. * @max_level: maximum cooling level. One less than total number of valid * cpufreq frequencies. * @freq_table: Freq table in descending order of frequencies @@ -84,12 +83,12 @@ struct cpufreq_cooling_device { int id; u32 last_load; unsigned int cpufreq_state; - unsigned int clipped_freq; unsigned int max_level; struct freq_table *freq_table; /* In descending order */ struct cpufreq_policy *policy; struct list_head node; struct time_in_idle *idle_time; + struct dev_pm_qos_request qos_req; }; static DEFINE_IDA(cpufreq_ida); @@ -118,59 +117,6 @@ static unsigned long get_level(struct cpufreq_cooling_device *cpufreq_cdev, return level - 1; } -/** - * cpufreq_thermal_notifier - notifier callback for cpufreq policy change. - * @nb: struct notifier_block * with callback info. - * @event: value showing cpufreq event for which this function invoked. - * @data: callback-specific data - * - * Callback to hijack the notification on cpufreq policy transition. - * Every time there is a change in policy, we will intercept and - * update the cpufreq policy with thermal constraints. - * - * Return: 0 (success) - */ -static int cpufreq_thermal_notifier(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct cpufreq_policy *policy = data; - unsigned long clipped_freq; - struct cpufreq_cooling_device *cpufreq_cdev; - - if (event != CPUFREQ_ADJUST) - return NOTIFY_DONE; - - mutex_lock(&cooling_list_lock); - list_for_each_entry(cpufreq_cdev, &cpufreq_cdev_list, node) { - /* - * A new copy of the policy is sent to the notifier and can't - * compare that directly. - */ - if (policy->cpu != cpufreq_cdev->policy->cpu) - continue; - - /* - * policy->max is the maximum allowed frequency defined by user - * and clipped_freq is the maximum that thermal constraints - * allow. - * - * If clipped_freq is lower than policy->max, then we need to - * readjust policy->max. - * - * But, if clipped_freq is greater than policy->max, we don't - * need to do anything. - */ - clipped_freq = cpufreq_cdev->clipped_freq; - - if (policy->max > clipped_freq) - cpufreq_verify_within_limits(policy, 0, clipped_freq); - break; - } - mutex_unlock(&cooling_list_lock); - - return NOTIFY_OK; -} - /** * update_freq_table() - Update the freq table with power numbers * @cpufreq_cdev: the cpufreq cooling device in which to update the table @@ -374,7 +320,6 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) { struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; - unsigned int clip_freq; /* Request state should be less than max_level */ if (WARN_ON(state > cpufreq_cdev->max_level)) @@ -384,13 +329,10 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, if (cpufreq_cdev->cpufreq_state == state) return 0; - clip_freq = cpufreq_cdev->freq_table[state].frequency; cpufreq_cdev->cpufreq_state = state; - cpufreq_cdev->clipped_freq = clip_freq; - - cpufreq_update_policy(cpufreq_cdev->policy->cpu); - return 0; + return dev_pm_qos_update_request(&cpufreq_cdev->qos_req, + cpufreq_cdev->freq_table[state].frequency); } /** @@ -554,11 +496,6 @@ static struct thermal_cooling_device_ops cpufreq_power_cooling_ops = { .power2state = cpufreq_power2state, }; -/* Notifier for cpufreq policy change */ -static struct notifier_block thermal_cpufreq_notifier_block = { - .notifier_call = cpufreq_thermal_notifier, -}; - static unsigned int find_next_max(struct cpufreq_frequency_table *table, unsigned int prev_max) { @@ -596,9 +533,16 @@ __cpufreq_cooling_register(struct device_node *np, struct cpufreq_cooling_device *cpufreq_cdev; char dev_name[THERMAL_NAME_LENGTH]; unsigned int freq, i, num_cpus; + struct device *dev; int ret; struct thermal_cooling_device_ops *cooling_ops; - bool first; + + dev = get_cpu_device(policy->cpu); + if (unlikely(!dev)) { + pr_warn("No cpu device for cpu %d\n", policy->cpu); + return ERR_PTR(-ENODEV); + } + if (IS_ERR_OR_NULL(policy)) { pr_err("%s: cpufreq policy isn't valid: %p\n", __func__, policy); @@ -671,25 +615,29 @@ __cpufreq_cooling_register(struct device_node *np, cooling_ops = &cpufreq_cooling_ops; } + ret = dev_pm_qos_add_request(dev, &cpufreq_cdev->qos_req, + DEV_PM_QOS_MAX_FREQUENCY, + cpufreq_cdev->freq_table[0].frequency); + if (ret < 0) { + pr_err("%s: Failed to add freq constraint (%d)\n", __func__, + ret); + cdev = ERR_PTR(ret); + goto remove_ida; + } + cdev = thermal_of_cooling_device_register(np, dev_name, cpufreq_cdev, cooling_ops); if (IS_ERR(cdev)) - goto remove_ida; - - cpufreq_cdev->clipped_freq = cpufreq_cdev->freq_table[0].frequency; + goto remove_qos_req; mutex_lock(&cooling_list_lock); - /* Register the notifier for first cpufreq cooling device */ - first = list_empty(&cpufreq_cdev_list); list_add(&cpufreq_cdev->node, &cpufreq_cdev_list); mutex_unlock(&cooling_list_lock); - if (first) - cpufreq_register_notifier(&thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); - return cdev; +remove_qos_req: + dev_pm_qos_remove_request(&cpufreq_cdev->qos_req); remove_ida: ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id); free_table: @@ -777,7 +725,6 @@ EXPORT_SYMBOL_GPL(of_cpufreq_cooling_register); void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) { struct cpufreq_cooling_device *cpufreq_cdev; - bool last; if (!cdev) return; @@ -786,15 +733,10 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) mutex_lock(&cooling_list_lock); list_del(&cpufreq_cdev->node); - /* Unregister the notifier for the last cpufreq cooling device */ - last = list_empty(&cpufreq_cdev_list); mutex_unlock(&cooling_list_lock); - if (last) - cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); - thermal_cooling_device_unregister(cdev); + dev_pm_qos_remove_request(&cpufreq_cdev->qos_req); ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id); kfree(cpufreq_cdev->idle_time); kfree(cpufreq_cdev->freq_table); From patchwork Tue Jul 23 06:14:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169485 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8447136ilk; Mon, 22 Jul 2019 23:15:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqymVh4Pd8CZjDChrfYqwxT8i4ZkDYFh4uH3iPfbspDjW4/kTxNHWaQln8/ZhYfCY8AUAd1W X-Received: by 2002:a63:ec03:: with SMTP id j3mr48942843pgh.325.1563862507417; Mon, 22 Jul 2019 23:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563862507; cv=none; d=google.com; s=arc-20160816; b=hxDzQKd6UyiZbBictqQoAojxBEo+P4gv/k5k7Ot2YCJvc/7cS2IWgPdxCWxqRqUew6 nEEU2FSR719l2c++C56JNecruoejRjaPQ4m3o3NfK4VkyB77wuZIrUZJb8hxCco6lHeF rDClRMBRfCKVLLwaOS3j9s2O6oRA7entIBQnkCpDBAsI25J3/pff3mtA9TozdU3SijRA PMyWUDhTx9aD2L+1ylJKGF1NYcvnMXwKG/sPcHF//tAMLoDRiGFN/TXhwE8K7c1nKR+R k9qt21rTMot8fzpWhy1BcXhucSCNFeiQ4kxy2SVD5d6EAMuXh+OngKu4LsN9+p532iM0 mHbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KfxdZKhpROdsD8TEUU0uSmTytrjjuhlMQjqVQfanDQg=; b=rTW3Jw0VvfPB9birZxA46flQUpvEGRujTypNrz9hOQC1vi6XQaOntgm+aHNvUJNRCN kyx12/oW50KljEY7elX45cGVLzmqBcuCZxtqQIZkpmlzMrc8QnHl8Ly+DXZOVyqWrHcT nk0FTHwk7Zr85aA8F87uatdO8zWW/6t/TYf8OFLim1O0F1g3dxqP0+CbzWibbThv6eS0 5cdkt8iVggdix4y3vSqBtQH/AB6yRbE5pRDJ83w/3j3ITs6/C5GV4ETYIOhY04+ctPjO s00iWDaavAIxXj9uwMSDQyN8/atcIfQLRb+G3qovX/5Tg2ftxR6cfSmmYPaIaShsxUXG uwPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hEjEXBoE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3si13297039pje.1.2019.07.22.23.15.07; Mon, 22 Jul 2019 23:15:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 header.s=google header.b=hEjEXBoE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S2388130AbfGWGOm (ORCPT + 29 others); Tue, 23 Jul 2019 02:14:42 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46463 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388115AbfGWGOi (ORCPT ); Tue, 23 Jul 2019 02:14:38 -0400 Received: by mail-pf1-f194.google.com with SMTP id c73so18567967pfb.13 for ; Mon, 22 Jul 2019 23:14:37 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=KfxdZKhpROdsD8TEUU0uSmTytrjjuhlMQjqVQfanDQg=; b=hEjEXBoEqNjml0DemynQzJhiNMoQfS3MUfI8uB/l1iStoCmt/+43B5V3mF8G1ldH3w Apty1XSG1DB1n+aaB6SNjHy7JHzAf73ZIsMUCybv4iLpOuuVQTPFJh9rgdaeXkQsPIPQ ybZEpK0OEmih9P/PWGiamnPYRLJUqLLos/yIvmAg74+GgiOwDReK1jPr6j8QBycmMYdt gz5wWMsvWPileZtUcLLKNp0+bH5ezgduOdNYDPAclEv8e+dPjvFEdOeHZdz9z3RXns16 cLwLNFbszLDv4Snsk2oo0JEG68GGRQKMUskVedyFFgJTx7CLJ3fOoclP64oHdY3ttnwH Bz4g== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=KfxdZKhpROdsD8TEUU0uSmTytrjjuhlMQjqVQfanDQg=; b=Dvs48hszFUuLKtXOJNQeDMRoU9iuQNUSHrfq8+/HwMUj8CKc7weLeAzw2wxWLK+1ef yls1t6i00ARo/JKMBzxqHqmCxEWsU/pCpC6R26osYy2gX9QWJFJruASnnSiimRNEoQ9P MAv6Hij90pewB2S1Jgkz2FzQ6AUs4NrK4VYZ5KibxkhdG0El4Wl5ehswakYzRGuWdi+y yDteQ7ZGakssDSbwoFTO+eB67ctp57XTUbWK+miELCKqKAPdVPQt8T2dhaL48mZjiGR6 qNvyL7FAhvQqLsCg/xpJg3T5FvOzuRM/mrXCPDVqGEDkMsOOkVR8zgmhYoTbGiPBHlnq oHWw== X-Gm-Message-State: APjAAAXDArPNMmfc+I8CtynCPGZkg0ehbsH9EXK0teFr7GidW3PkBpJP XbNqGQ1Xjjr/6bkLTC4qPjsKug== X-Received: by 2002:a17:90a:9488:: with SMTP id s8mr82818553pjo.2.1563862477399; Mon, 22 Jul 2019 23:14:37 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id l26sm27326325pgb.90.2019.07.22.23.14.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 23:14:36 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Len Brown , Zhang Rui , Robert Moore , Erik Schmauss Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, devel@acpica.org Subject: [PATCH V2 05/10] ACPI: cpufreq: Switch to QoS requests instead of cpufreq notifier Date: Tue, 23 Jul 2019 11:44:05 +0530 Message-Id: <86dc4a082ea00c278c0e1d7f3fcbdc4ab9af2eec.1563862014.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpufreq core now takes the min/max frequency constraints via QoS requests and the CPUFREQ_ADJUST notifier shall get removed later on. Switch over to using the QoS request for maximum frequency constraint for acpi driver. Signed-off-by: Viresh Kumar --- drivers/acpi/processor_driver.c | 44 +++++++++++-- drivers/acpi/processor_perflib.c | 106 +++++++++++++------------------ drivers/acpi/processor_thermal.c | 81 ++++++++++++----------- include/acpi/processor.h | 22 ++++--- 4 files changed, 137 insertions(+), 116 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index aea8d674a33d..e7a3f07e9879 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -284,6 +284,35 @@ static int acpi_processor_stop(struct device *dev) return 0; } +bool acpi_processor_cpufreq_init; + +static int acpi_processor_notifier(struct notifier_block *nb, + unsigned long event, void *data) +{ + struct cpufreq_policy *policy = data; + int cpu; + + if (event == CPUFREQ_CREATE_POLICY) { + for_each_cpu(cpu, policy->cpus) + per_cpu(processors, cpu)->policy = policy; + + acpi_thermal_cpufreq_init(policy); + acpi_processor_ppc_init(policy); + } else if (event == CPUFREQ_REMOVE_POLICY) { + acpi_processor_ppc_exit(policy); + acpi_thermal_cpufreq_exit(policy); + + for_each_cpu(cpu, policy->cpus) + per_cpu(processors, cpu)->policy = NULL; + } + + return 0; +} + +static struct notifier_block acpi_processor_notifier_block = { + .notifier_call = acpi_processor_notifier, +}; + /* * We keep the driver loaded even when ACPI is not running. * This is needed for the powernow-k8 driver, that works even without @@ -310,8 +339,11 @@ static int __init acpi_processor_driver_init(void) cpuhp_setup_state_nocalls(CPUHP_ACPI_CPUDRV_DEAD, "acpi/cpu-drv:dead", NULL, acpi_soft_cpu_dead); - acpi_thermal_cpufreq_init(); - acpi_processor_ppc_init(); + if (!cpufreq_register_notifier(&acpi_processor_notifier_block, + CPUFREQ_POLICY_NOTIFIER)) { + acpi_processor_cpufreq_init = true; + } + acpi_processor_throttling_init(); return 0; err: @@ -324,8 +356,12 @@ static void __exit acpi_processor_driver_exit(void) if (acpi_disabled) return; - acpi_processor_ppc_exit(); - acpi_thermal_cpufreq_exit(); + if (acpi_processor_cpufreq_init) { + cpufreq_unregister_notifier(&acpi_processor_notifier_block, + CPUFREQ_POLICY_NOTIFIER); + acpi_processor_cpufreq_init = false; + } + cpuhp_remove_state_nocalls(hp_online); cpuhp_remove_state_nocalls(CPUHP_ACPI_CPUDRV_DEAD); driver_unregister(&acpi_processor_driver); diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index ee87cb6f6e59..1a22b2415a8b 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -50,57 +50,13 @@ module_param(ignore_ppc, int, 0644); MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \ "limited by BIOS, this should help"); -#define PPC_REGISTERED 1 -#define PPC_IN_USE 2 - -static int acpi_processor_ppc_status; - -static int acpi_processor_ppc_notifier(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct cpufreq_policy *policy = data; - struct acpi_processor *pr; - unsigned int ppc = 0; - - if (ignore_ppc < 0) - ignore_ppc = 0; - - if (ignore_ppc) - return 0; - - if (event != CPUFREQ_ADJUST) - return 0; - - mutex_lock(&performance_mutex); - - pr = per_cpu(processors, policy->cpu); - if (!pr || !pr->performance) - goto out; - - ppc = (unsigned int)pr->performance_platform_limit; - - if (ppc >= pr->performance->state_count) - goto out; - - cpufreq_verify_within_limits(policy, 0, - pr->performance->states[ppc]. - core_frequency * 1000); - - out: - mutex_unlock(&performance_mutex); - - return 0; -} - -static struct notifier_block acpi_ppc_notifier_block = { - .notifier_call = acpi_processor_ppc_notifier, -}; +static int acpi_processor_ppc_in_use; static int acpi_processor_get_platform_limit(struct acpi_processor *pr) { acpi_status status = 0; unsigned long long ppc = 0; - + int ret; if (!pr) return -EINVAL; @@ -112,7 +68,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) status = acpi_evaluate_integer(pr->handle, "_PPC", NULL, &ppc); if (status != AE_NOT_FOUND) - acpi_processor_ppc_status |= PPC_IN_USE; + acpi_processor_ppc_in_use = 1; if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PPC")); @@ -124,6 +80,16 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) pr->performance_platform_limit = (int)ppc; + if (ignore_ppc || ppc >= pr->performance->state_count) + return 0; + + ret = dev_pm_qos_update_request(pr->perflib_req, + pr->performance->states[ppc].core_frequency * 1000); + if (ret) { + pr_warn("Failed to update perflib freq constraint: cpu%d (%d)\n", + pr->id, ret); + } + return 0; } @@ -184,23 +150,39 @@ int acpi_processor_get_bios_limit(int cpu, unsigned int *limit) } EXPORT_SYMBOL(acpi_processor_get_bios_limit); -void acpi_processor_ppc_init(void) +void acpi_processor_ppc_init(struct cpufreq_policy *policy) { - if (!cpufreq_register_notifier - (&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER)) - acpi_processor_ppc_status |= PPC_REGISTERED; - else - printk(KERN_DEBUG - "Warning: Processor Platform Limit not supported.\n"); + struct acpi_processor *pr = per_cpu(processors, policy->cpu); + struct dev_pm_qos_request *req; + int ret; + + req = kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) + return; + + ret = dev_pm_qos_add_request(get_cpu_device(policy->cpu), + req, DEV_PM_QOS_MAX_FREQUENCY, + policy->cpuinfo.max_freq); + if (ret < 0) { + pr_err("Failed to add freq constraint for cpu%d (%d)\n", + policy->cpu, ret); + kfree(req); + return; + } + + pr->perflib_req = req; + + if (ignore_ppc < 0) + ignore_ppc = 0; } -void acpi_processor_ppc_exit(void) +void acpi_processor_ppc_exit(struct cpufreq_policy *policy) { - if (acpi_processor_ppc_status & PPC_REGISTERED) - cpufreq_unregister_notifier(&acpi_ppc_notifier_block, - CPUFREQ_POLICY_NOTIFIER); + struct acpi_processor *pr = per_cpu(processors, policy->cpu); - acpi_processor_ppc_status &= ~PPC_REGISTERED; + dev_pm_qos_remove_request(pr->perflib_req); + kfree(pr->perflib_req); + pr->perflib_req = NULL; } static int acpi_processor_get_performance_control(struct acpi_processor *pr) @@ -477,7 +459,7 @@ int acpi_processor_notify_smm(struct module *calling_module) static int is_done = 0; int result; - if (!(acpi_processor_ppc_status & PPC_REGISTERED)) + if (!acpi_processor_cpufreq_init) return -EBUSY; if (!try_module_get(calling_module)) @@ -513,7 +495,7 @@ int acpi_processor_notify_smm(struct module *calling_module) * we can allow the cpufreq driver to be rmmod'ed. */ is_done = 1; - if (!(acpi_processor_ppc_status & PPC_IN_USE)) + if (!acpi_processor_ppc_in_use) module_put(calling_module); return 0; @@ -742,7 +724,7 @@ acpi_processor_register_performance(struct acpi_processor_performance { struct acpi_processor *pr; - if (!(acpi_processor_ppc_status & PPC_REGISTERED)) + if (!acpi_processor_cpufreq_init) return -EINVAL; mutex_lock(&performance_mutex); diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c index 50fb0107375e..02407b33b874 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -35,7 +35,6 @@ ACPI_MODULE_NAME("processor_thermal"); #define CPUFREQ_THERMAL_MAX_STEP 3 static DEFINE_PER_CPU(unsigned int, cpufreq_thermal_reduction_pctg); -static unsigned int acpi_thermal_cpufreq_is_init = 0; #define reduction_pctg(cpu) \ per_cpu(cpufreq_thermal_reduction_pctg, phys_package_first_cpu(cpu)) @@ -61,35 +60,11 @@ static int phys_package_first_cpu(int cpu) static int cpu_has_cpufreq(unsigned int cpu) { struct cpufreq_policy policy; - if (!acpi_thermal_cpufreq_is_init || cpufreq_get_policy(&policy, cpu)) + if (!acpi_processor_cpufreq_init || cpufreq_get_policy(&policy, cpu)) return 0; return 1; } -static int acpi_thermal_cpufreq_notifier(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct cpufreq_policy *policy = data; - unsigned long max_freq = 0; - - if (event != CPUFREQ_ADJUST) - goto out; - - max_freq = ( - policy->cpuinfo.max_freq * - (100 - reduction_pctg(policy->cpu) * 20) - ) / 100; - - cpufreq_verify_within_limits(policy, 0, max_freq); - - out: - return 0; -} - -static struct notifier_block acpi_thermal_cpufreq_notifier_block = { - .notifier_call = acpi_thermal_cpufreq_notifier, -}; - static int cpufreq_get_max_state(unsigned int cpu) { if (!cpu_has_cpufreq(cpu)) @@ -108,7 +83,9 @@ static int cpufreq_get_cur_state(unsigned int cpu) static int cpufreq_set_cur_state(unsigned int cpu, int state) { - int i; + struct acpi_processor *pr; + unsigned long max_freq; + int i, ret; if (!cpu_has_cpufreq(cpu)) return 0; @@ -121,33 +98,53 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) * frequency. */ for_each_online_cpu(i) { - if (topology_physical_package_id(i) == + if (topology_physical_package_id(i) != topology_physical_package_id(cpu)) - cpufreq_update_policy(i); + continue; + + pr = per_cpu(processors, i); + max_freq = (pr->policy->cpuinfo.max_freq * (100 - reduction_pctg(i) * 20)) / 100; + + ret = dev_pm_qos_update_request(pr->thermal_req, max_freq); + if (ret) { + pr_warn("Failed to update thermal freq constraint: cpu%d (%d)\n", + pr->id, ret); + } } return 0; } -void acpi_thermal_cpufreq_init(void) +void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy) { - int i; + struct acpi_processor *pr = per_cpu(processors, policy->cpu); + struct dev_pm_qos_request *req; + int ret; + + req = kzalloc(sizeof(*req), GFP_KERNEL); + if (!req) + return; + + ret = dev_pm_qos_add_request(get_cpu_device(policy->cpu), + req, DEV_PM_QOS_MAX_FREQUENCY, + policy->cpuinfo.max_freq); + if (ret < 0) { + pr_err("Failed to add freq constraint for cpu%d (%d)\n", + policy->cpu, ret); + kfree(req); + return; + } - i = cpufreq_register_notifier(&acpi_thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); - if (!i) - acpi_thermal_cpufreq_is_init = 1; + pr->thermal_req = req; } -void acpi_thermal_cpufreq_exit(void) +void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy) { - if (acpi_thermal_cpufreq_is_init) - cpufreq_unregister_notifier - (&acpi_thermal_cpufreq_notifier_block, - CPUFREQ_POLICY_NOTIFIER); + struct acpi_processor *pr = per_cpu(processors, policy->cpu); - acpi_thermal_cpufreq_is_init = 0; + dev_pm_qos_remove_request(pr->thermal_req); + kfree(pr->thermal_req); + pr->thermal_req = NULL; } - #else /* ! CONFIG_CPU_FREQ */ static int cpufreq_get_max_state(unsigned int cpu) { diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 1194a4c78d55..a1a7966bb755 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -4,6 +4,8 @@ #include #include +#include +#include #include #include @@ -230,6 +232,9 @@ struct acpi_processor { struct acpi_processor_limit limit; struct thermal_cooling_device *cdev; struct device *dev; /* Processor device. */ + struct cpufreq_policy *policy; + struct dev_pm_qos_request *perflib_req; + struct dev_pm_qos_request *thermal_req; }; struct acpi_processor_errata { @@ -296,16 +301,17 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx /* in processor_perflib.c */ #ifdef CONFIG_CPU_FREQ -void acpi_processor_ppc_init(void); -void acpi_processor_ppc_exit(void); +extern bool acpi_processor_cpufreq_init; +void acpi_processor_ppc_init(struct cpufreq_policy *policy); +void acpi_processor_ppc_exit(struct cpufreq_policy *policy); void acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag); extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit); #else -static inline void acpi_processor_ppc_init(void) +static inline void acpi_processor_ppc_init(struct cpufreq_policy *policy) { return; } -static inline void acpi_processor_ppc_exit(void) +static inline void acpi_processor_ppc_exit(struct cpufreq_policy *policy) { return; } @@ -421,14 +427,14 @@ static inline int acpi_processor_hotplug(struct acpi_processor *pr) int acpi_processor_get_limit_info(struct acpi_processor *pr); extern const struct thermal_cooling_device_ops processor_cooling_ops; #if defined(CONFIG_ACPI_CPU_FREQ_PSS) & defined(CONFIG_CPU_FREQ) -void acpi_thermal_cpufreq_init(void); -void acpi_thermal_cpufreq_exit(void); +void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy); +void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy); #else -static inline void acpi_thermal_cpufreq_init(void) +static inline void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy) { return; } -static inline void acpi_thermal_cpufreq_exit(void) +static inline void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy) { return; } From patchwork Tue Jul 23 06:14:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169480 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8446784ilk; Mon, 22 Jul 2019 23:14:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKzSY8BjrTyn6XC4aeftfYPQfogAUP1PuO6/VdPWjZdXWqmb0vdAquINj+rBR7KGjxGH7i X-Received: by 2002:a17:90a:71ca:: with SMTP id m10mr26719187pjs.27.1563862485161; Mon, 22 Jul 2019 23:14:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563862485; cv=none; d=google.com; s=arc-20160816; b=hMcFGWcjzBMQ2MMdevAyNIw83vQgu0mF/qAwHuGU6QTKAIYRQlAgOnexoJUpXBrNvE 3GMxq9KHEetfgcyHVFBgfYRj37Gh1J5O9JMle9zV00WBgIzlQPJrilCqqQVXuoK1KXuS 1NRJ9NHIjW5mDm4cobUedX4Zd8EhdO0CunwZiveqI8gV+iDD5MvDP3WBCAKuvT94wIhu trH4GMKJe7FC4FpOByfql6vkypfph8WFzel8cHAHkYwL6gWyE4BJB2024utqwDbl03AA NGDF0irRF8UYnK2/b85fvtPnHofqDtqy4aibC0msMB9QaPUsPSPSTrg26iaj96sPsGsH +pcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jB85xxBwApqxzP5t70awnp6QUVo8jjK/SH2bjct3MZE=; b=M7IoQ2dYECqflRNe5MZGcjVcl9ePXJPglhZoWYpjoIFfgOMnVt9sFvaVec61ebxNTz +wpeNXxaFs0BtBHRW5Bwr8NPOThobWMbOmC6sENU45S4kxciwe7lgk9CkonrvsX4MoYs QMYTxh2oTpDRmKoq4loY+xlhVCLJesWDDnM80o4PLM4sgAuvkFrdPTpoLRPBapoTe89N +PlkHZJ7YH2A+StMKyXyFKWyyRL2zthHmyZNcsDKPXaE4SxPZA7FksW0G1nhXKTEzu7J 4vu0RI9k40nZnvSQMD4vjjKFiqkhJDeKs+l5r17HOXQUW62Z4VJ8/i7ADxi9NkCg+1Fn /sEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G5ctZVOy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2si13506322pgl.74.2019.07.22.23.14.44; Mon, 22 Jul 2019 23:14:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 header.s=google header.b=G5ctZVOy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S2388141AbfGWGOn (ORCPT + 29 others); Tue, 23 Jul 2019 02:14:43 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35261 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388104AbfGWGOl (ORCPT ); Tue, 23 Jul 2019 02:14:41 -0400 Received: by mail-pg1-f196.google.com with SMTP id s1so12554365pgr.2 for ; Mon, 22 Jul 2019 23:14:40 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=jB85xxBwApqxzP5t70awnp6QUVo8jjK/SH2bjct3MZE=; b=G5ctZVOyf1e2+mEbnsRNWd8L4HRAYyjqt9+LW4CUAh8H5q1QIFrn68m3DxIA1i/Ola XOm1L6f/TFr3BLsK/WRE9ka7TxXewhH3vqqKhEt5lrHGCaTxB+i9oKHNY2JalB7+nQZz W4FrpBrZ76Ci8SwLkhQ+H61D9Hi8YB9BsEFLjYpj7n9p6zZe19Pmitda/4B/N8NCCRrc XBtt1T/Gq4Bg0Kk/8GWDxdLw8w98y/jeZhrqcToiBoVkXh0DBpddlpEOMlqsU64KdWzF WxedSaGzqwXztSOwKn2w+K8gz7NFPiTwtsBnotow/RWB/EPeQtW681nVz/fFoikGlctk gXgA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=jB85xxBwApqxzP5t70awnp6QUVo8jjK/SH2bjct3MZE=; b=E8hjcaS2qJzkJ1YKjLWphplXeyyE603IDdda8PcAB9eydKookm7W+sf9ToPtaqkRfn 0k0pVQWuwyjZQvJWgkJSyhZfQsHnIC47akKtSaFi8w0AJkmZT25sojJcew5R8U5a5YIg EanmRRlJsG7093V701xU1B6lvKCoS/s9gwvrBKt/wYVq/c/flO4pXmHSv531Mf182YmU UnNxGSubi2MBsl1zudDlbKt9m6zrn5/ck2TBjTFUpIYJASfQNkkh0+wVRWyLOmdb7TWX TWFSC628R9uxd8vCoRVqrR+hvHrmCrz6qh6V5cqk+Scz1sk4+Wc22VAUsVfYsSwv1eCG qLJg== X-Gm-Message-State: APjAAAU8Np1UN9pJi0tm4iXVfdfot347aDnzdlwHuzCSZ0PPJrirInC5 MiNXWFVy++3s0RXxQvDrDIAfUA== X-Received: by 2002:a62:6344:: with SMTP id x65mr4282837pfb.111.1563862480370; Mon, 22 Jul 2019 23:14:40 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id q1sm49359764pfg.84.2019.07.22.23.14.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 23:14:39 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Greg Kroah-Hartman , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH V2 06/10] arch_topology: Use CPUFREQ_CREATE_POLICY instead of CPUFREQ_NOTIFY Date: Tue, 23 Jul 2019 11:44:06 +0530 Message-Id: <3afc5046ba9435d229a004c17b005197488006d4.1563862014.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CPUFREQ_NOTIFY is going to get removed soon, lets use CPUFREQ_CREATE_POLICY instead of that here. CPUFREQ_CREATE_POLICY is called only once (which is exactly what we want here) for each cpufreq policy when it is first created. Signed-off-by: Viresh Kumar --- drivers/base/arch_topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 63c1e76739f1..8cab1f5a8e0c 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -174,7 +174,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, if (!raw_capacity) return 0; - if (val != CPUFREQ_NOTIFY) + if (val != CPUFREQ_CREATE_POLICY) return 0; pr_debug("cpu_capacity: init cpu capacity for CPUs [%*pbl] (to_visit=%*pbl)\n", From patchwork Tue Jul 23 06:14:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169482 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8446873ilk; Mon, 22 Jul 2019 23:14:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmFiXBfS3KzO7FMUu6OTJ5ZBxjl2YVCcwvhwmgrs9MeNkCM/kazUvcYQe0bGOCmduMyFxq X-Received: by 2002:a65:6108:: with SMTP id z8mr43602077pgu.289.1563862489835; Mon, 22 Jul 2019 23:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563862489; cv=none; d=google.com; s=arc-20160816; b=jSqR/ACnxsQfWKnBM4/pENzgBcXXzWLJNW7/eNbEOufCYQ5FBfycFuIvvF9IPf+oYh f/vHWQ3QzYU+QK937pvo6y1Om1MShhvfWqTsprm+Tb+xidmxC3k2hkj1tK3naB8U3EAZ w8MUGV238UliVFUdcjSUbjHgOTAGDDMAvGlitTGE7TQrOYUj0d5mb6dDrGSfqD/vRZgQ ojodZzSlV9T9cyVyh42fbWk/WeNSIrcmmdFu0Pv0Yp3GukOLZkSeBRkBRonICc/UMQ8c 1TX4HWCO+WVL5zMYU0tY5IPEGw3zntfpfka3d7KPMvJ/Ur9OYfumoNHfIUsaLtQGlPcs Tb9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WSy97MHTyvjB+tNxNcL94WmxX39zNt2juy/xtyGFT8Y=; b=UnHZHMxoLw0hmtTCSYT2zOxLTn7pnPqRkqcaNBuQGw9ivsOJpX3GneniJYfC/Oyx81 CgpfiouxaJqHef516p2ykCMm0rixYBHnOYqAPWQPJtJuRxAxv+fExz3Jd1e9Or4SZV5i 0bvWzpjO21lWweEAkGY37pANjoPB2KJkuMmkxJG9Sxclef2Wd+TglyxaMADvTak0mj5q 5Heh3Gu8pycaeDEkXcgdzqgRNcggfD4vpqLEoIh9p2O2PWIJZP74VFSFwoLxW/RZNHop 5s2TPIxvyuxaKsTJPFqzRHKknhbG+sRmjBXVcDPL0iCEOow3b3OCN0Dl5WxL1AyWxd7x enBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qtTFfvyZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2si13506322pgl.74.2019.07.22.23.14.49; Mon, 22 Jul 2019 23:14:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 header.s=google header.b=qtTFfvyZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S2388149AbfGWGOr (ORCPT + 29 others); Tue, 23 Jul 2019 02:14:47 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42863 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388145AbfGWGOo (ORCPT ); Tue, 23 Jul 2019 02:14:44 -0400 Received: by mail-pl1-f194.google.com with SMTP id ay6so20200113plb.9 for ; Mon, 22 Jul 2019 23:14:43 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=WSy97MHTyvjB+tNxNcL94WmxX39zNt2juy/xtyGFT8Y=; b=qtTFfvyZQ+n3BuQV5HhEc01LRgT8Q3RVePNpiuu1aFBWLZo5PygfiqyPF5qZVn9kMs Ap/gS6I2/VtC79MvUUIFxAKz6PdL+jGvXs+qAQdfW+vWgCs0L5x6oMb817ZLrMRe+HJQ WQpmjP9g8/XywOFL87iUm1K0rWmzH6s0K/FknZkn08PcKHDV9j9derGTZZzn51hs2CvT bcbSjLS3S1IYcrl3kb/7UKnHwtQZcYDaFH2WL5o7WNBYy0kLw3qMjxeMVKpIO/5avxle slCcswwRW/HdUXQIyAaM/e+zokBpHfS8HYwRX12Njthf0f1F944t4XBK4n+1xmq6SCdT dckw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=WSy97MHTyvjB+tNxNcL94WmxX39zNt2juy/xtyGFT8Y=; b=AqJwibQJ7/MrHOXMF/pVmeWcfScItpsGjIoQy8NqZoE9kCpLi0rp30QOvXcXSFwZM9 s+CvDaxcKItRY+ZtF/YC4Dh71ArP39rzca6QirT1J3r3MFvaabRAqiiuJu0ZpJzpog+Z b1MKdL13sVVG6YCIiWv9Aj+MahzhQ/v3oZ11E9WCyYSKUKs0BadENmeG5jxUA0hdXPsh s81sd0JyNV7FrfqkzLcc+MV2opfbfS7qGZryz/liLQR1Pg6VgGVqOzUoOljrKk4aIhBc dSZalR8jgPCE+PQzxF454rfwNMsmp1kX2BmdS6MBC3O8JP3FcJVCA6D5P2xTSiAhfKja C5/w== X-Gm-Message-State: APjAAAVnDKKUdKKb8mzzNUCxA/vkjkkR2FzsLRyqOsEO6CyxT0UdLUHw Vz5fjA8m3pgFDGlT2aKyQsgpZQ== X-Received: by 2002:a17:902:a504:: with SMTP id s4mr56706631plq.117.1563862483299; Mon, 22 Jul 2019 23:14:43 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id o3sm76723419pje.1.2019.07.22.23.14.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 23:14:42 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Bartlomiej Zolnierkiewicz Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 07/10] video: sa1100fb: Remove cpufreq policy notifier Date: Tue, 23 Jul 2019 11:44:07 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpufreq policy notifier's CPUFREQ_ADJUST notification is going to get removed soon. The notifier callback sa1100fb_freq_policy() isn't doing anything apart from printing a debug message on CPUFREQ_ADJUST notification. There is no point in keeping an otherwise empty callback and registering the notifier. Remove it. Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: Viresh Kumar --- drivers/video/fbdev/sa1100fb.c | 27 --------------------------- drivers/video/fbdev/sa1100fb.h | 1 - 2 files changed, 28 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c index f7f8dee044b1..ae2bcfee338a 100644 --- a/drivers/video/fbdev/sa1100fb.c +++ b/drivers/video/fbdev/sa1100fb.c @@ -1005,31 +1005,6 @@ sa1100fb_freq_transition(struct notifier_block *nb, unsigned long val, } return 0; } - -static int -sa1100fb_freq_policy(struct notifier_block *nb, unsigned long val, - void *data) -{ - struct sa1100fb_info *fbi = TO_INF(nb, freq_policy); - struct cpufreq_policy *policy = data; - - switch (val) { - case CPUFREQ_ADJUST: - dev_dbg(fbi->dev, "min dma period: %d ps, " - "new clock %d kHz\n", sa1100fb_min_dma_period(fbi), - policy->max); - /* todo: fill in min/max values */ - break; - case CPUFREQ_NOTIFY: - do {} while(0); - /* todo: panic if min/max values aren't fulfilled - * [can't really happen unless there's a bug in the - * CPU policy verififcation process * - */ - break; - } - return 0; -} #endif #ifdef CONFIG_PM @@ -1242,9 +1217,7 @@ static int sa1100fb_probe(struct platform_device *pdev) #ifdef CONFIG_CPU_FREQ fbi->freq_transition.notifier_call = sa1100fb_freq_transition; - fbi->freq_policy.notifier_call = sa1100fb_freq_policy; cpufreq_register_notifier(&fbi->freq_transition, CPUFREQ_TRANSITION_NOTIFIER); - cpufreq_register_notifier(&fbi->freq_policy, CPUFREQ_POLICY_NOTIFIER); #endif /* This driver cannot be unloaded at the moment */ diff --git a/drivers/video/fbdev/sa1100fb.h b/drivers/video/fbdev/sa1100fb.h index 7a1a9ca33cec..d0aa33b0b88a 100644 --- a/drivers/video/fbdev/sa1100fb.h +++ b/drivers/video/fbdev/sa1100fb.h @@ -64,7 +64,6 @@ struct sa1100fb_info { #ifdef CONFIG_CPU_FREQ struct notifier_block freq_transition; - struct notifier_block freq_policy; #endif const struct sa1100fb_mach_info *inf; From patchwork Tue Jul 23 06:14:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 169484 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp8447060ilk; Mon, 22 Jul 2019 23:15:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoIWxFKKX7xpaZXc6umF+53mw4nUTJTnhn+MzKWxFtGOpuPCLoQcnNgcFe2Pci+1QkrBW1 X-Received: by 2002:a17:90a:ac13:: with SMTP id o19mr80922784pjq.143.1563862502843; Mon, 22 Jul 2019 23:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563862502; cv=none; d=google.com; s=arc-20160816; b=VWMWOAzoZ6yNN9CQh1HGEcNN+GpLQyRH9x1L6hwh/GRfhyqmf8H3lM8+LF3Mz+KQnk XMmL7bDnufcM7/rJwF0CGVkLTjEP5wDBXwvoIu96R5jZk2JlUGK7tXxvcLuKvyUIDJ6h qQkNUZc2GQKbY3ByzB6jQjB3ItfmZZq+lwre2C4eE8C5oY6rNKyRTTp33ZqoMMPEoRfw h2rqpmomLjQkA3A/cEH5aC2vMrrNtRRhiC7Pk13l6PBXtTDyRz8JBMVYMPZzAmRRU03c K+6NqUmRvKQmXgRtT13kMCTbiktghD49G2wh9STNdzm6RHcdURSEcADlYg2UdPCrQnjZ PwsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JQKPSfuw5DbCIirqqIDBXsU1/ucOSKObdNO60ntwNTU=; b=FxAUON/5/LPkti4xVpVY0xQTaS+sAp2WIlVUBt8+7lNwUIWTdbFuKf24fkiwkZYKY8 pGuaGdYGTgYLa59V2iwpn+yUX2vZ4FKT6lVy6QWQXNGZ9zgYKkFxRb9j8ev20ReaGqQF Dvl8A+i5k/NmQW2owwJIT4fYwofB3hGD29MPgyDEvLN5qhpQTBNihaIRTkOkaBOxyCIv gSEz09qO7y9+qvQJK3XJS1FoR7FbuKZoZPJkshCgCPmOSbz64xzJH5SsNRJZh1R15FcY ItKL4LM2try5G7eeKDvrIpxsBsooqHwOrzPwODSLOPGqy9wL/sTQl/lvJAY3uVmWk0/y GLkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qbj5m+n+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 39si17075156plc.99.2019.07.22.23.15.02; Mon, 22 Jul 2019 23:15:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 header.s=google header.b=qbj5m+n+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S2388197AbfGWGPB (ORCPT + 29 others); Tue, 23 Jul 2019 02:15:01 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:43096 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732457AbfGWGOu (ORCPT ); Tue, 23 Jul 2019 02:14:50 -0400 Received: by mail-pl1-f194.google.com with SMTP id 4so13192023pld.10 for ; Mon, 22 Jul 2019 23:14:49 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=JQKPSfuw5DbCIirqqIDBXsU1/ucOSKObdNO60ntwNTU=; b=qbj5m+n+BO01X6WUkYr4iIMz44Y5GyxzX+56ztB2cxEWQkOK7JTj1U9C3bTi7wjFO5 gI6KcNWalrFLBhnNf2g+ZrY3CcSUIMqWjE+2GBvLOr2Qwp/etwXraRoCuZ3Np5xXtnMc 9yTiJMilFZPro7O2f7rKeBI3jkL06KgxtaltLd4Hb/3dVL6XUagNimPY7FRW6F7e/Zrn gBhR2T4h1ncAB26r3+OmIMgtVoKviA7DmWi60tCiEZ4ULUgs/h1e+sXufTX0Cjkuem4s Qv1+cqKo4bWNtrAWCgh6IjhnB6Q7KSTfAMz4wOWUDpAG0y7sVSrS2/E8S33Ol0geJpJ+ M2sQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=JQKPSfuw5DbCIirqqIDBXsU1/ucOSKObdNO60ntwNTU=; b=Nz73IGJjjg/oJTz9B/VBRbbcTMhqvUOMyNKHgTWH6/vqvylHJ8JPyHNeaSVDrVmuon t9Yt8p0a0dBU889SAKE1/5+MYtaEECoaGabP4ebVQB9ZJzEuWPECL92N9NW8htT6JtAF 8ThpKA83LXxE0dpb2vNcBuN+ue5//w0AEVF5svKJp8Aq42wdU3jfvIUksb8BNLD7pMfD qIHt5EuqpzbaSAZdQ18acBcFDdVhSr/HfcYihg0xGOccBcfJDjRXN7uHXzkCxWcnezZP mQjxqEPps7tiVTPSuhXa+OmZxMSRR2/7lEHrBEhzBREpbpm+mcwpGyrRXL2TQqi2uBMD yfow== X-Gm-Message-State: APjAAAUI2Up+Ekni/DJwts3FMvnjPcy6sMnF0ai+HgIUghhpCdGLz5C1 RDC16Am/IEJpgzTR5zOsVg/DlQ== X-Received: by 2002:a17:902:e582:: with SMTP id cl2mr79536058plb.60.1563862489459; Mon, 22 Jul 2019 23:14:49 -0700 (PDT) Received: from localhost ([122.172.28.117]) by smtp.gmail.com with ESMTPSA id 64sm43449485pfe.128.2019.07.22.23.14.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 23:14:48 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH V2 09/10] cpufreq: Remove CPUFREQ_ADJUST and CPUFREQ_NOTIFY policy notifier events Date: Tue, 23 Jul 2019 11:44:09 +0530 Message-Id: <0b9220ad282d38922d968be278da3e5aa9ca5895.1563862014.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No driver makes reference to these events now, remove them and the code related to them. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 36 +++++++----------------------------- include/linux/cpufreq.h | 6 ++---- 2 files changed, 9 insertions(+), 33 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index c13dcb59b30c..e0ee23895497 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2360,15 +2360,13 @@ EXPORT_SYMBOL(cpufreq_get_policy); * @policy: Policy object to modify. * @new_policy: New policy data. * - * Pass @new_policy to the cpufreq driver's ->verify() callback, run the - * installed policy notifiers for it with the CPUFREQ_ADJUST value, pass it to - * the driver's ->verify() callback again and run the notifiers for it again - * with the CPUFREQ_NOTIFY value. Next, copy the min and max parameters - * of @new_policy to @policy and either invoke the driver's ->setpolicy() - * callback (if present) or carry out a governor update for @policy. That is, - * run the current governor's ->limits() callback (if the governor field in - * @new_policy points to the same object as the one in @policy) or replace the - * governor for @policy with the new one stored in @new_policy. + * Pass @new_policy to the cpufreq driver's ->verify() callback. Next, copy the + * min and max parameters of @new_policy to @policy and either invoke the + * driver's ->setpolicy() callback (if present) or carry out a governor update + * for @policy. That is, run the current governor's ->limits() callback (if the + * governor field in @new_policy points to the same object as the one in + * @policy) or replace the governor for @policy with the new one stored in + * @new_policy. * * The cpuinfo part of @policy is not updated by this function. */ @@ -2396,26 +2394,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, if (ret) return ret; - /* - * The notifier-chain shall be removed once all the users of - * CPUFREQ_ADJUST are moved to use the QoS framework. - */ - /* adjust if necessary - all reasons */ - blocking_notifier_call_chain(&cpufreq_policy_notifier_list, - CPUFREQ_ADJUST, new_policy); - - /* - * verify the cpu speed can be set within this limit, which might be - * different to the first one - */ - ret = cpufreq_driver->verify(new_policy); - if (ret) - return ret; - - /* notification of the new policy */ - blocking_notifier_call_chain(&cpufreq_policy_notifier_list, - CPUFREQ_NOTIFY, new_policy); - policy->min = new_policy->min; policy->max = new_policy->max; trace_cpu_frequency_limits(policy); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index afc10384a681..c57e88e85c41 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -456,10 +456,8 @@ static inline void cpufreq_resume(void) {} #define CPUFREQ_POSTCHANGE (1) /* Policy Notifiers */ -#define CPUFREQ_ADJUST (0) -#define CPUFREQ_NOTIFY (1) -#define CPUFREQ_CREATE_POLICY (2) -#define CPUFREQ_REMOVE_POLICY (3) +#define CPUFREQ_CREATE_POLICY (0) +#define CPUFREQ_REMOVE_POLICY (1) #ifdef CONFIG_CPU_FREQ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);