Initialise thermal framework earlier during boot
Subsystems (5)
cover Initialise thermal framework earlier during boot
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 (4):
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
Lina Iyer (1):
thermal: Initialize thermal subsystem earlier
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 | 41 +++++++++++++++----------- 11 files changed, 34 insertions(+), 27 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/5 thermal: Initialize thermal subsystem earlier
From: Lina Iyer <[email protected]>
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.
However, netlink initialization happens only as part of subsys_initcall. At this time in the boot process, the userspace is not available yet. So initialize the netlink events later in fs_initcall.
--- drivers/thermal/thermal_core.c | 41 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 17 deletions(-)
drivers/thermal/thermal_core.c +24 -17
@@ -1468,6 +1468,8 @@ static struct genl_family thermal_event_genl_family __ro_after_init = { .n_mcgrps = ARRAY_SIZE(thermal_event_mcgrps), }; +static bool allow_netlink_events; +int thermal_generate_netlink_event (struct thermal_zone_device *tz,enum events event) {
@@ -1482,6 +1484,9 @@ int thermal_generate_netlink_event(struct thermal_zone_device *tz,if (!tz)return -EINVAL ; +if (!allow_netlink_events) +return -ENODEV ; +/* allocate memory */ size =nla_total_size (sizeof (struct thermal_genl_event )) +nla_total_size (0 );
@@ -1533,16 +1538,18 @@ EXPORT_SYMBOL_GPL(thermal_generate_netlink_event);static int __init genetlink_init (void ) { -return genl_register_family (&thermal_event_genl_family); -} +int ret; -static void genetlink_exit (void ) -{ -genl_unregister_family (&thermal_event_genl_family); + ret =genl_register_family (&thermal_event_genl_family); +if (!ret) + allow_netlink_events = true; +return ret; } +#else /* !CONFIG_NET */ static inline int genetlink_init (void ) {return 0 ; } -static inline void genetlink_exit (void ) {} +static inline int thermal_generate_netlink_event (struct thermal_zone_device *tz, +enum events event) {return -ENODEV ; }#endif /* !CONFIG_NET */ static int thermal_pm_notify(struct notifier_block *nb,
@@ -1591,19 +1598,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)
@@ -1612,13 +1615,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);
@@ -1626,4 +1627,10 @@ static int __init thermal_init(void)mutex_destroy (&poweroff_lock);return result; } -fs_initcall (thermal_init); + +static int __init thermal_netlink_init (void ) +{ +return genetlink_init (); +} +core_initcall (thermal_init); +fs_initcall (thermal_netlink_init);
Signature · 1 line
2.17.1
Re: [PATCH 1/5] thermal: Initialize thermal subsystem earlier
Quoted 9 lines · Amit Kucheria
From: Lina Iyer <[email protected]>
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.However, netlink initialization happens only as part of
subsys_initcall. At this time in the boot process, the userspace is not available yet. So initialize the netlink events later infs_initcall.
Why not kill directly the netlink part, no one is using it in the kernel?
Quoted 106 lines
Signed-off-by Lina Iyer <[email protected]>[Rebased, refactored and moved to core_initcall]Signed-off-by Amit Kucheria <[email protected]>--- drivers/thermal/thermal_core.c | 41 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 17 deletions(-)drivers/thermal/thermal_core.c +24
-17@@ -1468,6 +1468,8 @@ static struct genl_family thermal_event_genl_family __ro_after_init = { .n_mcgrps = ARRAY_SIZE(thermal_event_mcgrps), }; +static bool allow_netlink_events; +int thermal_generate_netlink_event (struct thermal_zone_device *tz,enum events event) {@@ -1482,6 +1484,9 @@ int thermal_generate_netlink_event(struct thermal_zone_device *tz,if (!tz)return -EINVAL ; +if (!allow_netlink_events) +return -ENODEV ; +/* allocate memory */ size =nla_total_size (sizeof (struct thermal_genl_event )) +nla_total_size (0 );@@ -1533,16 +1538,18 @@ EXPORT_SYMBOL_GPL(thermal_generate_netlink_event);static int __init genetlink_init (void ) { -return genl_register_family (&thermal_event_genl_family); -} +int ret; -static void genetlink_exit (void ) -{ -genl_unregister_family (&thermal_event_genl_family); + ret =genl_register_family (&thermal_event_genl_family); +if (!ret) + allow_netlink_events = true; +return ret; } +#else /* !CONFIG_NET */ static inline int genetlink_init (void ) {return 0 ; } -static inline void genetlink_exit (void ) {} +static inline int thermal_generate_netlink_event (struct thermal_zone_device *tz, +enum events event) {return -ENODEV ; }#endif /* !CONFIG_NET */ static int thermal_pm_notify(struct notifier_block *nb,@@ -1591,19 +1598,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)@@ -1612,13 +1615,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);@@ -1626,4 +1627,10 @@ static int __init thermal_init(void)mutex_destroy (&poweroff_lock);return result; } -fs_initcall (thermal_init); + +static int __init thermal_netlink_init (void ) +{ +return genetlink_init (); +} +core_initcall (thermal_init); +fs_initcall (thermal_netlink_init);
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Re: [PATCH 1/5] thermal: Initialize thermal subsystem earlier
Quoted 8 lines · Daniel Lezcano
Quoted 6 lines · Amit Kucheria
From: Lina Iyer <[email protected]>
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.
Quoted 5 lines
Quoted 3 lines
However, netlink initialization happens only as part of
subsys_initcall. At this time in the boot process, the userspace is not available yet. So initialize the netlink events later infs_initcall.Why not kill directly the netlink part, no one is using it in the kernel?
That's a good point. I wasn't sure if anybody was using it, but I can remove it completely since no driver seems to be using the thermal_generate_netlink_event() api.
Regards,
Amit
$ git grep thermal_generate_netlink_event Documentation/thermal/sysfs-api.rst:just need to call thermal_generate_netlink_event() with two arguments viz drivers/thermal/thermal_core.c:int thermal_generate_netlink_event(struct thermal_zone_device *tz, drivers/thermal/thermal_core.c:EXPORT_SYMBOL_GPL(thermal_generate_netlink_event); include/linux/thermal.h:extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, include/linux/thermal.h:static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz,
Zhang Rui
reviewerRe: [PATCH 1/5] thermal: Initialize thermal subsystem earlier
Quoted 18 lines · Amit Kucheria
Quoted 16 lines · Daniel Lezcano
Quoted 13 lines · Amit Kucheria
From: Lina Iyer <[email protected]>
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 tocore_initcall.However, netlink initialization happens only as part of
subsys_initcall.
At this time in the boot process, the userspace is not available yet. So
initialize the netlink events later infs_initcall.
Quoted 6 lines
Quoted 2 lines
Why not kill directly the netlink part, no one is using it in the kernel?
That's a good point. I wasn't sure if anybody was using it, but I can remove it completely since no driver seems to be using the
thermal_generate_netlink_event()api.
Interesting, I recalled that thermal_generate_netlink_event() is indeed used by some thermal driver, but it's true that no one is using it now.
let's remove it and see if we get any complains.
thanks,
rui
Quoted 15 lines
Regards,
Amit$ git grep thermal_generate_netlink_event Documentation/thermal/sysfs-api.rst:just need to call thermal_generate_netlink_event() with two arguments viz drivers/thermal/thermal_core.c:int thermal_generate_netlink_event(struct thermal_zone_device *tz, drivers/thermal/thermal_core.c:EXPORT_SYMBOL_GPL(thermal_generate_net link_event); include/linux/thermal.h:extern int thermal_generate_netlink_event(struct thermal_zone_device *tz, include/linux/thermal.h:static inline int thermal_generate_netlink_event(struct thermal_zone_device *tz,
PATCH 2/5 cpufreq: Initialise the governors in core_initcall
In reply to Amit KucheriaInitialise the cpufreq governors earlier to allow for earlier performance control during the boot process.
--- 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(-)
drivers/cpufreq/cpufreq_conservative.c +1 -1
@@ -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
drivers/cpufreq/cpufreq_ondemand.c +1 -1
@@ -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
drivers/cpufreq/cpufreq_performance.c +1 -1
@@ -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);
drivers/cpufreq/cpufreq_powersave.c +1 -1
@@ -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
drivers/cpufreq/cpufreq_userspace.c +1 -1
@@ -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
Signature · 1 line
2.17.1
Re: [PATCH 2/5] cpufreq: Initialise the governors in core_initcall
Quoted 11 lines · Amit Kucheria
Initialise the cpufreq governors earlier to allow for earlier performance control during the boot process.
Signed-off-by Amit Kucheria <[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(-)
Signature · 1 line
viresh
PATCH 3/5 cpufreq: Initialize cpufreq-dt driver earlier
In reply to Amit KucheriaThis allows HW drivers that depend on cpufreq-dt to initialise earlier.
--- drivers/cpufreq/cpufreq-dt-platdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cpufreq-dt-platdev.c +1 -1
@@ -175,4 +175,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);
Signature · 1 line
2.17.1
Re: [PATCH 3/5] cpufreq: Initialize cpufreq-dt driver earlier
Quoted 6 lines · Amit Kucheria
This allows HW drivers that depend on cpufreq-dt to initialise earlier.
Signed-off-by Amit Kucheria <[email protected]>--- drivers/cpufreq/cpufreq-dt-platdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
viresh
PATCH 4/5 clk: qcom: Initialise clock drivers earlier
In reply to Amit KucheriaInitialise the clock drivers on sdm845 and qcs404 in core_initcall so we can have earlier access to cpufreq during booting.
--- 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(-)
drivers/clk/qcom/clk-rpmh.c +1 -1
@@ -463,7 +463,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) {
drivers/clk/qcom/gcc-qcs404.c +1 -1
@@ -2825,7 +2825,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) {
drivers/clk/qcom/gcc-sdm845.c +1 -1
@@ -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) {
Signature · 1 line
2.17.1
Re: [PATCH 4/5] clk: qcom: Initialise clock drivers earlier
Quoting Amit Kucheria (2019-09-11 15:32:33)
Quoted 5 lines
Initialise the clock drivers on sdm845 and qcs404 in
core_initcallso we can have earlier access to cpufreq during booting.Signed-off-by Amit Kucheria <[email protected]>---
Did you want this patch to go through clk tree?
Re: [PATCH 4/5] clk: qcom: Initialise clock drivers earlier
Quoted 9 lines · Stephen Boyd
Quoting Amit Kucheria (2019-09-11 15:32:33)
Quoted 5 lines
Initialise the clock drivers on sdm845 and qcs404 in
core_initcallso we can have earlier access to cpufreq during booting.Signed-off-by Amit Kucheria <[email protected]>---
Did you want this patch to go through clk tree?
Yes, This patch can go in via the clk tree regardless of the rest of the series.
Regards,
Amit
PATCH 5/5 cpufreq: qcom-hw: Move driver initialisation earlier
In reply to Amit KucheriaAllow 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.
--- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-hw.c +1 -1
@@ -327,7 +327,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) {
Signature · 1 line
2.17.1
Re: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
Quoted 14 lines · Amit Kucheria
Allow qcom-hw driver to initialise right after the cpufreq and thermal subsystems are initialised in
core_initcallso we get earlier access to thermal mitigation.Signed-off-by Amit Kucheria <[email protected]>--- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/qcom-cpufreq-hw.c +0
-0
drivers/cpufreq/qcom-cpufreq-hw.c static int __init qcom_cpufreq_hw_init(void) · line 330
Quoted 5 lines
drivers/cpufreq/qcom-cpufreq-hw.c +1
-1@@ -327,7 +327,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);
Even core_initcall should work just fine because of the ordering in the Makefile in cpufreq directory.
Signature · 1 line
viresh
Re: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
In reply to Amit KucheriaQuoted 14 lines · Amit Kucheria
Allow qcom-hw driver to initialise right after the cpufreq and thermal subsystems are initialised in
core_initcallso we get earlier access to thermal mitigation.Signed-off-by Amit Kucheria <[email protected]>--- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/qcom-cpufreq-hw.c +0
-0
drivers/cpufreq/qcom-cpufreq-hw.c static int __init qcom_cpufreq_hw_init(void) · line 330
Quoted 5 lines
drivers/cpufreq/qcom-cpufreq-hw.c +1
-1@@ -327,7 +327,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);
I am fine with core framework initcall pushed to earlier initcall levels if required, but for individual/platform specific drivers I am not so happy to see that.
This goes against the grand plan of single common kernel strategy by Android moving all drivers as modules. We might decide to make this a module. Also there are few cpufreq drivers that are modules. Will they have issues ? If not, why do we need this change at all. Needing thermal mitigation during boot this earlier is still too much of expectation, I would rather boot slowly than relying on this feature.
--
Regards,
Sudeep
Re: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
Hi Sudeep,
Quoted 25 lines · Sudeep Holla
Quoted 14 lines · Amit Kucheria
Allow qcom-hw driver to initialise right after the cpufreq and thermal subsystems are initialised in
core_initcallso we get earlier access to thermal mitigation.Signed-off-by Amit Kucheria <[email protected]>--- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/qcom-cpufreq-hw.c +0
-0drivers/cpufreq/qcom-cpufreq-hw.c static int __init qcom_cpufreq_hw_init(void) · line 330
Quoted 5 lines
drivers/cpufreq/qcom-cpufreq-hw.c +1
-1@@ -327,7 +327,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);I am fine with core framework initcall pushed to earlier initcall levels if required, but for individual/platform specific drivers I am not so happy to see that.
Quoted 3 lines
This goes against the grand plan of single common kernel strategy by Android moving all drivers as modules. We might decide to make this a module.
module = mounted file system = very late initialization
Is that the plan? Force every driver to load too late?
There are core drivers which must be loaded as soon as possible. If the qcom driver is one of them, then what is the problem?
"The grand plan" will have to solve this first before doing the module move.
Quoted 2 lines
Also there are few cpufreq drivers that are modules. Will they have issues ? If not, why do we need this change at all.
Because some boards don't have thermal issues with the cpufreq drivers as module, other boards have.
Quoted 3 lines
Needing
thermal mitigation during boot this earlier is still too much of expectation, I would rather boot slowly than relying on this feature.
And what if we want to boot faster? The boot time is one of a key point of benchmark.
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Re: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
Hi Daniel
Quoted 49 lines · Daniel Lezcano
Hi Sudeep,
Quoted 25 lines · Sudeep Holla
Quoted 14 lines · Amit Kucheria
Allow qcom-hw driver to initialise right after the cpufreq and thermal subsystems are initialised in
core_initcallso we get earlier access to thermal mitigation.Signed-off-by Amit Kucheria <[email protected]>--- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/qcom-cpufreq-hw.c +0
-0drivers/cpufreq/qcom-cpufreq-hw.c static int __init qcom_cpufreq_hw_init(void) · line 330
Quoted 5 lines
drivers/cpufreq/qcom-cpufreq-hw.c +1
-1@@ -327,7 +327,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);I am fine with core framework initcall pushed to earlier initcall levels if required, but for individual/platform specific drivers I am not so happy to see that.
Quoted 3 lines
This goes against the grand plan of single common kernel strategy by Android moving all drivers as modules. We might decide to make this a module.
module = mounted file system = very late initialization
Is that the plan? Force every driver to load too late?
There are core drivers which must be loaded as soon as possible. If the qcom driver is one of them, then what is the problem?
"The grand plan" will have to solve this first before doing the module move.
Quoted 2 lines
Also there are few cpufreq drivers that are modules. Will they have issues ? If not, why do we need this change at all.
Because some boards don't have thermal issues with the cpufreq drivers as module, other boards have.
Quoted 6 lines
Quoted 3 lines
Needing
thermal mitigation during boot this earlier is still too much of expectation, I would rather boot slowly than relying on this feature.And what if we want to boot faster? The boot time is one of a key point of benchmark.
Could you share test results for this ? It'd be nice to see what if the gains in boot time outweight the additional pain for android folks
...
Thanks,
Quentin
Re: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
In reply to Daniel LezcanoQuoted 29 lines · Daniel Lezcano
Hi Sudeep,
Quoted 25 lines · Sudeep Holla
Quoted 14 lines · Amit Kucheria
Allow qcom-hw driver to initialise right after the cpufreq and thermal subsystems are initialised in
core_initcallso we get earlier access to thermal mitigation.Signed-off-by Amit Kucheria <[email protected]>--- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/qcom-cpufreq-hw.c +0
-0drivers/cpufreq/qcom-cpufreq-hw.c static int __init qcom_cpufreq_hw_init(void) · line 330
Quoted 5 lines
drivers/cpufreq/qcom-cpufreq-hw.c +1
-1@@ -327,7 +327,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);I am fine with core framework initcall pushed to earlier initcall levels if required, but for individual/platform specific drivers I am not so happy to see that.
Quoted 8 lines
Quoted 3 lines
This goes against the grand plan of single common kernel strategy by Android moving all drivers as modules. We might decide to make this a module.
module = mounted file system = very late initialization
Is that the plan? Force every driver to load too late?
Yes. Something similar to what we have on desktops/servers.
Quoted 3 lines
There are core drivers which must be loaded as soon as possible. If the qcom driver is one of them, then what is the problem?
I am fine with that if it's really issue but it shouldn't become the defacto trend.
Quoted 3 lines
"The grand plan" will have to solve this first before doing the module move.
Sure, I just expressed my view as it looks to be going in different direction for me.
Quoted 6 lines
Quoted 2 lines
Also there are few cpufreq drivers that are modules. Will they have issues ? If not, why do we need this change at all.
Because some boards don't have thermal issues with the cpufreq drivers as module, other boards have.
OK, so this platform boots with default high OPP and needs thermal mitigation that early ? If so, that's fine.
Quoted 7 lines
Quoted 3 lines
Needing
thermal mitigation during boot this earlier is still too much of expectation, I would rather boot slowly than relying on this feature.And what if we want to boot faster? The boot time is one of a key point of benchmark.
I understand the requirement, though for me it's really sounds stupid.
As Quentin pointed out, it would be good to get all those benchmark details, and preferably in the commit log so that we can look back whenever someone else take the same approach later.
--
Regards,
Sudeep
Re: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
Hi Sudeep,
Quoted 40 lines · Sudeep Holla
Quoted 29 lines · Daniel Lezcano
Hi Sudeep,
Quoted 25 lines · Sudeep Holla
Quoted 14 lines · Amit Kucheria
Allow qcom-hw driver to initialise right after the cpufreq and thermal subsystems are initialised in
core_initcallso we get earlier access to thermal mitigation.Signed-off-by Amit Kucheria <[email protected]>--- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/qcom-cpufreq-hw.c +0
-0drivers/cpufreq/qcom-cpufreq-hw.c static int __init qcom_cpufreq_hw_init(void) · line 330
Quoted 5 lines
drivers/cpufreq/qcom-cpufreq-hw.c +1
-1@@ -327,7 +327,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);I am fine with core framework initcall pushed to earlier initcall levels if required, but for individual/platform specific drivers I am not so happy to see that.
Quoted 8 lines
Quoted 3 lines
This goes against the grand plan of single common kernel strategy by Android moving all drivers as modules. We might decide to make this a module.
module = mounted file system = very late initialization
Is that the plan? Force every driver to load too late?
Quoted 8 lines
Yes. Something similar to what we have on desktops/servers.
Quoted 3 lines
There are core drivers which must be loaded as soon as possible. If the qcom driver is one of them, then what is the problem?
I am fine with that if it's really issue but it shouldn't become the defacto trend.
I didn't convert other HW drivers on purpose since it's really up to the platform to decide. I have tested with all drivers converted to core_initcall and didn't find any boot issues on kernelci.
Quoted 10 lines
Quoted 3 lines
"The grand plan" will have to solve this first before doing the module move.
Sure, I just expressed my view as it looks to be going in different direction for me.
Quoted 3 lines
Quoted 2 lines
Also there are few cpufreq drivers that are modules. Will they have issues ? If not, why do we need this change at all.
Quoted 6 lines
Quoted 3 lines
Because some boards don't have thermal issues with the cpufreq drivers as module, other boards have.
OK, so this platform boots with default high OPP and needs thermal mitigation that early ? If so, that's fine.
That is indeed the case - 30-40 degree rise in under 50ms can be seen on some of these platforms.
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
Needing
thermal mitigation during boot this earlier is still too much of expectation, I would rather boot slowly than relying on this feature.And what if we want to boot faster? The boot time is one of a key point of benchmark.
I understand the requirement, though for me it's really sounds stupid.
Is it stupid if the SoC was being used in automotive with a 2s (or less) startup requirement? :-)
Quoted 3 lines
As Quentin pointed out, it would be good to get all those benchmark details, and preferably in the commit log so that we can look back whenever someone else take the same approach later.
I'm traveling for Connect this week but will try to post some logs with initcall_debug turned on where changing these initcalls shaves off several seconds. Just to reassure everyone that GKI isn't forgotten, the next set of patches will actually add module support for the tsens driver so AOSP can make them modules and things will still work.
Regards,
Amit
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
In reply to Sudeep HollaQuoted 10 lines · Sudeep Holla
drivers/cpufreq/qcom-cpufreq-hw.c static int __init qcom_cpufreq_hw_init(void) · line 330
Quoted 2 lines · Amit Kucheria
drivers/cpufreq/qcom-cpufreq-hw.c +1
-1-device_initcall (qcom_cpufreq_hw_init); +postcore_initcall (qcom_cpufreq_hw_init);I am fine with core framework initcall pushed to earlier initcall levels if required, but for individual/platform specific drivers I am not so happy to see that.
This goes against the grand plan of single common kernel strategy by Android moving all drivers as modules.
Its been long that I got the opportunity to work on drivers directly, but as far as I remember (which should be incorrect based on your reply) we can still build a driver as module even if it has some postcore_initcall() declarations. They will execute at module insertion. Is that incorrect ? If not, then how is it going to affect android effort ?
Signature · 1 line
viresh
Re: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
Quoted 9 lines · Viresh Kumar
Quoted 8 lines · Sudeep Holla
drivers/cpufreq/qcom-cpufreq-hw.c static int __init qcom_cpufreq_hw_init(void) · line 330
Quoted 2 lines · Amit Kucheria
drivers/cpufreq/qcom-cpufreq-hw.c +1
-1-device_initcall (qcom_cpufreq_hw_init); +postcore_initcall (qcom_cpufreq_hw_init);I am fine with core framework initcall pushed to earlier initcall levels if required, but for individual/platform specific drivers I am not so happy to see that.
Quoted 9 lines
Quoted 2 lines
This goes against the grand plan of single common kernel strategy by Android moving all drivers as modules.
Its been long that I got the opportunity to work on drivers directly, but as far as I remember (which should be incorrect based on your reply) we can still build a driver as module even if it has some
postcore_initcall()declarations. They will execute at module insertion. Is that incorrect ? If not, then how is it going to affect android effort ?
Ah no, I am not referring to building as module. As you mention, that may work just fine. I was referring to timing dependency during boot. The idea is minimize the number of such initcall dependency. They should all work fine even as modules and should have least dependency on initcall sequence.
--
Regards,
Sudeep
Viresh Kumar
maintainerRe: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
Quoted 4 lines · Sudeep Holla
Ah no, I am not referring to building as module. As you mention, that may work just fine. I was referring to timing dependency during boot. The idea is minimize the number of such initcall dependency. They should all work fine even as modules and should have least dependency on initcall sequence.
Yeah, so things work fine for them right now but that can be improved by changing the sequence of boot here. And that's what Amit is trying to do here.
Even if android builds this as a module later, things will continue to work but that may not be the best performance/boot-time wise.
When I had a discussion about this with Amit earlier, I asked him to send patches even if he doesn't have any performance numbers for it as this is a platform driver and I find it okay for them to decide the boot sequence that they think is the best :)
Signature · 1 line
viresh
Re: [PATCH 5/5] cpufreq: qcom-hw: Move driver initialisation earlier
In reply to Amit KucheriaQuoted 5 lines · Amit Kucheria
Allow qcom-hw driver to initialise right after the cpufreq and thermal subsystems are initialised in
core_initcallso we get earlier access to thermal mitigation.Signed-off-by Amit Kucheria <[email protected]>
Quoted 18 lines
--- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/qcom-cpufreq-hw.c +1
-1@@ -327,7 +327,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) {
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog