All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] docs/zh_CN: add cpu-freq translation
@ 2021-03-24 15:07 Yanteng Si
  2021-03-24 15:07 ` [PATCH 1/8] docs/zh_CN: add cpu-freq core.rst translation Yanteng Si
                   ` (8 more replies)
  0 siblings, 9 replies; 25+ messages in thread
From: Yanteng Si @ 2021-03-24 15:07 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Yanteng Si

This series of patches:
 translates Documention/cpu-freq/* into Chinese.
 add .../zh_CN/mips to zh_CN index
 add .../zh_CN/iio to zh_CN index
 add .../zh_CN/riscv to zh_CN index

Yabteng Si(8):
docs/zh_CN: add cpu-freq core.rst translation
docs/zh_CN: add cpu-freq cpu-drivers.rst translation
docs/zh_CN: add cpu-freq cpufreq-stats.rst translation
docs/zh_CN: add cpu-freq index.rst translation
docs/zh_CN: add cpu-freq to zh_CN index
docs/zh_CN: add mips to zh_CN index
docs/zh_CN: add iio to zh_CN index
docs/zh_CN: add riscv to zh_CN index

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 Documentation/translations/zh_CN/cpu-freq/core.rst          | 105
+++++++++++++++++++++++++++++++++++++++++++++
 Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst   | 259
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst | 130
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Documentation/translations/zh_CN/cpu-freq/index.rst         |  45
++++++++++++++++++++
 Documentation/translations/zh_CN/index.rst                  |   4 ++
 5 files changed, 543 insertions(+)


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/8] docs/zh_CN: add cpu-freq core.rst translation
  2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
@ 2021-03-24 15:07 ` Yanteng Si
  2021-03-26  3:12   ` Jiaxun Yang
  2021-03-24 15:07 ` [PATCH 2/8] docs/zh_CN: add cpu-freq cpu-drivers.rst translation Yanteng Si
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Yanteng Si @ 2021-03-24 15:07 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Yanteng Si

This patch translates Documention/cpu-freq/core.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../translations/zh_CN/cpu-freq/core.rst      | 105 ++++++++++++++++++
 1 file changed, 105 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/cpu-freq/core.rst

diff --git a/Documentation/translations/zh_CN/cpu-freq/core.rst b/Documentation/translations/zh_CN/cpu-freq/core.rst
new file mode 100644
index 000000000000..1571087c2581
--- /dev/null
+++ b/Documentation/translations/zh_CN/cpu-freq/core.rst
@@ -0,0 +1,105 @@
+.. SPDX-License-Identifier: GPL-2.0
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../cpu-freq/core`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_core.rst:
+
+
+====================================
+CPUFreq核心和CPUFreq通知器的一般说明
+====================================
+
+作者:
+	- Dominik Brodowski  <linux@brodo.de>
+	- David Kimdon <dwhedon@debian.org>
+	- Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+	- Viresh Kumar <viresh.kumar@linaro.org>
+
+.. 目录:
+
+   1.  CPUFreq核心和接口
+   2.  CPUFreq通知器
+   3.  含有Operating Performance Point (OPP)的CPUFreq表的生成
+
+1. CPUFreq核心和接口
+======================
+
+cpufreq核心代码位于drivers/cpufreq/cpufreq.c中。这些cpufreq代码为CPUFreq架构的驱
+动程序(那些进行实际频率转换的代码)以及 "通知器 "提供了一个标准化的接口。
+这些是设备驱动程序或需要了解策略变化的其它内核部分(如 ACPI 等热模块)或所有频率更改(除
+计时代码外),甚至需要强制确定速度限制(如 ARM 架构上的 LCD 驱动程序)。
+此外, 内核 "常数" loops_per_jiffy会根据频率变化而更新。
+
+cpufreq策略的引用计数由 cpufreq_cpu_get 和 cpufreq_cpu_put 来完成,以确保 cpufreq 驱
+动程序被正确地注册到核心中,并且在 cpufreq_put_cpu 被调用之前不会被卸载。这也保证了各自的
+cpufreq 策略在使用时不会被释放。
+
+2. CPUFreq 通知器
+====================
+
+CPUFreq通知器符合标准的内核通知器接口。
+关于通知器的细节请参阅 linux/include/linux/notifier.h。
+
+这里有两个不同的CPUfreq通知器 - 策略通知器和转换通知器。
+
+
+2.1 CPUFreq策略通知器
+----------------------------
+
+当创建或移除策略时,这些都会被通知。
+
+阶段是在通知器的第二个参数中指定的。当第一次创建策略时,阶段是CPUFREQ_CREATE_POLICY,当
+策略被移除时,阶段是CPUFREQ_REMOVE_POLICY。
+
+第三个参数 ``void *pointer`` 指向一个结构体cpufreq_policy,其包括min,max(新策略的下限和
+上限(单位为kHz))这几个值。
+
+
+2.2 CPUFreq转换通知器
+--------------------------------
+
+当CPUfreq驱动切换CPU核心频率时,策略中的每个在线CPU都会收到两次通知,这些变化没有任何外部干
+预。
+
+第二个参数指定阶段 - CPUFREQ_PRECHANGE or CPUFREQ_POSTCHANGE.
+
+第三个参数是一个包含如下值的结构体cpufreq_freqs:
+
+=====	====================
+cpu	受影响cpu的编号
+old	旧频率
+new	新频率
+flags	cpufreq驱动的标志
+=====	====================
+
+3. 含有Operating Performance Point (OPP)的CPUFreq表的生成
+==================================================================
+关于OPP的细节请参阅 Documentation/power/opp.rst
+
+dev_pm_opp_init_cpufreq_table -
+	这个功能提供了一个随时可用的转换程序,用来将OPP层关于可用频率的内部信息翻译成一种容易提供给
+	cpufreq的格式。
+
+	.. Warning::
+
+		不要在中断上下文中使用此函数。
+
+	例如::
+
+	 soc_pm_init()
+	 {
+		/* Do things */
+		r = dev_pm_opp_init_cpufreq_table(dev, &freq_table);
+		if (!r)
+			policy->freq_table = freq_table;
+		/* Do other things */
+	 }
+
+	.. note::
+
+		该函数只有在CONFIG_PM_OPP之外还启用了CONFIG_CPU_FREQ时才可用。
+
+dev_pm_opp_free_cpufreq_table
+	释放dev_pm_opp_init_cpufreq_table分配的表。
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/8] docs/zh_CN: add cpu-freq cpu-drivers.rst translation
  2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
  2021-03-24 15:07 ` [PATCH 1/8] docs/zh_CN: add cpu-freq core.rst translation Yanteng Si
@ 2021-03-24 15:07 ` Yanteng Si
  2021-03-26  5:21   ` Wu X.C.
  2021-03-24 15:07 ` [PATCH 3/8] docs/zh_CN: add cpu-freq cpufreq-stats.rst translation Yanteng Si
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Yanteng Si @ 2021-03-24 15:07 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Yanteng Si

This patch translates Documention/cpu-freq/cpu-drivers.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../zh_CN/cpu-freq/cpu-drivers.rst            | 259 ++++++++++++++++++
 1 file changed, 259 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst

diff --git a/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
new file mode 100644
index 000000000000..27a70f3a9938
--- /dev/null
+++ b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
@@ -0,0 +1,259 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../cpu-freq/cpu-drivers`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_cpu-drivers.rst:
+
+
+=======================================
+如何实现一个新的CPUFreq处理器驱动程序?
+=======================================
+
+作者:
+
+
+	- Dominik Brodowski  <linux@brodo.de>
+	- Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+	- Viresh Kumar <viresh.kumar@linaro.org>
+
+.. Contents
+
+   1.   怎么做?
+   1.1  初始化
+   1.2  Per-CPU 初始化
+   1.3  验证
+   1.4  target 或 target_index 或 setpolicy?
+   1.5  target/target_index
+   1.6  setpolicy
+   1.7  get_intermediate 与 target_intermediate
+   2.   频率表助手
+
+
+
+1. 怎么做?
+===========
+
+如此,你刚刚得到了一个全新的CPU/芯片组与数据表,并希望为这个CPU/芯片组添加cpufreq
+支持?很好,这里有一些至关重要的提示:
+
+
+1.1 初始化
+----------
+
+首先,在__initcall_level_7 (module_init())或更靠后的函数中检查这个内核是否
+运行在正确的CPU和正确的芯片组上。如果是,则使用cpufreq_register_driver()向
+CPUfreq核心层注册一个cpufreq_driver结构体。
+
+结构体cpufreq_driver应该包含什么成员?
+
+ .name - 驱动的名字。
+
+ .init - 一个指向per-policy初始化函数的指针。
+
+ .verify - 一个指向"verification"函数的指针。
+
+ .setpolicy 或 .fast_switch 或 .target 或 .target_index - 差异见
+ 下文。
+
+并且可选择
+
+ .flags - cpufreq核的提示。
+
+ .driver_data - cpufreq驱动程序的特定数据。
+
+ .resolve_freq - 返回最适合目标频率的频率。不过并不能改变频率。
+
+ .get_intermediate and target_intermediate - 用于在改变CPU频率时切换到稳定
+ 的频率。
+
+ .get - 返回CPU的当前频率。
+
+ .bios_limit - 返回HW/BIOS对CPU的最大频率限制值。
+
+ .exit - 一个指向per-policy清理函数的指针,该函数在cpu热插拔过程的CPU_POST_DEAD
+ 阶段被调用。
+
+ .stop_cpu - 一个指向per-policy停止函数的指针,该函数在cpu热插拔过程的CPU_DOWN_PREPARE
+ 阶段被调用。
+
+ .suspend - 一个指向per-policy暂停函数的指针,该函数在关中断且在该策略的调节器停止
+ 后被调用。
+
+ .resume - 一个指向per-policy恢复函数的指针,该函数在关中断且在调节器再一次开始前被
+ 调用。
+
+ .ready - 一个指向per-policy准备函数的指针,该函数在策略完全初始化之后被调用。
+
+ .attr - 一个指向NULL结尾的"struct freq_attr"列表的指针,该函数允许导出值到
+ sysfs。
+
+ .boost_enabled - 如果设置,则启用提升频率。
+
+ .set_boost - 一个指向per-policy函数的指针,该函数用来开启/关闭提升频率功能。
+
+
+1.2 Per-CPU 初始化
+------------------
+
+每当一个新的CPU被注册到设备模型中,或者在cpufreq驱动注册自己之后,如果CPU不存在cpufreq
+策略,则会调用每个策略的初始化函数cpufreq_driver.init。请注意, .init() 和 .exit()例程
+只对策略调用一次,而不是对策略管理的每个CPU调用一次。它需要一个 ``struct cpufreq_policy
+*policy`` 作为参数。现在该怎么做呢?
+
+如果有必要,请在你的CPU上激活CPUfreq功能支持。
+
+然后,驱动程序必须填写以下数值:
+
++-----------------------------------+--------------------------------------+
+|policy->cpuinfo.min_freq _and_	    |					   |
+|policy->cpuinfo.max_freq	    | 该CPU支持的最低和最高频率(kHz)。   |
+|				    |                                      |
+|				    | 				           |
++-----------------------------------+--------------------------------------+
+|policy->cpuinfo.transition_latency |                                      |
+|				    | CPU在两个频率之间切换所需的时间,以  |
+|				    | 纳秒为单位(如果适用,否则指定       |
+|				    | CPUFREQ_ETERNAL)                    |
++-----------------------------------+--------------------------------------+
+|policy->cur			    | 该CPU当前的工作频率(如适用)          |
+|				    |                                      |
++-----------------------------------+--------------------------------------+
+|policy->min,			    |					   |
+|policy->max,			    |					   |
+|policy->policy and, if necessary,  |					   |
+|policy->governor		    | 必须包含该cpu的 “默认策略”,片刻后。 |
+|				    | 用这些值调用                         |
+|				    | cpufreq_driver.verify and either     |
+|				    | cpufreq_driver.setpolicy or          |
+|				    | cpufreq_driver.target/target_index   |
+|				    | 		                           |
++-----------------------------------+--------------------------------------+
+|policy->cpus			    | 用与这个CPU一起做DVFS的(在线+离线)   |
+|				    | CPU(即与它共享时钟/电压轨)的掩码更新 |
+|				    | 这个                                 |
+|				    |                                      |
++-----------------------------------+--------------------------------------+
+
+对于设置其中的一些值(cpuinfo.min[max]_freq, policy->min[max]),频率表助手可能会有帮
+助。关于它们的更多信息,请参见第2节。
+
+
+1.3 验证
+--------
+
+当用户决定设置一个新的策略(由 "policy,governor,min,max "组成)时,必须对这个策略进行验证,
+以便纠正不兼容的值。为了验证这些值,cpufreq_verify_within_limits(``struct cpufreq_policy
+*policy``, ``unsigned int min_freq``, ``unsigned int max_freq``)函数可能会有帮助。
+关于频率表助手的详细内容请参见第2节。
+
+您需要确保至少有一个有效频率(或工作范围)在 policy->min 和 policy->max 范围内。如果有必
+要,先增加policy->max,只有在没有办法的情况下,才减少policy->min。
+
+
+1.4 target 或 target_index 或 setpolicy 或 fast_switch?
+-------------------------------------------------------
+
+大多数cpufreq驱动甚至大多数cpu频率升降算法只允许将CPU频率设置为预定义的固定值。对于这些,你
+可以使用->target(),->target_index()或->fast_switch()回调。
+
+有些cpufreq功能的处理器可以自己在某些限制之间切换频率。这些应使用->setpolicy()回调。
+
+
+1.5. target/target_index
+------------------------
+
+target_index调用有两个参数。``struct cpufreq_policy * policy``,和``unsigned int``
+索引(进入陈述的频率表)。
+
+当调用这里时,CPUfreq驱动必须设置新的频率。实际频率必须由freq_table[index].frequency决定。
+
+它应该总是在错误的情况下恢复到早期的频率(即policy->restore_freq),即使我们之前切换到中间频率。
+
+Deprecated
+----------
+目标调用有三个参数。``struct cpufreq_policy * policy``, unsigned int target_frequency,
+unsigned int relation.
+
+CPUfreq驱动在调用这里时必须设置新的频率。实际的频率必须使用以下规则来确定。
+
+- 紧跟 "目标频率"。
+- policy->min <= new_freq <= policy->max (这必须是有效的!!!)
+- 如果 relation==CPUFREQ_REL_L,尝试选择一个高于或等于 target_freq 的 new_freq。("L代表
+  最低,但不能低于")
+- 如果 relation==CPUFREQ_REL_H,尝试选择一个低于或等于 target_freq 的 new_freq。("H代表
+  最高,但不能高于")
+
+这里,频率表助手可能会帮助你--详见第2节。
+
+1.6. fast_switch
+----------------
+
+这个函数用于从调度器的上下文进行频率切换。并非所有的驱动都要实现它,因为不允许在这个回调中睡眠。这
+个回调必须经过高度优化,以尽可能快地进行切换。
+
+这个函数有两个参数: ``struct cpufreq_policy *policy`` 和 ``unsigned int target_frequency``.
+
+
+1.7 setpolicy
+-------------
+
+setpolicy调用只需要一个``struct cpufreq_policy * policy``作为参数。需要将处理器内或芯片组内动态频
+率切换的下限设置为policy->min,上限设置为policy->max,如果支持的话,当policy->policy为
+CPUFREQ_POLICY_PERFORMANCE时选择面向性能的设置,当CPUFREQ_POLICY_POWERSAVE时选择面向省电的设置。
+也可以查看drivers/cpufreq/longrun.c中的参考实现。
+
+1.8 get_intermediate and target_intermediate
+--------------------------------------------
+
+仅适用于 target_index() 和 CPUFREQ_ASYNC_NOTIFICATION 未设置的驱动。
+
+get_intermediate应该返回一个平台想要切换到的稳定的中间频率,target_intermediate()应该将CPU设置为
+该频率,然后再跳转到'index'对应的频率。核心会负责发送通知,驱动不必在target_intermediate()或
+target_index()中处理。
+
+在驱动程序不想因为某个目标频率切换到中间频率的情况下,它们可以从get_intermediate()中返回'0'。在这种情况
+下,核心将直接调用->target_index()。
+
+注意:->target_index()应该在失败的情况下恢复到policy->restore_freq,因为core会为此发送通知。
+
+
+2. 频率表助手
+=============
+
+由于大多数cpufreq处理器只允许被设置为几个特定的频率,因此,一个带有一些函数的 "频率表 "可能会辅助处理器驱动
+程序的一些工作。这样的 "频率表" 由一个cpufreq_frequency_table条目构成的数组组成,"driver_data" 中包
+含了驱动程序的具体数值,"frequency" 中包含了相应的频率,并设置了标志。在表的最后,需要添加一个
+cpufreq_frequency_table条目,频率设置为CPUFREQ_TABLE_END。而如果想跳过表中的一个条目,则将频率设置为
+CPUFREQ_ENTRY_INVALID。这些条目不需要按照任何特定的顺序排序,但如果它们是cpufreq core会对它们进行快速的DVFS,
+因为搜索最佳匹配会更快。
+
+如果策略在其policy->freq_table字段中包含一个有效的指针,cpufreq表就会被核心自动验证。
+
+cpufreq_frequency_table_verify()保证至少有一个有效的频率在policy->min和policy->max范围内,并且所有其他
+标准都被满足。这对->验证调用很有帮助。
+
+cpufreq_frequency_table_target()是对应于->target阶段的频率表助手。只要把数值传递给这个函数,这个函数就会返
+回包含CPU要设置的频率的频率表条目。
+
+以下宏可以作为cpufreq_frequency_table的迭代器。
+
+cpufreq_for_each_entry(pos, table) - 遍历频率表的所有条目。
+
+cpufreq_for_each_valid_entry(pos, table) - 遍历所有条目,不包括CPUFREQ_ENTRY_INVALID频率。
+使用参数 "pos"--一个``cpufreq_frequency_table * `` 作为循环游标,使用参数 "table"--你想迭代
+的``cpufreq_frequency_table * `` 。
+
+例如::
+
+	struct cpufreq_frequency_table *pos, *driver_freq_table;
+
+	cpufreq_for_each_entry(pos, driver_freq_table) {
+		/* Do something with pos */
+		pos->frequency = ...
+	}
+
+  如果你需要在driver_freq_table中处理pos的位置,不要减去指针,因为它的代价相当高。相反,使用宏
+  cpufreq_for_each_entry_idx() 和 cpufreq_for_each_valid_entry_idx() 。
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 3/8] docs/zh_CN: add cpu-freq cpufreq-stats.rst translation
  2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
  2021-03-24 15:07 ` [PATCH 1/8] docs/zh_CN: add cpu-freq core.rst translation Yanteng Si
  2021-03-24 15:07 ` [PATCH 2/8] docs/zh_CN: add cpu-freq cpu-drivers.rst translation Yanteng Si
@ 2021-03-24 15:07 ` Yanteng Si
  2021-03-26  4:16   ` Wu X.C.
  2021-03-24 15:07 ` [PATCH 4/8] docs/zh_CN: add cpu-freq index.rst translation Yanteng Si
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Yanteng Si @ 2021-03-24 15:07 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Yanteng Si

This patch translates Documention/cpu-freq/cpufreq-stats.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../zh_CN/cpu-freq/cpufreq-stats.rst          | 130 ++++++++++++++++++
 1 file changed, 130 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst

diff --git a/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst b/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
new file mode 100644
index 000000000000..d21a317d9659
--- /dev/null
+++ b/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
@@ -0,0 +1,130 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../cpu-freq/cpufreq-stats`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_cpufreq-stats.rst:
+
+
+==========================================
+sysfs CPUFreq Stats的一般说明
+==========================================
+
+用户信息
+
+
+作者: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
+
+.. Contents
+
+   1. 简介
+   2. 提供的统计数据(举例说明)
+   3. 配置cpufreq-stats
+
+
+1. 简介
+===============
+
+cpufreq-stats是一个为每个CPU提供CPU频率统计的驱动。
+这些统计数据在/sysfs中以一堆只读接口的形式提供。这个接口(配置好后)将出现在
+/sysfs(<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/)中cpufreq下的一个单
+独的目录中,提供给每个CPU。
+各种统计数据将在此目录下形成只读文件。
+
+这个驱动的设计是独立于任何特定的cpufreq_driver的。可能在你的CPU上运行。因此,它将与所有
+cpufreq_driver一起工作。
+
+
+2. 提供的统计数据(举例说明)
+=====================================
+
+cpufreq stats提供了以下统计数据(在下面详细解释)。
+
+-  time_in_state
+-  total_trans
+-  trans_table
+
+所有的统计数据将从统计驱动被插入的时间(或统计被重置的时间)开始,到某一统计数据被读取的时间为止。
+显然,统计驱动不会有任何关于统计驱动插入之前的频率转换信息。
+
+::
+
+    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
+    total 0
+    drwxr-xr-x  2 root root    0 May 14 16:06 .
+    drwxr-xr-x  3 root root    0 May 14 15:58 ..
+    --w-------  1 root root 4096 May 14 16:06 reset
+    -r--r--r--  1 root root 4096 May 14 16:06 time_in_state
+    -r--r--r--  1 root root 4096 May 14 16:06 total_trans
+    -r--r--r--  1 root root 4096 May 14 16:06 trans_table
+
+- **reset**
+
+只写属性,可用于重置统计计数器。这对于评估不同调节器下的系统行为非常有用,且无需重启。
+
+
+- **time_in_state**
+
+这就给出了这个CPU所支持的每个频率所花费的时间。cat输出的每一行都会有"<frequency>
+<time>"对,表示这个CPU在<frequency>上花费了<time>个usertime单位的时间。这里的
+usertime单位是10mS(类似于/proc中输出的其他时间)。
+
+::
+
+    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state
+    3600000 2089
+    3400000 136
+    3200000 34
+    3000000 67
+    2800000 172488
+
+
+- **total_trans**
+
+给出了这个CPU上频率转换的总次数。cat的输出将有一个单一的计数,这就是频率转换的总数。
+
+::
+
+    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans
+    20
+
+- **trans_table**
+
+这将提供所有CPU频率转换的细粒度信息。这里的cat输出是一个二维矩阵,其中一个条目<i, j>(第
+i行,第j列)代表从Freq_i到Freq_j的转换次数。Freq_i行和Freq_j列遵循驱动最初提供给cpufreq
+核的频率表的排序顺序,因此可以排序(升序或降序)或不排序。 这里的输出也包含了每行每列的实际
+频率值,以便更好地阅读。
+
+如果转换表大于PAGE_SIZE,读取时将返回一个-EFBIG错误。
+
+::
+
+    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table
+    From  :    To
+	    :   3600000   3400000   3200000   3000000   2800000
+    3600000:         0         5         0         0         0
+    3400000:         4         0         2         0         0
+    3200000:         0         1         0         2         0
+    3000000:         0         0         1         0         3
+    2800000:         0         0         0         2         0
+
+3. 配置cpufreq-stats
+============================
+
+要在你的内核中配置cpufreq-stats。::
+
+	Config Main Menu
+		Power management options (ACPI, APM)  --->
+			CPU Frequency scaling  --->
+				[*] CPU Frequency scaling
+				[*]   CPU frequency translation statistics
+
+
+"CPU Frequency scaling" (CONFIG_CPU_FREQ) 应该被启用以配置cpufreq-stats。
+
+"CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT)提供了包括
+time_in_state、total_trans和trans_table的统计数据。
+
+一旦启用了这个选项,并且你的CPU支持cpufrequency,你就可以在/sysfs中看到CPU频率统计。
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 4/8] docs/zh_CN: add cpu-freq index.rst translation
  2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
                   ` (2 preceding siblings ...)
  2021-03-24 15:07 ` [PATCH 3/8] docs/zh_CN: add cpu-freq cpufreq-stats.rst translation Yanteng Si
@ 2021-03-24 15:07 ` Yanteng Si
  2021-03-24 15:07 ` [PATCH 5/8] docs/zh_CN: add cpu-freq to zh_CN index Yanteng Si
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 25+ messages in thread
From: Yanteng Si @ 2021-03-24 15:07 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Yanteng Si

This patch translates Documention/cpu-freq/index.rst into Chinese.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 .../translations/zh_CN/cpu-freq/index.rst     | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/cpu-freq/index.rst

diff --git a/Documentation/translations/zh_CN/cpu-freq/index.rst b/Documentation/translations/zh_CN/cpu-freq/index.rst
new file mode 100644
index 000000000000..39d4b058fd7f
--- /dev/null
+++ b/Documentation/translations/zh_CN/cpu-freq/index.rst
@@ -0,0 +1,45 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :doc:`../../../cpu-freq/index`
+:Translator: Yanteng Si <siyanteng@loongson.cn>
+
+.. _cn_index.rst:
+
+
+=======================================================
+Linux CPUFreq - Linux(TM)内核中的CPU频率和电压升降代码
+=======================================================
+
+Author: Dominik Brodowski  <linux@brodo.de>
+
+      时钟升降允许你在运行中改变CPU的时钟速度。这是一个很好的节省电池电量的方法,因为时
+      钟速度越低,CPU消耗的电量越少。
+
+
+.. toctree::
+   :maxdepth: 1
+
+   core
+   cpu-drivers
+   cpufreq-stats
+
+邮件列表
+------------
+这里有一个 CPU 频率变化的 CVS 提交和通用列表,您可以在这里报告bug、问题或提交补丁。要发
+布消息,请发送电子邮件到 linux-pm@vger.kernel.org。
+
+链接
+-----
+FTP档案:
+* ftp://ftp.linux.org.uk/pub/linux/cpufreq/
+
+如何访问CVS仓库:
+* http://cvs.arm.linux.org.uk/
+
+CPUFreq邮件列表:
+* http://vger.kernel.org/vger-lists.html#linux-pm
+
+SA-1100的时钟和电压标度:
+* http://www.lartmaker.nl/projects/scaling
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 5/8] docs/zh_CN: add cpu-freq to zh_CN index
  2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
                   ` (3 preceding siblings ...)
  2021-03-24 15:07 ` [PATCH 4/8] docs/zh_CN: add cpu-freq index.rst translation Yanteng Si
@ 2021-03-24 15:07 ` Yanteng Si
  2021-03-24 15:07 ` [PATCH 6/8] docs/zh_CN: add mips " Yanteng Si
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 25+ messages in thread
From: Yanteng Si @ 2021-03-24 15:07 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Yanteng Si

All the files in the cpu-freq directory have been translated into
Chinese and it is time to add them to the zh_CN index.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 Documentation/translations/zh_CN/index.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst
index 2767dacfe86d..cd55c1aea604 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -21,6 +21,7 @@
    filesystems/index
    arm64/index
    sound/index
+   cpu-freq/index
 
 目录和表格
 ----------
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 6/8] docs/zh_CN: add mips to zh_CN index
  2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
                   ` (4 preceding siblings ...)
  2021-03-24 15:07 ` [PATCH 5/8] docs/zh_CN: add cpu-freq to zh_CN index Yanteng Si
@ 2021-03-24 15:07 ` Yanteng Si
  2021-03-24 15:07 ` [PATCH 7/8] docs/zh_CN: add iio " Yanteng Si
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 25+ messages in thread
From: Yanteng Si @ 2021-03-24 15:07 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Yanteng Si

All the files in the mips directory have been translated into
Chinese and it is time to add them to the zh_CN index.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 Documentation/translations/zh_CN/index.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst
index cd55c1aea604..16641203dc88 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -22,6 +22,7 @@
    arm64/index
    sound/index
    cpu-freq/index
+   mips/index
 
 目录和表格
 ----------
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 7/8] docs/zh_CN: add iio to zh_CN index
  2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
                   ` (5 preceding siblings ...)
  2021-03-24 15:07 ` [PATCH 6/8] docs/zh_CN: add mips " Yanteng Si
@ 2021-03-24 15:07 ` Yanteng Si
  2021-03-24 15:07 ` [PATCH 8/8] docs/zh_CN: add riscv " Yanteng Si
  2021-03-25 12:23 ` [PATCH 0/8] docs/zh_CN: add cpu-freq translation Alex Shi
  8 siblings, 0 replies; 25+ messages in thread
From: Yanteng Si @ 2021-03-24 15:07 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Yanteng Si

All the files in the iio directory have been translated into
Chinese and it is time to add them to the zh_CN index.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 Documentation/translations/zh_CN/index.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst
index 16641203dc88..51c50f319487 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -23,6 +23,7 @@
    sound/index
    cpu-freq/index
    mips/index
+   iio/index
 
 目录和表格
 ----------
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 8/8] docs/zh_CN: add riscv to zh_CN index
  2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
                   ` (6 preceding siblings ...)
  2021-03-24 15:07 ` [PATCH 7/8] docs/zh_CN: add iio " Yanteng Si
@ 2021-03-24 15:07 ` Yanteng Si
  2021-03-25 12:23 ` [PATCH 0/8] docs/zh_CN: add cpu-freq translation Alex Shi
  8 siblings, 0 replies; 25+ messages in thread
From: Yanteng Si @ 2021-03-24 15:07 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Yanteng Si

All the files in the riscv directory have been translated into
Chinese and it is time to add them to the zh_CN index.

Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
---
 Documentation/translations/zh_CN/index.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/translations/zh_CN/index.rst b/Documentation/translations/zh_CN/index.rst
index 51c50f319487..892b6e85a8aa 100644
--- a/Documentation/translations/zh_CN/index.rst
+++ b/Documentation/translations/zh_CN/index.rst
@@ -24,6 +24,7 @@
    cpu-freq/index
    mips/index
    iio/index
+   riscv/index
 
 目录和表格
 ----------
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 0/8] docs/zh_CN: add cpu-freq translation
  2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
                   ` (7 preceding siblings ...)
  2021-03-24 15:07 ` [PATCH 8/8] docs/zh_CN: add riscv " Yanteng Si
@ 2021-03-25 12:23 ` Alex Shi
  2021-03-25 18:52   ` Jonathan Corbet
  2021-03-26  2:14   ` yanteng si
  8 siblings, 2 replies; 25+ messages in thread
From: Alex Shi @ 2021-03-25 12:23 UTC (permalink / raw)
  To: Yanteng Si, Jonathan Corbet
  Cc: Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc, realpuyuwang,
	siyanteng01, Wu XiangCheng

Cc Wu Xiangcheng,

Hi Yanteng,

Thanks for your work! believe we active translators could review
for each other. :)

Thanks!


在 2021/3/24 下午11:07, Yanteng Si 写道:
> This series of patches:
>  translates Documention/cpu-freq/* into Chinese.
>  add .../zh_CN/mips to zh_CN index
>  add .../zh_CN/iio to zh_CN index
>  add .../zh_CN/riscv to zh_CN index
> 
> Yabteng Si(8):
> docs/zh_CN: add cpu-freq core.rst translation
> docs/zh_CN: add cpu-freq cpu-drivers.rst translation
> docs/zh_CN: add cpu-freq cpufreq-stats.rst translation
> docs/zh_CN: add cpu-freq index.rst translation
> docs/zh_CN: add cpu-freq to zh_CN index
> docs/zh_CN: add mips to zh_CN index
> docs/zh_CN: add iio to zh_CN index
> docs/zh_CN: add riscv to zh_CN index
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>  Documentation/translations/zh_CN/cpu-freq/core.rst          | 105
> +++++++++++++++++++++++++++++++++++++++++++++
>  Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst   | 259
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst | 130
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  Documentation/translations/zh_CN/cpu-freq/index.rst         |  45
> ++++++++++++++++++++
>  Documentation/translations/zh_CN/index.rst                  |   4 ++
>  5 files changed, 543 insertions(+)
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 0/8] docs/zh_CN: add cpu-freq translation
  2021-03-25 12:23 ` [PATCH 0/8] docs/zh_CN: add cpu-freq translation Alex Shi
@ 2021-03-25 18:52   ` Jonathan Corbet
  2021-03-26  3:31     ` Jiaxun Yang
  2021-03-26  2:14   ` yanteng si
  1 sibling, 1 reply; 25+ messages in thread
From: Jonathan Corbet @ 2021-03-25 18:52 UTC (permalink / raw)
  To: Alex Shi, Yanteng Si
  Cc: Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc, realpuyuwang,
	siyanteng01, Wu XiangCheng

Alex Shi <alex.shi@linux.alibaba.com> writes:

> Cc Wu Xiangcheng,
>
> Hi Yanteng,
>
> Thanks for your work! believe we active translators could review
> for each other. :)

I'd very much like to second that.  Alex has been doing a great job of
reviewing these patches, but I think he deserves some help.

Thanks,

jon

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 0/8] docs/zh_CN: add cpu-freq translation
  2021-03-25 12:23 ` [PATCH 0/8] docs/zh_CN: add cpu-freq translation Alex Shi
  2021-03-25 18:52   ` Jonathan Corbet
@ 2021-03-26  2:14   ` yanteng si
  1 sibling, 0 replies; 25+ messages in thread
From: yanteng si @ 2021-03-26  2:14 UTC (permalink / raw)
  To: Alex Shi
  Cc: Yanteng Si, Jonathan Corbet, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, Puyu Wang, Wu XiangCheng

Hi Alex.

Great! I'd be happy to do it. :)

Thanks!

Alex Shi <alex.shi@linux.alibaba.com> 于2021年3月25日周四 下午8:28写道:
>
> Cc Wu Xiangcheng,
>
> Hi Yanteng,
>
> Thanks for your work! believe we active translators could review
> for each other. :)
>
> Thanks!
>
>
> 在 2021/3/24 下午11:07, Yanteng Si 写道:
> > This series of patches:
> >  translates Documention/cpu-freq/* into Chinese.
> >  add .../zh_CN/mips to zh_CN index
> >  add .../zh_CN/iio to zh_CN index
> >  add .../zh_CN/riscv to zh_CN index
> >
> > Yabteng Si(8):
> > docs/zh_CN: add cpu-freq core.rst translation
> > docs/zh_CN: add cpu-freq cpu-drivers.rst translation
> > docs/zh_CN: add cpu-freq cpufreq-stats.rst translation
> > docs/zh_CN: add cpu-freq index.rst translation
> > docs/zh_CN: add cpu-freq to zh_CN index
> > docs/zh_CN: add mips to zh_CN index
> > docs/zh_CN: add iio to zh_CN index
> > docs/zh_CN: add riscv to zh_CN index
> >
> > Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> > ---
> >  Documentation/translations/zh_CN/cpu-freq/core.rst          | 105
> > +++++++++++++++++++++++++++++++++++++++++++++
> >  Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst   | 259
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst | 130
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  Documentation/translations/zh_CN/cpu-freq/index.rst         |  45
> > ++++++++++++++++++++
> >  Documentation/translations/zh_CN/index.rst                  |   4 ++
> >  5 files changed, 543 insertions(+)
> >

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/8] docs/zh_CN: add cpu-freq core.rst translation
  2021-03-24 15:07 ` [PATCH 1/8] docs/zh_CN: add cpu-freq core.rst translation Yanteng Si
@ 2021-03-26  3:12   ` Jiaxun Yang
  2021-03-27  2:13     ` yanteng si
  2021-03-29 12:24     ` yanteng si
  0 siblings, 2 replies; 25+ messages in thread
From: Jiaxun Yang @ 2021-03-26  3:12 UTC (permalink / raw)
  To: Yanteng Si, Jonathan Corbet
  Cc: Alex Shi, Huacai Chen, Harry Wei, linux-doc, realpuyuwang, yanteng si



On Wed, Mar 24, 2021, at 11:07 PM, Yanteng Si wrote:
> This patch translates Documention/cpu-freq/core.rst into Chinese.
> 
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>  .../translations/zh_CN/cpu-freq/core.rst      | 105 ++++++++++++++++++
>  1 file changed, 105 insertions(+)
>  create mode 100644 Documentation/translations/zh_CN/cpu-freq/core.rst
> 
> diff --git a/Documentation/translations/zh_CN/cpu-freq/core.rst 
> b/Documentation/translations/zh_CN/cpu-freq/core.rst
> new file mode 100644
> index 000000000000..1571087c2581
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/cpu-freq/core.rst
> @@ -0,0 +1,105 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +.. include:: ../disclaimer-zh_CN.rst
> +
> +:Original: :doc:`../../../cpu-freq/core`
> +:Translator: Yanteng Si <siyanteng@loongson.cn>
> +
> +.. _cn_core.rst:
> +
> +
> +====================================
> +CPUFreq核心和CPUFreq通知器的一般说明
> +====================================

一般 -> 通用? 

> +
> +作者:
> +	- Dominik Brodowski  <linux@brodo.de>
> +	- David Kimdon <dwhedon@debian.org>
> +	- Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> +	- Viresh Kumar <viresh.kumar@linaro.org>
> +
> +.. 目录:
> +
> +   1.  CPUFreq核心和接口
> +   2.  CPUFreq通知器
> +   3.  含有Operating Performance Point (OPP)的CPUFreq表的生成
> +
> +1. CPUFreq核心和接口
> +======================
> +
> +cpufreq核心代码位于drivers/cpufreq/cpufreq.c中。这些cpufreq代码为CPUFreq架构的驱
> +动程序(那些进行实际频率转换的代码)以及 "通知器 "提供了一个标准化的接口。

那些操作硬件切换频率的代码 will help with understanding.


> +这些是设备驱动程序或需要了解策略变化的其它内核部分(如 ACPI 等热模块)或所有频率更改(除
Add sbject "通知器"
热模块 seems bogus, 热量管理?

> +计时代码外),甚至需要强制确定速度限制(如 ARM 架构上的 LCD 驱动程序)。
> +此外, 内核 "常数" loops_per_jiffy会根据频率变化而更新。
> +
> +cpufreq策略的引用计数由 cpufreq_cpu_get 和 cpufreq_cpu_put 来完成,以确保 cpufreq 驱
> +动程序被正确地注册到核心中,并且在 cpufreq_put_cpu 被调用之前不会被卸载。这也保证了各自的
> +cpufreq 策略在使用时不会被释放。

It makes me "Parser error" when reading.....

> +
> +2. CPUFreq 通知器
> +====================
> +
> +CPUFreq通知器符合标准的内核通知器接口。
> +关于通知器的细节请参阅 linux/include/linux/notifier.h。
> +
> +这里有两个不同的CPUfreq通知器 - 策略通知器和转换通知器。
> +
> +
> +2.1 CPUFreq策略通知器
> +----------------------------
> +
> +当创建或移除策略时,这些都会被通知。
> +
> +阶段是在通知器的第二个参数中指定的。当第一次创建策略时,阶段是CPUFREQ_CREATE_POLICY,当
> +策略被移除时,阶段是CPUFREQ_REMOVE_POLICY。
> +
> +第三个参数 ``void *pointer`` 指向一个结构体cpufreq_policy,其包括min,max(新策略的下限和
> +上限(单位为kHz))这几个值。
> +
> +
> +2.2 CPUFreq转换通知器
> +--------------------------------
> +
> +当CPUfreq驱动切换CPU核心频率时,策略中的每个在线CPU都会收到两次通知,这些变化没有任何外部干
> +预。
> +
> +第二个参数指定阶段 - CPUFREQ_PRECHANGE or CPUFREQ_POSTCHANGE.
> +
> +第三个参数是一个包含如下值的结构体cpufreq_freqs:
> +
> +=====	====================
> +cpu	受影响cpu的编号
> +old	旧频率
> +new	新频率
> +flags	cpufreq驱动的标志
> +=====	====================
> +
> +3. 含有Operating Performance Point (OPP)的CPUFreq表的生成
> +==================================================================
> +关于OPP的细节请参阅 Documentation/power/opp.rst
> +
> +dev_pm_opp_init_cpufreq_table -
> +	这个功能提供了一个随时可用的转换程序,用来将OPP层关于可用频率的内部信息翻译成一种容易提供给
> +	cpufreq的格式。
> +
> +	.. Warning::
> +
> +		不要在中断上下文中使用此函数。
> +
> +	例如::
> +
> +	 soc_pm_init()
> +	 {
> +		/* Do things */
> +		r = dev_pm_opp_init_cpufreq_table(dev, &freq_table);
> +		if (!r)
> +			policy->freq_table = freq_table;
> +		/* Do other things */
> +	 }
> +
> +	.. note::
> +
> +		该函数只有在CONFIG_PM_OPP之外还启用了CONFIG_CPU_FREQ时才可用。
> +
> +dev_pm_opp_free_cpufreq_table
> +	释放dev_pm_opp_init_cpufreq_table分配的表。
> -- 
> 2.25.1
> 
>

-- 
- Jiaxun

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 0/8] docs/zh_CN: add cpu-freq translation
  2021-03-25 18:52   ` Jonathan Corbet
@ 2021-03-26  3:31     ` Jiaxun Yang
  2021-03-26  7:44       ` Alex Shi
  0 siblings, 1 reply; 25+ messages in thread
From: Jiaxun Yang @ 2021-03-26  3:31 UTC (permalink / raw)
  To: Jonathan Corbet, Alex Shi, Yanteng Si
  Cc: Huacai Chen, Harry Wei, linux-doc, realpuyuwang, yanteng si,
	Wu XiangCheng



On Fri, Mar 26, 2021, at 2:52 AM, Jonathan Corbet wrote:
> Alex Shi <alex.shi@linux.alibaba.com> writes:
> 
> > Cc Wu Xiangcheng,
> >
> > Hi Yanteng,
> >
> > Thanks for your work! believe we active translators could review
> > for each other. :)
> 
> I'd very much like to second that.  Alex has been doing a great job of
> reviewing these patches, but I think he deserves some help.

Hi all,

I'm going too help with revewing as well.

However when reviewing these translations I found there are some inconsistencies
in word choices.

Probably for Chinese translations we need a general golssary to help translators?
We can pick up a general computer dictionary as baseline and make some linux
addtion entries. 

Thanks. 

- Jiaxun

> 
> Thanks,
> 
> jon
>

-- 
- Jiaxun

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 3/8] docs/zh_CN: add cpu-freq cpufreq-stats.rst translation
  2021-03-24 15:07 ` [PATCH 3/8] docs/zh_CN: add cpu-freq cpufreq-stats.rst translation Yanteng Si
@ 2021-03-26  4:16   ` Wu X.C.
  2021-03-27  3:13     ` yanteng si
  0 siblings, 1 reply; 25+ messages in thread
From: Wu X.C. @ 2021-03-26  4:16 UTC (permalink / raw)
  To: Yanteng Si
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Jonathan Corbet


在 2021/3/24 23:07, Yanteng Si 写道:
> This patch translates Documention/cpu-freq/cpufreq-stats.rst into Chinese.
>
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>   .../zh_CN/cpu-freq/cpufreq-stats.rst          | 130 ++++++++++++++++++
>   1 file changed, 130 insertions(+)
>   create mode 100644 Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
>
> diff --git a/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst b/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
> new file mode 100644
> index 000000000000..d21a317d9659
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
> @@ -0,0 +1,130 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +.. include:: ../disclaimer-zh_CN.rst
> +
> +:Original: :doc:`../../../cpu-freq/cpufreq-stats`
> +:Translator: Yanteng Si <siyanteng@loongson.cn>
> +
> +.. _cn_cpufreq-stats.rst:
> +
> +
> +==========================================
> +sysfs CPUFreq Stats的一般说明
> +==========================================
> +
> +用户信息
> +
> +
> +作者: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
> +
> +.. Contents
> +
> +   1. 简介
> +   2. 提供的统计数据(举例说明)
> +   3. 配置cpufreq-stats
> +
> +
> +1. 简介
> +===============
> +
> +cpufreq-stats是一个为每个CPU提供CPU频率统计的驱动。
> +这些统计数据在/sysfs中以一堆只读接口的形式提供。这个接口(配置好后)将出现在
在配置好后
> +/sysfs(<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/)中cpufreq下的一个单
> +独的目录中,提供给每个CPU。
> +各种统计数据将在此目录下形成只读文件。
> +
> +这个驱动的设计是独立于任何特定的cpufreq_driver的。可能在你的CPU上运行。因此,它将与所有
此驱动是独立于任何可能运行在你所用CPU上的特定cpufreq_driver而设计的。
> +cpufreq_driver一起工作。
> +
> +
> +2. 提供的统计数据(举例说明)
> +=====================================
> +
> +cpufreq stats提供了以下统计数据(在下面详细解释)。
> +
> +-  time_in_state
> +-  total_trans
> +-  trans_table
> +
> +所有的统计数据将从统计驱动被插入的时间(或统计被重置的时间)开始,到某一统计数据被读取的时间为止。
插入 use 载入?or another better word?
> +显然,统计驱动不会有任何关于统计驱动插入之前的频率转换信息。
> +
> +::
> +
> +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
> +    total 0
> +    drwxr-xr-x  2 root root    0 May 14 16:06 .
> +    drwxr-xr-x  3 root root    0 May 14 15:58 ..
> +    --w-------  1 root root 4096 May 14 16:06 reset
> +    -r--r--r--  1 root root 4096 May 14 16:06 time_in_state
> +    -r--r--r--  1 root root 4096 May 14 16:06 total_trans
> +    -r--r--r--  1 root root 4096 May 14 16:06 trans_table
> +
> +- **reset**
> +
> +只写属性,可用于重置统计计数器。这对于评估不同调节器下的系统行为非常有用,且无需重启。
> +
> +
> +- **time_in_state**
> +
> +这就给出了这个CPU所支持的每个频率所花费的时间。cat输出的每一行都会有"<frequency>
此项给出了…
> +<time>"对,表示这个CPU在<frequency>上花费了<time>个usertime单位的时间。这里的
> +usertime单位是10mS(类似于/proc中输出的其他时间)。
> +
> +::
> +
> +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state
> +    3600000 2089
> +    3400000 136
> +    3200000 34
> +    3000000 67
> +    2800000 172488
> +
> +
> +- **total_trans**
> +
> +给出了这个CPU上频率转换的总次数。cat的输出将有一个单一的计数,这就是频率转换的总数。
> +
> +::
> +
> +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans
> +    20
> +
> +- **trans_table**
> +
> +这将提供所有CPU频率转换的细粒度信息。这里的cat输出是一个二维矩阵,其中一个条目<i, j>(第
> +i行,第j列)代表从Freq_i到Freq_j的转换次数。Freq_i行和Freq_j列遵循驱动最初提供给cpufreq
> +核的频率表的排序顺序,因此可以排序(升序或降序)或不排序。 这里的输出也包含了每行每列的实际
排列顺序
> +频率值,以便更好地阅读。
> +
> +如果转换表大于PAGE_SIZE,读取时将返回一个-EFBIG错误。
> +
> +::
> +
> +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table
> +    From  :    To
> +	    :   3600000   3400000   3200000   3000000   2800000
> +    3600000:         0         5         0         0         0
> +    3400000:         4         0         2         0         0
> +    3200000:         0         1         0         2         0
> +    3000000:         0         0         1         0         3
> +    2800000:         0         0         0         2         0
> +
> +3. 配置cpufreq-stats
> +============================
> +
> +要在你的内核中配置cpufreq-stats。::
remove the “。”
> +
> +	Config Main Menu
> +		Power management options (ACPI, APM)  --->
> +			CPU Frequency scaling  --->
> +				[*] CPU Frequency scaling
> +				[*]   CPU frequency translation statistics
> +
> +
> +"CPU Frequency scaling" (CONFIG_CPU_FREQ) 应该被启用以配置cpufreq-stats。
> +
> +"CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT)提供了包括
> +time_in_state、total_trans和trans_table的统计数据。
> +
> +一旦启用了这个选项,并且你的CPU支持cpufrequency,你就可以在/sysfs中看到CPU频率统计。
Thanks!


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/8] docs/zh_CN: add cpu-freq cpu-drivers.rst translation
  2021-03-24 15:07 ` [PATCH 2/8] docs/zh_CN: add cpu-freq cpu-drivers.rst translation Yanteng Si
@ 2021-03-26  5:21   ` Wu X.C.
  2021-03-27  3:03     ` teng sterling
  0 siblings, 1 reply; 25+ messages in thread
From: Wu X.C. @ 2021-03-26  5:21 UTC (permalink / raw)
  To: Yanteng Si
  Cc: Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei, linux-doc,
	realpuyuwang, siyanteng01, Jonathan Corbet



在 2021/3/24 23:07, Yanteng Si 写道:
> This patch translates Documention/cpu-freq/cpu-drivers.rst into Chinese.
>
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> ---
>   .../zh_CN/cpu-freq/cpu-drivers.rst            | 259 ++++++++++++++++++
>   1 file changed, 259 insertions(+)
>   create mode 100644 Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
>
> diff --git a/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
> new file mode 100644
> index 000000000000..27a70f3a9938
> --- /dev/null
> +++ b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
> @@ -0,0 +1,259 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +.. include:: ../disclaimer-zh_CN.rst
> +
> +:Original: :doc:`../../../cpu-freq/cpu-drivers`
> +:Translator: Yanteng Si <siyanteng@loongson.cn>
> +
> +.. _cn_cpu-drivers.rst:
> +
> +
> +=======================================
> +如何实现一个新的CPUFreq处理器驱动程序?
> +=======================================
> +
> +作者:
> +
> +
> +	- Dominik Brodowski  <linux@brodo.de>
> +	- Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> +	- Viresh Kumar <viresh.kumar@linaro.org>
> +
> +.. Contents
> +
> +   1.   怎么做?
> +   1.1  初始化
> +   1.2  Per-CPU 初始化
> +   1.3  验证
> +   1.4  target 或 target_index 或 setpolicy?
target/target_index 或 setpolicy?
> +   1.5  target/target_index
> +   1.6  setpolicy
> +   1.7  get_intermediate 与 target_intermediate
> +   2.   频率表助手
> +
> +
> +
> +1. 怎么做?
> +===========
> +
> +如此,你刚刚得到了一个全新的CPU/芯片组与数据表,并希望为这个CPU/芯片组添加cpufreq
及其数据手册(datasheet),
> +支持?很好,这里有一些至关重要的提示:
> +
> +
> +1.1 初始化
> +----------
> +
> +首先,在__initcall_level_7 (module_init())或更靠后的函数中检查这个内核是否
> +运行在正确的CPU和正确的芯片组上。如果是,则使用cpufreq_register_driver()向
> +CPUfreq核心层注册一个cpufreq_driver结构体。
> +
> +结构体cpufreq_driver应该包含什么成员?
> +
> + .name - 驱动的名字。
> +
> + .init - 一个指向per-policy初始化函数的指针。
> +
> + .verify - 一个指向"verification"函数的指针。
> +
> + .setpolicy 或 .fast_switch 或 .target 或 .target_index - 差异见
> + 下文。
> +
> +并且可选择
> +
> + .flags - cpufreq核的提示。
> +
> + .driver_data - cpufreq驱动程序的特定数据。
> +
> + .resolve_freq - 返回最适合目标频率的频率。不过并不能改变频率。
> +
> + .get_intermediate and target_intermediate - 用于在改变CPU频率时切换到稳定
> + 的频率。
> +
> + .get - 返回CPU的当前频率。
> +
> + .bios_limit - 返回HW/BIOS对CPU的最大频率限制值。
> +
> + .exit - 一个指向per-policy清理函数的指针,该函数在cpu热插拔过程的CPU_POST_DEAD
> + 阶段被调用。
> +
> + .stop_cpu - 一个指向per-policy停止函数的指针,该函数在cpu热插拔过程的CPU_DOWN_PREPARE
> + 阶段被调用。
> +
> + .suspend - 一个指向per-policy暂停函数的指针,该函数在关中断且在该策略的调节器停止
> + 后被调用。
> +
> + .resume - 一个指向per-policy恢复函数的指针,该函数在关中断且在调节器再一次开始前被
> + 调用。
> +
> + .ready - 一个指向per-policy准备函数的指针,该函数在策略完全初始化之后被调用。
> +
> + .attr - 一个指向NULL结尾的"struct freq_attr"列表的指针,该函数允许导出值到
> + sysfs。
> +
> + .boost_enabled - 如果设置,则启用提升频率。
括注 boost
> +
> + .set_boost - 一个指向per-policy函数的指针,该函数用来开启/关闭提升频率功能。
> +
> +
> +1.2 Per-CPU 初始化
> +------------------
> +
> +每当一个新的CPU被注册到设备模型中,或者在cpufreq驱动注册自己之后,如果CPU不存在cpufreq
如果此CPU的cpufreq策略不存在
> +策略,则会调用每个策略的初始化函数cpufreq_driver.init。请注意, .init() 和 .exit()例程
per-policy

routines  程序
> +只对策略调用一次,而不是对策略管理的每个CPU调用一次。它需要一个 ``struct cpufreq_policy
> +*policy`` 作为参数。现在该怎么做呢?
> +
> +如果有必要,请在你的CPU上激活CPUfreq功能支持。
> +
> +然后,驱动程序必须填写以下数值:
> +
> ++-----------------------------------+--------------------------------------+
> +|policy->cpuinfo.min_freq _and_	    |					   |
> +|policy->cpuinfo.max_freq	    | 该CPU支持的最低和最高频率(kHz)。   |
remove “。”
> +|				    |                                      |
> +|				    | 				           |
> ++-----------------------------------+--------------------------------------+
> +|policy->cpuinfo.transition_latency |                                      |
> +|				    | CPU在两个频率之间切换所需的时间,以  |
> +|				    | 纳秒为单位(如果适用,否则指定       |
如适用,
> +|				    | CPUFREQ_ETERNAL)                    |
> ++-----------------------------------+--------------------------------------+
> +|policy->cur			    | 该CPU当前的工作频率(如适用)          |
> +|				    |                                      |
> ++-----------------------------------+--------------------------------------+
> +|policy->min,			    |					   |
> +|policy->max,			    |					   |
> +|policy->policy and, if necessary,  |					   |
> +|policy->governor		    | 必须包含该cpu的 “默认策略”,片刻后。 |
。稍后会用这些值调用
> +|				    | 用这些值调用                         |
> +|				    | cpufreq_driver.verify and either     |
> +|				    | cpufreq_driver.setpolicy or          |
> +|				    | cpufreq_driver.target/target_index   |
> +|				    | 		                           |
> ++-----------------------------------+--------------------------------------+
> +|policy->cpus			    | 用与这个CPU一起做DVFS的(在线+离线)   |
> +|				    | CPU(即与它共享时钟/电压轨)的掩码更新 |
> +|				    | 这个                                 |
> +|				    |                                      |
> ++-----------------------------------+--------------------------------------+
> +
> +对于设置其中的一些值(cpuinfo.min[max]_freq, policy->min[max]),频率表助手可能会有帮
> +助。关于它们的更多信息,请参见第2节。
> +
> +
> +1.3 验证
> +--------
> +
> +当用户决定设置一个新的策略(由 "policy,governor,min,max "组成)时,必须对这个策略进行验证,
引号内多余空格,或请用全角引号
> +以便纠正不兼容的值。为了验证这些值,cpufreq_verify_within_limits(``struct cpufreq_policy
> +*policy``, ``unsigned int min_freq``, ``unsigned int max_freq``)函数可能会有帮助。
> +关于频率表助手的详细内容请参见第2节。
> +
> +您需要确保至少有一个有效频率(或工作范围)在 policy->min 和 policy->max 范围内。如果有必
> +要,先增加policy->max,只有在没有办法的情况下,才减少policy->min。
> +
> +
> +1.4 target 或 target_index 或 setpolicy 或 fast_switch?
> +-------------------------------------------------------
> +
> +大多数cpufreq驱动甚至大多数cpu频率升降算法只允许将CPU频率设置为预定义的固定值。对于这些,你
> +可以使用->target(),->target_index()或->fast_switch()回调。
> +
> +有些cpufreq功能的处理器可以自己在某些限制之间切换频率。这些应使用->setpolicy()回调。
> +
> +
> +1.5. target/target_index
> +------------------------
> +
> +target_index调用有两个参数。``struct cpufreq_policy * policy``,和``unsigned int``
s/。/:/
删除 ,
> +索引(进入陈述的频率表)。
into the exposed frequency table
陈述?
> +
> +当调用这里时,CPUfreq驱动必须设置新的频率。实际频率必须由freq_table[index].frequency决定。
> +
> +它应该总是在错误的情况下恢复到早期的频率(即policy->restore_freq),即使我们之前切换到中间频率。
早期  之前的
> +
> +Deprecated
已弃用
> +----------
> +目标调用有三个参数。``struct cpufreq_policy * policy``, unsigned int target_frequency,
> +unsigned int relation.
> +
> +CPUfreq驱动在调用这里时必须设置新的频率。实际的频率必须使用以下规则来确定。
> +
> +- 紧跟 "目标频率"。
> +- policy->min <= new_freq <= policy->max (这必须是有效的!!!)
> +- 如果 relation==CPUFREQ_REL_L,尝试选择一个高于或等于 target_freq 的 new_freq。("L代表
> +  最低,但不能低于")
> +- 如果 relation==CPUFREQ_REL_H,尝试选择一个低于或等于 target_freq 的 new_freq。("H代表
> +  最高,但不能高于")
> +
> +这里,频率表助手可能会帮助你--详见第2节。
> +
> +1.6. fast_switch
> +----------------
> +
> +这个函数用于从调度器的上下文进行频率切换。并非所有的驱动都要实现它,因为不允许在这个回调中睡眠。这
> +个回调必须经过高度优化,以尽可能快地进行切换。
> +
> +这个函数有两个参数: ``struct cpufreq_policy *policy`` 和 ``unsigned int target_frequency``.
句号
> +
> +
> +1.7 setpolicy
> +-------------
> +
> +setpolicy调用只需要一个``struct cpufreq_policy * policy``作为参数。需要将处理器内或芯片组内动态频
> +率切换的下限设置为policy->min,上限设置为policy->max,如果支持的话,当policy->policy为
> +CPUFREQ_POLICY_PERFORMANCE时选择面向性能的设置,当CPUFREQ_POLICY_POWERSAVE时选择面向省电的设置。
> +也可以查看drivers/cpufreq/longrun.c中的参考实现。
> +
> +1.8 get_intermediate and target_intermediate
> +--------------------------------------------
> +
> +仅适用于 target_index() 和 CPUFREQ_ASYNC_NOTIFICATION 未设置的驱动。
> +
> +get_intermediate应该返回一个平台想要切换到的稳定的中间频率,target_intermediate()应该将CPU设置为
> +该频率,然后再跳转到'index'对应的频率。核心会负责发送通知,驱动不必在target_intermediate()或
> +target_index()中处理。
> +
> +在驱动程序不想因为某个目标频率切换到中间频率的情况下,它们可以从get_intermediate()中返回'0'。在这种情况
> +下,核心将直接调用->target_index()。
> +
> +注意:->target_index()应该在失败的情况下恢复到policy->restore_freq,因为core会为此发送通知。
> +
> +
> +2. 频率表助手
> +=============
> +
> +由于大多数cpufreq处理器只允许被设置为几个特定的频率,因此,一个带有一些函数的 "频率表 "可能会辅助处理器驱动
如果都是中文,请用全角引号
> +程序的一些工作。这样的 "频率表" 由一个cpufreq_frequency_table条目构成的数组组成,"driver_data" 中包
> +含了驱动程序的具体数值,"frequency" 中包含了相应的频率,并设置了标志。在表的最后,需要添加一个
> +cpufreq_frequency_table条目,频率设置为CPUFREQ_TABLE_END。而如果想跳过表中的一个条目,则将频率设置为
> +CPUFREQ_ENTRY_INVALID。这些条目不需要按照任何特定的顺序排序,但如果它们是cpufreq core会对它们进行快速的DVFS,
core是否翻译请统一
> +因为搜索最佳匹配会更快。
> +
> +如果策略在其policy->freq_table字段中包含一个有效的指针,cpufreq表就会被核心自动验证。
> +
> +cpufreq_frequency_table_verify()保证至少有一个有效的频率在policy->min和policy->max范围内,并且所有其他
> +标准都被满足。这对->验证调用很有帮助。
the ->verify call
> +
> +cpufreq_frequency_table_target()是对应于->target阶段的频率表助手。只要把数值传递给这个函数,这个函数就会返
> +回包含CPU要设置的频率的频率表条目。
> +
> +以下宏可以作为cpufreq_frequency_table的迭代器。
> +
> +cpufreq_for_each_entry(pos, table) - 遍历频率表的所有条目。
> +
> +cpufreq_for_each_valid_entry(pos, table) - 遍历所有条目,不包括CPUFREQ_ENTRY_INVALID频率。
> +使用参数 "pos"--一个``cpufreq_frequency_table * `` 作为循环游标,使用参数 "table"--你想迭代
单连字符

这句话读不太通
> +的``cpufreq_frequency_table * `` 。
> +
> +例如::
> +
> +	struct cpufreq_frequency_table *pos, *driver_freq_table;
> +
> +	cpufreq_for_each_entry(pos, driver_freq_table) {
> +		/* Do something with pos */
> +		pos->frequency = ...
> +	}
> +
> +  如果你需要在driver_freq_table中处理pos的位置,不要减去指针,因为它的代价相当高。相反,使用宏
开头空格多余
> +  cpufreq_for_each_entry_idx() 和 cpufreq_for_each_valid_entry_idx() 。
Thanks!


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 0/8] docs/zh_CN: add cpu-freq translation
  2021-03-26  3:31     ` Jiaxun Yang
@ 2021-03-26  7:44       ` Alex Shi
  2021-03-26  8:25         ` Wu X.C.
  0 siblings, 1 reply; 25+ messages in thread
From: Alex Shi @ 2021-03-26  7:44 UTC (permalink / raw)
  To: Jiaxun Yang, Jonathan Corbet, Yanteng Si
  Cc: Huacai Chen, Harry Wei, linux-doc, realpuyuwang, yanteng si,
	Wu XiangCheng, alexs, 黄江慧


在 2021/3/26 上午11:31, Jiaxun Yang 写道:
> 
> 
> On Fri, Mar 26, 2021, at 2:52 AM, Jonathan Corbet wrote:
>> Alex Shi <alex.shi@linux.alibaba.com> writes:
>>
>>> Cc Wu Xiangcheng,
>>>
>>> Hi Yanteng,
>>>
>>> Thanks for your work! believe we active translators could review
>>> for each other. :)
>>
>> I'd very much like to second that.  Alex has been doing a great job of
>> reviewing these patches, but I think he deserves some help.

Thanks for encourage, My great pleasure. :)

> 
> Hi all,
> 
> I'm going too help with revewing as well.

Very glad to more Chinese translators working together :)

> 
> However when reviewing these translations I found there are some inconsistencies
> in word choices.

Uh, generally, I am not warry about the slightly different words if they are all
common used in computer industry or have no clearly misleading. And we still has
chances to change inconsistency in review or by a patch.

> 
> Probably for Chinese translations we need a general golssary to help translators?
> We can pick up a general computer dictionary as baseline and make some linux
> addtion entries. 

I don't know if there some common acked computer dictionaries. Im afraid that the
dictionary selection may cause much discussion and long time. :D

May let's trust translators and provide better options in each of review?


BTW,
I am leaving alibaba, this email account will be invalid soon. Please cc me at
alexs@kernel.org or seakeel@gmail.com

Thanks
Alex

> 
> Thanks. 
> 
> - Jiaxun
> 
>>
>> Thanks,
>>
>> jon
>>
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 0/8] docs/zh_CN: add cpu-freq translation
  2021-03-26  7:44       ` Alex Shi
@ 2021-03-26  8:25         ` Wu X.C.
  2021-03-26  8:34           ` Alex Shi
  0 siblings, 1 reply; 25+ messages in thread
From: Wu X.C. @ 2021-03-26  8:25 UTC (permalink / raw)
  To: Alex Shi, Jonathan Corbet
  Cc: Huacai Chen, Harry Wei, linux-doc, realpuyuwang, yanteng si,
	alexs, 黄江慧,
	Yanteng Si, Jiaxun Yang

在 2021/3/26 15:44, Alex Shi 写道:
> 在 2021/3/26 上午11:31, Jiaxun Yang 写道:
>>
>> On Fri, Mar 26, 2021, at 2:52 AM, Jonathan Corbet wrote:
>>> Alex Shi <alex.shi@linux.alibaba.com> writes:
>>>
>>>> Cc Wu Xiangcheng,
>>>>
>>>> Hi Yanteng,
>>>>
>>>> Thanks for your work! believe we active translators could review
>>>> for each other. :)
>>> I'd very much like to second that.  Alex has been doing a great job of
>>> reviewing these patches, but I think he deserves some help.
> Thanks for encourage, My great pleasure. :)
>
>> Hi all,
>>
>> I'm going too help with revewing as well.
> Very glad to more Chinese translators working together :)
>
>> However when reviewing these translations I found there are some inconsistencies
>> in word choices.
> Uh, generally, I am not warry about the slightly different words if they are all
> common used in computer industry or have no clearly misleading. And we still has
> chances to change inconsistency in review or by a patch.
>
>> Probably for Chinese translations we need a general golssary to help translators?
>> We can pick up a general computer dictionary as baseline and make some linux
>> addtion entries.
> I don't know if there some common acked computer dictionaries. Im afraid that the
> dictionary selection may cause much discussion and long time. :D
>
> May let's trust translators and provide better options in each of review?
There is a website called termonline.cn by CNCTST which could be used as 
a reference.
But there are still a lot of words missing.
So I support Alex Shi's view.
>
>
> BTW,
> I am leaving alibaba, this email account will be invalid soon. Please cc me at
> alexs@kernel.org or seakeel@gmail.com
Don't forget to change the Maintainer file ;)

And does Harry Wei still maintain the zh_CN translation? According to 
git log, he/she
last appear at many years ago.
Also there is a maillist for Linux group of Xi'an University of Posts and
Telecommunication marked here, seems not suitable.

Thanks
Wu X.C.
>
> Thanks
> Alex
>
>> Thanks.
>>
>> - Jiaxun
>>
>>> Thanks,
>>>
>>> jon
>>>


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 0/8] docs/zh_CN: add cpu-freq translation
  2021-03-26  8:25         ` Wu X.C.
@ 2021-03-26  8:34           ` Alex Shi
  0 siblings, 0 replies; 25+ messages in thread
From: Alex Shi @ 2021-03-26  8:34 UTC (permalink / raw)
  To: Wu X.C., Jonathan Corbet
  Cc: Huacai Chen, Harry Wei, linux-doc, realpuyuwang, yanteng si,
	alexs, 黄江慧,
	Yanteng Si, Jiaxun Yang



在 2021/3/26 下午4:25, Wu X.C. 写道:
> 在 2021/3/26 15:44, Alex Shi 写道:
>> 在 2021/3/26 上午11:31, Jiaxun Yang 写道:
>>>
>>> On Fri, Mar 26, 2021, at 2:52 AM, Jonathan Corbet wrote:
>>>> Alex Shi <alex.shi@linux.alibaba.com> writes:
>>>>
>>>>> Cc Wu Xiangcheng,
>>>>>
>>>>> Hi Yanteng,
>>>>>
>>>>> Thanks for your work! believe we active translators could review
>>>>> for each other. :)
>>>> I'd very much like to second that.  Alex has been doing a great job of
>>>> reviewing these patches, but I think he deserves some help.
>> Thanks for encourage, My great pleasure. :)
>>
>>> Hi all,
>>>
>>> I'm going too help with revewing as well.
>> Very glad to more Chinese translators working together :)
>>
>>> However when reviewing these translations I found there are some inconsistencies
>>> in word choices.
>> Uh, generally, I am not warry about the slightly different words if they are all
>> common used in computer industry or have no clearly misleading. And we still has
>> chances to change inconsistency in review or by a patch.
>>
>>> Probably for Chinese translations we need a general golssary to help translators?
>>> We can pick up a general computer dictionary as baseline and make some linux
>>> addtion entries.
>> I don't know if there some common acked computer dictionaries. Im afraid that the
>> dictionary selection may cause much discussion and long time. :D
>>
>> May let's trust translators and provide better options in each of review?
> There is a website called termonline.cn by CNCTST which could be used as a reference.
> But there are still a lot of words missing.
> So I support Alex Shi's view.
>>
>>
>> BTW,
>> I am leaving alibaba, this email account will be invalid soon. Please cc me at
>> alexs@kernel.org or seakeel@gmail.com
> Don't forget to change the Maintainer file ;)

I will, thanks for reminder!

> 
> And does Harry Wei still maintain the zh_CN translation? According to git log, he/she
> last appear at many years ago.
> Also there is a maillist for Linux group of Xi'an University of Posts and
> Telecommunication marked here, seems not suitable.

You could send a mail to update MAINTAINER file, also please cc Harry Wei. :)

Thanks!

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/8] docs/zh_CN: add cpu-freq core.rst translation
  2021-03-26  3:12   ` Jiaxun Yang
@ 2021-03-27  2:13     ` yanteng si
  2021-03-29 12:24     ` yanteng si
  1 sibling, 0 replies; 25+ messages in thread
From: yanteng si @ 2021-03-27  2:13 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: Yanteng Si, Jonathan Corbet, Alex Shi, Huacai Chen, Harry Wei,
	linux-doc, Puyu Wang

Jiaxun Yang <jiaxun.yang@flygoat.com> 于2021年3月26日周五 上午11:13写道:
>
>
>
> On Wed, Mar 24, 2021, at 11:07 PM, Yanteng Si wrote:
> > This patch translates Documention/cpu-freq/core.rst into Chinese.
> >
> > Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> > ---
> >  .../translations/zh_CN/cpu-freq/core.rst      | 105 ++++++++++++++++++
> >  1 file changed, 105 insertions(+)
> >  create mode 100644 Documentation/translations/zh_CN/cpu-freq/core.rst
> >
> > diff --git a/Documentation/translations/zh_CN/cpu-freq/core.rst
> > b/Documentation/translations/zh_CN/cpu-freq/core.rst
> > new file mode 100644
> > index 000000000000..1571087c2581
> > --- /dev/null
> > +++ b/Documentation/translations/zh_CN/cpu-freq/core.rst
> > @@ -0,0 +1,105 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +.. include:: ../disclaimer-zh_CN.rst
> > +
> > +:Original: :doc:`../../../cpu-freq/core`
> > +:Translator: Yanteng Si <siyanteng@loongson.cn>
> > +
> > +.. _cn_core.rst:
> > +
> > +
> > +====================================
> > +CPUFreq核心和CPUFreq通知器的一般说明
> > +====================================
>
> 一般 -> 通用?
OK!
>
> > +
> > +作者:
> > +     - Dominik Brodowski  <linux@brodo.de>
> > +     - David Kimdon <dwhedon@debian.org>
> > +     - Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > +     - Viresh Kumar <viresh.kumar@linaro.org>
> > +
> > +.. 目录:
> > +
> > +   1.  CPUFreq核心和接口
> > +   2.  CPUFreq通知器
> > +   3.  含有Operating Performance Point (OPP)的CPUFreq表的生成
> > +
> > +1. CPUFreq核心和接口
> > +======================
> > +
> > +cpufreq核心代码位于drivers/cpufreq/cpufreq.c中。这些cpufreq代码为CPUFreq架构的驱
> > +动程序(那些进行实际频率转换的代码)以及 "通知器 "提供了一个标准化的接口。
>
> 那些操作硬件切换频率的代码 will help with understanding.
OK!
>
>
> > +这些是设备驱动程序或需要了解策略变化的其它内核部分(如 ACPI 等热模块)或所有频率更改(除
> Add sbject "通知器"
> 热模块 seems bogus, 热量管理?
OK!
>“
> > +计时代码外),甚至需要强制确定速度限制(如 ARM 架构上的 LCD 驱动程序)。
> > +此外, 内核 "常数" loops_per_jiffy会根据频率变化而更新。
> > +
> > +cpufreq策略的引用计数由 cpufreq_cpu_get 和 cpufreq_cpu_put 来完成,以确保 cpufreq 驱
> > +动程序被正确地注册到核心中,并且在 cpufreq_put_cpu 被调用之前不会被卸载。这也保证了各自的
> > +cpufreq 策略在使用时不会被释放。
>
> It makes me "Parser error" when reading.....
emmmm. I guess "cpufreq_put_cpu -> cpufreq_cpu_put,"
Maybe I should revise the original draft first。

as for "Parser error"
+cpufreq策略的引用计数由 cpufreq_cpu_get 和 cpufreq_cpu_put 来完成,以确保 cpufreq 驱
+动程序被正确地注册到核心中,并且驱动程序在 cpufreq_cpu_put 被调用之前不会被卸载。这也保证了每个核的
+cpufreq 策略在使用时不会被释放。
OK?:)

>
> > +
> > +2. CPUFreq 通知器
> > +====================
> > +
> > +CPUFreq通知器符合标准的内核通知器接口。
> > +关于通知器的细节请参阅 linux/include/linux/notifier.h。
> > +
> > +这里有两个不同的CPUfreq通知器 - 策略通知器和转换通知器。
> > +
> > +
> > +2.1 CPUFreq策略通知器
> > +----------------------------
> > +
> > +当创建或移除策略时,这些都会被通知。
> > +
> > +阶段是在通知器的第二个参数中指定的。当第一次创建策略时,阶段是CPUFREQ_CREATE_POLICY,当
> > +策略被移除时,阶段是CPUFREQ_REMOVE_POLICY。
> > +
> > +第三个参数 ``void *pointer`` 指向一个结构体cpufreq_policy,其包括min,max(新策略的下限和
> > +上限(单位为kHz))这几个值。
> > +
> > +
> > +2.2 CPUFreq转换通知器
> > +--------------------------------
> > +
> > +当CPUfreq驱动切换CPU核心频率时,策略中的每个在线CPU都会收到两次通知,这些变化没有任何外部干
> > +预。
> > +
> > +第二个参数指定阶段 - CPUFREQ_PRECHANGE or CPUFREQ_POSTCHANGE.
> > +
> > +第三个参数是一个包含如下值的结构体cpufreq_freqs:
> > +
> > +=====        ====================
> > +cpu  受影响cpu的编号
> > +old  旧频率
> > +new  新频率
> > +flags        cpufreq驱动的标志
> > +=====        ====================
> > +
> > +3. 含有Operating Performance Point (OPP)的CPUFreq表的生成
> > +==================================================================
> > +关于OPP的细节请参阅 Documentation/power/opp.rst
> > +
> > +dev_pm_opp_init_cpufreq_table -
> > +     这个功能提供了一个随时可用的转换程序,用来将OPP层关于可用频率的内部信息翻译成一种容易提供给
> > +     cpufreq的格式。
> > +
> > +     .. Warning::
> > +
> > +             不要在中断上下文中使用此函数。
> > +
> > +     例如::
> > +
> > +      soc_pm_init()
> > +      {
> > +             /* Do things */
> > +             r = dev_pm_opp_init_cpufreq_table(dev, &freq_table);
> > +             if (!r)
> > +                     policy->freq_table = freq_table;
> > +             /* Do other things */
> > +      }
> > +
> > +     .. note::
> > +
> > +             该函数只有在CONFIG_PM_OPP之外还启用了CONFIG_CPU_FREQ时才可用。
> > +
> > +dev_pm_opp_free_cpufreq_table
> > +     释放dev_pm_opp_init_cpufreq_table分配的表。
> > --
> > 2.25.1
> >
> >
>
> --
> - Jiaxun

Yan teng

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/8] docs/zh_CN: add cpu-freq cpu-drivers.rst translation
  2021-03-26  5:21   ` Wu X.C.
@ 2021-03-27  3:03     ` teng sterling
  2021-03-27 10:32       ` Wu X.C.
  0 siblings, 1 reply; 25+ messages in thread
From: teng sterling @ 2021-03-27  3:03 UTC (permalink / raw)
  To: Wu X.C.
  Cc: Yanteng Si, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, Yanteng Si, Jonathan Corbet, alexs

Wu X.C. <bobwxc@email.cn> 于2021年3月26日周五 下午1:23写道:
>
>
>
> 在 2021/3/24 23:07, Yanteng Si 写道:
> > This patch translates Documention/cpu-freq/cpu-drivers.rst into Chinese.
> >
> > Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> > ---
> >   .../zh_CN/cpu-freq/cpu-drivers.rst            | 259 ++++++++++++++++++
> >   1 file changed, 259 insertions(+)
> >   create mode 100644 Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
> >
> > diff --git a/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
> > new file mode 100644
> > index 000000000000..27a70f3a9938
> > --- /dev/null
> > +++ b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
> > @@ -0,0 +1,259 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +.. include:: ../disclaimer-zh_CN.rst
> > +
> > +:Original: :doc:`../../../cpu-freq/cpu-drivers`
> > +:Translator: Yanteng Si <siyanteng@loongson.cn>
> > +
> > +.. _cn_cpu-drivers.rst:
> > +
> > +
> > +=======================================
> > +如何实现一个新的CPUFreq处理器驱动程序?
> > +=======================================
> > +
> > +作者:
> > +
> > +
> > +     - Dominik Brodowski  <linux@brodo.de>
> > +     - Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > +     - Viresh Kumar <viresh.kumar@linaro.org>
> > +
> > +.. Contents
> > +
> > +   1.   怎么做?
> > +   1.1  初始化
> > +   1.2  Per-CPU 初始化
> > +   1.3  验证
> > +   1.4  target 或 target_index 或 setpolicy?
> target/target_index 或 setpolicy?
OK!
> > +   1.5  target/target_index
> > +   1.6  setpolicy
> > +   1.7  get_intermediate 与 target_intermediate
> > +   2.   频率表助手
> > +
> > +
> > +
> > +1. 怎么做?
> > +===========
> > +
> > +如此,你刚刚得到了一个全新的CPU/芯片组与数据表,并希望为这个CPU/芯片组添加cpufreq
> 及其数据手册(datasheet),
OK!
> > +支持?很好,这里有一些至关重要的提示:
> > +
> > +
> > +1.1 初始化
> > +----------
> > +
> > +首先,在__initcall_level_7 (module_init())或更靠后的函数中检查这个内核是否
> > +运行在正确的CPU和正确的芯片组上。如果是,则使用cpufreq_register_driver()向
> > +CPUfreq核心层注册一个cpufreq_driver结构体。
> > +
> > +结构体cpufreq_driver应该包含什么成员?
> > +
> > + .name - 驱动的名字。
> > +
> > + .init - 一个指向per-policy初始化函数的指针。
> > +
> > + .verify - 一个指向"verification"函数的指针。
> > +
> > + .setpolicy 或 .fast_switch 或 .target 或 .target_index - 差异见
> > + 下文。
> > +
> > +并且可选择
> > +
> > + .flags - cpufreq核的提示。
> > +
> > + .driver_data - cpufreq驱动程序的特定数据。
> > +
> > + .resolve_freq - 返回最适合目标频率的频率。不过并不能改变频率。
> > +
> > + .get_intermediate and target_intermediate - 用于在改变CPU频率时切换到稳定
> 和
?
> > + 的频率。
> > +
> > + .get - 返回CPU的当前频率。
> > +
> > + .bios_limit - 返回HW/BIOS对CPU的最大频率限制值。
> > +
> > + .exit - 一个指向per-policy清理函数的指针,该函数在cpu热插拔过程的CPU_POST_DEAD
> > + 阶段被调用。
> > +
> > + .stop_cpu - 一个指向per-policy停止函数的指针,该函数在cpu热插拔过程的CPU_DOWN_PREPARE
> > + 阶段被调用。
> > +
> > + .suspend - 一个指向per-policy暂停函数的指针,该函数在关中断且在该策略的调节器停止
> > + 后被调用。
> > +
> > + .resume - 一个指向per-policy恢复函数的指针,该函数在关中断且在调节器再一次开始前被
> > + 调用。
> > +
> > + .ready - 一个指向per-policy准备函数的指针,该函数在策略完全初始化之后被调用。
> > +
> > + .attr - 一个指向NULL结尾的"struct freq_attr"列表的指针,该函数允许导出值到
> > + sysfs。
> > +
> > + .boost_enabled - 如果设置,则启用提升频率。
> 括注 boost
?
> > +
> > + .set_boost - 一个指向per-policy函数的指针,该函数用来开启/关闭提升频率功能。
> > +
> > +
> > +1.2 Per-CPU 初始化
> > +------------------
> > +
> > +每当一个新的CPU被注册到设备模型中,或者在cpufreq驱动注册自己之后,如果CPU不存在cpufreq
> 如果此CPU的cpufreq策略不存在
> > +策略,则会调用每个策略的初始化函数cpufreq_driver.init。请注意, .init() 和 .exit()例程
> per-policy
>
> routines  程序
OK!
> > +只对策略调用一次,而不是对策略管理的每个CPU调用一次。它需要一个 ``struct cpufreq_policy
> > +*policy`` 作为参数。现在该怎么做呢?
> > +
> > +如果有必要,请在你的CPU上激活CPUfreq功能支持。
> > +
> > +然后,驱动程序必须填写以下数值:
> > +
> > ++-----------------------------------+--------------------------------------+
> > +|policy->cpuinfo.min_freq _and_          |                                      |
> 和
> > +|policy->cpuinfo.max_freq        | 该CPU支持的最低和最高频率(kHz)。   |
> remove “。”
OK!
> > +|                                |                                      |
> > +|                                |                                      |
> > ++-----------------------------------+--------------------------------------+
> > +|policy->cpuinfo.transition_latency |                                      |
> > +|                                | CPU在两个频率之间切换所需的时间,以  |
> > +|                                | 纳秒为单位(如果适用,否则指定       |
> 如适用,
OK!
> > +|                                | CPUFREQ_ETERNAL)                    |
> > ++-----------------------------------+--------------------------------------+
> > +|policy->cur                     | 该CPU当前的工作频率(如适用)          |
> > +|                                |                                      |
> > ++-----------------------------------+--------------------------------------+
> > +|policy->min,                            |                                      |
> > +|policy->max,                            |                                      |
> > +|policy->policy and, if necessary,  |                                           |
> > +|policy->governor                | 必须包含该cpu的 “默认策略”,片刻后。 |
> 。稍后会用这些值调用
OK!
> > +|                                | 用这些值调用                         |
> > +|                                | cpufreq_driver.verify and either     |
> > +|                                | cpufreq_driver.setpolicy or          |
> > +|                                | cpufreq_driver.target/target_index   |
> > +|                                |                                      |
> > ++-----------------------------------+--------------------------------------+
> > +|policy->cpus                            | 用与这个CPU一起做DVFS的(在线+离线)   |
> > +|                                | CPU(即与它共享时钟/电压轨)的掩码更新 |
> > +|                                | 这个                                 |
> > +|                                |                                      |
> > ++-----------------------------------+--------------------------------------+
> > +
> > +对于设置其中的一些值(cpuinfo.min[max]_freq, policy->min[max]),频率表助手可能会有帮
> > +助。关于它们的更多信息,请参见第2节。
> > +
> > +
> > +1.3 验证
> > +--------
> > +
> > +当用户决定设置一个新的策略(由 "policy,governor,min,max "组成)时,必须对这个策略进行验证,
> 引号内多余空格,或请用全角引号
OK!
> > +以便纠正不兼容的值。为了验证这些值,cpufreq_verify_within_limits(``struct cpufreq_policy
> > +*policy``, ``unsigned int min_freq``, ``unsigned int max_freq``)函数可能会有帮助。
> > +关于频率表助手的详细内容请参见第2节。
> > +
> > +您需要确保至少有一个有效频率(或工作范围)在 policy->min 和 policy->max 范围内。如果有必
> > +要,先增加policy->max,只有在没有办法的情况下,才减少policy->min。
> > +
> > +
> > +1.4 target 或 target_index 或 setpolicy 或 fast_switch?
> > +-------------------------------------------------------
> > +
> > +大多数cpufreq驱动甚至大多数cpu频率升降算法只允许将CPU频率设置为预定义的固定值。对于这些,你
> > +可以使用->target(),->target_index()或->fast_switch()回调。
> > +
> > +有些cpufreq功能的处理器可以自己在某些限制之间切换频率。这些应使用->setpolicy()回调。
> > +
> > +
> > +1.5. target/target_index
> > +------------------------
> > +
> > +target_index调用有两个参数。``struct cpufreq_policy * policy``,和``unsigned int``
> s/。/:/
> 删除 ,
OK!
> > +索引(进入陈述的频率表)。
> into the exposed frequency table
> 陈述?
列出?
> > +
> > +当调用这里时,CPUfreq驱动必须设置新的频率。实际频率必须由freq_table[index].frequency决定。
> > +
> > +它应该总是在错误的情况下恢复到早期的频率(即policy->restore_freq),即使我们之前切换到中间频率。
> 早期  之前的
OK!
> > +
> > +Deprecated
> 已弃用
OK!
> > +----------
> > +目标调用有三个参数。``struct cpufreq_policy * policy``, unsigned int target_frequency,
> > +unsigned int relation.
> > +
> > +CPUfreq驱动在调用这里时必须设置新的频率。实际的频率必须使用以下规则来确定。
> > +
> > +- 紧跟 "目标频率"。
> > +- policy->min <= new_freq <= policy->max (这必须是有效的!!!)
> > +- 如果 relation==CPUFREQ_REL_L,尝试选择一个高于或等于 target_freq 的 new_freq。("L代表
> > +  最低,但不能低于")
> > +- 如果 relation==CPUFREQ_REL_H,尝试选择一个低于或等于 target_freq 的 new_freq。("H代表
> > +  最高,但不能高于")
> > +
> > +这里,频率表助手可能会帮助你--详见第2节。
> > +
> > +1.6. fast_switch
> > +----------------
> > +
> > +这个函数用于从调度器的上下文进行频率切换。并非所有的驱动都要实现它,因为不允许在这个回调中睡眠。这
> > +个回调必须经过高度优化,以尽可能快地进行切换。
> > +
> > +这个函数有两个参数: ``struct cpufreq_policy *policy`` 和 ``unsigned int target_frequency``.
> 句号
OK!
> > +
> > +
> > +1.7 setpolicy
> > +-------------
> > +
> > +setpolicy调用只需要一个``struct cpufreq_policy * policy``作为参数。需要将处理器内或芯片组内动态频
> > +率切换的下限设置为policy->min,上限设置为policy->max,如果支持的话,当policy->policy为
> > +CPUFREQ_POLICY_PERFORMANCE时选择面向性能的设置,当CPUFREQ_POLICY_POWERSAVE时选择面向省电的设置。
> > +也可以查看drivers/cpufreq/longrun.c中的参考实现。
> > +
> > +1.8 get_intermediate and target_intermediate
> 和
OK!
> > +--------------------------------------------
> > +
> > +仅适用于 target_index() 和 CPUFREQ_ASYNC_NOTIFICATION 未设置的驱动。
> > +
> > +get_intermediate应该返回一个平台想要切换到的稳定的中间频率,target_intermediate()应该将CPU设置为
> > +该频率,然后再跳转到'index'对应的频率。核心会负责发送通知,驱动不必在target_intermediate()或
> > +target_index()中处理。
> > +
> > +在驱动程序不想因为某个目标频率切换到中间频率的情况下,它们可以从get_intermediate()中返回'0'。在这种情况
> > +下,核心将直接调用->target_index()。
> > +
> > +注意:->target_index()应该在失败的情况下恢复到policy->restore_freq,因为core会为此发送通知。
> > +
> > +
> > +2. 频率表助手
> > +=============
> > +
> > +由于大多数cpufreq处理器只允许被设置为几个特定的频率,因此,一个带有一些函数的 "频率表 "可能会辅助处理器驱动
> 如果都是中文,请用全角引号
> > +程序的一些工作。这样的 "频率表" 由一个cpufreq_frequency_table条目构成的数组组成,"driver_data" 中包
> > +含了驱动程序的具体数值,"frequency" 中包含了相应的频率,并设置了标志。在表的最后,需要添加一个
> > +cpufreq_frequency_table条目,频率设置为CPUFREQ_TABLE_END。而如果想跳过表中的一个条目,则将频率设置为
> > +CPUFREQ_ENTRY_INVALID。这些条目不需要按照任何特定的顺序排序,但如果它们是cpufreq core会对它们进行快速的DVFS,
> core是否翻译请统一
core -> 核心
OK!
> > +因为搜索最佳匹配会更快。
> > +
> > +如果策略在其policy->freq_table字段中包含一个有效的指针,cpufreq表就会被核心自动验证。
> > +
> > +cpufreq_frequency_table_verify()保证至少有一个有效的频率在policy->min和policy->max范围内,并且所有其他
> > +标准都被满足。这对->验证调用很有帮助。
> the ->verify call
验证 -> verify
OK!
> > +
> > +cpufreq_frequency_table_target()是对应于->target阶段的频率表助手。只要把数值传递给这个函数,这个函数就会返
> > +回包含CPU要设置的频率的频率表条目。
> > +
> > +以下宏可以作为cpufreq_frequency_table的迭代器。
> > +
> > +cpufreq_for_each_entry(pos, table) - 遍历频率表的所有条目。
> > +
> > +cpufreq_for_each_valid_entry(pos, table) - 遍历所有条目,不包括CPUFREQ_ENTRY_INVALID频率。
> > +使用参数 "pos"--一个``cpufreq_frequency_table * `` 作为循环游标,使用参数 "table"--你想迭代
> 单连字符
>
OK!
> 这句话读不太通
code:
#define cpufreq_for_each_entry(pos, table)      \
         for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)

 "pos"--``cpufreq_frequency_table * ``用途是作为循环游标(循环计数,just like "i++")
 "table"--你想迭代的``cpufreq_frequency_table * `` 。
I surrender, do you have a more appropriate expression?:)
> > +的``cpufreq_frequency_table * `` 。
> > +
> > +例如::
> > +
> > +     struct cpufreq_frequency_table *pos, *driver_freq_table;
> > +
> > +     cpufreq_for_each_entry(pos, driver_freq_table) {
> > +             /* Do something with pos */
> > +             pos->frequency = ...
> > +     }
> > +
> > +  如果你需要在driver_freq_table中处理pos的位置,不要减去指针,因为它的代价相当高。相反,使用宏
> 开头空格多余
OK!
> > +  cpufreq_for_each_entry_idx() 和 cpufreq_for_each_valid_entry_idx() 。
> Thanks!
>
Sorry! I forgot to CC alexs@kernel.org when I replied to the email
[PATCH 1/8] T_T

Thanks!

Yan teng

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 3/8] docs/zh_CN: add cpu-freq cpufreq-stats.rst translation
  2021-03-26  4:16   ` Wu X.C.
@ 2021-03-27  3:13     ` yanteng si
  2021-03-27 10:38       ` Wu X.C.
  0 siblings, 1 reply; 25+ messages in thread
From: yanteng si @ 2021-03-27  3:13 UTC (permalink / raw)
  To: Wu X.C.
  Cc: Yanteng Si, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, Puyu Wang, Jonathan Corbet, alexs

Wu X.C. <bobwxc@email.cn> 于2021年3月26日周五 下午12:16写道:
>
>
> 在 2021/3/24 23:07, Yanteng Si 写道:
> > This patch translates Documention/cpu-freq/cpufreq-stats.rst into Chinese.
> >
> > Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> > ---
> >   .../zh_CN/cpu-freq/cpufreq-stats.rst          | 130 ++++++++++++++++++
> >   1 file changed, 130 insertions(+)
> >   create mode 100644 Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
> >
> > diff --git a/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst b/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
> > new file mode 100644
> > index 000000000000..d21a317d9659
> > --- /dev/null
> > +++ b/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
> > @@ -0,0 +1,130 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +.. include:: ../disclaimer-zh_CN.rst
> > +
> > +:Original: :doc:`../../../cpu-freq/cpufreq-stats`
> > +:Translator: Yanteng Si <siyanteng@loongson.cn>
> > +
> > +.. _cn_cpufreq-stats.rst:
> > +
> > +
> > +==========================================
> > +sysfs CPUFreq Stats的一般说明
> > +==========================================
> > +
> > +用户信息
> > +
> > +
> > +作者: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
> > +
> > +.. Contents
> > +
> > +   1. 简介
> > +   2. 提供的统计数据(举例说明)
> > +   3. 配置cpufreq-stats
> > +
> > +
> > +1. 简介
> > +===============
> > +
> > +cpufreq-stats是一个为每个CPU提供CPU频率统计的驱动。
> > +这些统计数据在/sysfs中以一堆只读接口的形式提供。这个接口(配置好后)将出现在
> 在配置好后
OK!
> > +/sysfs(<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/)中cpufreq下的一个单
> > +独的目录中,提供给每个CPU。
> > +各种统计数据将在此目录下形成只读文件。
> > +
> > +这个驱动的设计是独立于任何特定的cpufreq_driver的。可能在你的CPU上运行。因此,它将与所有
> 此驱动是独立于任何可能运行在你所用CPU上的特定cpufreq_driver而设计的。
OK!
> > +cpufreq_driver一起工作。
> > +
> > +
> > +2. 提供的统计数据(举例说明)
> > +=====================================
> > +
> > +cpufreq stats提供了以下统计数据(在下面详细解释)。
> > +
> > +-  time_in_state
> > +-  total_trans
> > +-  trans_table
> > +
> > +所有的统计数据将从统计驱动被插入的时间(或统计被重置的时间)开始,到某一统计数据被读取的时间为止。
> 插入 use 载入?or another better word?
I like "载入"
OK!
> > +显然,统计驱动不会有任何关于统计驱动插入之前的频率转换信息。
> > +
> > +::
> > +
> > +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
> > +    total 0
> > +    drwxr-xr-x  2 root root    0 May 14 16:06 .
> > +    drwxr-xr-x  3 root root    0 May 14 15:58 ..
> > +    --w-------  1 root root 4096 May 14 16:06 reset
> > +    -r--r--r--  1 root root 4096 May 14 16:06 time_in_state
> > +    -r--r--r--  1 root root 4096 May 14 16:06 total_trans
> > +    -r--r--r--  1 root root 4096 May 14 16:06 trans_table
> > +
> > +- **reset**
> > +
> > +只写属性,可用于重置统计计数器。这对于评估不同调节器下的系统行为非常有用,且无需重启。
> > +
> > +
> > +- **time_in_state**
> > +
> > +这就给出了这个CPU所支持的每个频率所花费的时间。cat输出的每一行都会有"<frequency>
> 此项给出了…
OK!
> > +<time>"对,表示这个CPU在<frequency>上花费了<time>个usertime单位的时间。这里的
> > +usertime单位是10mS(类似于/proc中输出的其他时间)。
> > +
> > +::
> > +
> > +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state
> > +    3600000 2089
> > +    3400000 136
> > +    3200000 34
> > +    3000000 67
> > +    2800000 172488
> > +
> > +
> > +- **total_trans**
> > +
> > +给出了这个CPU上频率转换的总次数。cat的输出将有一个单一的计数,这就是频率转换的总数。
> > +
> > +::
> > +
> > +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans
> > +    20
> > +
> > +- **trans_table**
> > +
> > +这将提供所有CPU频率转换的细粒度信息。这里的cat输出是一个二维矩阵,其中一个条目<i, j>(第
> > +i行,第j列)代表从Freq_i到Freq_j的转换次数。Freq_i行和Freq_j列遵循驱动最初提供给cpufreq
> > +核的频率表的排序顺序,因此可以排序(升序或降序)或不排序。 这里的输出也包含了每行每列的实际
> 排列顺序
?
> > +频率值,以便更好地阅读。
> > +
> > +如果转换表大于PAGE_SIZE,读取时将返回一个-EFBIG错误。
> > +
> > +::
> > +
> > +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table
> > +    From  :    To
> > +         :   3600000   3400000   3200000   3000000   2800000
> > +    3600000:         0         5         0         0         0
> > +    3400000:         4         0         2         0         0
> > +    3200000:         0         1         0         2         0
> > +    3000000:         0         0         1         0         3
> > +    2800000:         0         0         0         2         0
> > +
> > +3. 配置cpufreq-stats
> > +============================
> > +
> > +要在你的内核中配置cpufreq-stats。::
> remove the “。”
OK!
> > +
> > +     Config Main Menu
> > +             Power management options (ACPI, APM)  --->
> > +                     CPU Frequency scaling  --->
> > +                             [*] CPU Frequency scaling
> > +                             [*]   CPU frequency translation statistics
> > +
> > +
> > +"CPU Frequency scaling" (CONFIG_CPU_FREQ) 应该被启用以配置cpufreq-stats。
> > +
> > +"CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT)提供了包括
> > +time_in_state、total_trans和trans_table的统计数据。
> > +
> > +一旦启用了这个选项,并且你的CPU支持cpufrequency,你就可以在/sysfs中看到CPU频率统计。
> Thanks!
>
Thanks!

Yanteng

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/8] docs/zh_CN: add cpu-freq cpu-drivers.rst translation
  2021-03-27  3:03     ` teng sterling
@ 2021-03-27 10:32       ` Wu X.C.
  0 siblings, 0 replies; 25+ messages in thread
From: Wu X.C. @ 2021-03-27 10:32 UTC (permalink / raw)
  To: teng sterling
  Cc: Yanteng Si, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, realpuyuwang, Yanteng Si, Jonathan Corbet, alexs

在 2021/3/27 11:03, teng sterling 写道:
> Wu X.C. <bobwxc@email.cn> 于2021年3月26日周五 下午1:23写道:
>>
>>
>> 在 2021/3/24 23:07, Yanteng Si 写道:
>>> This patch translates Documention/cpu-freq/cpu-drivers.rst into Chinese.
>>>
>>> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
>>> ---
>>>    .../zh_CN/cpu-freq/cpu-drivers.rst            | 259 ++++++++++++++++++
>>>    1 file changed, 259 insertions(+)
>>>    create mode 100644 Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
>>>
>>> diff --git a/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
>>> new file mode 100644
>>> index 000000000000..27a70f3a9938
>>> --- /dev/null
>>> +++ b/Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst
>>> @@ -0,0 +1,259 @@
>>> +.. SPDX-License-Identifier: GPL-2.0
>>> +
>>> +.. include:: ../disclaimer-zh_CN.rst
>>> +
>>> +:Original: :doc:`../../../cpu-freq/cpu-drivers`
>>> +:Translator: Yanteng Si <siyanteng@loongson.cn>
>>> +
>>> +.. _cn_cpu-drivers.rst:
>>> +
>>> +
>>> +=======================================
>>> +如何实现一个新的CPUFreq处理器驱动程序?
>>> +=======================================
>>> +
>>> +作者:
>>> +
>>> +
>>> +     - Dominik Brodowski  <linux@brodo.de>
>>> +     - Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>> +     - Viresh Kumar <viresh.kumar@linaro.org>
>>> +
>>> +.. Contents
>>> +
>>> +   1.   怎么做?
>>> +   1.1  初始化
>>> +   1.2  Per-CPU 初始化
>>> +   1.3  验证
>>> +   1.4  target 或 target_index 或 setpolicy?
>> target/target_index 或 setpolicy?
> OK!
>>> +   1.5  target/target_index
>>> +   1.6  setpolicy
>>> +   1.7  get_intermediate 与 target_intermediate
>>> +   2.   频率表助手
>>> +
>>> +
>>> +
>>> +1. 怎么做?
>>> +===========
>>> +
>>> +如此,你刚刚得到了一个全新的CPU/芯片组与数据表,并希望为这个CPU/芯片组添加cpufreq
>> 及其数据手册(datasheet),
> OK!
>>> +支持?很好,这里有一些至关重要的提示:
>>> +
>>> +
>>> +1.1 初始化
>>> +----------
>>> +
>>> +首先,在__initcall_level_7 (module_init())或更靠后的函数中检查这个内核是否
>>> +运行在正确的CPU和正确的芯片组上。如果是,则使用cpufreq_register_driver()向
>>> +CPUfreq核心层注册一个cpufreq_driver结构体。
>>> +
>>> +结构体cpufreq_driver应该包含什么成员?
>>> +
>>> + .name - 驱动的名字。
>>> +
>>> + .init - 一个指向per-policy初始化函数的指针。
>>> +
>>> + .verify - 一个指向"verification"函数的指针。
>>> +
>>> + .setpolicy 或 .fast_switch 或 .target 或 .target_index - 差异见
>>> + 下文。
>>> +
>>> +并且可选择
>>> +
>>> + .flags - cpufreq核的提示。
>>> +
>>> + .driver_data - cpufreq驱动程序的特定数据。
>>> +
>>> + .resolve_freq - 返回最适合目标频率的频率。不过并不能改变频率。
>>> +
>>> + .get_intermediate and target_intermediate - 用于在改变CPU频率时切换到稳定
>> 和
> ?
I mean the "and" seems need translate.
>>> + 的频率。
>>> +
>>> + .get - 返回CPU的当前频率。
>>> +
>>> + .bios_limit - 返回HW/BIOS对CPU的最大频率限制值。
>>> +
>>> + .exit - 一个指向per-policy清理函数的指针,该函数在cpu热插拔过程的CPU_POST_DEAD
>>> + 阶段被调用。
>>> +
>>> + .stop_cpu - 一个指向per-policy停止函数的指针,该函数在cpu热插拔过程的CPU_DOWN_PREPARE
>>> + 阶段被调用。
>>> +
>>> + .suspend - 一个指向per-policy暂停函数的指针,该函数在关中断且在该策略的调节器停止
>>> + 后被调用。
>>> +
>>> + .resume - 一个指向per-policy恢复函数的指针,该函数在关中断且在调节器再一次开始前被
>>> + 调用。
>>> +
>>> + .ready - 一个指向per-policy准备函数的指针,该函数在策略完全初始化之后被调用。
>>> +
>>> + .attr - 一个指向NULL结尾的"struct freq_attr"列表的指针,该函数允许导出值到
>>> + sysfs。
>>> +
>>> + .boost_enabled - 如果设置,则启用提升频率。
>> 括注 boost
> ?
则启用提升(boost)频率
>>> +
>>> + .set_boost - 一个指向per-policy函数的指针,该函数用来开启/关闭提升频率功能。
>>> +
>>> +
>>> +1.2 Per-CPU 初始化
>>> +------------------
>>> +
>>> +每当一个新的CPU被注册到设备模型中,或者在cpufreq驱动注册自己之后,如果CPU不存在cpufreq
>> 如果此CPU的cpufreq策略不存在
>>> +策略,则会调用每个策略的初始化函数cpufreq_driver.init。请注意, .init() 和 .exit()例程
>> per-policy
>>
>> routines  程序
> OK!
>>> +只对策略调用一次,而不是对策略管理的每个CPU调用一次。它需要一个 ``struct cpufreq_policy
>>> +*policy`` 作为参数。现在该怎么做呢?
>>> +
>>> +如果有必要,请在你的CPU上激活CPUfreq功能支持。
>>> +
>>> +然后,驱动程序必须填写以下数值:
>>> +
>>> ++-----------------------------------+--------------------------------------+
>>> +|policy->cpuinfo.min_freq _and_          |                                      |
>> 和
>>> +|policy->cpuinfo.max_freq        | 该CPU支持的最低和最高频率(kHz)。   |
>> remove “。”
> OK!
>>> +|                                |                                      |
>>> +|                                |                                      |
>>> ++-----------------------------------+--------------------------------------+
>>> +|policy->cpuinfo.transition_latency |                                      |
>>> +|                                | CPU在两个频率之间切换所需的时间,以  |
>>> +|                                | 纳秒为单位(如果适用,否则指定       |
>> 如适用,
> OK!
>>> +|                                | CPUFREQ_ETERNAL)                    |
>>> ++-----------------------------------+--------------------------------------+
>>> +|policy->cur                     | 该CPU当前的工作频率(如适用)          |
>>> +|                                |                                      |
>>> ++-----------------------------------+--------------------------------------+
>>> +|policy->min,                            |                                      |
>>> +|policy->max,                            |                                      |
>>> +|policy->policy and, if necessary,  |                                           |
>>> +|policy->governor                | 必须包含该cpu的 “默认策略”,片刻后。 |
>> 。稍后会用这些值调用
> OK!
>>> +|                                | 用这些值调用                         |
>>> +|                                | cpufreq_driver.verify and either     |
>>> +|                                | cpufreq_driver.setpolicy or          |
>>> +|                                | cpufreq_driver.target/target_index   |
>>> +|                                |                                      |
>>> ++-----------------------------------+--------------------------------------+
>>> +|policy->cpus                            | 用与这个CPU一起做DVFS的(在线+离线)   |
>>> +|                                | CPU(即与它共享时钟/电压轨)的掩码更新 |
>>> +|                                | 这个                                 |
>>> +|                                |                                      |
>>> ++-----------------------------------+--------------------------------------+
>>> +
>>> +对于设置其中的一些值(cpuinfo.min[max]_freq, policy->min[max]),频率表助手可能会有帮
>>> +助。关于它们的更多信息,请参见第2节。
>>> +
>>> +
>>> +1.3 验证
>>> +--------
>>> +
>>> +当用户决定设置一个新的策略(由 "policy,governor,min,max "组成)时,必须对这个策略进行验证,
>> 引号内多余空格,或请用全角引号
> OK!
>>> +以便纠正不兼容的值。为了验证这些值,cpufreq_verify_within_limits(``struct cpufreq_policy
>>> +*policy``, ``unsigned int min_freq``, ``unsigned int max_freq``)函数可能会有帮助。
>>> +关于频率表助手的详细内容请参见第2节。
>>> +
>>> +您需要确保至少有一个有效频率(或工作范围)在 policy->min 和 policy->max 范围内。如果有必
>>> +要,先增加policy->max,只有在没有办法的情况下,才减少policy->min。
>>> +
>>> +
>>> +1.4 target 或 target_index 或 setpolicy 或 fast_switch?
>>> +-------------------------------------------------------
>>> +
>>> +大多数cpufreq驱动甚至大多数cpu频率升降算法只允许将CPU频率设置为预定义的固定值。对于这些,你
>>> +可以使用->target(),->target_index()或->fast_switch()回调。
>>> +
>>> +有些cpufreq功能的处理器可以自己在某些限制之间切换频率。这些应使用->setpolicy()回调。
>>> +
>>> +
>>> +1.5. target/target_index
>>> +------------------------
>>> +
>>> +target_index调用有两个参数。``struct cpufreq_policy * policy``,和``unsigned int``
>> s/。/:/
>> 删除 ,
> OK!
>>> +索引(进入陈述的频率表)。
>> into the exposed frequency table
>> 陈述?
> 列出?
(于列出的的频率表)

How about this? A little hard to translate :/
>>> +
>>> +当调用这里时,CPUfreq驱动必须设置新的频率。实际频率必须由freq_table[index].frequency决定。
>>> +
>>> +它应该总是在错误的情况下恢复到早期的频率(即policy->restore_freq),即使我们之前切换到中间频率。
>> 早期  之前的
> OK!
>>> +
>>> +Deprecated
>> 已弃用
> OK!
>>> +----------
>>> +目标调用有三个参数。``struct cpufreq_policy * policy``, unsigned int target_frequency,
>>> +unsigned int relation.
>>> +
>>> +CPUfreq驱动在调用这里时必须设置新的频率。实际的频率必须使用以下规则来确定。
>>> +
>>> +- 紧跟 "目标频率"。
>>> +- policy->min <= new_freq <= policy->max (这必须是有效的!!!)
>>> +- 如果 relation==CPUFREQ_REL_L,尝试选择一个高于或等于 target_freq 的 new_freq。("L代表
>>> +  最低,但不能低于")
>>> +- 如果 relation==CPUFREQ_REL_H,尝试选择一个低于或等于 target_freq 的 new_freq。("H代表
>>> +  最高,但不能高于")
>>> +
>>> +这里,频率表助手可能会帮助你--详见第2节。
>>> +
>>> +1.6. fast_switch
>>> +----------------
>>> +
>>> +这个函数用于从调度器的上下文进行频率切换。并非所有的驱动都要实现它,因为不允许在这个回调中睡眠。这
>>> +个回调必须经过高度优化,以尽可能快地进行切换。
>>> +
>>> +这个函数有两个参数: ``struct cpufreq_policy *policy`` 和 ``unsigned int target_frequency``.
>> 句号
> OK!
>>> +
>>> +
>>> +1.7 setpolicy
>>> +-------------
>>> +
>>> +setpolicy调用只需要一个``struct cpufreq_policy * policy``作为参数。需要将处理器内或芯片组内动态频
>>> +率切换的下限设置为policy->min,上限设置为policy->max,如果支持的话,当policy->policy为
>>> +CPUFREQ_POLICY_PERFORMANCE时选择面向性能的设置,当CPUFREQ_POLICY_POWERSAVE时选择面向省电的设置。
>>> +也可以查看drivers/cpufreq/longrun.c中的参考实现。
>>> +
>>> +1.8 get_intermediate and target_intermediate
>> 和
> OK!
>>> +--------------------------------------------
>>> +
>>> +仅适用于 target_index() 和 CPUFREQ_ASYNC_NOTIFICATION 未设置的驱动。
>>> +
>>> +get_intermediate应该返回一个平台想要切换到的稳定的中间频率,target_intermediate()应该将CPU设置为
>>> +该频率,然后再跳转到'index'对应的频率。核心会负责发送通知,驱动不必在target_intermediate()或
>>> +target_index()中处理。
>>> +
>>> +在驱动程序不想因为某个目标频率切换到中间频率的情况下,它们可以从get_intermediate()中返回'0'。在这种情况
>>> +下,核心将直接调用->target_index()。
>>> +
>>> +注意:->target_index()应该在失败的情况下恢复到policy->restore_freq,因为core会为此发送通知。
>>> +
>>> +
>>> +2. 频率表助手
>>> +=============
>>> +
>>> +由于大多数cpufreq处理器只允许被设置为几个特定的频率,因此,一个带有一些函数的 "频率表 "可能会辅助处理器驱动
>> 如果都是中文,请用全角引号
>>> +程序的一些工作。这样的 "频率表" 由一个cpufreq_frequency_table条目构成的数组组成,"driver_data" 中包
>>> +含了驱动程序的具体数值,"frequency" 中包含了相应的频率,并设置了标志。在表的最后,需要添加一个
>>> +cpufreq_frequency_table条目,频率设置为CPUFREQ_TABLE_END。而如果想跳过表中的一个条目,则将频率设置为
>>> +CPUFREQ_ENTRY_INVALID。这些条目不需要按照任何特定的顺序排序,但如果它们是cpufreq core会对它们进行快速的DVFS,
>> core是否翻译请统一
> core -> 核心
> OK!
>>> +因为搜索最佳匹配会更快。
>>> +
>>> +如果策略在其policy->freq_table字段中包含一个有效的指针,cpufreq表就会被核心自动验证。
>>> +
>>> +cpufreq_frequency_table_verify()保证至少有一个有效的频率在policy->min和policy->max范围内,并且所有其他
>>> +标准都被满足。这对->验证调用很有帮助。
>> the ->verify call
> 验证 -> verify
> OK!
>>> +
>>> +cpufreq_frequency_table_target()是对应于->target阶段的频率表助手。只要把数值传递给这个函数,这个函数就会返
>>> +回包含CPU要设置的频率的频率表条目。
>>> +
>>> +以下宏可以作为cpufreq_frequency_table的迭代器。
>>> +
>>> +cpufreq_for_each_entry(pos, table) - 遍历频率表的所有条目。
>>> +
>>> +cpufreq_for_each_valid_entry(pos, table) - 遍历所有条目,不包括CPUFREQ_ENTRY_INVALID频率。
>>> +使用参数 "pos"--一个``cpufreq_frequency_table * `` 作为循环游标,使用参数 "table"--你想迭代
>> 单连字符
>>
> OK!
>> 这句话读不太通
> code:
> #define cpufreq_for_each_entry(pos, table)      \
>           for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)
>
>   "pos"--``cpufreq_frequency_table * ``用途是作为循环游标(循环计数,just like "i++")
>   "table"--你想迭代的``cpufreq_frequency_table * `` 。
> I surrender, do you have a more appropriate expression?:)
懂了,这样是不是好点?或者你给出的也可以

参数"pos"为一个``cpufreq_frequency_table * `` 
,用作循环游标;参数"table"为你想迭代的``cpufreq_frequency_table * `` 。

Thanks!

Wu X.C.
>>> +的``cpufreq_frequency_table * `` 。
>>> +
>>> +例如::
>>> +
>>> +     struct cpufreq_frequency_table *pos, *driver_freq_table;
>>> +
>>> +     cpufreq_for_each_entry(pos, driver_freq_table) {
>>> +             /* Do something with pos */
>>> +             pos->frequency = ...
>>> +     }
>>> +
>>> +  如果你需要在driver_freq_table中处理pos的位置,不要减去指针,因为它的代价相当高。相反,使用宏
>> 开头空格多余
> OK!
>>> +  cpufreq_for_each_entry_idx() 和 cpufreq_for_each_valid_entry_idx() 。
>> Thanks!
>>
> Sorry! I forgot to CC alexs@kernel.org when I replied to the email
> [PATCH 1/8] T_T
>
> Thanks!
>
> Yan teng


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 3/8] docs/zh_CN: add cpu-freq cpufreq-stats.rst translation
  2021-03-27  3:13     ` yanteng si
@ 2021-03-27 10:38       ` Wu X.C.
  0 siblings, 0 replies; 25+ messages in thread
From: Wu X.C. @ 2021-03-27 10:38 UTC (permalink / raw)
  To: yanteng si
  Cc: Yanteng Si, Alex Shi, Huacai Chen, Jiaxun Yang, Harry Wei,
	linux-doc, Puyu Wang, Jonathan Corbet, alexs


在 2021/3/27 11:13, yanteng si 写道:
> Wu X.C. <bobwxc@email.cn> 于2021年3月26日周五 下午12:16写道:
>>
>> 在 2021/3/24 23:07, Yanteng Si 写道:
>>> This patch translates Documention/cpu-freq/cpufreq-stats.rst into Chinese.
>>>
>>> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
>>> ---
>>>    .../zh_CN/cpu-freq/cpufreq-stats.rst          | 130 ++++++++++++++++++
>>>    1 file changed, 130 insertions(+)
>>>    create mode 100644 Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
>>>
>>> diff --git a/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst b/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
>>> new file mode 100644
>>> index 000000000000..d21a317d9659
>>> --- /dev/null
>>> +++ b/Documentation/translations/zh_CN/cpu-freq/cpufreq-stats.rst
>>> @@ -0,0 +1,130 @@
>>> +.. SPDX-License-Identifier: GPL-2.0
>>> +
>>> +.. include:: ../disclaimer-zh_CN.rst
>>> +
>>> +:Original: :doc:`../../../cpu-freq/cpufreq-stats`
>>> +:Translator: Yanteng Si <siyanteng@loongson.cn>
>>> +
>>> +.. _cn_cpufreq-stats.rst:
>>> +
>>> +
>>> +==========================================
>>> +sysfs CPUFreq Stats的一般说明
>>> +==========================================
>>> +
>>> +用户信息
>>> +
>>> +
>>> +作者: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
>>> +
>>> +.. Contents
>>> +
>>> +   1. 简介
>>> +   2. 提供的统计数据(举例说明)
>>> +   3. 配置cpufreq-stats
>>> +
>>> +
>>> +1. 简介
>>> +===============
>>> +
>>> +cpufreq-stats是一个为每个CPU提供CPU频率统计的驱动。
>>> +这些统计数据在/sysfs中以一堆只读接口的形式提供。这个接口(配置好后)将出现在
>> 在配置好后
> OK!
>>> +/sysfs(<sysfs root>/devices/system/cpu/cpuX/cpufreq/stats/)中cpufreq下的一个单
>>> +独的目录中,提供给每个CPU。
>>> +各种统计数据将在此目录下形成只读文件。
>>> +
>>> +这个驱动的设计是独立于任何特定的cpufreq_driver的。可能在你的CPU上运行。因此,它将与所有
>> 此驱动是独立于任何可能运行在你所用CPU上的特定cpufreq_driver而设计的。
> OK!
>>> +cpufreq_driver一起工作。
>>> +
>>> +
>>> +2. 提供的统计数据(举例说明)
>>> +=====================================
>>> +
>>> +cpufreq stats提供了以下统计数据(在下面详细解释)。
>>> +
>>> +-  time_in_state
>>> +-  total_trans
>>> +-  trans_table
>>> +
>>> +所有的统计数据将从统计驱动被插入的时间(或统计被重置的时间)开始,到某一统计数据被读取的时间为止。
>> 插入 use 载入?or another better word?
> I like "载入"
> OK!
>>> +显然,统计驱动不会有任何关于统计驱动插入之前的频率转换信息。
>>> +
>>> +::
>>> +
>>> +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # ls -l
>>> +    total 0
>>> +    drwxr-xr-x  2 root root    0 May 14 16:06 .
>>> +    drwxr-xr-x  3 root root    0 May 14 15:58 ..
>>> +    --w-------  1 root root 4096 May 14 16:06 reset
>>> +    -r--r--r--  1 root root 4096 May 14 16:06 time_in_state
>>> +    -r--r--r--  1 root root 4096 May 14 16:06 total_trans
>>> +    -r--r--r--  1 root root 4096 May 14 16:06 trans_table
>>> +
>>> +- **reset**
>>> +
>>> +只写属性,可用于重置统计计数器。这对于评估不同调节器下的系统行为非常有用,且无需重启。
>>> +
>>> +
>>> +- **time_in_state**
>>> +
>>> +这就给出了这个CPU所支持的每个频率所花费的时间。cat输出的每一行都会有"<frequency>
>> 此项给出了…
> OK!
>>> +<time>"对,表示这个CPU在<frequency>上花费了<time>个usertime单位的时间。这里的
>>> +usertime单位是10mS(类似于/proc中输出的其他时间)。
>>> +
>>> +::
>>> +
>>> +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat time_in_state
>>> +    3600000 2089
>>> +    3400000 136
>>> +    3200000 34
>>> +    3000000 67
>>> +    2800000 172488
>>> +
>>> +
>>> +- **total_trans**
>>> +
>>> +给出了这个CPU上频率转换的总次数。cat的输出将有一个单一的计数,这就是频率转换的总数。
>>> +
>>> +::
>>> +
>>> +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat total_trans
>>> +    20
>>> +
>>> +- **trans_table**
>>> +
>>> +这将提供所有CPU频率转换的细粒度信息。这里的cat输出是一个二维矩阵,其中一个条目<i, j>(第
>>> +i行,第j列)代表从Freq_i到Freq_j的转换次数。Freq_i行和Freq_j列遵循驱动最初提供给cpufreq
>>> +核的频率表的排序顺序,因此可以排序(升序或降序)或不排序。 这里的输出也包含了每行每列的实际
>> 排列顺序
> ?
Nothing, keep it.
Ignore this comment.  >_<
>>> +频率值,以便更好地阅读。
>>> +
>>> +如果转换表大于PAGE_SIZE,读取时将返回一个-EFBIG错误。
>>> +
>>> +::
>>> +
>>> +    <mysystem>:/sys/devices/system/cpu/cpu0/cpufreq/stats # cat trans_table
>>> +    From  :    To
>>> +         :   3600000   3400000   3200000   3000000   2800000
>>> +    3600000:         0         5         0         0         0
>>> +    3400000:         4         0         2         0         0
>>> +    3200000:         0         1         0         2         0
>>> +    3000000:         0         0         1         0         3
>>> +    2800000:         0         0         0         2         0
>>> +
>>> +3. 配置cpufreq-stats
>>> +============================
>>> +
>>> +要在你的内核中配置cpufreq-stats。::
>> remove the “。”
> OK!
>>> +
>>> +     Config Main Menu
>>> +             Power management options (ACPI, APM)  --->
>>> +                     CPU Frequency scaling  --->
>>> +                             [*] CPU Frequency scaling
>>> +                             [*]   CPU frequency translation statistics
>>> +
>>> +
>>> +"CPU Frequency scaling" (CONFIG_CPU_FREQ) 应该被启用以配置cpufreq-stats。
>>> +
>>> +"CPU frequency translation statistics" (CONFIG_CPU_FREQ_STAT)提供了包括
>>> +time_in_state、total_trans和trans_table的统计数据。
>>> +
>>> +一旦启用了这个选项,并且你的CPU支持cpufrequency,你就可以在/sysfs中看到CPU频率统计。
>> Thanks!
>>
> Thanks!
>
> Yanteng


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/8] docs/zh_CN: add cpu-freq core.rst translation
  2021-03-26  3:12   ` Jiaxun Yang
  2021-03-27  2:13     ` yanteng si
@ 2021-03-29 12:24     ` yanteng si
  1 sibling, 0 replies; 25+ messages in thread
From: yanteng si @ 2021-03-29 12:24 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: Yanteng Si, Jonathan Corbet, Alex Shi, Huacai Chen, Harry Wei,
	linux-doc, Puyu Wang

Hi Jiaxun

Do you mind if I add the following?

+:校译:
+
+ Jiaxun Yang <jiaxun.yang@flygoat.com>

Jiaxun Yang <jiaxun.yang@flygoat.com> 于2021年3月26日周五 上午11:13写道:
>
>
>
> On Wed, Mar 24, 2021, at 11:07 PM, Yanteng Si wrote:
> > This patch translates Documention/cpu-freq/core.rst into Chinese.
> >
> > Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> > ---
> >  .../translations/zh_CN/cpu-freq/core.rst      | 105 ++++++++++++++++++
> >  1 file changed, 105 insertions(+)
> >  create mode 100644 Documentation/translations/zh_CN/cpu-freq/core.rst
> >
> > diff --git a/Documentation/translations/zh_CN/cpu-freq/core.rst
> > b/Documentation/translations/zh_CN/cpu-freq/core.rst
> > new file mode 100644
> > index 000000000000..1571087c2581
> > --- /dev/null
> > +++ b/Documentation/translations/zh_CN/cpu-freq/core.rst
> > @@ -0,0 +1,105 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +.. include:: ../disclaimer-zh_CN.rst
> > +
> > +:Original: :doc:`../../../cpu-freq/core`
> > +:Translator: Yanteng Si <siyanteng@loongson.cn>
> > +
> > +.. _cn_core.rst:
> > +
> > +
> > +====================================
> > +CPUFreq核心和CPUFreq通知器的一般说明
> > +====================================
>
> 一般 -> 通用?
>
> > +
> > +作者:
> > +     - Dominik Brodowski  <linux@brodo.de>
> > +     - David Kimdon <dwhedon@debian.org>
> > +     - Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > +     - Viresh Kumar <viresh.kumar@linaro.org>
> > +
> > +.. 目录:
> > +
> > +   1.  CPUFreq核心和接口
> > +   2.  CPUFreq通知器
> > +   3.  含有Operating Performance Point (OPP)的CPUFreq表的生成
> > +
> > +1. CPUFreq核心和接口
> > +======================
> > +
> > +cpufreq核心代码位于drivers/cpufreq/cpufreq.c中。这些cpufreq代码为CPUFreq架构的驱
> > +动程序(那些进行实际频率转换的代码)以及 "通知器 "提供了一个标准化的接口。
>
> 那些操作硬件切换频率的代码 will help with understanding.
>
>
> > +这些是设备驱动程序或需要了解策略变化的其它内核部分(如 ACPI 等热模块)或所有频率更改(除
> Add sbject "通知器"
> 热模块 seems bogus, 热量管理?
>
> > +计时代码外),甚至需要强制确定速度限制(如 ARM 架构上的 LCD 驱动程序)。
> > +此外, 内核 "常数" loops_per_jiffy会根据频率变化而更新。
> > +
> > +cpufreq策略的引用计数由 cpufreq_cpu_get 和 cpufreq_cpu_put 来完成,以确保 cpufreq 驱
> > +动程序被正确地注册到核心中,并且在 cpufreq_put_cpu 被调用之前不会被卸载。这也保证了各自的
> > +cpufreq 策略在使用时不会被释放。
>
> It makes me "Parser error" when reading.....
>
> > +
> > +2. CPUFreq 通知器
> > +====================
> > +
> > +CPUFreq通知器符合标准的内核通知器接口。
> > +关于通知器的细节请参阅 linux/include/linux/notifier.h。
> > +
> > +这里有两个不同的CPUfreq通知器 - 策略通知器和转换通知器。
> > +
> > +
> > +2.1 CPUFreq策略通知器
> > +----------------------------
> > +
> > +当创建或移除策略时,这些都会被通知。
> > +
> > +阶段是在通知器的第二个参数中指定的。当第一次创建策略时,阶段是CPUFREQ_CREATE_POLICY,当
> > +策略被移除时,阶段是CPUFREQ_REMOVE_POLICY。
> > +
> > +第三个参数 ``void *pointer`` 指向一个结构体cpufreq_policy,其包括min,max(新策略的下限和
> > +上限(单位为kHz))这几个值。
> > +
> > +
> > +2.2 CPUFreq转换通知器
> > +--------------------------------
> > +
> > +当CPUfreq驱动切换CPU核心频率时,策略中的每个在线CPU都会收到两次通知,这些变化没有任何外部干
> > +预。
> > +
> > +第二个参数指定阶段 - CPUFREQ_PRECHANGE or CPUFREQ_POSTCHANGE.
> > +
> > +第三个参数是一个包含如下值的结构体cpufreq_freqs:
> > +
> > +=====        ====================
> > +cpu  受影响cpu的编号
> > +old  旧频率
> > +new  新频率
> > +flags        cpufreq驱动的标志
> > +=====        ====================
> > +
> > +3. 含有Operating Performance Point (OPP)的CPUFreq表的生成
> > +==================================================================
> > +关于OPP的细节请参阅 Documentation/power/opp.rst
> > +
> > +dev_pm_opp_init_cpufreq_table -
> > +     这个功能提供了一个随时可用的转换程序,用来将OPP层关于可用频率的内部信息翻译成一种容易提供给
> > +     cpufreq的格式。
> > +
> > +     .. Warning::
> > +
> > +             不要在中断上下文中使用此函数。
> > +
> > +     例如::
> > +
> > +      soc_pm_init()
> > +      {
> > +             /* Do things */
> > +             r = dev_pm_opp_init_cpufreq_table(dev, &freq_table);
> > +             if (!r)
> > +                     policy->freq_table = freq_table;
> > +             /* Do other things */
> > +      }
> > +
> > +     .. note::
> > +
> > +             该函数只有在CONFIG_PM_OPP之外还启用了CONFIG_CPU_FREQ时才可用。
> > +
> > +dev_pm_opp_free_cpufreq_table
> > +     释放dev_pm_opp_init_cpufreq_table分配的表。
> > --
> > 2.25.1
> >
> >
>
> --
> - Jiaxun

Thanks

Yanteng

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2021-03-29 12:26 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 15:07 [PATCH 0/8] docs/zh_CN: add cpu-freq translation Yanteng Si
2021-03-24 15:07 ` [PATCH 1/8] docs/zh_CN: add cpu-freq core.rst translation Yanteng Si
2021-03-26  3:12   ` Jiaxun Yang
2021-03-27  2:13     ` yanteng si
2021-03-29 12:24     ` yanteng si
2021-03-24 15:07 ` [PATCH 2/8] docs/zh_CN: add cpu-freq cpu-drivers.rst translation Yanteng Si
2021-03-26  5:21   ` Wu X.C.
2021-03-27  3:03     ` teng sterling
2021-03-27 10:32       ` Wu X.C.
2021-03-24 15:07 ` [PATCH 3/8] docs/zh_CN: add cpu-freq cpufreq-stats.rst translation Yanteng Si
2021-03-26  4:16   ` Wu X.C.
2021-03-27  3:13     ` yanteng si
2021-03-27 10:38       ` Wu X.C.
2021-03-24 15:07 ` [PATCH 4/8] docs/zh_CN: add cpu-freq index.rst translation Yanteng Si
2021-03-24 15:07 ` [PATCH 5/8] docs/zh_CN: add cpu-freq to zh_CN index Yanteng Si
2021-03-24 15:07 ` [PATCH 6/8] docs/zh_CN: add mips " Yanteng Si
2021-03-24 15:07 ` [PATCH 7/8] docs/zh_CN: add iio " Yanteng Si
2021-03-24 15:07 ` [PATCH 8/8] docs/zh_CN: add riscv " Yanteng Si
2021-03-25 12:23 ` [PATCH 0/8] docs/zh_CN: add cpu-freq translation Alex Shi
2021-03-25 18:52   ` Jonathan Corbet
2021-03-26  3:31     ` Jiaxun Yang
2021-03-26  7:44       ` Alex Shi
2021-03-26  8:25         ` Wu X.C.
2021-03-26  8:34           ` Alex Shi
2021-03-26  2:14   ` yanteng si

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.