Skip to content

soc: apple: clpc: only step down busy CPU clusters on low-power PHPC - #3488

Merged
RyanTheTide merged 2 commits into
mainfrom
fix/clpc-low-power-busy-cluster
Dec 1, 2026
Merged

RyanTheTide merged 2 commits into
mainfrom
fix/clpc-low-power-busy-cluster

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What

Fix the low-power platform profile walking idle CPU clusters down to their minimum OPP (300 MHz) when a GPU or display workload holds package power (PHPC) above low_power_mw (reported in #3450):

  • Extract apple_clpc_sample_busy() from apple_clpc_sample_cluster() and call it from apple_clpc_profile_limit() when !clpc->has_pmc and low-power package power limiting is active, so cl->busy is maintained across both PMC-backed and standalone CLPC instances without SoC gating.
  • Extract apple_clpc_pick_profile_step() and skip clusters with cl->busy < APPLE_CLPC_BUSY_PCT (50%) when stepping down (step < 0), while still restoring idle capped clusters when PHPC falls below 90% of low_power_mw (step > 0).
  • Add KUnit test apple_clpc_profile_step_busy_test in apple-clpc-policy.

Tested

Tested: host tests and KUnit 19/19 (below); J714s hardware row in the comments shows the gate does not engage on has_pmc SoCs (rework pending).

  • python3 tools/asahi/clpc-gpu-demand-tests.py: PASS (all positive and negative controls).
  • python3 tools/asahi/clpc-high-power-cleanup-tests.py: PASS.
  • scripts/checkpatch.pl: 0 errors, 0 warnings.
  • make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- O=out-kunit W=1 drivers/soc/apple/clpc.o: clean, 0 warnings.
  • ./tools/testing/kunit/kunit.py run --arch=arm64 --cross_compile=aarch64-linux-gnu- --kunitconfig=drivers/soc/apple/clpc.kunitconfig --build_dir=out-kunit --jobs=6 'apple-clpc*': 19/19 passed (apple-clpc-policy: 5/5 including apple_clpc_profile_step_busy_test, apple-clpc-gpu: 14/14, under KASAN + UBSAN in QEMU).
KUnit output summary
[PASSED] apple_clpc_step_khz_test
[PASSED] apple_clpc_steps_first_test
[PASSED] apple_clpc_vote_test
[PASSED] apple_clpc_floor_test
[PASSED] apple_clpc_profile_step_busy_test
... (apple-clpc-gpu 14/14 PASSED)
Testing complete. Ran 19 tests: passed: 19

Risk

Risk: two-way door · Macs whose CLPC runs the low-power platform profile (T6050 and others). Scoped strictly to drivers/soc/apple/clpc.c low-power PHPC step-down selection. Busy CPU workloads (cl->busy >= 50%) step down in the exact same apple_clpc_steps_first() order as before; recovery (step > 0) is unchanged; no DT/ABI changes or SoC gates; single-commit revert.

Not yet

Fixes #3450

In the low-power platform profile, apple_clpc_profile_limit() reads SMC
PHPC (package power, which includes the GPU and display as well as the
CPUs) and steps one CPU cluster down on every new reading above
low_power_mw. When a GPU or display workload holds PHPC above
low_power_mw while the CPUs are idle or lightly loaded, stepping down
CPU ceilings saves almost no power, so PHPC stays above target and every
CPU cluster walks down to its minimum OPP (300 MHz).

Neither SMC nor apple-pmc exposes a per-cluster CPU-only power meter on
these platforms (CPU and GPU share PHPC), so gate downward steps on the
cluster's scheduler non-idle utilisation (cl->busy >= APPLE_CLPC_BUSY_PCT,
already sampled by apple_clpc_sample_cluster()):

- Extract apple_clpc_sample_busy() and run it for standalone
  (!clpc->has_pmc) low-power package-power instances as well, so
  cl->busy is populated uniformly without SoC gating.
- Extract apple_clpc_pick_profile_step() and skip clusters with
  cl->busy < APPLE_CLPC_BUSY_PCT when stepping down (step < 0), while
  still stepping every capped cluster back up when PHPC drops below 90%
  of low_power_mw (step > 0).
- Add KUnit test apple_clpc_profile_step_busy_test covering idle
  clusters under over-budget PHPC, single busy cluster selection,
  multi-cluster busy ordering, idle recovery on step-up, and step == 0.

Fixes: #3450
Signed-off-by: Ryan Murray <[email protected]>

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 9163bf17

Blockers:

  1. All CI checks (apple-build, host-tests, KUnit clpc, pr-text, readiness, etc.) are still QUEUED; wait for green CI.
  2. Live hardware verification repeating the low-power GPU/animation + CPU load matrix from #3450 (e.g., T6050 J714s/K114s) plus a second-family regression row are pending.
  3. Requires independent code-owner / maintainer approval before merge.

Checked:

  • drivers/soc/apple/clpc.c: verified apple_clpc_sample_busy() extraction preserves PMC-backed sampling behavior and populates cl->busy on standalone (!clpc->has_pmc) instances when low && clpc->low_power_mw; verified apple_clpc_pick_profile_step() gates only downward steps (step < 0) on cl->busy >= APPLE_CLPC_BUSY_PCT while allowing step > 0 to restore idle capped clusters in apple_clpc_steps_first() order.
  • KUnit test apple_clpc_profile_step_busy_test: verified coverage of idle-under-overbudget, single-busy selection, multi-cluster busy ordering, idle step-up recovery, and step == 0.
  • Non-blocking note: because cl->busy tracks the per-cluster maximum single-CPU utilization against APPLE_CLPC_BUSY_PCT (50%), a lightly spread multi-core load (<50% on every core) will not step down; confirm during the hardware matrix that this matches the intended #3450 balance.
  • Checked for Apple material, AI attribution, private serials, and board/SoC gates: none found; human Signed-off-by present.
Evidence
  • Head: 9163bf17bea2d9 (base: main, mergeable: MERGEABLE, 1 commit).
  • Code and KUnit test are clean; waiting on CI, hardware rows, and independent approval.

@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 28, 2026
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Merge readiness at b7dfdf9b: not ready yet

Check Detail
CI at head running running: apple-build, host-tests, source, pr-text / pr-text, KUnit plan, rust-build
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA b7dfdf9b, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · Macs whose CLPC runs the low-power platform profile (T6050 and others). Scoped strictly to drivers/soc/apple/clpc.c low-power PHPC step-down selection. Busy CPU workloads (cl->busy >= 50%) step down in the exact same appleclpcstepsfirst() order as before; recovery (step > 0) is unchanged; no DT/ABI changes or SoC gates; single-commit revert.

Areas: area:platform

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

satchlj
satchlj previously approved these changes Nov 28, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review PASS at 9163bf17be.

Verified:

  • apple_clpc_sample_busy() cleanly factors cluster busy-share sampling and is invoked on non-PMC systems when low && clpc->low_power_mw.
  • apple_clpc_pick_profile_step() skips clusters with cl->busy < APPLE_CLPC_BUSY_PCT only on step-down (step < 0), so GPU/display loads holding PHPC above low_power_mw do not walk idle CPU clusters to their minimum OPP, while step-up (step > 0) restores every capped cluster.
  • Signed-off-by present.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 28, 2026
@betizzel

Copy link
Copy Markdown
Contributor

Hardware row at 9163bf17: J714s (MacBook Pro 14" M5 Pro, T6050, 15 cores), on battery. Kernel v272-26 (7f00dc6bc52c plus local patches that don't touch clpc.c), before and after this one commit (clpc.c = pin + 9163bf1, applied with fuzz 1 on hunk 1 only). Result: the GPU-load case still walks all three clusters to 300 MHz, only more slowly. The CPU-load controls are unchanged.

Same script both times: PHPC (hwmon "Heatpipe Power") and scaling_max_freq for policies 0/5/10, sampled every 0.5 s. Each case starts from a balanced → low-power switch, so the steps start from the profile ceiling. PHPC and busy are the mean of the last 15 s. "Busy" is the busiest CPU per cluster from /proc/stat over each 0.5 s sample.

Load (low-power unless noted) Kernel PHPC caps at end (MHz) lowest caps first at 300 MHz busy %
idle desktop before 7.2 W 2964/2964/2880 2964/2964/2880 never 7/1/25
after 6.2 W 2964/2964/2880 2964/2964/2880 never 33/2/9
15× yes before 14.4 W 1644/1644/1620 1644/1644/1620 never 99/99/100
after 14.3 W 1644/1644/1980 1644/1644/1980 never 100/100/100
15× 30% duty (every CPU busy 30 of each 100 ms) before 13.5 W 1344/1344/300 300/300/300 17 / 18 / 43 s 53/37/80
after 14.3 W 300/1344/1308 300/300/1308 16 / 13 s / never 47/37/77
screensaver (foot), balanced before 16.5 W uncapped uncapped never 22/19/29
after 15.2 W uncapped uncapped never 14/14/26
screensaver (foot) before 13.4 W 1344/1344/1308 300/300/300 14.5 / 15 / 16 s 27/27/48
after 14.1 W 1344/1344/1308 300/300/300 44.6 / 53.6 / 30.5 s 20/18/39
screensaver + 15× yes before 14.2 W 1644/1344/1620 1344/1344/1308 never 100/99/100
after 14.1 W 1644/1344/1620 1344/1344/1308 never 100/100/100

Step-downs during the low-power screensaver run, and how many came while that cluster read under 50% busy in the 0.5 s samples on either side:

policy before after
0 14, 14 quiet 6, 6 quiet
5 8, 8 quiet 6, 6 quiet
10 11, 7 quiet 16, 13 quiet

Why I think the gate leaks on T6050: the J714s's CLPC sits under apple,t6050-pmc, which has 4 rails, so has_pmc is true. The new !has_pmc call in apple_clpc_profile_limit() never runs here. Instead, cl->busy is whatever apple_clpc_sample_cluster() last stored on the APPLE_CLPC_SAMPLE_MS (4 ms) cadence: the busiest of five CPUs over about 4 ms. On each new PHPC reading (about 1 Hz), the gate sees that one 4 ms window. A compositor and terminal redrawing at 120 Hz put some CPU in the cluster over 50% in that window often enough, so the cluster keeps stepping, just less often. The 1344 → 300 MHz step is a single table row (1308 → 300 on policy 10), so one leaked step at 1344 lands on the floor. At 300 MHz the same rendering work then reads busier (policy 10 went to 50-58%), which helps it stay there.

Two possible changes. Neither is tested:

  • Give the PHPC loop its own busy share over its own interval, the time since the last PHPC reading it acted on, with separate wall/idle baselines and on every instance (PMC or not). Then the gate sees about 1 s of history instead of the PMC sampler's last 4 ms.
  • As a backstop, don't let the PHPC loop step below the lowest row above the floor (1344/1308 on T6050). Nothing in the low-power loop needs the 300 MHz row to hit 15 W: 15× yes settled at 1.6-2 GHz.

I can build and run either on the J714s, with the same table.

@betizzel

Copy link
Copy Markdown
Contributor

Follow-up with an experiment on the same J714s, on battery: v272-26 + 9163bf17 + this patch (7.3.0-17.v272-26.2). It adds two module parameters, both off by default, so off/off is this PR unchanged:

  • clpc.profile_busy_window: the PHPC loop keeps its own per-CPU wall/idle baselines and gates step-downs on the busiest CPU since the last PHPC reading it acted on (about 1 s), not on cl->busy from the PMC sampler's last 4 ms.
  • clpc.profile_floor: the PHPC loop never steps a cluster onto its lowest table row (on T6050 the lowest it goes is 1344 / 1308 MHz).

All 16 rows are low-power, one run. Each starts from a balanced → low-power switch. "Steps down (quiet)" counts the cap reductions per policy 0/5/10; the number in brackets is how many happened while that cluster read under 50% busy in the 0.5 s samples on either side.

window floor Load PHPC (last 15 s) lowest caps (MHz) first at 300 MHz steps down (quiet)
0 0 screensaver (foot) 14.2 W 300/300/300 47 / 42 / 36 s 8 (8) / 6 (6) / 9 (8)
1 0 screensaver (foot) 16.1 W 2964/2964/2880 never 0 / 0 / 0
0 1 screensaver (foot) 15.1 W 1344/1344/1308 never 8 (8) / 5 (5) / 15 (15)
1 1 screensaver (foot) 15.3 W 2964/2964/2880 never 0 / 0 / 0
0 0 15× yes 14.3 W 1644/1644/1980 never 6 (0) / 4 (0) / 3 (0)
1 0 15× yes 14.1 W 1644/1644/1980 never 5 (0) / 4 (0) / 3 (0)
0 1 15× yes 14.0 W 1644/1644/1980 never 5 (0) / 4 (0) / 3 (0)
1 1 15× yes 14.4 W 1644/1992/1980 never 4 (0) / 3 (0) / 3 (0)
0 0 15× 30% duty 11.7 W uncapped never 0 / 0 / 0
1 0 15× 30% duty 12.3 W uncapped never 0 / 0 / 0
0 1 15× 30% duty 11.9 W uncapped never 0 / 0 / 0
1 1 15× 30% duty 11.6 W uncapped never 0 / 0 / 0
0 0 screensaver + 15× yes 13.6 W 300/1344/1308 p0 12 s 14 (0) / 4 (0) / 6 (0)
1 0 screensaver + 15× yes 14.1 W 300/1344/1308 p0 17.6 s 16 (0) / 5 (0) / 8 (0)
0 1 screensaver + 15× yes 14.6 W 1344/1344/1308 never 7 (0) / 4 (0) / 8 (0)
1 1 screensaver + 15× yes 15.1 W 1344/1344/1308 never 6 (0) / 5 (0) / 10 (0)

What it shows:

  • The window fixes soc: apple: clpc: low-power profile drives the CPUs to 300 MHz when the GPU holds PHPC above low_power_mw #3450. With the busy share taken over the PHPC interval, the screensaver case takes no steps at all, and none of the CPU-load controls change. The cost: PHPC stays about 1 W over low_power_mw (16.1 W), which is the roughly 1 W the CPU steps were buying in soc: apple: clpc: low-power profile drives the CPUs to 300 MHz when the GPU holds PHPC above low_power_mw #3450. With a GPU load, the CPU caps can't bring package power to 15 W anyway.
  • The floor alone hides the symptom but not the cause. The screensaver still takes 28 steps, all on quiet clusters, and the clusters end at 1.3 GHz instead of 300 MHz.
  • The floor still matters with the window on. In the screensaver + yes case, policy 0 lands on 300 MHz with the window alone (1344 → 300 is a single row). Those are real steps on busy CPUs, but the 300 MHz row costs far more performance than it saves in power. Window plus floor holds 1344/1344/1308 at 15.1 W.
  • The 30% duty load didn't go over budget this run (11.6-12.3 W, no steps in any variant). In the earlier runs it reached 13.5-14.3 W and did step, so this run doesn't answer the reviewer's question about lightly spread loads. With the window, a cluster whose CPUs are all under 50% for a whole second won't step. That is the PR's intended behaviour, now measured over a window that can see it.

One more thing about the PR as it stands: the new !clpc->has_pmc call to apple_clpc_sample_busy() uses clpc->wall / clpc->idle, but probe allocates those only inside if (clpc->has_pmc). A standalone CLPC node with apple,low-power-mw would dereference NULL there. No DT sets that property today, so it doesn't trigger, but per-loop baselines allocated whenever low_power_khz && low_power_mw avoid it. That is what the experiment does.

My suggestion for #3488: take the window behaviour unconditionally (no parameter), plus the floor. I'm happy to send it as a commit on your branch or as a separate PR, whichever you prefer. The parameters exist only to A/B the variants on one kernel.

Experiment patch on top of 9163bf1 (applies to clpc.c at 7f00dc6 + 9163bf1)
--- a/drivers/soc/apple/clpc.c
+++ b/drivers/soc/apple/clpc.c
@@ -68,6 +68,19 @@
 #define APPLE_CLPC_GPU_BACKOFF_MS	100
 /* Package power readings in the low-power profile: every 100 ms */
 #define APPLE_CLPC_POWER_MS	100
+/*
+ * Experiment for aurora-silicon/linux #3450 (not for merging as is): how the
+ * low-power package power loop decides that a cluster is busy, and whether it
+ * may step a cluster onto its lowest table row.
+ */
+static bool profile_busy_window;
+module_param(profile_busy_window, bool, 0644);
+MODULE_PARM_DESC(profile_busy_window,
+		 "low-power PHPC loop: busy share since the last PHPC reading it acted on, not the last sample");
+static bool profile_floor;
+module_param(profile_floor, bool, 0644);
+MODULE_PARM_DESC(profile_floor,
+		 "low-power PHPC loop: never step a cluster down to its lowest table row");
 
 /* Why the last vote was cast, for debugfs */
 #define APPLE_CLPC_REASON_CPU		BIT(0)
@@ -158,6 +171,8 @@
 	unsigned int policy_cpu;
 	cpumask_var_t cpus;
 	unsigned int busy;
+	/* Busy share since the last package power reading the profile acted on */
+	unsigned int power_busy;
 	unsigned int streak;
 	unsigned int level;
 	unsigned int request[APPLE_CLPC_RAILS];
@@ -273,6 +288,9 @@
 	unsigned long power_next;
 	unsigned long power_reads, power_updates;
 	int power_mw;
+	/* Per-CPU baselines for power_busy, taken at each package power reading */
+	u64 *power_idle;
+	u64 *power_wall;
 };
 
 /* Protect publication/removal of provider drvdata, never a submission path. */
@@ -603,8 +621,12 @@
 	}
 }
 
-static void apple_clpc_sample_busy(struct apple_clpc *clpc,
-				   struct apple_clpc_cluster *cl)
+/*
+ * The busiest CPU of @cl since @base_wall/@base_idle, in percent, and move
+ * the baselines to now.
+ */
+static unsigned int apple_clpc_busy_since(const struct apple_clpc_cluster *cl,
+					  u64 *base_wall, u64 *base_idle)
 {
 	unsigned int cpu, busy = 0;
 
@@ -618,21 +640,21 @@
 		 * baseline once it is back.
 		 */
 		if (!cpu_online(cpu)) {
-			clpc->wall[cpu] = 0;
+			base_wall[cpu] = 0;
 			continue;
 		}
 
 		idle = get_cpu_idle_time(cpu, &wall, 0);
-		dw = wall - clpc->wall[cpu];
-		di = idle - clpc->idle[cpu];
-		valid = clpc->wall[cpu];
-		clpc->wall[cpu] = wall;
-		clpc->idle[cpu] = idle;
+		dw = wall - base_wall[cpu];
+		di = idle - base_idle[cpu];
+		valid = base_wall[cpu];
+		base_wall[cpu] = wall;
+		base_idle[cpu] = idle;
 		if (valid && dw && di <= dw)
 			busy = max_t(unsigned int, busy,
 				     div64_u64((dw - di) * 100, dw));
 	}
-	cl->busy = busy;
+	return busy;
 }
 
 static void apple_clpc_sample_cluster(struct apple_clpc *clpc,
@@ -641,8 +663,8 @@
 	struct cpufreq_policy *policy;
 	unsigned int busy, q, rail;
 
-	apple_clpc_sample_busy(clpc, cl);
-	busy = cl->busy;
+	busy = apple_clpc_busy_since(cl, clpc->wall, clpc->idle);
+	cl->busy = busy;
 
 	cl->level = 0;
 	policy = cpufreq_cpu_get(cl->policy_cpu);
@@ -1012,11 +1034,16 @@
 
 		if (!policy[i])
 			continue;
-		if (step < 0 && cl->busy < APPLE_CLPC_BUSY_PCT)
+		if (step < 0 &&
+		    (READ_ONCE(profile_busy_window) ? cl->power_busy : cl->busy) <
+		    APPLE_CLPC_BUSY_PCT)
 			continue;
 		khz = apple_clpc_step_khz(policy[i], cl->max_khz, step > 0);
 		if (khz == cl->max_khz || khz > cl->top_khz)
 			continue;
+		if (step < 0 && READ_ONCE(profile_floor) &&
+		    khz <= policy[i]->cpuinfo.min_freq)
+			continue;
 		if (pick < 0 ||
 		    apple_clpc_steps_first(cl->max_khz, policy[i]->cpuinfo.max_freq,
 					   clpc->clusters[pick].max_khz,
@@ -1042,8 +1069,9 @@
 {
 	bool low = READ_ONCE(clpc->low_power);
 	struct cpufreq_policy *policy[APPLE_CLPC_MAX_CLUSTERS] = {};
-	unsigned int i, pick_khz = 0;
+	unsigned int i, cpu, pick_khz = 0;
 	int mw, step = 0, pick;
+	bool fresh = false;
 
 	if (!clpc->low_power_khz || time_before(jiffies, clpc->power_next))
 		return;
@@ -1054,6 +1082,7 @@
 		/* The SMC updates the reading less often: act on a new one only. */
 		if (mw >= 0 && mw != clpc->power_mw) {
 			clpc->power_updates++;
+			fresh = true;
 			if (mw > (int)clpc->low_power_mw)
 				step = -1;
 			else if (mw < (int)clpc->low_power_mw * 9 / 10)
@@ -1064,8 +1093,13 @@
 	for (i = 0; i < clpc->nr_clusters; i++) {
 		struct apple_clpc_cluster *cl = &clpc->clusters[i];
 
-		if (!clpc->has_pmc && low && clpc->low_power_mw)
-			apple_clpc_sample_busy(clpc, cl);
+		if (fresh && clpc->power_wall)
+			cl->power_busy = apple_clpc_busy_since(cl, clpc->power_wall,
+							       clpc->power_idle);
+		else if (!low && clpc->power_wall)
+			/* The next low-power reading starts a fresh window. */
+			for_each_cpu(cpu, cl->cpus)
+				clpc->power_wall[cpu] = 0;
 		policy[i] = cpufreq_cpu_get(cl->policy_cpu);
 		if (!policy[i])
 			continue;
@@ -1864,6 +1898,14 @@
 		clpc->saved_floor = apple_pmc_floor_read(clpc->pmc, clpc->agent) &
 				    clpc->mask;
 	}
+	if (clpc->low_power_khz && clpc->low_power_mw) {
+		clpc->power_idle = devm_kcalloc(dev, nr_cpu_ids, sizeof(*clpc->power_idle),
+						GFP_KERNEL);
+		clpc->power_wall = devm_kcalloc(dev, nr_cpu_ids, sizeof(*clpc->power_wall),
+						GFP_KERNEL);
+		if (!clpc->power_idle || !clpc->power_wall)
+			return -ENOMEM;
+	}
 
 	for (i = 0; i < APPLE_CLPC_MAX_CLUSTERS; i++) {
 		if (!zalloc_cpumask_var(&clpc->clusters[i].cpus, GFP_KERNEL)) {
@@ -1957,6 +1999,9 @@
 	if (clpc->wall)
 		for_each_possible_cpu(cpu)
 			clpc->wall[cpu] = 0;
+	if (clpc->power_wall)
+		for_each_possible_cpu(cpu)
+			clpc->power_wall[cpu] = 0;
 	clpc->power_next = jiffies;
 	WRITE_ONCE(clpc->stopped, false);
 	apple_clpc_queue(clpc, true);

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

@betizzel thank you. Both runs settle it: as it stands this PR doesn't fix #3450 on T6050, because has_pmc is true there and the new busy sample never runs. Your window plus floor variant does. Yes, please send it. A PR against this branch (fix/clpc-low-power-busy-cluster) is easiest, with:

  1. the busy share taken over the PHPC interval, always on with no module parameter,
  2. the floor,
  3. per-loop baselines so the !has_pmc path no longer touches the clpc->wall/clpc->idle arrays that only the has_pmc probe allocates,
  4. your Signed-off-by.

I'll merge it into this PR, and your J714s table counts as the hardware row at that head. We still need one regression row on another family, which I'll run. If you'd rather not, say so here and I'll write it from your experiment patch, credit you with Suggested-by, and link your two comments. If I haven't heard by 12-01 12:00 AEDT, I'll go ahead that way.

@github-actions github-actions Bot added blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-template PR body lacks Tested or Risk (bot) labels Nov 30, 2026
@betizzel

Copy link
Copy Markdown
Contributor

@RyanTheTide opened #3671 against fix/clpc-low-power-busy-cluster with the always-on PHPC-interval busy window, the lowest-row floor, per-loop baselines (independent of has_pmc), updated KUnit coverage, and my Signed-off-by.

Locally verified on 3ec9d7e08604: checkpatch.pl --strict clean, both CLPC host tests PASS, W=1 builds clean (LLVM + KUnit and gcc + asahi.config), and KUnit apple-clpc* 19/19 passed under KASAN + UBSAN in QEMU.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 9163bf17bea2

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: - drivers/soc/apple/clpc.c: verified apple_clpc_sample_busy() extraction preserves PMC-backed sampling behavior and populates cl->busy on standalone (!clpc->has_pmc) instances when low && clpc->low_power_mw; verified apple_clpc_pick_profile_step() gates only downward steps (step < 0) on cl->busy >= APPLE_CLPC_BUSY_PCT while allowing step > 0 to restore idle capped clusters in apple_clpc_steps_first() order.

  • KUnit test apple_clpc_profile_step_busy_test: verified coverage of idle-under-overbudget, single-busy selection, multi-cluster busy ordering, idle step-up recovery, and step == 0.
  • Non-blocking note: because cl->busy tracks the per-cluster maximum single-CPU utilization against APPLE_CLPC_BUSY_PCT (50%), a lightly spread multi-core load (<50% on every core) will not step down; confirm during the hardware matrix that this matches the intended #3450 balance.
  • Checked for Apple material, AI attribution, private serials, and board/SoC gates: none found; human Signed-off-by present.

Follow-ups (not blocking): queued CI, T6050 low-power load matrix row, maintainer approval; check spread multi-core load

@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 1, 2026
clpc.c: main added apple_clpc_gpu_busy_clear_test and this branch adds
apple_clpc_profile_step_busy_test at the same place, each with its
KUNIT_CASE entry. Both tests and both entries are kept.
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merged main in at b7dfdf9b5c84 (no change to this PR's own code). One conflict in clpc.c: main added apple_clpc_gpu_busy_clear_test where this PR adds apple_clpc_profile_step_busy_test; both tests and both KUNIT_CASE entries are kept. Built drivers/soc/apple locally with the Apple config (defconfig + asahi.config, LLVM) and compiled clpc.c with its KUnit block enabled: no new warnings. The earlier row still covers this PR's files.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) and removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 1, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merging at b7dfdf9b5c84 (B2 merge train, 12-01 merge bar). Approval at this head: aurora-silicon-review[bot] at 9163bf1 (this head only merges main in: maintainer merge-up). Row: the hardware row at 9163bf1 (same PR files; this head only merges main in). CI: linux train L5 = main + #3218 #3488 #2763 #3419 #3647 #2213 #2432 #3392: Apple driver compile pass, Apple DTBs W=1 pass, planned KUnit clpc/dcp-fabric/dcp-topology/dcp-display/macsmc/jpeg/asahi/sep pass, host tests apple-dcp + g14-v27-2 (25/25) pass. Hosted CI is queued behind the backlog. Revert: git revert -m 1 <merge commit>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

soc: apple: clpc: low-power profile drives the CPUs to 300 MHz when the GPU holds PHPC above low_power_mw

3 participants