* [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot
@ 2019-10-21 12:15 Amit Kucheria
2019-10-21 12:15 ` [PATCH v5 1/6] thermal: Remove netlink support Amit Kucheria
2019-10-31 2:42 ` [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot Zhang Rui
0 siblings, 2 replies; 5+ messages in thread
From: Amit Kucheria @ 2019-10-21 12:15 UTC (permalink / raw)
To: linux-kernel, linux-arm-msm, daniel.lezcano, viresh.kumar,
sudeep.holla, bjorn.andersson, edubezval, agross, tdas, swboyd,
ilina, Rafael J. Wysocki, Amit Kucheria, Ben Segall,
Dietmar Eggemann, Ingo Molnar, Juri Lelli, Mel Gorman,
Peter Zijlstra, Steven Rostedt, Vincent Guittot, Zhang Rui
Cc: linux-clk, linux-doc, linux-pm
Changes since v4:
- Collect Acks
- Pick the US spelling for 'initialis^Hze' consistently.
Changes since v3:
- Init schedutil governor earlier too
- Simplified changes to thermal_init() error path
- Collects Acks
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: Initialize the governors in core_initcall
cpufreq: Initialize cpufreq-dt driver earlier
clk: qcom: Initialize clock drivers earlier
cpufreq: qcom-hw: Move driver initialization 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 | 103 +-----------------
include/linux/thermal.h | 11 --
kernel/sched/cpufreq_schedutil.c | 2 +-
14 files changed, 19 insertions(+), 143 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v5 1/6] thermal: Remove netlink support
2019-10-21 12:15 [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot Amit Kucheria
@ 2019-10-21 12:15 ` Amit Kucheria
2019-10-31 2:42 ` [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot Zhang Rui
1 sibling, 0 replies; 5+ messages in thread
From: Amit Kucheria @ 2019-10-21 12:15 UTC (permalink / raw)
To: linux-kernel, linux-arm-msm, daniel.lezcano, viresh.kumar,
sudeep.holla, bjorn.andersson, edubezval, agross, tdas, swboyd,
ilina, Rafael J. Wysocki, Amit Kucheria, Ben Segall,
Dietmar Eggemann, Ingo Molnar, Juri Lelli, Mel Gorman,
Peter Zijlstra, Steven Rostedt, Vincent Guittot, Zhang Rui
Cc: linux-doc, linux-pm
There are no users of netlink messages for thermal inside the kernel.
Remove the code and adjust the documentation.
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../driver-api/thermal/sysfs-api.rst | 26 ++---
drivers/thermal/thermal_core.c | 101 +-----------------
include/linux/thermal.h | 11 --
3 files changed, 7 insertions(+), 131 deletions(-)
diff --git a/Documentation/driver-api/thermal/sysfs-api.rst b/Documentation/driver-api/thermal/sysfs-api.rst
index fab2c9b36d084..b40b1f8391481 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 d4481cc8958fe..cced0638b686f 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)
{
@@ -1607,13 +1514,9 @@ static int __init thermal_init(void)
if (result)
goto unregister_governors;
- result = genetlink_init();
- if (result)
- goto unregister_class;
-
result = of_parse_thermal_zones();
if (result)
- goto exit_netlink;
+ goto unregister_class;
result = register_pm_notifier(&thermal_pm_nb);
if (result)
@@ -1622,8 +1525,6 @@ static int __init thermal_init(void)
return 0;
-exit_netlink:
- genetlink_exit();
unregister_class:
class_unregister(&thermal_class);
unregister_governors:
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index e45659c759209..d9111aebb97d6 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot
2019-10-21 12:15 [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot Amit Kucheria
2019-10-21 12:15 ` [PATCH v5 1/6] thermal: Remove netlink support Amit Kucheria
@ 2019-10-31 2:42 ` Zhang Rui
2019-10-31 4:43 ` Amit Kucheria
2019-10-31 6:00 ` Daniel Lezcano
1 sibling, 2 replies; 5+ messages in thread
From: Zhang Rui @ 2019-10-31 2:42 UTC (permalink / raw)
To: Amit Kucheria, linux-kernel, linux-arm-msm, daniel.lezcano,
viresh.kumar, sudeep.holla, bjorn.andersson, edubezval, agross,
tdas, swboyd, ilina, Rafael J. Wysocki, Amit Kucheria, Ben Segall,
Dietmar Eggemann, Ingo Molnar, Juri Lelli, Mel Gorman,
Peter Zijlstra, Steven Rostedt, Vincent Guittot
Cc: linux-clk, linux-doc, linux-pm
Hi,
Given that all the patches in this series have got the ACK from the
subsystem maintainers, I suppose we can take all the patches through
thermal tree, right?
thanks,
rui
On Mon, 2019-10-21 at 17:45 +0530, Amit Kucheria wrote:
> Changes since v4:
> - Collect Acks
> - Pick the US spelling for 'initialis^Hze' consistently.
>
> Changes since v3:
> - Init schedutil governor earlier too
> - Simplified changes to thermal_init() error path
> - Collects Acks
>
> 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: Initialize the governors in core_initcall
> cpufreq: Initialize cpufreq-dt driver earlier
> clk: qcom: Initialize clock drivers earlier
> cpufreq: qcom-hw: Move driver initialization 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 | 103 +---------------
> --
> include/linux/thermal.h | 11 --
> kernel/sched/cpufreq_schedutil.c | 2 +-
> 14 files changed, 19 insertions(+), 143 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot
2019-10-31 2:42 ` [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot Zhang Rui
@ 2019-10-31 4:43 ` Amit Kucheria
2019-10-31 6:00 ` Daniel Lezcano
1 sibling, 0 replies; 5+ messages in thread
From: Amit Kucheria @ 2019-10-31 4:43 UTC (permalink / raw)
To: Zhang Rui
Cc: LKML, linux-arm-msm, Daniel Lezcano, Viresh Kumar, Sudeep Holla,
Bjorn Andersson, Eduardo Valentin, Andy Gross, Taniya Das,
Stephen Boyd, ilina, Rafael J. Wysocki, Ben Segall,
Dietmar Eggemann, Ingo Molnar, Juri Lelli, Mel Gorman,
Peter Zijlstra, Steven Rostedt, Vincent Guittot, linux-clk,
linux-doc, Linux PM list
Hi Rui,
I'm assuming that since Rafael acked it, he is ok with this going thru
the thermal tree.
Regards,
Amit
On Thu, Oct 31, 2019 at 8:12 AM Zhang Rui <rui.zhang@intel.com> wrote:
>
> Hi,
>
> Given that all the patches in this series have got the ACK from the
> subsystem maintainers, I suppose we can take all the patches through
> thermal tree, right?
>
> thanks,
> rui
>
> On Mon, 2019-10-21 at 17:45 +0530, Amit Kucheria wrote:
> > Changes since v4:
> > - Collect Acks
> > - Pick the US spelling for 'initialis^Hze' consistently.
> >
> > Changes since v3:
> > - Init schedutil governor earlier too
> > - Simplified changes to thermal_init() error path
> > - Collects Acks
> >
> > 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: Initialize the governors in core_initcall
> > cpufreq: Initialize cpufreq-dt driver earlier
> > clk: qcom: Initialize clock drivers earlier
> > cpufreq: qcom-hw: Move driver initialization 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 | 103 +---------------
> > --
> > include/linux/thermal.h | 11 --
> > kernel/sched/cpufreq_schedutil.c | 2 +-
> > 14 files changed, 19 insertions(+), 143 deletions(-)
> >
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot
2019-10-31 2:42 ` [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot Zhang Rui
2019-10-31 4:43 ` Amit Kucheria
@ 2019-10-31 6:00 ` Daniel Lezcano
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Lezcano @ 2019-10-31 6:00 UTC (permalink / raw)
To: Zhang Rui, Amit Kucheria, linux-kernel, linux-arm-msm,
viresh.kumar, sudeep.holla, bjorn.andersson, edubezval, agross,
tdas, swboyd, ilina, Rafael J. Wysocki, Amit Kucheria, Ben Segall,
Dietmar Eggemann, Ingo Molnar, Juri Lelli, Mel Gorman,
Peter Zijlstra, Steven Rostedt, Vincent Guittot
Cc: linux-clk, linux-doc, linux-pm
Hi Zhang,
On 31/10/2019 03:42, Zhang Rui wrote:
> Hi,
>
> Given that all the patches in this series have got the ACK from the
> subsystem maintainers, I suppose we can take all the patches through
> thermal tree, right?
Right
--
<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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-31 6:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-21 12:15 [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot Amit Kucheria
2019-10-21 12:15 ` [PATCH v5 1/6] thermal: Remove netlink support Amit Kucheria
2019-10-31 2:42 ` [PATCH v5 0/6] Initialise thermal framework and cpufreq earlier during boot Zhang Rui
2019-10-31 4:43 ` Amit Kucheria
2019-10-31 6:00 ` Daniel Lezcano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).