Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2592683rdb; Fri, 8 Dec 2023 12:42:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1YUctbIjBFYCasunXyG4QFvd4noMjR4/nE+//AObSL1KfkKUcdwlPimBxiv0fhBgm6ZX/ X-Received: by 2002:a17:903:246:b0:1d0:6ffd:8369 with SMTP id j6-20020a170903024600b001d06ffd8369mr565026plh.116.1702068169011; Fri, 08 Dec 2023 12:42:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702068168; cv=none; d=google.com; s=arc-20160816; b=yGl1q69fo4F9v5zyyw1VHbs3CtTVqSgxRHmzpHoiHm5xT29fkl7uzsuqZeGFTtMPYM 6EDDPaehgrZp4YDrNhuF/zESBQIUW962bT/heLjjSkCi2ahQJZ85hr+rxRBDUokbDSu7 34QqfPHm+PAMy9MSB2S+RXC91vSUkOnkfUjI1Ml2GH1Ds6PtLa3306WxHYTDoKC6u70f y5VdMTGD4ptBPqw5MHQipH46rm0FRcWKjHZs0m1v/0MdspoIPugqx5mpCYgkD63/GNgU jn9WX3Oc+waEkiiwCM4sdcD2Z6lrBn0h9ziWmbLnwf0iqs7BjnpWYf0H/jtnfKhDTGOK jxwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=z3FtgcVQ4CI8pS5+jNc3naCoa/d+AKzX2Qc5406ILM0=; fh=9wRfq24KJP1JWR06tAlUd/KA5IbZQvZDZdaPvVjv4e0=; b=J291fV/ua3kB9dUddk3BV792nNzozoQCTlgoMazoDJC95pChN0xrRIf8dQe8Q561x0 zO/rTl25T3Duvr/qART8IDLzzWhLpGF5qMzS55ZGeXv1HBuzFXY6+lv4AetnvsfBsHDi zwwSQWaJYWM1apzLrMK42vLwO75+iyhrcyQuziYWcJBMORA4aQyKQ0OVzJ8cHmIRLoZg sLRARgly/RBhV9x4TlAy+xoEWeqZrYt9io7D9eAMc3wkPYLYGiJ+zAMp+JN3VnkQ7S0A HsldpJWENYNEnZopbR+iOrgVHIYUFSeqEb2vcjsmfm76XaKMxhiKHgtzyHJnqBwqD0rD y7Hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u10-20020a170903124a00b001cfa8f0e365si2081544plh.305.2023.12.08.12.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 12:42:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 421B182CBA6E; Fri, 8 Dec 2023 12:42:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233919AbjLHUmc convert rfc822-to-8bit (ORCPT + 99 others); Fri, 8 Dec 2023 15:42:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230309AbjLHUmb (ORCPT ); Fri, 8 Dec 2023 15:42:31 -0500 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 973EE171E; Fri, 8 Dec 2023 12:42:37 -0800 (PST) Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6d9d6f8485eso309232a34.0; Fri, 08 Dec 2023 12:42:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702068157; x=1702672957; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F//99F/9ZrwtkWvIQbflf74wFg1Bqqbh42D5kCs6IT4=; b=kcr2oD8bJkibDNzC3UxrJAzh3BG+k9N1T/q5cU3fbB3N6iJZmqzQtJIYrAIlTGvK8i CFc4XMQ/fD/kJgm0ekwjU0CUcXqF8NFj8B9l2kVqdT9DO1k45K9T4PHPGdsjVy1qPFX3 6NWVlP7k47JfPVa5z8e9JtD+s/Pwi9ozPjhDW02t1turfle2bXJm4EoDJMrl7Z7vTYhy 290F2aYxpdVeuypE34GhW8imk6/f3zxL7CsmlR+LyVZBJOZiptltdoLMSYjxmiNa/LgS gGsySfpWCVU47sZEw9eB+BuDfQRVqvhCqxFTtz+gXdj+Rc9Ya11nLos9XXy5gkNekEb1 olrg== X-Gm-Message-State: AOJu0YwIToIDiixVjVyftiEhfBO1fj604/83TMhdz4dyguhtmYzCvh0E TClNPjXsJBmLXGJ3jJ41A8SWk7o2InUUx4B8ep4iotkHDxE= X-Received: by 2002:a4a:a7c4:0:b0:590:6585:5c41 with SMTP id n4-20020a4aa7c4000000b0059065855c41mr1408409oom.0.1702068156758; Fri, 08 Dec 2023 12:42:36 -0800 (PST) MIME-Version: 1.0 References: <20231201190757.144741-1-daniel.lezcano@linaro.org> In-Reply-To: <20231201190757.144741-1-daniel.lezcano@linaro.org> From: "Rafael J. Wysocki" Date: Fri, 8 Dec 2023 21:42:25 +0100 Message-ID: Subject: Re: [RFC PATCH 1/2] pm_qos: Rename freq to interval constraint To: Daniel Lezcano Cc: rjw@rjwysocki.net, caleb.connolly@linaro.org, lina.iyer@linaro.org, linux-pm@vger.kernel.org, mani@kernel.org, linux-kernel@vger.kernel.org, lukasz.luba@arm.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 08 Dec 2023 12:42:46 -0800 (PST) On Fri, Dec 1, 2023 at 8:08 PM Daniel Lezcano wrote: > > The frequency pm_qos relies on a couple of values, the min and max > frequencies. However more pm_qos will be added with the same logic of > a couple of min and max. Instead of writing new set of constraints as > well as type, etc... let's rename freq_* to a more generic name > interval_* I'm fine with a rename if it helps, but I would rather call it range_* than interval_*. > > That way, new qos interval based can be added easily. > > Signed-off-by: Daniel Lezcano > --- > drivers/base/power/qos.c | 4 +-- > drivers/powercap/dtpm_cpu.c | 2 +- > drivers/thermal/cpufreq_cooling.c | 2 +- > include/linux/cpufreq.h | 6 ++-- > include/linux/pm_qos.h | 55 ++++++++++++++++--------------- > kernel/power/qos.c | 53 +++++++++++++++-------------- > 6 files changed, 61 insertions(+), 61 deletions(-) > > diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c > index 8e93167f1783..561d2a0e106c 100644 > --- a/drivers/base/power/qos.c > +++ b/drivers/base/power/qos.c > @@ -285,14 +285,14 @@ void dev_pm_qos_constraints_destroy(struct device *dev) > memset(req, 0, sizeof(*req)); > } > > - c = &qos->freq.min_freq; > + c = &qos->freq.min; > plist_for_each_entry_safe(req, tmp, &c->list, data.freq.pnode) { > apply_constraint(req, PM_QOS_REMOVE_REQ, > PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE); > memset(req, 0, sizeof(*req)); > } > > - c = &qos->freq.max_freq; > + c = &qos->freq.max; > plist_for_each_entry_safe(req, tmp, &c->list, data.freq.pnode) { > apply_constraint(req, PM_QOS_REMOVE_REQ, > PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE); > diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c > index 2ff7717530bf..6587c94d0127 100644 > --- a/drivers/powercap/dtpm_cpu.c > +++ b/drivers/powercap/dtpm_cpu.c > @@ -28,7 +28,7 @@ > > struct dtpm_cpu { > struct dtpm dtpm; > - struct freq_qos_request qos_req; > + struct interval_qos_request qos_req; > int cpu; > }; > > diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c > index e2cc7bd30862..72e9f0cde55c 100644 > --- a/drivers/thermal/cpufreq_cooling.c > +++ b/drivers/thermal/cpufreq_cooling.c > @@ -77,7 +77,7 @@ struct cpufreq_cooling_device { > #ifndef CONFIG_SMP > struct time_in_idle *idle_time; > #endif > - struct freq_qos_request qos_req; > + struct interval_qos_request qos_req; > }; > > #ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR > diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h > index 71d186d6933a..7e2d66c37535 100644 > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -80,9 +80,9 @@ struct cpufreq_policy { > struct work_struct update; /* if update_policy() needs to be > * called, but you're in IRQ context */ > > - struct freq_constraints constraints; > - struct freq_qos_request *min_freq_req; > - struct freq_qos_request *max_freq_req; > + struct interval_constraints constraints; > + struct interval_qos_request *min_freq_req; > + struct interval_qos_request *max_freq_req; > > struct cpufreq_frequency_table *freq_table; > enum cpufreq_table_sorting freq_table_sorted; > diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h > index 4a69d4af3ff8..a662ac918e3e 100644 > --- a/include/linux/pm_qos.h > +++ b/include/linux/pm_qos.h > @@ -77,25 +77,26 @@ struct pm_qos_flags { > #define FREQ_QOS_MIN_DEFAULT_VALUE 0 > #define FREQ_QOS_MAX_DEFAULT_VALUE S32_MAX > > -enum freq_qos_req_type { > - FREQ_QOS_MIN = 1, > +enum interval_qos_req_type { > + INTERVAL_QOS_MIN = 1, > + INTERVAL_QOS_MAX, > + FREQ_QOS_MIN, > FREQ_QOS_MAX, > }; > > -struct freq_constraints { > - struct pm_qos_constraints min_freq; > - struct blocking_notifier_head min_freq_notifiers; > - struct pm_qos_constraints max_freq; > - struct blocking_notifier_head max_freq_notifiers; > +struct interval_constraints { > + struct pm_qos_constraints min; > + struct blocking_notifier_head min_notifiers; > + struct pm_qos_constraints max; > + struct blocking_notifier_head max_notifiers; > }; Also I would rename min_freq and max_freq to lower_bound and upper_bound, respectively, because this is less likely to get confused with other things with the same name. So the above would be +struct range_constraints { + struct pm_qos_constraints lower_bound; + struct blocking_notifier_head lower_bound_notifiers; + struct pm_qos_constraints upper_bound; + struct blocking_notifier_head upper_bound_notifiers; };