Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a207d5c4 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

core_ctl: Take state_lock while preparing the global_state



global_state file output is prepared by reading the members of CPU
and cluster data structures. These members are updated under state_lock,
so acquire the same lock while preparing the output.

Change-Id: I8cb3ca6f9100a24f0bc9b293d364ad6aa8aabefb
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 68e85fd7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -260,6 +260,7 @@ static ssize_t show_global_state(const struct cluster_data *state, char *buf)
	ssize_t count = 0;
	unsigned int cpu;

	spin_lock_irq(&state_lock);
	for_each_possible_cpu(cpu) {
		c = &per_cpu(cpu_state, cpu);
		cluster = c->cluster;
@@ -295,6 +296,7 @@ static ssize_t show_global_state(const struct cluster_data *state, char *buf)
		count += snprintf(buf + count, PAGE_SIZE - count,
				"\tBoost: %u\n", (unsigned int) cluster->boost);
	}
	spin_unlock_irq(&state_lock);

	return count;
}