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
Bug: 291846209
Test: boot and thermal-hal can receive thermal genl events from kernel
Change-Id: Idb3f4b07a2a2740c01d8785910878bfe6edc832d
Signed-off-by: davidchao <davidchao@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
(cherry picked from commit 6ca2ff04a1)
Bug: 287008367
Bug: 295178116
Signed-off-by: André Draszik <draszik@google.com>
This commit is contained in:
davidchao 2021-02-01 16:46:13 +08:00 committed by André Draszik
parent c5c84f48b7
commit 90bc763c0c
2 changed files with 7 additions and 0 deletions

View File

@ -312,3 +312,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_cold_pageout_skip);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue_smallest_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue_smallest_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_one_page_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_one_page_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_regmap_update); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_regmap_update);
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"
@ -274,6 +275,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)