From 8b49160d2343ceb75638e2bef4918b3b22b35055 Mon Sep 17 00:00:00 2001 From: Sai Harshini Nimmala Date: Thu, 18 Aug 2022 05:40:47 -0700 Subject: [PATCH] ANDROID: topology: Add a flag to indicate topology has been updated Create a flag that stores information about the completion of topology initialization. This information is needed by Qualcomm's WALT scheduler vendor module. Usually the WALT module waits on the tracehook callback to initialize its topology internal state. However in situations when the insertion of the module happens after update_topology_flags_workfn(), the module needs to be told that it was late in being inserted i.e. the tracehook was run long before it was inserted. The module pseudo code would be walt_init() { if already initialited exit else proceed with initialization } hook callback () { walt_init() } probe() { register for update_topology_flag_workfn tracehook if (topology_update_done) walt_init() } This reverts commit b9bca6992d86 ("Revert "ANDROID: topology: Add flag to indicate topology has been updated" "). Change was originally reverted, bringing it back in. Bug: 187234873 Signed-off-by: Sai Harshini Nimmala Change-Id: I8e5366a660a2bf5b1d10f9cb0b0cf4f18286a043 --- drivers/base/arch_topology.c | 3 +++ include/linux/arch_topology.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index f4e5939b7958..2ede75484c62 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -244,6 +244,8 @@ static int register_cpu_capacity_sysctl(void) subsys_initcall(register_cpu_capacity_sysctl); static int update_topology; +bool topology_update_done; +EXPORT_SYMBOL_GPL(topology_update_done); int topology_update_cpu_topology(void) { @@ -258,6 +260,7 @@ static void update_topology_flags_workfn(struct work_struct *work) { update_topology = 1; rebuild_sched_domains(); + topology_update_done = true; trace_android_vh_update_topology_flags_workfn(NULL); pr_debug("sched_domain hierarchy rebuilt, flags updated\n"); update_topology = 0; diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h index a07b510e7dc5..589f2a21a4af 100644 --- a/include/linux/arch_topology.h +++ b/include/linux/arch_topology.h @@ -93,5 +93,6 @@ void remove_cpu_topology(unsigned int cpuid); void reset_cpu_topology(void); int parse_acpi_topology(void); #endif +extern bool topology_update_done; #endif /* _LINUX_ARCH_TOPOLOGY_H_ */