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 b9bca6992d ("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 <quic_snimmala@quicinc.com>
Change-Id: I8e5366a660a2bf5b1d10f9cb0b0cf4f18286a043
This commit is contained in:
Sai Harshini Nimmala 2022-08-18 05:40:47 -07:00 committed by Todd Kjos
parent 285daa8b39
commit 8b49160d23
2 changed files with 4 additions and 0 deletions

View File

@ -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;

View File

@ -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_ */