mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
To: Sudeep Holla <sudeep.holla@arm.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Len Brown <len.brown@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	Ricardo Neri <ricardo.neri@intel.com>,
	Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Subject: [PATCH 2/2] cpufreq: intel_pstate: Populate the cpu_capacity sysfs entries
Date: Fri, 18 Apr 2025 19:55:04 -0700	[thread overview]
Message-ID: <20250419025504.9760-3-ricardo.neri-calderon@linux.intel.com> (raw)
In-Reply-To: <20250419025504.9760-1-ricardo.neri-calderon@linux.intel.com>

Intel hybrid processors have CPUs of different capacity. Populate the
interface /sys/devices/system/cpu/cpuN/cpu_capacity.

This interface uses the per-CPU variable `cpu_scale`. On x86 this variable
has no other use besides feeding the sysfs entries. Initialize it when
setting CPU capacity for the scheduler and scale-invariant code. Feed it
with arch_scale_cpu_capacity() as it gives capacity normalized to the
interval [0, SCHED_CAPACITY_SCALE].

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
 drivers/cpufreq/intel_pstate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 4aad79d26c64..c32312843f19 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -952,6 +952,8 @@ static void hybrid_set_cpu_capacity(struct cpudata *cpu)
 			      cpu->capacity_perf,
 			      cpu->pstate.max_pstate_physical);
 
+	topology_set_cpu_scale(cpu->cpu, arch_scale_cpu_capacity(cpu->cpu));
+
 	pr_debug("CPU%d: perf = %u, max. perf = %u, base perf = %d\n", cpu->cpu,
 		 cpu->capacity_perf, hybrid_max_perf_cpu->capacity_perf,
 		 cpu->pstate.max_pstate_physical);
-- 
2.43.0


  parent reply	other threads:[~2025-04-19  2:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-19  2:55 [PATCH 0/2] topology/sysfs, cpufreq/intel_pstate: Populate cpu_capacity Ricardo Neri
2025-04-19  2:55 ` [PATCH 1/2] arch_topology: Relocate cpu_scale to topology.[h|c] Ricardo Neri
2025-04-25 16:31   ` Christian Loehle
2025-05-07 21:18     ` Ricardo Neri
2025-04-19  2:55 ` Ricardo Neri [this message]
2025-05-07 20:00 ` [PATCH 0/2] topology/sysfs, cpufreq/intel_pstate: Populate cpu_capacity Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250419025504.9760-3-ricardo.neri-calderon@linux.intel.com \
    --to=ricardo.neri-calderon@linux.intel.com \
    --cc=dakr@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=ricardo.neri@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®