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

Commit c337d4aa authored by Archana Sathyakumar's avatar Archana Sathyakumar Committed by Gerrit - the friendly Code Review server
Browse files

lpm: Resolve inconsistent CPU status with M4M sleep



Cluster sleep preparation and configuration starts first with L2 and
then M4M (or parent level). In the exit path, cluster unpreparation
starts with L2 and then M4M. Only the first cpu from each cluster waits
to unprepare M4M and send out M4M exit notifications.

       CPU0
	|
	|
	|
	V	      CPU2
    Cluster 0 L2	|
	|		|
	| 		|
	|		V
	V	       L2	      CPU3
       M4M	        |		|
	|		|		|
	| 		| Unprepare	|
	| 		V		V
	V	        M4 	    L2 unprepare(not first cpu)
     Sleep	        ^		^
		        |		|
			|		|
	          CPU2 Active	      CPU3 Active
					|
					|
					V
				Request for frequency change

Instead the entry/exit path should acquire M4M lock holding onto the L2
lock such that there is no race condition between the cpus that are
exiting/entering.

       CPU0
	|
	|
	|
	V	      CPU2
    Cluster 0 L2	|
	|		|
	| 		|
	|		V
	V	       L2	      CPU3
       M4M	        |		|
	|		|		|
	| 		| Unprepare	|
	| 		V		V
	|	        M4 	    L2 unprepare(waiting on spinlock
	V		|		acquired by CPU2)
     Sleep	        |		|
		        |		|
			V		|
	          CPU2 Active	      spinlock for L2 acquired
					|
					|
					|
				CPU3 is not the first cpu in the cluster
					|
					| exit idle path
					V
				     CPU3 active
					|
					|
					V
					safe time
				for frequency change

Also, number of children in sync is accessed without the lock of the
same cluster. This causes inconsistency within the same cluster. Ensure
this variable is accessed within the spinlock.

Change-Id: I182692fbc2bd6b0b0beaee0666bf108a76adc34a
Signed-off-by: default avatarArchana Sathyakumar <asathyak@codeaurora.org>
parent 122fe9b1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment