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>
This commit is contained in:
davidchao
2024-06-19 00:04:51 +00:00
committed by Will McVicker
parent e1456ad867
commit d513fa226c
3 changed files with 27 additions and 0 deletions
+2
View File
@@ -46,6 +46,7 @@
#include <trace/hooks/traps.h>
#include <trace/hooks/fault.h>
#include <trace/hooks/topology.h>
#include <trace/hooks/thermal.h>
#include <trace/hooks/rwsem.h>
#include <trace/hooks/bl_hib.h>
#include <trace/hooks/futex.h>
@@ -208,3 +209,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_flush_wq_wait_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_flush_wq_wait_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_flush_work_wait_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_flush_work_wait_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check);
+6
View File
@@ -10,6 +10,7 @@
#include <linux/notifier.h>
#include <linux/kernel.h>
#include <net/genetlink.h>
#include <trace/hooks/thermal.h>
#include <uapi/linux/thermal.h>
#include "thermal_core.h"
@@ -270,6 +271,11 @@ static int thermal_genl_send_event(enum thermal_genl_event event,
struct sk_buff *msg;
int ret = -EMSGSIZE;
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;
if (!thermal_group_has_listeners(THERMAL_GENL_EVENT_GROUP))
return 0;
+19
View File
@@ -0,0 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM thermal
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_THERMAL_H
#include <trace/hooks/vendor_hooks.h>
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 */
/* This part must be outside protection */
#include <trace/define_trace.h>