Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3351989pxb; Mon, 9 Nov 2020 08:59:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5lkex5TP5Rer1R6OPh7kDo0X4YYtWEbjYqH+CNIpInG6fvNmSnwvYIRKsLVrCshpdwYaY X-Received: by 2002:aa7:c512:: with SMTP id o18mr13837745edq.357.1604941183021; Mon, 09 Nov 2020 08:59:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604941183; cv=none; d=google.com; s=arc-20160816; b=ZfFA1v/8KSg992muU3MylWQrTyQ2fc2fSde0PI/PvSUtdtY+KvrhgbgSJr8I2L9u4Y KfZKvO/6EMq4HHxLA7ByJVekJVhdEqXpkCKTEedlY1ODeeIjnZARnmqmrBV2GlxC66Ny 63eC0A7RyBIhysZ8OYaFPpriQ1z0jM6kzqxPaNAy0VhLyDZCERztVdWv58nkjq7+ghoE R/qbIArGscgs33h5zbPFTQ3+clByWzEGoXdo1jDFOeB6obYBly0FgZ4zWvF3iTF+aVxY Yk4X13BwEj5ZeoxHA38FID0si9vhCDuwfUyYKYnuWVYAd1TBQKzbrbNLc1R19pQzFCFM Ux5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NlkpZRrBIyD7mii1OLRx7t9vfrqHJqhj5uqrP3wdJE8=; b=qpAubPW8xMRMrBqucbxLvOimVVqNsN906opBF5qXt6kUnpneFHR3W68fZPP6VlR37q rpgvrMjv6RNndLu2QbRQA3Ujy4VNeez92AoxoFguFbR1XHt1Spku9eU8mlJVxKlX2oST vpbpbvmCdTPXX6aubDKp9iqXvh6Ywx7PDa0JjbUKTBP8yLo8MrvXlVG7SgU9/bjQzRcs IT32A4yPq0SGR3XGUHRNbY8zm2Jmd0M3AvHbGdydlTkM4e6mR1WsU2y1rvs/FyGYhOZq KmVP15J3ej26OF1kmDPBlRhHUDJC0IyGiJ3NwLRJfEhbVRupKVSLLpuZ6KQMk4guEG6K Da0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si6474900edu.542.2020.11.09.08.59.19; Mon, 09 Nov 2020 08:59:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731115AbgKIQ5R (ORCPT + 99 others); Mon, 9 Nov 2020 11:57:17 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:42276 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731097AbgKIQ5J (ORCPT ); Mon, 9 Nov 2020 11:57:09 -0500 Received: from 89-64-87-89.dynamic.chello.pl (89.64.87.89) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.520) id b29284a7e0268766; Mon, 9 Nov 2020 17:57:07 +0100 From: "Rafael J. Wysocki" To: Linux PM Cc: "Rafael J. Wysocki" , Viresh Kumar , Srinivas Pandruvada , Zhang Rui , LKML , Doug Smythies Subject: [PATCH v2 1/4] cpufreq: Introduce governor flags Date: Mon, 09 Nov 2020 17:51:41 +0100 Message-ID: <1876249.M1ZxxmeKtZ@kreacher> In-Reply-To: <13269660.K2JYd4sGFX@kreacher> References: <13269660.K2JYd4sGFX@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki A new cpufreq governor flag will be added subsequently, so replace the bool dynamic_switching fleid in struct cpufreq_governor with a flags field and introduce CPUFREQ_GOV_FLAG_DYN_SWITCH to set for the "dynamic switching" governors instead of it. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq.c | 2 +- drivers/cpufreq/cpufreq_governor.h | 2 +- include/linux/cpufreq.h | 9 +++++++-- kernel/sched/cpufreq_schedutil.c | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) Index: linux-pm/drivers/cpufreq/cpufreq.c =================================================================== --- linux-pm.orig/drivers/cpufreq/cpufreq.c +++ linux-pm/drivers/cpufreq/cpufreq.c @@ -2254,7 +2254,7 @@ static int cpufreq_init_governor(struct return -EINVAL; /* Platform doesn't want dynamic frequency switching ? */ - if (policy->governor->dynamic_switching && + if (policy->governor->flags & CPUFREQ_GOV_FLAG_DYN_SWITCH && cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING) { struct cpufreq_governor *gov = cpufreq_fallback_governor(); Index: linux-pm/drivers/cpufreq/cpufreq_governor.h =================================================================== --- linux-pm.orig/drivers/cpufreq/cpufreq_governor.h +++ linux-pm/drivers/cpufreq/cpufreq_governor.h @@ -156,7 +156,7 @@ void cpufreq_dbs_governor_limits(struct #define CPUFREQ_DBS_GOVERNOR_INITIALIZER(_name_) \ { \ .name = _name_, \ - .dynamic_switching = true, \ + .flags = CPUFREQ_GOV_FLAG_DYN_SWITCH, \ .owner = THIS_MODULE, \ .init = cpufreq_dbs_governor_init, \ .exit = cpufreq_dbs_governor_exit, \ Index: linux-pm/include/linux/cpufreq.h =================================================================== --- linux-pm.orig/include/linux/cpufreq.h +++ linux-pm/include/linux/cpufreq.h @@ -565,12 +565,17 @@ struct cpufreq_governor { char *buf); int (*store_setspeed) (struct cpufreq_policy *policy, unsigned int freq); - /* For governors which change frequency dynamically by themselves */ - bool dynamic_switching; struct list_head governor_list; struct module *owner; + u8 flags; }; +/* Governor flags */ + +/* For governors which change frequency dynamically by themselves */ +#define CPUFREQ_GOV_FLAG_DYN_SWITCH BIT(0) + + /* Pass a target to the cpufreq driver */ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, unsigned int target_freq); Index: linux-pm/kernel/sched/cpufreq_schedutil.c =================================================================== --- linux-pm.orig/kernel/sched/cpufreq_schedutil.c +++ linux-pm/kernel/sched/cpufreq_schedutil.c @@ -881,7 +881,7 @@ static void sugov_limits(struct cpufreq_ struct cpufreq_governor schedutil_gov = { .name = "schedutil", .owner = THIS_MODULE, - .dynamic_switching = true, + .flags = CPUFREQ_GOV_FLAG_DYN_SWITCH, .init = sugov_init, .exit = sugov_exit, .start = sugov_start,