Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pmdomain: Merge branch fixes into next

Merge the pmdomain fixes for v6.16-rc[n] into the next branch, to allow
them to get tested together with the new changes that are targeted for
v6.17.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

+16 -2
+16 -2
drivers/pmdomain/governor.c
··· 8 8 #include <linux/pm_domain.h> 9 9 #include <linux/pm_qos.h> 10 10 #include <linux/hrtimer.h> 11 + #include <linux/cpu.h> 11 12 #include <linux/cpuidle.h> 12 13 #include <linux/cpumask.h> 13 14 #include <linux/ktime.h> ··· 350 349 struct cpuidle_device *dev; 351 350 ktime_t domain_wakeup, next_hrtimer; 352 351 ktime_t now = ktime_get(); 352 + struct device *cpu_dev; 353 + s64 cpu_constraint, global_constraint; 353 354 s64 idle_duration_ns; 354 355 int cpu, i; 355 356 ··· 362 359 if (!(genpd->flags & GENPD_FLAG_CPU_DOMAIN)) 363 360 return true; 364 361 362 + global_constraint = cpu_latency_qos_limit(); 365 363 /* 366 364 * Find the next wakeup for any of the online CPUs within the PM domain 367 365 * and its subdomains. Note, we only need the genpd->cpus, as it already ··· 376 372 if (ktime_before(next_hrtimer, domain_wakeup)) 377 373 domain_wakeup = next_hrtimer; 378 374 } 375 + 376 + cpu_dev = get_cpu_device(cpu); 377 + if (cpu_dev) { 378 + cpu_constraint = dev_pm_qos_raw_resume_latency(cpu_dev); 379 + if (cpu_constraint < global_constraint) 380 + global_constraint = cpu_constraint; 381 + } 379 382 } 380 383 384 + global_constraint *= NSEC_PER_USEC; 381 385 /* The minimum idle duration is from now - until the next wakeup. */ 382 386 idle_duration_ns = ktime_to_ns(ktime_sub(domain_wakeup, now)); 383 387 if (idle_duration_ns <= 0) ··· 401 389 */ 402 390 i = genpd->state_idx; 403 391 do { 404 - if (idle_duration_ns >= (genpd->states[i].residency_ns + 405 - genpd->states[i].power_off_latency_ns)) { 392 + if ((idle_duration_ns >= (genpd->states[i].residency_ns + 393 + genpd->states[i].power_off_latency_ns)) && 394 + (global_constraint >= (genpd->states[i].power_on_latency_ns + 395 + genpd->states[i].power_off_latency_ns))) { 406 396 genpd->state_idx = i; 407 397 genpd->gd->last_enter = now; 408 398 genpd->gd->reflect_residency = true;