From nobody Sun Feb 8 06:22:42 2026 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C276274B5C for ; Mon, 1 Dec 2025 20:24:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764620689; cv=none; b=SshlqNAHy6VEtolZUvC3qNSNoq26fBslg6WN67E739+scnRy4Nu0ohgryyBjMes266PGrTCs2fHrsx2p7GE+J10eEaWfmV2DYn/wHxmac4g14C1gU/yE3di9QiK+BQZdcRVPsjZxivZtOo3NOAh1bxqUpk3zcvcT/i623g2Ll+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764620689; c=relaxed/simple; bh=c8mlL+8JS1BJUpGU/CCeiDRO5fIc5qgfb2CsJTD7loM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=opMfDiM+Jbfpvfh4URAmHbZ6ZeMBKj0T3bBJp6mOWa1Z0GGGHoL2ki9XplTKgSQCDFRzIgytrpXx+QOx1rUH0NeAtJkO6BCQL3HR7/rBOSRtcoX9T3bpV6zYLS70Tc9EvyZDiW2PafZYv9N8pEKlQlfeMSs8GB8h2GE089z/6d0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--wusamuel.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hFRrM7mp; arc=none smtp.client-ip=209.85.215.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--wusamuel.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hFRrM7mp" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-b969f3f5bb1so6635302a12.0 for ; Mon, 01 Dec 2025 12:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764620687; x=1765225487; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=hVFOz36NzkthLgnEyyQ+T4r4aeS1YE42iDi3jXssFxw=; b=hFRrM7mpzLrZTZ2TFHNzSGTtT3ZCRTlV6VnyC1B06vb+UCzxj5rO3hcTfBjgZYEdQR dOqBf2N4cx9S/hxn2Wapt93EUeCQMcp9uvOl56LDH7pa6A6AztQlSIdFGHPafNJgce5V yKe2+pZm5Ztn+1YiIhllZxWkB4fPosZmh5OLGPUiTUzrQ56JA2WakcqcPBvqvXXN4s9q PCyw7pVxMim5HDerEzCaO54D5BpeJ57/bwxGGz0XNNHF5adwAhoLmHLPMAYj5CiqmjrA r+uMKAq0CHDN2AYR/BlMZe+oh+mrjj3uAiiJtPEzqW1scUWaiwt6d/RgBmzyEbfBvH+g jcZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764620687; x=1765225487; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hVFOz36NzkthLgnEyyQ+T4r4aeS1YE42iDi3jXssFxw=; b=HecRG5Ttdcz0cf2C29pe3r39kJDb2/TmtGDP358ONW26vIujjDh2qI/aq8dB6my5i1 5YRuY9F8WQ84ZjzF+X3LCVGVeZaypl/CcoIFpVLcxQz6jsguCB1m+fhxwumWvEe2v1UW wBoCQRPCTiB/VN1c8UojbfgxEawPZt+xnDfKNIo2Y7ndEPNFbTAqJSAbx3BAL8E1gcCI DpKYOJX+5GM6iUG9TbKtxQcdToItm5XxtQKKaHXhJ3l13LWdgv0GH1NF1WOrIprRX79c iWDKLdJCm35wmCfPZCfyHXBUNY50rGfP37CuOkqtgx0GE62G7makQmxeEsYrNr57v0A+ +71g== X-Forwarded-Encrypted: i=1; AJvYcCUezZ0Jj1owwFgPENv4l5QeqXbbI7VGheofimATmmhv10iiLlPR60CBebSb7V7lbDT4llei0TIxdbKjojk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+UZ1NZboZTulbvLCg83A1yaWBBfzSRZgFZgOvhKCyVk4GK94Q fIGUfjEgY8tdV73pZDJnkHIABpq9acb2jpycy26qnLDSu8NWICXRwdqXyTsmP3QzmPsQL5Ai/7/ //jrNllepbQSs4w== X-Google-Smtp-Source: AGHT+IHPxyuFPomFpGgGktNU3wpxpzdAkLl3pdvHFWHui5G6OkggawCXSx5wuTjHZkmGbO2fX9w00ZQkykohvQ== X-Received: from dycro14.prod.google.com ([2002:a05:693c:2b0e:b0:2a2:454c:f92]) (user=wusamuel job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:220f:b0:2a4:3593:c7df with SMTP id 5a478bee46e88-2a719bfe888mr27242313eec.31.1764620686557; Mon, 01 Dec 2025 12:24:46 -0800 (PST) Date: Mon, 1 Dec 2025 12:24:34 -0800 In-Reply-To: <20251201202437.3750901-1-wusamuel@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251201202437.3750901-1-wusamuel@google.com> X-Mailer: git-send-email 2.52.0.107.ga0afd4fd5b-goog Message-ID: <20251201202437.3750901-2-wusamuel@google.com> Subject: [PATCH v3 1/2] cpufreq: Replace trace_cpu_frequency with trace_policy_frequency From: Samuel Wu To: Huang Rui , "Gautham R. Shenoy" , Mario Limonciello , Perry Yuan , Jonathan Corbet , "Rafael J. Wysocki" , Viresh Kumar , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Srinivas Pandruvada , Len Brown , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Ian Rogers , Adrian Hunter , James Clark Cc: christian.loehle@arm.com, Samuel Wu , kernel-team@android.com, linux-pm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The existing cpu_frequency trace_event can be verbose, emitting a nearly identical trace event for every CPU in the policy even when their frequencies are identical. This patch replaces the cpu_frequency trace event with policy_frequency trace event, a more efficient alternative. From the kernel's perspective, emitting a trace event once per policy instead of once per cpu saves some memory and is less overhead. From the post-processing perspective, analysis of the trace log is simplified without any loss of information. Signed-off-by: Samuel Wu Acked-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 14 ++------------ drivers/cpufreq/intel_pstate.c | 6 ++++-- include/trace/events/power.h | 24 +++++++++++++++++++++--- kernel/trace/power-traces.c | 2 +- samples/bpf/cpustat_kern.c | 8 ++++---- samples/bpf/cpustat_user.c | 6 +++--- tools/perf/builtin-timechart.c | 12 ++++++------ 7 files changed, 41 insertions(+), 31 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 4472bb1ec83c..dd3f08f3b958 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -309,8 +309,6 @@ static void cpufreq_notify_transition(struct cpufreq_po= licy *policy, struct cpufreq_freqs *freqs, unsigned int state) { - int cpu; - BUG_ON(irqs_disabled()); =20 if (cpufreq_disabled()) @@ -344,10 +342,7 @@ static void cpufreq_notify_transition(struct cpufreq_p= olicy *policy, adjust_jiffies(CPUFREQ_POSTCHANGE, freqs); pr_debug("FREQ: %u - CPUs: %*pbl\n", freqs->new, cpumask_pr_args(policy->cpus)); - - for_each_cpu(cpu, policy->cpus) - trace_cpu_frequency(freqs->new, cpu); - + trace_policy_frequency(freqs->new, policy->cpu, policy->cpus); srcu_notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_POSTCHANGE, freqs); =20 @@ -2201,7 +2196,6 @@ unsigned int cpufreq_driver_fast_switch(struct cpufre= q_policy *policy, unsigned int target_freq) { unsigned int freq; - int cpu; =20 target_freq =3D clamp_val(target_freq, policy->min, policy->max); freq =3D cpufreq_driver->fast_switch(policy, target_freq); @@ -2213,11 +2207,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufr= eq_policy *policy, arch_set_freq_scale(policy->related_cpus, freq, arch_scale_freq_ref(policy->cpu)); cpufreq_stats_record_transition(policy, freq); - - if (trace_cpu_frequency_enabled()) { - for_each_cpu(cpu, policy->cpus) - trace_cpu_frequency(freq, cpu); - } + trace_policy_frequency(freq, policy->cpu, policy->cpus); =20 return freq; } diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index ec4abe374573..9724b5d19d83 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -2297,7 +2297,8 @@ static int hwp_get_cpu_scaling(int cpu) =20 static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) { - trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu); + trace_policy_frequency(pstate * cpu->pstate.scaling, cpu->cpu, + cpumask_of(cpu->cpu)); cpu->pstate.current_pstate =3D pstate; /* * Generally, there is no guarantee that this code will always run on @@ -2587,7 +2588,8 @@ static void intel_pstate_adjust_pstate(struct cpudata= *cpu) =20 target_pstate =3D get_target_pstate(cpu); target_pstate =3D intel_pstate_prepare_request(cpu, target_pstate); - trace_cpu_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu); + trace_policy_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu, + cpumask_of(cpu->cpu)); intel_pstate_update_pstate(cpu, target_pstate); =20 sample =3D &cpu->sample; diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 370f8df2fdb4..317098ffdd5f 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h @@ -182,11 +182,29 @@ TRACE_EVENT(pstate_sample, { PM_EVENT_RECOVER, "recover" }, \ { PM_EVENT_POWEROFF, "poweroff" }) =20 -DEFINE_EVENT(cpu, cpu_frequency, +TRACE_EVENT(policy_frequency, =20 - TP_PROTO(unsigned int frequency, unsigned int cpu_id), + TP_PROTO(unsigned int frequency, unsigned int cpu_id, + const struct cpumask *policy_cpus), =20 - TP_ARGS(frequency, cpu_id) + TP_ARGS(frequency, cpu_id, policy_cpus), + + TP_STRUCT__entry( + __field(u32, state) + __field(u32, cpu_id) + __cpumask(cpumask) + ), + + TP_fast_assign( + __entry->state =3D frequency; + __entry->cpu_id =3D cpu_id; + __assign_cpumask(cpumask, policy_cpus); + ), + + TP_printk("state=3D%lu cpu_id=3D%lu policy_cpus=3D%*pb", + (unsigned long)__entry->state, + (unsigned long)__entry->cpu_id, + cpumask_pr_args((struct cpumask *)__get_dynamic_array(cpumask))) ); =20 TRACE_EVENT(cpu_frequency_limits, diff --git a/kernel/trace/power-traces.c b/kernel/trace/power-traces.c index f2fe33573e54..a537e68a6878 100644 --- a/kernel/trace/power-traces.c +++ b/kernel/trace/power-traces.c @@ -16,5 +16,5 @@ =20 EXPORT_TRACEPOINT_SYMBOL_GPL(suspend_resume); EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_idle); -EXPORT_TRACEPOINT_SYMBOL_GPL(cpu_frequency); +EXPORT_TRACEPOINT_SYMBOL_GPL(policy_frequency); =20 diff --git a/samples/bpf/cpustat_kern.c b/samples/bpf/cpustat_kern.c index 7ec7143e2757..f485de0f89b2 100644 --- a/samples/bpf/cpustat_kern.c +++ b/samples/bpf/cpustat_kern.c @@ -75,9 +75,9 @@ struct { } pstate_duration SEC(".maps"); =20 /* - * The trace events for cpu_idle and cpu_frequency are taken from: + * The trace events for cpu_idle and policy_frequency are taken from: * /sys/kernel/tracing/events/power/cpu_idle/format - * /sys/kernel/tracing/events/power/cpu_frequency/format + * /sys/kernel/tracing/events/power/policy_frequency/format * * These two events have same format, so define one common structure. */ @@ -162,7 +162,7 @@ int bpf_prog1(struct cpu_args *ctx) */ if (ctx->state !=3D (u32)-1) { =20 - /* record pstate after have first cpu_frequency event */ + /* record pstate after have first policy_frequency event */ if (!*pts) return 0; =20 @@ -208,7 +208,7 @@ int bpf_prog1(struct cpu_args *ctx) return 0; } =20 -SEC("tracepoint/power/cpu_frequency") +SEC("tracepoint/power/policy_frequency") int bpf_prog2(struct cpu_args *ctx) { u64 *pts, *cstate, *pstate, cur_ts, delta; diff --git a/samples/bpf/cpustat_user.c b/samples/bpf/cpustat_user.c index 356f756cba0d..f7e81f702358 100644 --- a/samples/bpf/cpustat_user.c +++ b/samples/bpf/cpustat_user.c @@ -143,12 +143,12 @@ static int cpu_stat_inject_cpu_idle_event(void) =20 /* * It's possible to have no any frequency change for long time and cannot - * get ftrace event 'trace_cpu_frequency' for long period, this introduces + * get ftrace event 'trace_policy_frequency' for long period, this introdu= ces * big deviation for pstate statistics. * * To solve this issue, below code forces to set 'scaling_max_freq' to 208= MHz - * for triggering ftrace event 'trace_cpu_frequency' and then recovery bac= k to - * the maximum frequency value 1.2GHz. + * for triggering ftrace event 'trace_policy_frequency' and then recovery = back + * to the maximum frequency value 1.2GHz. */ static int cpu_stat_inject_cpu_frequency_event(void) { diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 22050c640dfa..3ef1a2fd0493 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -612,10 +612,10 @@ process_sample_cpu_idle(struct timechart *tchart __ma= ybe_unused, } =20 static int -process_sample_cpu_frequency(struct timechart *tchart, - struct evsel *evsel, - struct perf_sample *sample, - const char *backtrace __maybe_unused) +process_sample_policy_frequency(struct timechart *tchart, + struct evsel *evsel, + struct perf_sample *sample, + const char *backtrace __maybe_unused) { u32 state =3D evsel__intval(evsel, sample, "state"); u32 cpu_id =3D evsel__intval(evsel, sample, "cpu_id"); @@ -1541,7 +1541,7 @@ static int __cmd_timechart(struct timechart *tchart, = const char *output_name) { const struct evsel_str_handler power_tracepoints[] =3D { { "power:cpu_idle", process_sample_cpu_idle }, - { "power:cpu_frequency", process_sample_cpu_frequency }, + { "power:policy_frequency", process_sample_policy_frequency }, { "sched:sched_wakeup", process_sample_sched_wakeup }, { "sched:sched_switch", process_sample_sched_switch }, #ifdef SUPPORT_OLD_POWER_EVENTS @@ -1804,7 +1804,7 @@ static int timechart__record(struct timechart *tchart= , int argc, const char **ar unsigned int backtrace_args_no =3D ARRAY_SIZE(backtrace_args); =20 const char * const power_args[] =3D { - "-e", "power:cpu_frequency", + "-e", "power:policy_frequency", "-e", "power:cpu_idle", }; unsigned int power_args_nr =3D ARRAY_SIZE(power_args); --=20 2.52.0.107.ga0afd4fd5b-goog From nobody Sun Feb 8 06:22:42 2026 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 201C92773EE for ; Mon, 1 Dec 2025 20:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764620693; cv=none; b=GnVvfc76GDghtlRa+zt02vrGsKj3PtjSI4EHnAa/HdkTK0Yy9bbuTlR4kaWsnP9ckS5TdrUgywA+n/13ChelGmemYQFXBhBPrSyxsyLZZ64DziSK4Ty6ydSCyZ+tK5400nkw+qKpYDK3BZ1mKlmC8aehFGqbdYhvAqy1EOVOWvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764620693; c=relaxed/simple; bh=9VtX2NvFz0RoQVJ8SSqGMuTYPnLO3r9LWpqks/kmpMQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=T4/ApNtevTUFoyWjOCeESFg4i3bzlzDd0eHK38EwRbVndq+muov7bC+SMkP015C1ax2MAn3/+HwPkY+0afxHBEqRd1RdoYGxX7CvlM+kT1+ZdRO2M2oVMs63f0Pu2XQLw05awTpx5gEjLYifJPPBj/5TtKSVbCxdPrdbumc7y3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--wusamuel.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=jkNbt3ou; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--wusamuel.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jkNbt3ou" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-bde2e654286so3723825a12.3 for ; Mon, 01 Dec 2025 12:24:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764620691; x=1765225491; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=iuYJ8a9yf5YfCIOX0vDCxkx5Zc9d0WA0EbWHTfFbCpI=; b=jkNbt3ouuc6NmxFq5apXPbnMYpm1+zjWpeLCHENUhZshBHu5HtyWtBRrtrgDl7yalQ OtXQasM1U+p8W2X/IYCa2cUExCHo0oVWoB8FJsSl1BeopyHbTrYz+9YzTGuqlAKYUaQI IJapEgCG+EizpaCFsG6l5ATwt5rzAJ4+tDTdFaxXAEItPwJu0MKHQ7YGAErlkZb1XXhU MWgjhSmcDoofFGwbkjtHo5nMbpLoUUNjN5loYr7jv9kC3Q+I/88Ak23hMapuj4HFYfBO son19Lz+dHz87y71srH8WwtEHospUet67m9ZKRWT2Iyh2vFf+e/JVNXH8Z5jFwFJqBQ3 1TiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764620691; x=1765225491; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iuYJ8a9yf5YfCIOX0vDCxkx5Zc9d0WA0EbWHTfFbCpI=; b=ub8G8+K7DvQYNGtJrDb0e2M34UnVmAtRxJTJjZ12amC/Ur9jBgWb+jcHwk5SIyoiys KQxzQbu83TrltJaorQ77xUbQJ/caFgjbTB/0ajbSqGY/zLaVI1Nij++PlQYD1Ue3mmIj /Gu1PgUNjMC61qz6zGUV1ZLKbdulxf7qUfpp5MxNpswK9VbDqlGwclTAmgEQmm23ExVZ 8CP9/AQIstH/UWxC8MzU99/zeZJp3r+fpqjgp4q9l1E/PLybf1IEAGdsAHLg/PkZeX+q wuVGkcN37RsuPN0aKXdrPCL+N1E3P92W02q1Djde5JY6OYNsAVvQbeqyej1pn4B2Ubhh IiXQ== X-Forwarded-Encrypted: i=1; AJvYcCXRq7k1T+lLwsENvbDWZ6udPrmbFHg1hw+hwvZbxuHYEh6iVLNDttnEaiKY78EhNmESDfeCVx448fJbjKI=@vger.kernel.org X-Gm-Message-State: AOJu0YwDa9ocbnZM891gv7zHRA2aV1R5sCfEnySui2j0of3Q9Vsx2UQA q9J/iY7z6ikmFlH6ZR/dnkk21sYu9zMgbiD050WFDgSOD2kSqVWeLxDRXFjk/Qhdx4g43/hvSE5 gr2adRZhWJy8Deg== X-Google-Smtp-Source: AGHT+IGsvk85QlzW667SyDst19B1vMCsdIZFkhsIWO+5Oz5JLmlMK/v87N6vvqpae9OjXI/Z5iDlf2o2nXomaQ== X-Received: from dlbdd25.prod.google.com ([2002:a05:7022:a99:b0:11c:58e4:e325]) (user=wusamuel job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:6726:b0:119:e56b:98ab with SMTP id a92af1059eb24-11cb3ede9dcmr19616669c88.18.1764620691371; Mon, 01 Dec 2025 12:24:51 -0800 (PST) Date: Mon, 1 Dec 2025 12:24:35 -0800 In-Reply-To: <20251201202437.3750901-1-wusamuel@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251201202437.3750901-1-wusamuel@google.com> X-Mailer: git-send-email 2.52.0.107.ga0afd4fd5b-goog Message-ID: <20251201202437.3750901-3-wusamuel@google.com> Subject: [PATCH v3 2/2] cpufreq: Documentation update for trace_policy_frequency From: Samuel Wu To: Huang Rui , "Gautham R. Shenoy" , Mario Limonciello , Perry Yuan , Jonathan Corbet , "Rafael J. Wysocki" , Viresh Kumar , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Srinivas Pandruvada , Len Brown , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Ian Rogers , Adrian Hunter , James Clark Cc: christian.loehle@arm.com, Samuel Wu , kernel-team@android.com, linux-pm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Documentation update corresponding to replace the cpu_frequency trace event with the policy_frequency trace event. Signed-off-by: Samuel Wu Acked-by: Viresh Kumar --- Documentation/admin-guide/pm/amd-pstate.rst | 10 +++++----- Documentation/admin-guide/pm/intel_pstate.rst | 14 +++++++------- Documentation/trace/events-power.rst | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/ad= min-guide/pm/amd-pstate.rst index e1771f2225d5..e110854ece88 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -503,8 +503,8 @@ Trace Events -------------- =20 There are two static trace events that can be used for ``amd-pstate`` -diagnostics. One of them is the ``cpu_frequency`` trace event generally us= ed -by ``CPUFreq``, and the other one is the ``amd_pstate_perf`` trace event +diagnostics. One of them is the ``policy_frequency`` trace event generally +used by ``CPUFreq``, and the other one is the ``amd_pstate_perf`` trace ev= ent specific to ``amd-pstate``. The following sequence of shell commands can be used to enable them and see their output (if the kernel is configured to support event tracing). :: @@ -531,9 +531,9 @@ configured to support event tracing). :: -0 [003] d.s.. 4995.980971: amd_pstate_perf: amd_mi= n_perf=3D85 amd_des_perf=3D85 amd_max_perf=3D166 cpu_id=3D3 changed=3Dfalse= fast_switch=3Dtrue -0 [011] d.s.. 4995.980996: amd_pstate_perf: amd_mi= n_perf=3D85 amd_des_perf=3D85 amd_max_perf=3D166 cpu_id=3D11 changed=3Dfals= e fast_switch=3Dtrue =20 -The ``cpu_frequency`` trace event will be triggered either by the ``schedu= til`` scaling -governor (for the policies it is attached to), or by the ``CPUFreq`` core = (for the -policies with other scaling governors). +The ``policy_frequency`` trace event will be triggered either by the +``schedutil`` scaling governor (for the policies it is attached to), or by= the +``CPUFreq`` core (for the policies with other scaling governors). =20 =20 Tracer Tool diff --git a/Documentation/admin-guide/pm/intel_pstate.rst b/Documentation/= admin-guide/pm/intel_pstate.rst index fde967b0c2e0..274c9208f342 100644 --- a/Documentation/admin-guide/pm/intel_pstate.rst +++ b/Documentation/admin-guide/pm/intel_pstate.rst @@ -822,23 +822,23 @@ Trace Events ------------ =20 There are two static trace events that can be used for ``intel_pstate`` -diagnostics. One of them is the ``cpu_frequency`` trace event generally u= sed -by ``CPUFreq``, and the other one is the ``pstate_sample`` trace event spe= cific -to ``intel_pstate``. Both of them are triggered by ``intel_pstate`` only = if -it works in the :ref:`active mode `. +diagnostics. One of them is the ``policy_frequency`` trace event generally +used by ``CPUFreq``, and the other one is the ``pstate_sample`` trace event +specific to ``intel_pstate``. Both of them are triggered by ``intel_pstat= e`` +only if it works in the :ref:`active mode `. =20 The following sequence of shell commands can be used to enable them and see their output (if the kernel is generally configured to support event traci= ng):: =20 # cd /sys/kernel/tracing/ # echo 1 > events/power/pstate_sample/enable - # echo 1 > events/power/cpu_frequency/enable + # echo 1 > events/power/policy_frequency/enable # cat trace gnome-terminal--4510 [001] ..s. 1177.680733: pstate_sample: core_busy= =3D107 scaled=3D94 from=3D26 to=3D26 mperf=3D1143818 aperf=3D1230607 tsc=3D= 29838618 freq=3D2474476 - cat-5235 [002] ..s. 1177.681723: cpu_frequency: state=3D2900000 cpu_id= =3D2 + cat-5235 [002] ..s. 1177.681723: policy_frequency: state=3D2900000 cpu_= id=3D2 policy_cpus=3D04 =20 If ``intel_pstate`` works in the :ref:`passive mode `, the -``cpu_frequency`` trace event will be triggered either by the ``schedutil`` +``policy_frequency`` trace event will be triggered either by the ``schedut= il`` scaling governor (for the policies it is attached to), or by the ``CPUFreq= `` core (for the policies with other scaling governors). =20 diff --git a/Documentation/trace/events-power.rst b/Documentation/trace/eve= nts-power.rst index f45bf11fa88d..f013c74b932f 100644 --- a/Documentation/trace/events-power.rst +++ b/Documentation/trace/events-power.rst @@ -26,8 +26,8 @@ cpufreq. :: =20 cpu_idle "state=3D%lu cpu_id=3D%lu" - cpu_frequency "state=3D%lu cpu_id=3D%lu" cpu_frequency_limits "min=3D%lu max=3D%lu cpu_id=3D%lu" + policy_frequency "state=3D%lu cpu_id=3D%lu policy_cpus=3D%*pb" =20 A suspend event is used to indicate the system going in and out of the suspend mode: --=20 2.52.0.107.ga0afd4fd5b-goog