2019-10-18 15:45:45

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH v3 0/6] Initialise thermal framework and cpufreq earlier during boot

Changes since v2:
- Missed one patch when posting v2. Respinning.

Changes since v1:
- Completely get rid of netlink support in the thermal framework.
- This changes the early init patch to a single line - change to
core_initcall. Changed authorship of patch since it is nothing like the
original. Lina, let me know if you feel otherwise.
- I've tested to make sure that the qcom-cpufreq-hw driver continues to
work correctly as a module so this won't impact Android's GKI plans.
- Collected Acks

Device boot needs to be as fast as possible while keeping under the thermal
envelope. Now that thermal framework is built-in to the kernel, we can
initialize it earlier to enable thermal mitigation during boot.

We also need the cpufreq HW drivers to be initialised earlier to act as the
cooling devices. This series only converts over the qcom-hw driver to
initialize earlier but can be extended to other platforms as well.

Amit Kucheria (6):
thermal: Remove netlink support
thermal: Initialize thermal subsystem earlier
cpufreq: Initialise the governors in core_initcall
cpufreq: Initialize cpufreq-dt driver earlier
clk: qcom: Initialise clock drivers earlier
cpufreq: qcom-hw: Move driver initialisation earlier

.../driver-api/thermal/sysfs-api.rst | 26 +----
drivers/clk/qcom/clk-rpmh.c | 2 +-
drivers/clk/qcom/gcc-qcs404.c | 2 +-
drivers/clk/qcom/gcc-sdm845.c | 2 +-
drivers/cpufreq/cpufreq-dt-platdev.c | 2 +-
drivers/cpufreq/cpufreq_conservative.c | 2 +-
drivers/cpufreq/cpufreq_ondemand.c | 2 +-
drivers/cpufreq/cpufreq_performance.c | 2 +-
drivers/cpufreq/cpufreq_powersave.c | 2 +-
drivers/cpufreq/cpufreq_userspace.c | 2 +-
drivers/cpufreq/qcom-cpufreq-hw.c | 2 +-
drivers/thermal/thermal_core.c | 110 +-----------------
include/linux/thermal.h | 11 --
13 files changed, 22 insertions(+), 145 deletions(-)

--
2.17.1


2019-10-18 15:45:50

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH v3 1/6] thermal: Remove netlink support

There are no users of netlink messages for thermal inside the kernel.
Remove the code and adjust the documentation.

Signed-off-by: Amit Kucheria <[email protected]>
---
.../driver-api/thermal/sysfs-api.rst | 26 +----
drivers/thermal/thermal_core.c | 107 +-----------------
include/linux/thermal.h | 11 --
3 files changed, 10 insertions(+), 134 deletions(-)

diff --git a/Documentation/driver-api/thermal/sysfs-api.rst b/Documentation/driver-api/thermal/sysfs-api.rst
index fab2c9b36d08..b40b1f839148 100644
--- a/Documentation/driver-api/thermal/sysfs-api.rst
+++ b/Documentation/driver-api/thermal/sysfs-api.rst
@@ -725,24 +725,10 @@ method, the sys I/F structure will be built like this::
|---temp1_input: 37000
|---temp1_crit: 100000

-4. Event Notification
+4. Export Symbol APIs
=====================

-The framework includes a simple notification mechanism, in the form of a
-netlink event. Netlink socket initialization is done during the _init_
-of the framework. Drivers which intend to use the notification mechanism
-just need to call thermal_generate_netlink_event() with two arguments viz
-(originator, event). The originator is a pointer to struct thermal_zone_device
-from where the event has been originated. An integer which represents the
-thermal zone device will be used in the message to identify the zone. The
-event will be one of:{THERMAL_AUX0, THERMAL_AUX1, THERMAL_CRITICAL,
-THERMAL_DEV_FAULT}. Notification can be sent when the current temperature
-crosses any of the configured thresholds.
-
-5. Export Symbol APIs
-=====================
-
-5.1. get_tz_trend
+4.1. get_tz_trend
-----------------

This function returns the trend of a thermal zone, i.e the rate of change
@@ -751,14 +737,14 @@ are supposed to implement the callback. If they don't, the thermal
framework calculated the trend by comparing the previous and the current
temperature values.

-5.2. get_thermal_instance
+4.2. get_thermal_instance
-------------------------

This function returns the thermal_instance corresponding to a given
{thermal_zone, cooling_device, trip_point} combination. Returns NULL
if such an instance does not exist.

-5.3. thermal_notify_framework
+4.3. thermal_notify_framework
-----------------------------

This function handles the trip events from sensor drivers. It starts
@@ -768,14 +754,14 @@ and does actual throttling for other trip points i.e ACTIVE and PASSIVE.
The throttling policy is based on the configured platform data; if no
platform data is provided, this uses the step_wise throttling policy.

-5.4. thermal_cdev_update
+4.4. thermal_cdev_update
------------------------

This function serves as an arbitrator to set the state of a cooling
device. It sets the cooling device to the deepest cooling state if
possible.

-6. thermal_emergency_poweroff
+5. thermal_emergency_poweroff
=============================

On an event of critical trip temperature crossing. Thermal framework
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d4481cc8958f..d21b754baee2 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -19,8 +19,6 @@
#include <linux/reboot.h>
#include <linux/string.h>
#include <linux/of.h>
-#include <net/netlink.h>
-#include <net/genetlink.h>
#include <linux/suspend.h>

#define CREATE_TRACE_POINTS
@@ -1464,97 +1462,6 @@ struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name)
}
EXPORT_SYMBOL_GPL(thermal_zone_get_zone_by_name);

-#ifdef CONFIG_NET
-static const struct genl_multicast_group thermal_event_mcgrps[] = {
- { .name = THERMAL_GENL_MCAST_GROUP_NAME, },
-};
-
-static struct genl_family thermal_event_genl_family __ro_after_init = {
- .module = THIS_MODULE,
- .name = THERMAL_GENL_FAMILY_NAME,
- .version = THERMAL_GENL_VERSION,
- .maxattr = THERMAL_GENL_ATTR_MAX,
- .mcgrps = thermal_event_mcgrps,
- .n_mcgrps = ARRAY_SIZE(thermal_event_mcgrps),
-};
-
-int thermal_generate_netlink_event(struct thermal_zone_device *tz,
- enum events event)
-{
- struct sk_buff *skb;
- struct nlattr *attr;
- struct thermal_genl_event *thermal_event;
- void *msg_header;
- int size;
- int result;
- static unsigned int thermal_event_seqnum;
-
- if (!tz)
- return -EINVAL;
-
- /* allocate memory */
- size = nla_total_size(sizeof(struct thermal_genl_event)) +
- nla_total_size(0);
-
- skb = genlmsg_new(size, GFP_ATOMIC);
- if (!skb)
- return -ENOMEM;
-
- /* add the genetlink message header */
- msg_header = genlmsg_put(skb, 0, thermal_event_seqnum++,
- &thermal_event_genl_family, 0,
- THERMAL_GENL_CMD_EVENT);
- if (!msg_header) {
- nlmsg_free(skb);
- return -ENOMEM;
- }
-
- /* fill the data */
- attr = nla_reserve(skb, THERMAL_GENL_ATTR_EVENT,
- sizeof(struct thermal_genl_event));
-
- if (!attr) {
- nlmsg_free(skb);
- return -EINVAL;
- }
-
- thermal_event = nla_data(attr);
- if (!thermal_event) {
- nlmsg_free(skb);
- return -EINVAL;
- }
-
- memset(thermal_event, 0, sizeof(struct thermal_genl_event));
-
- thermal_event->orig = tz->id;
- thermal_event->event = event;
-
- /* send multicast genetlink message */
- genlmsg_end(skb, msg_header);
-
- result = genlmsg_multicast(&thermal_event_genl_family, skb, 0,
- 0, GFP_ATOMIC);
- if (result)
- dev_err(&tz->device, "Failed to send netlink event:%d", result);
-
- return result;
-}
-EXPORT_SYMBOL_GPL(thermal_generate_netlink_event);
-
-static int __init genetlink_init(void)
-{
- return genl_register_family(&thermal_event_genl_family);
-}
-
-static void genetlink_exit(void)
-{
- genl_unregister_family(&thermal_event_genl_family);
-}
-#else /* !CONFIG_NET */
-static inline int genetlink_init(void) { return 0; }
-static inline void genetlink_exit(void) {}
-#endif /* !CONFIG_NET */
-
static int thermal_pm_notify(struct notifier_block *nb,
unsigned long mode, void *_unused)
{
@@ -1601,19 +1508,15 @@ static int __init thermal_init(void)
mutex_init(&poweroff_lock);
result = thermal_register_governors();
if (result)
- goto error;
+ goto init_exit;

result = class_register(&thermal_class);
if (result)
goto unregister_governors;

- result = genetlink_init();
- if (result)
- goto unregister_class;
-
result = of_parse_thermal_zones();
if (result)
- goto exit_netlink;
+ goto exit_zone_parse;

result = register_pm_notifier(&thermal_pm_nb);
if (result)
@@ -1622,13 +1525,11 @@ static int __init thermal_init(void)

return 0;

-exit_netlink:
- genetlink_exit();
-unregister_class:
+exit_zone_parse:
class_unregister(&thermal_class);
unregister_governors:
thermal_unregister_governors();
-error:
+init_exit:
ida_destroy(&thermal_tz_ida);
ida_destroy(&thermal_cdev_ida);
mutex_destroy(&thermal_list_lock);
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index e45659c75920..d9111aebb97d 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -544,15 +544,4 @@ static inline void thermal_notify_framework(struct thermal_zone_device *tz,
{ }
#endif /* CONFIG_THERMAL */

-#if defined(CONFIG_NET) && IS_ENABLED(CONFIG_THERMAL)
-extern int thermal_generate_netlink_event(struct thermal_zone_device *tz,
- enum events event);
-#else
-static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz,
- enum events event)
-{
- return 0;
-}
-#endif
-
#endif /* __THERMAL_H__ */
--
2.17.1

2019-10-18 15:45:51

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH v3 2/6] thermal: Initialize thermal subsystem earlier

Now that the thermal framework is built-in, in order to facilitate
thermal mitigation as early as possible in the boot cycle, move the
thermal framework initialization to core_initcall.

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/thermal/thermal_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d21b754baee2..d8251d723459 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1537,4 +1537,5 @@ static int __init thermal_init(void)
mutex_destroy(&poweroff_lock);
return result;
}
-fs_initcall(thermal_init);
+
+core_initcall(thermal_init);
--
2.17.1

2019-10-18 15:45:54

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH v3 3/6] cpufreq: Initialise the governors in core_initcall

Initialise the cpufreq governors earlier to allow for earlier
performance control during the boot process.

Signed-off-by: Amit Kucheria <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
---
drivers/cpufreq/cpufreq_conservative.c | 2 +-
drivers/cpufreq/cpufreq_ondemand.c | 2 +-
drivers/cpufreq/cpufreq_performance.c | 2 +-
drivers/cpufreq/cpufreq_powersave.c | 2 +-
drivers/cpufreq/cpufreq_userspace.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index b66e81c06a57..737ff3b9c2c0 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -346,7 +346,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
return CPU_FREQ_GOV_CONSERVATIVE;
}

-fs_initcall(cpufreq_gov_dbs_init);
+core_initcall(cpufreq_gov_dbs_init);
#else
module_init(cpufreq_gov_dbs_init);
#endif
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index dced033875bf..82a4d37ddecb 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -483,7 +483,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
return CPU_FREQ_GOV_ONDEMAND;
}

-fs_initcall(cpufreq_gov_dbs_init);
+core_initcall(cpufreq_gov_dbs_init);
#else
module_init(cpufreq_gov_dbs_init);
#endif
diff --git a/drivers/cpufreq/cpufreq_performance.c b/drivers/cpufreq/cpufreq_performance.c
index aaa04dfcacd9..def9afe0f5b8 100644
--- a/drivers/cpufreq/cpufreq_performance.c
+++ b/drivers/cpufreq/cpufreq_performance.c
@@ -50,5 +50,5 @@ MODULE_AUTHOR("Dominik Brodowski <[email protected]>");
MODULE_DESCRIPTION("CPUfreq policy governor 'performance'");
MODULE_LICENSE("GPL");

-fs_initcall(cpufreq_gov_performance_init);
+core_initcall(cpufreq_gov_performance_init);
module_exit(cpufreq_gov_performance_exit);
diff --git a/drivers/cpufreq/cpufreq_powersave.c b/drivers/cpufreq/cpufreq_powersave.c
index c143dc237d87..1ae66019eb83 100644
--- a/drivers/cpufreq/cpufreq_powersave.c
+++ b/drivers/cpufreq/cpufreq_powersave.c
@@ -43,7 +43,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
return &cpufreq_gov_powersave;
}

-fs_initcall(cpufreq_gov_powersave_init);
+core_initcall(cpufreq_gov_powersave_init);
#else
module_init(cpufreq_gov_powersave_init);
#endif
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
index cbd81c58cb8f..b43e7cd502c5 100644
--- a/drivers/cpufreq/cpufreq_userspace.c
+++ b/drivers/cpufreq/cpufreq_userspace.c
@@ -147,7 +147,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
return &cpufreq_gov_userspace;
}

-fs_initcall(cpufreq_gov_userspace_init);
+core_initcall(cpufreq_gov_userspace_init);
#else
module_init(cpufreq_gov_userspace_init);
#endif
--
2.17.1

2019-10-18 15:45:58

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH v3 4/6] cpufreq: Initialize cpufreq-dt driver earlier

This allows HW drivers that depend on cpufreq-dt to initialise earlier.

Signed-off-by: Amit Kucheria <[email protected]>
Acked-by: Viresh Kumar <[email protected]>
---
drivers/cpufreq/cpufreq-dt-platdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c
index bca8d1f47fd2..3282defe14d4 100644
--- a/drivers/cpufreq/cpufreq-dt-platdev.c
+++ b/drivers/cpufreq/cpufreq-dt-platdev.c
@@ -180,4 +180,4 @@ static int __init cpufreq_dt_platdev_init(void)
-1, data,
sizeof(struct cpufreq_dt_platform_data)));
}
-device_initcall(cpufreq_dt_platdev_init);
+core_initcall(cpufreq_dt_platdev_init);
--
2.17.1

2019-10-18 15:46:24

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH v3 6/6] cpufreq: qcom-hw: Move driver initialisation earlier

Allow qcom-hw driver to initialise right after the cpufreq and thermal
subsystems are initialised in core_initcall so we get earlier access to
thermal mitigation.

Signed-off-by: Amit Kucheria <[email protected]>
Acked-by: Daniel Lezcano <[email protected]>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index a9ae2f84a4ef..fc92a8842e25 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -334,7 +334,7 @@ static int __init qcom_cpufreq_hw_init(void)
{
return platform_driver_register(&qcom_cpufreq_hw_driver);
}
-device_initcall(qcom_cpufreq_hw_init);
+postcore_initcall(qcom_cpufreq_hw_init);

static void __exit qcom_cpufreq_hw_exit(void)
{
--
2.17.1

2019-10-18 15:47:01

by Amit Kucheria

[permalink] [raw]
Subject: [PATCH v3 5/6] clk: qcom: Initialise clock drivers earlier

Initialise the clock drivers on sdm845 and qcs404 in core_initcall so we
can have earlier access to cpufreq during booting.

Signed-off-by: Amit Kucheria <[email protected]>
---
drivers/clk/qcom/clk-rpmh.c | 2 +-
drivers/clk/qcom/gcc-qcs404.c | 2 +-
drivers/clk/qcom/gcc-sdm845.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
index 96a36f6ff667..20d4258f125b 100644
--- a/drivers/clk/qcom/clk-rpmh.c
+++ b/drivers/clk/qcom/clk-rpmh.c
@@ -487,7 +487,7 @@ static int __init clk_rpmh_init(void)
{
return platform_driver_register(&clk_rpmh_driver);
}
-subsys_initcall(clk_rpmh_init);
+core_initcall(clk_rpmh_init);

static void __exit clk_rpmh_exit(void)
{
diff --git a/drivers/clk/qcom/gcc-qcs404.c b/drivers/clk/qcom/gcc-qcs404.c
index bd32212f37e6..9b0c4ce2ef4e 100644
--- a/drivers/clk/qcom/gcc-qcs404.c
+++ b/drivers/clk/qcom/gcc-qcs404.c
@@ -2855,7 +2855,7 @@ static int __init gcc_qcs404_init(void)
{
return platform_driver_register(&gcc_qcs404_driver);
}
-subsys_initcall(gcc_qcs404_init);
+core_initcall(gcc_qcs404_init);

static void __exit gcc_qcs404_exit(void)
{
diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c
index 95be125c3bdd..49dcff1af2db 100644
--- a/drivers/clk/qcom/gcc-sdm845.c
+++ b/drivers/clk/qcom/gcc-sdm845.c
@@ -3628,7 +3628,7 @@ static int __init gcc_sdm845_init(void)
{
return platform_driver_register(&gcc_sdm845_driver);
}
-subsys_initcall(gcc_sdm845_init);
+core_initcall(gcc_sdm845_init);

static void __exit gcc_sdm845_exit(void)
{
--
2.17.1

2019-10-18 22:10:04

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH v3 5/6] clk: qcom: Initialise clock drivers earlier

Quoting Amit Kucheria (2019-10-17 05:27:37)
> Initialise the clock drivers on sdm845 and qcs404 in core_initcall so we
> can have earlier access to cpufreq during booting.
>
> Signed-off-by: Amit Kucheria <[email protected]>
> ---

Acked-by: Stephen Boyd <[email protected]>

Makes me sad again.

2019-10-18 22:14:05

by Taniya Das

[permalink] [raw]
Subject: Re: [PATCH v3 6/6] cpufreq: qcom-hw: Move driver initialisation earlier



On 10/17/2019 5:57 PM, Amit Kucheria wrote:
> Allow qcom-hw driver to initialise right after the cpufreq and thermal
> subsystems are initialised in core_initcall so we get earlier access to
> thermal mitigation.
>
> Signed-off-by: Amit Kucheria<[email protected]>
> Acked-by: Daniel Lezcano<[email protected]>
> ---

Acked-by: Taniya Das<[email protected]>

--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation.

--

2019-10-18 22:15:47

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v3 3/6] cpufreq: Initialise the governors in core_initcall

On Thu, Oct 17, 2019 at 2:28 PM Amit Kucheria <[email protected]> wrote:
>
> Initialise the cpufreq governors earlier to allow for earlier
> performance control during the boot process.
>
> Signed-off-by: Amit Kucheria <[email protected]>
> Acked-by: Viresh Kumar <[email protected]>

You also want to do that for the schedutil governor I think.

> ---
> drivers/cpufreq/cpufreq_conservative.c | 2 +-
> drivers/cpufreq/cpufreq_ondemand.c | 2 +-
> drivers/cpufreq/cpufreq_performance.c | 2 +-
> drivers/cpufreq/cpufreq_powersave.c | 2 +-
> drivers/cpufreq/cpufreq_userspace.c | 2 +-
> 5 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
> index b66e81c06a57..737ff3b9c2c0 100644
> --- a/drivers/cpufreq/cpufreq_conservative.c
> +++ b/drivers/cpufreq/cpufreq_conservative.c
> @@ -346,7 +346,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
> return CPU_FREQ_GOV_CONSERVATIVE;
> }
>
> -fs_initcall(cpufreq_gov_dbs_init);
> +core_initcall(cpufreq_gov_dbs_init);
> #else
> module_init(cpufreq_gov_dbs_init);
> #endif
> diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
> index dced033875bf..82a4d37ddecb 100644
> --- a/drivers/cpufreq/cpufreq_ondemand.c
> +++ b/drivers/cpufreq/cpufreq_ondemand.c
> @@ -483,7 +483,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
> return CPU_FREQ_GOV_ONDEMAND;
> }
>
> -fs_initcall(cpufreq_gov_dbs_init);
> +core_initcall(cpufreq_gov_dbs_init);
> #else
> module_init(cpufreq_gov_dbs_init);
> #endif
> diff --git a/drivers/cpufreq/cpufreq_performance.c b/drivers/cpufreq/cpufreq_performance.c
> index aaa04dfcacd9..def9afe0f5b8 100644
> --- a/drivers/cpufreq/cpufreq_performance.c
> +++ b/drivers/cpufreq/cpufreq_performance.c
> @@ -50,5 +50,5 @@ MODULE_AUTHOR("Dominik Brodowski <[email protected]>");
> MODULE_DESCRIPTION("CPUfreq policy governor 'performance'");
> MODULE_LICENSE("GPL");
>
> -fs_initcall(cpufreq_gov_performance_init);
> +core_initcall(cpufreq_gov_performance_init);
> module_exit(cpufreq_gov_performance_exit);
> diff --git a/drivers/cpufreq/cpufreq_powersave.c b/drivers/cpufreq/cpufreq_powersave.c
> index c143dc237d87..1ae66019eb83 100644
> --- a/drivers/cpufreq/cpufreq_powersave.c
> +++ b/drivers/cpufreq/cpufreq_powersave.c
> @@ -43,7 +43,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
> return &cpufreq_gov_powersave;
> }
>
> -fs_initcall(cpufreq_gov_powersave_init);
> +core_initcall(cpufreq_gov_powersave_init);
> #else
> module_init(cpufreq_gov_powersave_init);
> #endif
> diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
> index cbd81c58cb8f..b43e7cd502c5 100644
> --- a/drivers/cpufreq/cpufreq_userspace.c
> +++ b/drivers/cpufreq/cpufreq_userspace.c
> @@ -147,7 +147,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
> return &cpufreq_gov_userspace;
> }
>
> -fs_initcall(cpufreq_gov_userspace_init);
> +core_initcall(cpufreq_gov_userspace_init);
> #else
> module_init(cpufreq_gov_userspace_init);
> #endif
> --
> 2.17.1
>

2019-10-18 22:17:22

by Amit Kucheria

[permalink] [raw]
Subject: Re: [PATCH v3 3/6] cpufreq: Initialise the governors in core_initcall

On Fri, Oct 18, 2019 at 12:41 AM Rafael J. Wysocki <[email protected]> wrote:
>
> On Thu, Oct 17, 2019 at 2:28 PM Amit Kucheria <[email protected]> wrote:
> >
> > Initialise the cpufreq governors earlier to allow for earlier
> > performance control during the boot process.
> >
> > Signed-off-by: Amit Kucheria <[email protected]>
> > Acked-by: Viresh Kumar <[email protected]>
>
> You also want to do that for the schedutil governor I think.

Indeed. Thanks for the review. I'll respin.

>
> > ---
> > drivers/cpufreq/cpufreq_conservative.c | 2 +-
> > drivers/cpufreq/cpufreq_ondemand.c | 2 +-
> > drivers/cpufreq/cpufreq_performance.c | 2 +-
> > drivers/cpufreq/cpufreq_powersave.c | 2 +-
> > drivers/cpufreq/cpufreq_userspace.c | 2 +-
> > 5 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
> > index b66e81c06a57..737ff3b9c2c0 100644
> > --- a/drivers/cpufreq/cpufreq_conservative.c
> > +++ b/drivers/cpufreq/cpufreq_conservative.c
> > @@ -346,7 +346,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
> > return CPU_FREQ_GOV_CONSERVATIVE;
> > }
> >
> > -fs_initcall(cpufreq_gov_dbs_init);
> > +core_initcall(cpufreq_gov_dbs_init);
> > #else
> > module_init(cpufreq_gov_dbs_init);
> > #endif
> > diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
> > index dced033875bf..82a4d37ddecb 100644
> > --- a/drivers/cpufreq/cpufreq_ondemand.c
> > +++ b/drivers/cpufreq/cpufreq_ondemand.c
> > @@ -483,7 +483,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
> > return CPU_FREQ_GOV_ONDEMAND;
> > }
> >
> > -fs_initcall(cpufreq_gov_dbs_init);
> > +core_initcall(cpufreq_gov_dbs_init);
> > #else
> > module_init(cpufreq_gov_dbs_init);
> > #endif
> > diff --git a/drivers/cpufreq/cpufreq_performance.c b/drivers/cpufreq/cpufreq_performance.c
> > index aaa04dfcacd9..def9afe0f5b8 100644
> > --- a/drivers/cpufreq/cpufreq_performance.c
> > +++ b/drivers/cpufreq/cpufreq_performance.c
> > @@ -50,5 +50,5 @@ MODULE_AUTHOR("Dominik Brodowski <[email protected]>");
> > MODULE_DESCRIPTION("CPUfreq policy governor 'performance'");
> > MODULE_LICENSE("GPL");
> >
> > -fs_initcall(cpufreq_gov_performance_init);
> > +core_initcall(cpufreq_gov_performance_init);
> > module_exit(cpufreq_gov_performance_exit);
> > diff --git a/drivers/cpufreq/cpufreq_powersave.c b/drivers/cpufreq/cpufreq_powersave.c
> > index c143dc237d87..1ae66019eb83 100644
> > --- a/drivers/cpufreq/cpufreq_powersave.c
> > +++ b/drivers/cpufreq/cpufreq_powersave.c
> > @@ -43,7 +43,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
> > return &cpufreq_gov_powersave;
> > }
> >
> > -fs_initcall(cpufreq_gov_powersave_init);
> > +core_initcall(cpufreq_gov_powersave_init);
> > #else
> > module_init(cpufreq_gov_powersave_init);
> > #endif
> > diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
> > index cbd81c58cb8f..b43e7cd502c5 100644
> > --- a/drivers/cpufreq/cpufreq_userspace.c
> > +++ b/drivers/cpufreq/cpufreq_userspace.c
> > @@ -147,7 +147,7 @@ struct cpufreq_governor *cpufreq_default_governor(void)
> > return &cpufreq_gov_userspace;
> > }
> >
> > -fs_initcall(cpufreq_gov_userspace_init);
> > +core_initcall(cpufreq_gov_userspace_init);
> > #else
> > module_init(cpufreq_gov_userspace_init);
> > #endif
> > --
> > 2.17.1
> >

2019-10-18 23:21:17

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v3 5/6] clk: qcom: Initialise clock drivers earlier

On 17-10-19, 10:47, Stephen Boyd wrote:
> Quoting Amit Kucheria (2019-10-17 05:27:37)
> > Initialise the clock drivers on sdm845 and qcs404 in core_initcall so we
> > can have earlier access to cpufreq during booting.
> >
> > Signed-off-by: Amit Kucheria <[email protected]>
> > ---
>
> Acked-by: Stephen Boyd <[email protected]>
>
> Makes me sad again.

I am wondering why it makes you sad ? :)

--
viresh

2019-10-18 23:21:19

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v3 1/6] thermal: Remove netlink support

On 17-10-19, 17:57, Amit Kucheria wrote:
> There are no users of netlink messages for thermal inside the kernel.
> Remove the code and adjust the documentation.
>
> Signed-off-by: Amit Kucheria <[email protected]>
> ---
> .../driver-api/thermal/sysfs-api.rst | 26 +----
> drivers/thermal/thermal_core.c | 107 +-----------------
> include/linux/thermal.h | 11 --
> 3 files changed, 10 insertions(+), 134 deletions(-)

Acked-by: Viresh Kumar <[email protected]>

--
viresh

2019-10-18 23:21:50

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v3 2/6] thermal: Initialize thermal subsystem earlier

On 17-10-19, 17:57, Amit Kucheria wrote:
> Now that the thermal framework is built-in, in order to facilitate
> thermal mitigation as early as possible in the boot cycle, move the
> thermal framework initialization to core_initcall.
>
> Signed-off-by: Amit Kucheria <[email protected]>
> ---
> drivers/thermal/thermal_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index d21b754baee2..d8251d723459 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1537,4 +1537,5 @@ static int __init thermal_init(void)
> mutex_destroy(&poweroff_lock);
> return result;
> }
> -fs_initcall(thermal_init);
> +

remove the blank line please.

> +core_initcall(thermal_init);

Acked-by: Viresh Kumar <[email protected]>

--
viresh

2019-10-29 09:20:05

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH v3 5/6] clk: qcom: Initialise clock drivers earlier

On Mon, Oct 28, 2019 at 10:22:24AM -0700, Stephen Boyd wrote:
> Quoting Viresh Kumar (2019-10-17 23:03:45)
> > On 17-10-19, 10:47, Stephen Boyd wrote:
> > > Quoting Amit Kucheria (2019-10-17 05:27:37)
> > > > Initialise the clock drivers on sdm845 and qcs404 in core_initcall so we
> > > > can have earlier access to cpufreq during booting.
> > > >
> > > > Signed-off-by: Amit Kucheria <[email protected]>
> > > > ---
> > >
> > > Acked-by: Stephen Boyd <[email protected]>
> > >
> > > Makes me sad again.
> >
> > I am wondering why it makes you sad ? :)
> >
>
> We're playing games with initcall levels :(
>

+1, which will come back and bite us hard soon :)

--
Regards,
Sudeep

2019-11-05 06:54:09

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v3 5/6] clk: qcom: Initialise clock drivers earlier

On 29-10-19, 09:06, Sudeep Holla wrote:
> On Mon, Oct 28, 2019 at 10:22:24AM -0700, Stephen Boyd wrote:
> > Quoting Viresh Kumar (2019-10-17 23:03:45)
> > > On 17-10-19, 10:47, Stephen Boyd wrote:
> > > > Quoting Amit Kucheria (2019-10-17 05:27:37)
> > > > > Initialise the clock drivers on sdm845 and qcs404 in core_initcall so we
> > > > > can have earlier access to cpufreq during booting.
> > > > >
> > > > > Signed-off-by: Amit Kucheria <[email protected]>
> > > > > ---
> > > >
> > > > Acked-by: Stephen Boyd <[email protected]>
> > > >
> > > > Makes me sad again.
> > >
> > > I am wondering why it makes you sad ? :)
> > >
> >
> > We're playing games with initcall levels :(
> >
>
> +1, which will come back and bite us hard soon :)

:)

I don't like reordering init calls as well, but only when they are
used to avoid issues and probe things in a particular order. While the
only thing we are doing here is to get things to probe earlier, which
isn't wrong IMO :)

Lets see if it bites us anytime soon, I would be surprised really :)

--
viresh