ANDROID: thermal: Add vendor thermal genl check

Add vendor enable_thermal_genl_check logic.
Filter on-die tz genl event.

To avoid thermal-hal being woken up all the time by thermal genl events,
only the selected thermal_zone and cooling_device can send events from
kernel.

Bug: 170682696
Test: boot and thermal-hal can receive thermal genl events from kernel
Change-Id: Idb3f4b07a2a2740c01d8785910878bfe6edc832d
Signed-off-by: davidchao <davidchao@google.com>
This commit is contained in:
davidchao
2021-02-01 16:46:13 +08:00
committed by Wei Wang
parent ce3c550c15
commit 7b9c0e11b4
3 changed files with 11 additions and 0 deletions

View File

@@ -275,3 +275,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_offline);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_online); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_online);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_free); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_free);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_alloc); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_alloc);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check);

View File

@@ -9,6 +9,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <net/genetlink.h> #include <net/genetlink.h>
#include <trace/hooks/thermal.h>
#include <uapi/linux/thermal.h> #include <uapi/linux/thermal.h>
#include "thermal_core.h" #include "thermal_core.h"
@@ -229,6 +230,11 @@ static int thermal_genl_send_event(enum thermal_genl_event event,
struct sk_buff *msg; struct sk_buff *msg;
int ret = -EMSGSIZE; int ret = -EMSGSIZE;
void *hdr; void *hdr;
int enable_thermal_genl = 1;
trace_android_vh_enable_thermal_genl_check(event, p->tz_id, &enable_thermal_genl);
if (!enable_thermal_genl)
return 0;
msg = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); msg = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
if (!msg) if (!msg)

View File

@@ -45,6 +45,10 @@ DECLARE_HOOK(android_vh_disable_thermal_cooling_stats,
TP_PROTO(struct thermal_cooling_device *cdev, int *disable_stats), TP_PROTO(struct thermal_cooling_device *cdev, int *disable_stats),
TP_ARGS(cdev, disable_stats)); TP_ARGS(cdev, disable_stats));
DECLARE_HOOK(android_vh_enable_thermal_genl_check,
TP_PROTO(int event, int tz_id, int *enable_thermal_genl),
TP_ARGS(event, tz_id, enable_thermal_genl));
#endif /* _TRACE_HOOK_THERMAL_H */ #endif /* _TRACE_HOOK_THERMAL_H */
/* This part must be outside protection */ /* This part must be outside protection */
#include <trace/define_trace.h> #include <trace/define_trace.h>