Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3956312pxb; Tue, 10 Nov 2020 04:38:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJwj9cg+phGzEbE4FVsa65annzEtljrX8tzVwvOAi0Sft1wW8A87Zhbs32BI+s46T3Kg58OQ X-Received: by 2002:a50:96d2:: with SMTP id z18mr21586344eda.367.1605011896119; Tue, 10 Nov 2020 04:38:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605011896; cv=none; d=google.com; s=arc-20160816; b=Rqkq3WNZUANberbzF15hdqVLtpYtzZ/XbfRRywQQFoJTnhSmt2sJfFqfjzcCx0Oby/ MagEsvJacLck9kfLB3KLwmj2Ep5t+WHuBfBakczip6Uuru0OzebTkCliBG4Q4WL3+js3 +B+zHRk9qLE4Z4fHC7ht0pWr32JoLyIyt54Tmxs8DuFAQwTitrBohGzpDFXmjSkzvY74 2kXPev0QEWhEcGhu0Kso9VtI7Xx9dBtix/KX94VR4jsZaFonPt739v6EYlETpkL4xpOw jha/bKb+QG13nPuC6u3JacYQfk3AJFOEsIWvJvizpzdvt7xsfUAwsJjRIw8Jms5PZBHx fVyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=w5f5uEO3r6sI5bF7NOkmG8gXoj1KbzEchukRim9NVXM=; b=JaZfKpdZlwTiBqfcUUiia+onyg9vj3RRg3ar41THf6tdCqXpUUzcVx/m5wOR52m9GK akTjEv4KuyCYlLbfrc0w/HmAW0i6whFpaNJ36BMgyatC+Ll6GZVzrwdHn06l6GwSbNrM 50jQUL8FWIIYVfcb0i7xaOxRd6HMEBKmF6S5CYwW1EKhod/V3ve3PIvDzpqgM4z443nb FfFJpXpbSgK2z28Pgx/5AG6e6ARHhLpLT61CJhn3EELmSCKD/Nzq4fo4Lfl3USE3rI2O 7JUfZBjPozxOnnzYiyA3pUucNMDuu6pkqQryKW5JfO2vYoYC72XhOnxETxnoMzgJDCE1 kutA== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si9598986edp.497.2020.11.10.04.37.50; Tue, 10 Nov 2020 04:38:16 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730097AbgKJMgQ (ORCPT + 99 others); Tue, 10 Nov 2020 07:36:16 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:44306 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbgKJMgQ (ORCPT ); Tue, 10 Nov 2020 07:36:16 -0500 Received: by mail-ot1-f67.google.com with SMTP id f16so12293504otl.11; Tue, 10 Nov 2020 04:36:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=w5f5uEO3r6sI5bF7NOkmG8gXoj1KbzEchukRim9NVXM=; b=jaFeMUIw3NIFMwCF8v6Yl5DQrDw/E0j6r19qdN7/g/lhVYyAI8EOGm+Jkj1HLa78/7 yhyF6uInIWWeCI88jtvbeX0no98QN1+/6Lgx2xQhpGVgYgTFDNNq+c7bqpmWRSltKU7M qeW6pK8dTRzdVzsFf14QohqNj3yCeqrHjVXSkGm7RTcQhzvMhIOIdHgc8QLyTHI5Dc6A +a2p5mvuG3sFDSF0HUl5pKziWfsPkDaHax7oeDCd8dS+yUjwUwOiSxVr89hB262nGvCe nQaj/LXNLxuGnTdwzPTQETWpPGUl/LHPuJj/qYO4BNgDQVMDEQojzIlGnfD3ZtTcTDYI QrnA== X-Gm-Message-State: AOAM5333+K893422dRdRb3uc+6o3mRmcW8Caz93J9G0kVQLCEwHSx+ov DY8AM7CyYZuotywkHtQBabMb2JyPxw0ZwhTzq3w= X-Received: by 2002:a9d:222f:: with SMTP id o44mr14179002ota.321.1605011775337; Tue, 10 Nov 2020 04:36:15 -0800 (PST) MIME-Version: 1.0 References: <13269660.K2JYd4sGFX@kreacher> <1876249.M1ZxxmeKtZ@kreacher> <20201110024126.v4yxai5hpguj5p5b@vireshk-i7> In-Reply-To: <20201110024126.v4yxai5hpguj5p5b@vireshk-i7> From: "Rafael J. Wysocki" Date: Tue, 10 Nov 2020 13:36:02 +0100 Message-ID: Subject: Re: [PATCH v2 1/4] cpufreq: Introduce governor flags To: Viresh Kumar Cc: "Rafael J. Wysocki" , Linux PM , "Rafael J. Wysocki" , Srinivas Pandruvada , Zhang Rui , LKML , Doug Smythies Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 3:41 AM Viresh Kumar wrote: > > On 09-11-20, 17:51, Rafael J. Wysocki wrote: > > 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 && > > I completely forgot that we had something like this :) > > > + 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) > > Maybe just drop the FLAG_ part as we don't use it for other cpufreq related > flags as well. That will also give us space to write DYN as DYNAMIC (it may be > better as we use the full name in CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING). OK, I'll rename the flag (and the new one too). > Acked-by: Viresh Kumar Thanks!