All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2
@ 2022-06-15  9:24 Binbin Zhou
  2022-06-15  9:24 ` [PATCH 1/9] docs/zh_CN: core-api: Update the translation of cachetlb.rst " Binbin Zhou
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15  9:24 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

This series of patches updat the contents of the translated files
in the core-api directory to 5.19-rc2.

In the next step, I plan to translate the untranslated documents
in the core-api directory. For details, see TODOLIST in the
core-api/index.rst file.

Binbin Zhou (9):
  docs/zh_CN: core-api: Update the translation of cachetlb.rst to
    5.19-rc2
  docs/zh_CN: core-api: Update the translation of cpu_hotplug.rst to
    5.19-rc2
  docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst to
    5.19-rc2
  docs/zh_CN: core-api: Update the translation of kernel-api.rst to
    5.19-rc2
  docs/zh_CN: core-api: Update the translation of mm-api.rst to 5.19-rc2
  docs/zh_CN: core-api: Update the translation of printk-basics.rst to
    5.19-rc2
  docs/zh_CN: core-api: Update the translation of printk-format.rst to
    5.19-rc2
  docs/zh_CN: core-api: Update the translation of workqueue.rst to
    5.19-rc2
  docs/zh_CN: core-api: Update the translation of xarray.rst to 5.19-rc2

 .../translations/zh_CN/core-api/cachetlb.rst  |   6 +
 .../zh_CN/core-api/cpu_hotplug.rst            | 435 +++++++++++++++---
 .../zh_CN/core-api/irq/irq-domain.rst         |  22 +-
 .../zh_CN/core-api/kernel-api.rst             |   3 +
 .../translations/zh_CN/core-api/mm-api.rst    |  23 +-
 .../zh_CN/core-api/printk-basics.rst          |   3 +-
 .../zh_CN/core-api/printk-formats.rst         |  13 +-
 .../translations/zh_CN/core-api/workqueue.rst |  21 +-
 .../translations/zh_CN/core-api/xarray.rst    |   4 +-
 9 files changed, 459 insertions(+), 71 deletions(-)

-- 
2.20.1


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

* [PATCH 1/9] docs/zh_CN: core-api: Update the translation of cachetlb.rst to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
@ 2022-06-15  9:24 ` Binbin Zhou
  2022-06-15  9:24 ` [PATCH 2/9] docs/zh_CN: core-api: Update the translation of cpu_hotplug.rst " Binbin Zhou
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15  9:24 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

Synchronous translation from upstream commit 08b0b0059bf1
("mm: Add flush_dcache_folio()")

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 Documentation/translations/zh_CN/core-api/cachetlb.rst | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/translations/zh_CN/core-api/cachetlb.rst b/Documentation/translations/zh_CN/core-api/cachetlb.rst
index 6fee45fe5e80..b4a76ec75daa 100644
--- a/Documentation/translations/zh_CN/core-api/cachetlb.rst
+++ b/Documentation/translations/zh_CN/core-api/cachetlb.rst
@@ -5,6 +5,7 @@
 :翻译:
 
  司延腾 Yanteng Si <siyanteng@loongson.cn>
+ 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
 
 :校译:
 
@@ -278,6 +279,11 @@ HyperSparc cpu就是这样一个具有这种属性的cpu。
 				CPU上,因为它将cpu存储到页面上,使其变脏。同样,请看
 				sparc64关于如何处理这个问题的例子。
 
+  ``void flush_dcache_folio(struct folio *folio)``
+
+	该函数的调用情形与flush_dcache_page()相同。它允许架构针对刷新整个
+	folio页面进行优化,而不是一次刷新一页。
+
   ``void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
   unsigned long user_vaddr, void *dst, void *src, int len)``
   ``void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
-- 
2.20.1


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

* [PATCH 2/9] docs/zh_CN: core-api: Update the translation of cpu_hotplug.rst to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
  2022-06-15  9:24 ` [PATCH 1/9] docs/zh_CN: core-api: Update the translation of cachetlb.rst " Binbin Zhou
@ 2022-06-15  9:24 ` Binbin Zhou
       [not found]   ` <20220616002137.6614-1-bobwxc@email.cn>
  2022-06-15  9:24 ` [PATCH 3/9] docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst " Binbin Zhou
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15  9:24 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

Synchronous translation from upstream commit c9871c800f65
("Documentation: core-api/cpuhotplug: Rewrite the API section")

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../zh_CN/core-api/cpu_hotplug.rst            | 435 +++++++++++++++---
 1 file changed, 377 insertions(+), 58 deletions(-)

diff --git a/Documentation/translations/zh_CN/core-api/cpu_hotplug.rst b/Documentation/translations/zh_CN/core-api/cpu_hotplug.rst
index 85a264287426..007a58f8086d 100644
--- a/Documentation/translations/zh_CN/core-api/cpu_hotplug.rst
+++ b/Documentation/translations/zh_CN/core-api/cpu_hotplug.rst
@@ -4,6 +4,7 @@
 :翻译:
 
  司延腾 Yanteng Si <siyanteng@loongson.cn>
+ 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
 
 :校译:
 
@@ -15,12 +16,13 @@
 内核中的CPU热拔插
 =================
 
-:时间: 2016年12月
+:时间: 2021年9月
 :作者: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
-          Rusty Russell <rusty@rustcorp.com.au>,
-          Srivatsa Vaddagiri <vatsa@in.ibm.com>,
-          Ashok Raj <ashok.raj@intel.com>,
-          Joel Schopp <jschopp@austin.ibm.com>
+       Rusty Russell <rusty@rustcorp.com.au>,
+       Srivatsa Vaddagiri <vatsa@in.ibm.com>,
+       Ashok Raj <ashok.raj@intel.com>,
+       Joel Schopp <jschopp@austin.ibm.com>,
+       Thomas Gleixner <tglx@linutronix.de>
 
 简介
 ====
@@ -139,7 +141,7 @@ CPU的热拔插协作
 下线情况
 --------
 
-一旦CPU被逻辑关闭,注册的热插拔状态的清除回调将被调用,从 ``CPUHP_ONLINE`` 开始,在
+一旦CPU被逻辑关闭,注册的热插拔状态的清除回调将被调用,从 ``CPUHP_ONLINE`` 开始,到
 ``CPUHP_OFFLINE`` 状态结束。这包括:
 
 * 如果任务因暂停操作而被冻结,那么 *cpuhp_tasks_frozen* 将被设置为true。
@@ -154,82 +156,399 @@ CPU的热拔插协作
 * 一旦所有的服务被迁移,内核会调用一个特定的例程 ``__cpu_disable()`` 来进行特定的清
   理。
 
-使用热插拔API
--------------
+CPU热插拔API
+============
+
+CPU热拔插状态机
+---------------
+
+CPU热插拔使用一个从CPUHP_OFFLINE到CPUHP_ONLINE的线性状态空间的普通状态机。每个状态都
+有一个startup和teardown的回调。
+
+当一个CPU上线时,将按顺序调用startup回调,直到达到CPUHP_ONLINE状态。当设置状态的回调
+或将实例添加到多实例状态时,也可以调用它们。
+
+当一个CPU下线时,将按相反的顺序依次调用teardown回调,直到达到CPUHP_OFFLINE状态。当删
+除状态的回调或从多实例状态中删除实例时,也可以调用它们。
+
+如果某个使用场景只需要一个方向的热插拔操作回调(CPU上线或CPU下线),则在设置状态时,
+可以将另一个不需要的回调设置为NULL。
+
+状态空间被划分成三个阶段:
+
+* PREPARE阶段
+
+  PREPARE阶段涵盖了从CPUHP_OFFLINE到CPUHP_BRINGUP_CPU之间的状态空间。
+
+  在该阶段中,startup回调在CPU上线操作启动CPU之前被调用,teardown回调在CPU下线操作使
+  CPU功能失调之后被调用。
+
+  这些回调是在控制CPU上调用的,因为它们显然不能在热插拔的CPU上运行,此时热插拔的CPU要
+  么还没有启动,要么已经功能失调。
+
+  startup回调用于设置CPU成功上线所需要的资源。teardown回调用于释放资源或在热插拔的CPU
+  不能正常工作后,将待处理的工作转移到在线的CPU上。
+
+  允许startup回调失败。如果回调失败,CPU上线操作被中止,CPU将再次被降到之前的状态(通
+  常是CPUHP_OFFLINE)。
+
+  本阶段中的teardown回调不允许失败。
+
+* STARTING阶段
+
+  STARTING阶段涵盖了CPUHP_BRINGUP_CPU + 1到CPUHP_AP_ONLINE之间的状态空间。
+
+  该阶段中的startup回调是在早期CPU设置代码中的CPU上线操作期间,禁用中断的情况下在热拔
+  插的CPU上被调用。teardown回调是在CPU完全关闭前不久的CPU下线操作期间,禁用中断的情况
+  下在热拔插的CPU上被调用。
+
+  该阶段中的回调不允许失败。
+
+  回调用于低级别的硬件初始化/关机和核心子系统。
+
+* ONLINE阶段
+
+  ONLINE阶段涵盖了CPUHP_AP_ONLINE + 1到CPUHP_ONLINE之间的状态空间。
+
+  该阶段中的startup回调是在CPU上线时在热插拔的CPU上调用的。teardown回调是在CPU下线操
+  作时在热插拔CPU上调用的。
+
+  回调是在每个CPU热插拔线程的上下文中调用的,该线程绑定在热插拔的CPU上。回调是在启用
+  中断和抢占的情况下调用的。
+
+  允许回调失败。如果回调失败,CPU热插拔操作被中止,CPU将恢复到之前的状态。
+
+CPU 上线/下线操作
+-----------------
+
+一个成功的上线操作如下::
+
+  [CPUHP_OFFLINE]
+  [CPUHP_OFFLINE + 1]->startup()       -> 成功
+  [CPUHP_OFFLINE + 2]->startup()       -> 成功
+  [CPUHP_OFFLINE + 3]                  -> 略过,因为startup == NULL
+  ...
+  [CPUHP_BRINGUP_CPU]->startup()       -> 成功
+  === PREPARE阶段结束
+  [CPUHP_BRINGUP_CPU + 1]->startup()   -> 成功
+  ...
+  [CPUHP_AP_ONLINE]->startup()         -> 成功
+  === STARTUP阶段结束
+  [CPUHP_AP_ONLINE + 1]->startup()     -> 成功
+  ...
+  [CPUHP_ONLINE - 1]->startup()        -> 成功
+  [CPUHP_ONLINE]
+
+一个成功的下线操作如下::
+
+  [CPUHP_ONLINE]
+  [CPUHP_ONLINE - 1]->teardown()       -> 成功
+  ...
+  [CPUHP_AP_ONLINE + 1]->teardown()    -> 成功
+  === STARTUP阶段开始
+  [CPUHP_AP_ONLINE]->teardown()        -> 成功
+  ...
+  [CPUHP_BRINGUP_ONLINE - 1]->teardown()
+  ...
+  === PREPARE阶段开始
+  [CPUHP_BRINGUP_CPU]->teardown()
+  [CPUHP_OFFLINE + 3]->teardown()
+  [CPUHP_OFFLINE + 2]                  -> 略过,因为teardown == NULL
+  [CPUHP_OFFLINE + 1]->teardown()
+  [CPUHP_OFFLINE]
+
+一个失败的上线操作如下::
+
+  [CPUHP_OFFLINE]
+  [CPUHP_OFFLINE + 1]->startup()       -> 成功
+  [CPUHP_OFFLINE + 2]->startup()       -> 成功
+  [CPUHP_OFFLINE + 3]                  -> 略过,因为startup == NULL
+  ...
+  [CPUHP_BRINGUP_CPU]->startup()       -> 成功
+  === PREPARE阶段结束
+  [CPUHP_BRINGUP_CPU + 1]->startup()   -> 成功
+  ...
+  [CPUHP_AP_ONLINE]->startup()         -> 成功
+  === STARTUP阶段结束
+  [CPUHP_AP_ONLINE + 1]->startup()     -> 成功
+  ---
+  [CPUHP_AP_ONLINE + N]->startup()     -> 失败
+  [CPUHP_AP_ONLINE + (N - 1)]->teardown()
+  ...
+  [CPUHP_AP_ONLINE + 1]->teardown()
+  === STARTUP阶段开始
+  [CPUHP_AP_ONLINE]->teardown()
+  ...
+  [CPUHP_BRINGUP_ONLINE - 1]->teardown()
+  ...
+  === PREPARE阶段开始
+  [CPUHP_BRINGUP_CPU]->teardown()
+  [CPUHP_OFFLINE + 3]->teardown()
+  [CPUHP_OFFLINE + 2]                  -> 略过,因为teardown == NULL
+  [CPUHP_OFFLINE + 1]->teardown()
+  [CPUHP_OFFLINE]
+
+一个失败的下线操作如下::
+
+  [CPUHP_ONLINE]
+  [CPUHP_ONLINE - 1]->teardown()       -> 成功
+  ...
+  [CPUHP_ONLINE - N]->teardown()       -> 失败
+  [CPUHP_ONLINE - (N - 1)]->startup()
+  ...
+  [CPUHP_ONLINE - 1]->startup()
+  [CPUHP_ONLINE]
+
+递归失败不能被合理地处理。
+请看下面的例子,由于下线操作失败而导致的递归失败: ::
+
+  [CPUHP_ONLINE]
+  [CPUHP_ONLINE - 1]->teardown()       -> 成功
+  ...
+  [CPUHP_ONLINE - N]->teardown()       -> 失败
+  [CPUHP_ONLINE - (N - 1)]->startup()  -> 成功
+  [CPUHP_ONLINE - (N - 2)]->startup()  -> 失败
+
+CPU热插拔状态机在此停止,并不试图再次回滚,因为这可能会导致无尽的循环::
+
+  [CPUHP_ONLINE - (N - 1)]->teardown() -> 成功
+  [CPUHP_ONLINE - N]->teardown()       -> 失败
+  [CPUHP_ONLINE - (N - 1)]->startup()  -> 成功
+  [CPUHP_ONLINE - (N - 2)]->startup()  -> 失败
+  [CPUHP_ONLINE - (N - 1)]->teardown() -> 成功
+  [CPUHP_ONLINE - N]->teardown()       -> 失败
+
+擦洗,冲洗,重复。在这种情况下,CPU留在该状态中::
+
+  [CPUHP_ONLINE - (N - 1)]
+
+这至少可以让系统取得进展,让用户有机会进行调试,甚至解决这个问题。
+
+分配一个状态
+------------
+
+有两种方式分配一个CPU热插拔状态:
+
+* 静态分配
+
+  当子系统或驱动程序有相对于其他CPU热插拔状态的排序要求时,必须使用静态分配。例如,
+  在CPU上线操作期间,PERF核心startup回调必须在PERF驱动startup回调之前被调用。在CPU
+  下线操作中,驱动teardown回调必须在核心teardown回调之前调用。静态分配的状态由
+  cpuhp_state枚举中的常量描述,可以在include/linux/cpuhotplug.h中找到。
+
+  在适当的位置将状态插入枚举中,这样就满足了排序要求。状态常量必须被用于状态的设置
+  和移除。
+
+  当状态回调不是在运行时设置的,并且是kernel/cpu.c中CPU热插拔状态数组初始化的一部分
+  时,也需要静态分配。
+
+* 动态分配
+
+  当对状态回调没有排序要求时,动态分配是首选方法。状态编号由setup函数分配,并在成功
+  后返回给调用者。
+
+  只有PREPARE和ONLINE阶段提供了一个动态分配范围。STARTING阶段则没有,因为该部分的大多
+  数回调都有明确的排序要求。
+
+CPU热插拔状态的设置
+-------------------
+
+核心代码提供了以下函数用来设置状态:
+
+* cpuhp_setup_state(state, name, startup, teardown)
+* cpuhp_setup_state_nocalls(state, name, startup, teardown)
+* cpuhp_setup_state_cpuslocked(state, name, startup, teardown)
+* cpuhp_setup_state_nocalls_cpuslocked(state, name, startup, teardown)
+
+对于一个驱动程序或子系统有多个实例,并且每个实例都需要调用相同的CPU hotplug状态回
+调的情况,CPU hotplug核心提供多实例支持。与驱动程序特定的实例列表相比,其优势在于
+与实例相关的函数完全针对CPU hotplug操作进行序列化,并在添加和删除时提供状态回调的
+自动调用。要设置这样一个多实例状态,可以使用以下函数:
+
+* cpuhp_setup_state_multi(state, name, startup, teardown)
+
+@state参数要么是静态分配的状态,要么是动态分配状态(PUHP_PREPARE_DYN,CPUHP_ONLINE_DYN)
+的常量之一, 具体取决于应该分配动态状态的状态阶段(PREPARE,ONLINE)。
+
+@name参数用于sysfs输出和检测。命名惯例是"subsys:mode"或"subsys/driver:mode",
+例如 "perf:mode"或"perf/x86:mode"。常见的mode名称有:
+
+======== ============================================
+prepare  对应PREPARE阶段中的状态
+
+dead     对应PREPARE阶段中不提供startup回调的状态
+
+starting 对应STARTING阶段中的状态
+
+dying    对应STARTING阶段中不提供startup回调的状态
+
+online   对应ONLINE阶段中的状态
+
+offline  对应ONLINE阶段中不提供startup回调的状态
+======== ============================================
+
+由于@name参数只用于sysfs和检测,如果其他mode描述符比常见的描述符更好地描述状态的性质,
+也可以使用。
+
+@name参数的示例:"perf/online", "perf/x86:prepare", "RCU/tree:dying", "sched/waitempty"
+
+@startup参数是一个指向回调的函数指针,在CPU上线操作时被调用。若应用不需要startup
+回调,则将该指针设为NULL。
+
+@teardown参数是一个指向回调的函数指针,在CPU下线操作时调用。若应用不需要teardown
+回调,则将该指针设为NULL。
+
+这些函数在处理已注册回调的方式上有所不同:
+
+  * cpuhp_setup_state_nocalls(), cpuhp_setup_state_nocalls_cpuslocked()和
+    cpuhp_setup_state_multi()只注册回调。
+
+  * cpuhp_setup_state()和cpuhp_setup_state_cpuslocked()注册回调,并对当前状态大于新
+    安装状态的所有在线CPU调用@startup回调(如果不是NULL)。根据状态阶段,回调要么在
+    当前的CPU上调用(PREPARE阶段),要么在CPU的热插拔线程中调用每个在线CPU(ONLINE阶段)。
+
+    如果CPU N的回调失败,那么CPU 0...N-1的teardown回调被调用以回滚操作。状态设置失败,
+    状态的回调没有被注册,在动态分配的情况下,分配的状态被释放。
+
+状态设置和回调调用是针对CPU热拔插操作进行序列化的。如果设置函数必须从CPU热插拔的读
+锁定区域调用,那么必须使用_cpuslocked()变体。这些函数不能在CPU热拔插回调中使用。
+
+函数返回值:
+  ======== ==========================================================
+  0        静态分配的状态设置成功
+
+  >0       动态分配的状态设置成功
+
+           返回的数值是被分配的状态编号。如果状态回调后来必须被移除,
+           例如模块移除,那么这个数值必须由调用者保存,并作为状态移
+           除函数的@state参数。对于多实例状态,动态分配的状态编号也
+           需要作为实例添加/删除操作的@state参数。
+
+  <0	   操作失败
+  ======== ==========================================================
+
+移除CPU热拔插状态
+-----------------
+
+为了移除一个之前设置好的状态,提供了如下函数:
+
+* cpuhp_remove_state(state)
+* cpuhp_remove_state_nocalls(state)
+* cpuhp_remove_state_nocalls_cpuslocked(state)
+* cpuhp_remove_multi_state(state)
+
+@state参数要么是静态分配的状态,要么是由cpuhp_setup_state*()在动态范围内分配
+的状态编号。如果状态在动态范围内,则状态编号被释放,可再次进行动态分配。
+
+这些函数在处理已注册回调的方式上有所不同:
+
+  * cpuhp_remove_state_nocalls(), cpuhp_remove_state_nocalls_cpuslocked()
+    和 cpuhp_remove_multi_state()只删除回调。
+
+  * cpuhp_remove_state()删除回调,并调用所有当前状态大于被删除状态的在线CPU的
+    teardown回调(如果不是NULL)。根据状态阶段,回调要么在当前的CPU上调用
+    (PREPARE阶段),要么在CPU的热插拔线程中调用每个在线CPU(ONLINE阶段)。
+
+    为了完成移除工作,teardown回调不能失败。
+
+状态移除和回调调用是针对CPU热拔插操作进行序列化的。如果移除函数必须从CPU hotplug
+读取锁定区域调用,那么必须使用_cpuslocked()变体。这些函数不能从CPU热插拔的回调中使用。
+
+如果一个多实例的状态被移除,那么调用者必须先移除所有的实例。
+
+多实例状态实例管理
+------------------
+
+一旦多实例状态被建立,实例就可以被添加到状态中:
 
-一旦一个CPU下线或上线,就有可能收到通知。这对某些需要根据可用CPU数量执行某种设置或清
-理功能的驱动程序来说可能很重要::
+  * cpuhp_state_add_instance(state, node)
+  * cpuhp_state_add_instance_nocalls(state, node)
 
-  #include <linux/cpuhotplug.h>
+@state参数是一个静态分配的状态或由cpuhp_setup_state_multi()在动态范围内分配的状
+态编号。
 
-  ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "X/Y:online",
-                          Y_online, Y_prepare_down);
+@node参数是一个指向hlist_node的指针,它被嵌入到实例的数据结构中。这个指针被交给
+多实例状态的回调,可以被回调用来通过container_of()检索到实例。
 
-*X* 是子系统, *Y* 是特定的驱动程序。 *Y_online* 回调将在所有在线CPU的注册过程中被调用。
-如果在线回调期间发生错误, *Y_prepare_down*  回调将在所有之前调用过在线回调的CPU上调
-用。注册完成后,一旦有CPU上线, *Y_online* 回调将被调用,当CPU关闭时, *Y_prepare_down*
-将被调用。所有之前在 *Y_online* 中分配的资源都应该在 *Y_prepare_down* 中释放。如果在
-注册过程中发生错误,返回值 *ret* 为负值。否则会返回一个正值,其中包含动态分配状态
-( *CPUHP_AP_ONLINE_DYN* )的分配热拔插。对于预定义的状态,它将返回0。
+这些函数在处理已注册回调的方式上有所不同:
 
-该回调可以通过调用 ``cpuhp_remove_state()`` 来删除。如果是动态分配的状态
-( *CPUHP_AP_ONLINE_DYN* ),则使用返回的状态。在移除热插拔状态的过程中,将调用拆解回调。
+  * cpuhp_state_add_instance_nocalls()只将实例添加到多实例状态的节点列表中。
 
-多个实例
-~~~~~~~~
+  * cpuhp_state_add_instance()为所有当前状态大于@state的在线CPU添加实例并调用与
+    @state相关的startup回调(如果不是NULL)。该回调只对将要添加的实例进行调用。
+    根据状态阶段,回调要么在当前的CPU上调用(PREPARE阶段),要么在CPU的热插拔线
+    程中调用每个在线CPU(ONLINE阶段)。
 
-如果一个驱动程序有多个实例,并且每个实例都需要独立执行回调,那么很可能应该使用
-``multi-state`` 。首先需要注册一个多状态的状态::
+    如果CPU N的回调失败,那么CPU 0 ... N-1的teardown回调被调用以回滚操作,该函数
+    失败,实例不会被添加到多实例状态的节点列表中。
 
-  ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "X/Y:online,
-                                Y_online, Y_prepare_down);
-  Y_hp_online = ret;
+要从状态的节点列表中删除一个实例,可以使用这些函数:
 
-``cpuhp_setup_state_multi()`` 的行为与 ``cpuhp_setup_state()`` 类似,只是它
-为多状态准备了回调,但不调用回调。这是一个一次性的设置。
-一旦分配了一个新的实例,你需要注册这个新实例::
+  * cpuhp_state_remove_instance(state, node)
+  * cpuhp_state_remove_instance_nocalls(state, node)
 
-  ret = cpuhp_state_add_instance(Y_hp_online, &d->node);
+参数与上述cpuhp_state_add_instance*()变体相同。
 
-这个函数将把这个实例添加到你先前分配的 ``Y_hp_online`` 状态,并在所有在线的
-CPU上调用先前注册的回调( ``Y_online`` )。 *node* 元素是你的每个实例数据结构
-中的一个 ``struct hlist_node`` 成员。
+这些函数在处理已注册回调的方式上有所不同:
 
-在移除该实例时::
+  * cpuhp_state_remove_instance_nocalls()只从状态的节点列表中删除实例。
 
-  cpuhp_state_remove_instance(Y_hp_online, &d->node)
+  * cpuhp_state_remove_instance()删除实例并调用与@state相关的回调(如果不是NULL),
+    用于所有当前状态大于@state的在线CPU。 该回调只对将要被移除的实例进行调用。
+    根据状态阶段,回调要么在当前的CPU上调用(PREPARE阶段),要么在CPU的热插拔
+    线程中调用每个在线CPU(ONLINE阶段)。
 
-应该被调用,这将在所有在线CPU上调用拆分回调。
+    为了完成移除工作,teardown回调不能失败。
 
-手动设置
-~~~~~~~~
+节点列表的添加/删除操作和回调调用是针对CPU热拔插操作进行序列化。这些函数不能在
+CPU hotplug回调和CPU hotplug读取锁定区域内使用。
 
-通常情况下,在注册或移除状态时调用setup和teamdown回调是很方便的,因为通常在CPU上线
-(下线)和驱动的初始设置(关闭)时需要执行该操作。然而,每个注册和删除功能也有一个
-_nocalls的后缀,如果不希望调用回调,则不调用所提供的回调。在手动设置(或关闭)期间,
-应该使用 ``get_online_cpus()`` 和 ``put_online_cpus()`` 函数来抑制CPU热插拔操作。
+例证
+----
 
+在STARTING阶段设置和取消静态分配的状态,以获取上线和下线操作的通知::
 
-事件的顺序
-----------
+   ret = cpuhp_setup_state(CPUHP_SUBSYS_STARTING, "subsys:starting", subsys_cpu_starting, subsys_cpu_dying);
+   if (ret < 0)
+        return ret;
+   ....
+   cpuhp_remove_state(CPUHP_SUBSYS_STARTING);
 
-热插拔状态被定义在 ``include/linux/cpuhotplug.h``:
+在ONLINE阶段设置和取消动态分配的状态,以获取下线操作的通知::
 
-* ``CPUHP_OFFLINE`` ... ``CPUHP_AP_OFFLINE`` 状态是在CPU启动前调用的。
+   state = cpuhp_setup_state(CPUHP_ONLINE_DYN, "subsys:offline", NULL, subsys_cpu_offline);
+   if (state < 0)
+       return state;
+   ....
+   cpuhp_remove_state(state);
 
-* ``CPUHP_AP_OFFLINE`` ... ``CPUHP_AP_ONLINE`` 状态是在CPU被启动后被调用的。
-  中断是关闭的,调度程序还没有在这个CPU上活动。从 ``CPUHP_AP_OFFLINE`` 开始,
-  回调被调用到目标CPU上。
+在ONLINE阶段设置和取消动态分配的状态,以获取有关上线操作的通知,而无需调用回调::
 
-* ``CPUHP_AP_ONLINE_DYN`` 和 ``CPUHP_AP_ONLINE_DYN_END`` 之间的状态被保留
-  给动态分配。
+   state = cpuhp_setup_state_nocalls(CPUHP_ONLINE_DYN, "subsys:online", subsys_cpu_online, NULL);
+   if (state < 0)
+       return state;
+   ....
+   cpuhp_remove_state_nocalls(state);
 
-* 这些状态在CPU关闭时以相反的顺序调用,从 ``CPUHP_ONLINE`` 开始,在 ``CPUHP_OFFLINE``
-  停止。这里的回调是在将被关闭的CPU上调用的,直到 ``CPUHP_AP_OFFLINE`` 。
+在ONLINE阶段设置、使用和取消动态分配的多实例状态,以获得上线和下线操作的通知::
 
-通过 ``CPUHP_AP_ONLINE_DYN`` 动态分配的状态通常已经足够了。然而,如果在启动或关闭
-期间需要更早的调用,那么应该获得一个显式状态。如果热拔插事件需要相对于另一个热拔插事
-件的特定排序,也可能需要一个显式状态。
+   state = cpuhp_setup_state_multi(CPUHP_ONLINE_DYN, "subsys:online", subsys_cpu_online, subsys_cpu_offline);
+   if (state < 0)
+       return state;
+   ....
+   ret = cpuhp_state_add_instance(state, &inst1->node);
+   if (ret)
+        return ret;
+   ....
+   ret = cpuhp_state_add_instance(state, &inst2->node);
+   if (ret)
+        return ret;
+   ....
+   cpuhp_remove_instance(state, &inst1->node);
+   ....
+   cpuhp_remove_instance(state, &inst2->node);
+   ....
+   remove_multi_state(state);
 
 测试热拔插状态
 ==============
-- 
2.20.1


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

* [PATCH 3/9] docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
  2022-06-15  9:24 ` [PATCH 1/9] docs/zh_CN: core-api: Update the translation of cachetlb.rst " Binbin Zhou
  2022-06-15  9:24 ` [PATCH 2/9] docs/zh_CN: core-api: Update the translation of cpu_hotplug.rst " Binbin Zhou
@ 2022-06-15  9:24 ` Binbin Zhou
  2022-06-16  2:18   ` YanTeng Si
  2022-06-15  9:24 ` [PATCH 4/9] docs/zh_CN: core-api: Update the translation of kernel-api.rst " Binbin Zhou
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15  9:24 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

Synchronous translation from the following commits(Latest in front):

[1]: commit 0953fb263714("irq: remove handle_domain_{irq,nmi}()")

[2]: commit 0ddc5e55e6f1("Documentation: Fix irq-domain.rst build warning")

[3]: commit 991007ba6cca("Documentation: Update
     irq_domain.rst with new lookup APIs")

[4]: commit 405e94e9aed2("irqdomain: Kill irq_domain_add_legacy_isa")

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../zh_CN/core-api/irq/irq-domain.rst         | 22 +++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
index 7d077742f758..863e4488c36b 100644
--- a/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
+++ b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
@@ -5,6 +5,7 @@
 :翻译:
 
  司延腾 Yanteng Si <siyanteng@loongson.cn>
+ 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
 
 .. _cn_irq-domain.rst:
 
@@ -52,8 +53,18 @@ irq_domain和一个hwirq号作为参数。 如果hwirq的映射还不存在,
 一个新的Linux irq_desc,将其与hwirq关联起来,并调用.map()回调,这样驱动
 程序就可以执行任何必要的硬件设置。
 
-当接收到一个中断时,应该使用irq_find_mapping()函数从hwirq号中找到
-Linux IRQ号。
+一旦建立了映射,可以通过多种方法检索或使用它:
+
+- irq_resolve_mapping()返回一个指向给定域和hwirq的irq_desc结构指针,
+  如果没有映射则返回NULL。
+
+- irq_find_mapping()返回给定域和hwirq的Linux IRQ号,如果没有映射则返回0。
+
+- irq_linear_revmap()现与irq_find_mapping()相同,已被废弃。
+
+- generic_handle_domain_irq()处理一个由域和hwirq描述的中断。
+
+请注意,irq域的查找必须发生在与RCU读临界区兼容的上下文中。
 
 在调用irq_find_mapping()之前,至少要调用一次irq_create_mapping()函数,
 以免描述符不能被分配。
@@ -119,7 +130,8 @@ irq_domain_add_tree()和irq_domain_create_tree()在功能上是等价的,除
 Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create_direct_mapping()
 会分配一个Linux IRQ号,并调用.map()回调,这样驱动就可以将Linux IRQ号编入硬件中。
 
-大多数驱动程序不能使用这个映射。
+大多数驱动程序无法使用此映射,现在它由CONFIG_IRQ_DOMAIN_NOMAP选项控制。
+请不要引入此API的新用户。
 
 传统映射类型
 ------------
@@ -128,7 +140,6 @@ Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create
 
 	irq_domain_add_simple()
 	irq_domain_add_legacy()
-	irq_domain_add_legacy_isa()
 	irq_domain_create_simple()
 	irq_domain_create_legacy()
 
@@ -137,6 +148,9 @@ Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create
 一组用于IRQ号的定义(#define),这些定义被传递给struct设备注册。 在这种情况下,
 不能动态分配Linux IRQ号,应该使用传统映射。
 
+顾名思义,\*_legacy()系列函数已被废弃,只是为了方便对古老平台的支持而存在。
+不应该增加新的用户。当\*_simple()系列函数的使用导致遗留行为时,他们也是如此。
+
 传统映射假设已经为控制器分配了一个连续的IRQ号范围,并且可以通过向hwirq号添加一
 个固定的偏移来计算IRQ号,反之亦然。 缺点是需要中断控制器管理IRQ分配,并且需要为每
 个hwirq分配一个irq_desc,即使它没有被使用。
-- 
2.20.1


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

* [PATCH 4/9] docs/zh_CN: core-api: Update the translation of kernel-api.rst to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
                   ` (2 preceding siblings ...)
  2022-06-15  9:24 ` [PATCH 3/9] docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst " Binbin Zhou
@ 2022-06-15  9:24 ` Binbin Zhou
  2022-06-15  9:24 ` [PATCH 5/9] docs/zh_CN: core-api: Update the translation of mm-api.rst " Binbin Zhou
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15  9:24 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

Synchronous translation from upstream commit 640d1930bef4
("block: Add bio_for_each_folio_all()")

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 Documentation/translations/zh_CN/core-api/kernel-api.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/translations/zh_CN/core-api/kernel-api.rst b/Documentation/translations/zh_CN/core-api/kernel-api.rst
index e45fe80d1cd8..120c051f6fcb 100644
--- a/Documentation/translations/zh_CN/core-api/kernel-api.rst
+++ b/Documentation/translations/zh_CN/core-api/kernel-api.rst
@@ -5,6 +5,7 @@
 :翻译:
 
  司延腾 Yanteng Si <siyanteng@loongson.cn>
+ 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
 
 .. _cn_kernel-api.rst:
 
@@ -282,6 +283,8 @@ kernel/acct.c
 
 该API在以下内核代码中:
 
+include/linux/bio.h
+
 block/blk-core.c
 
 block/blk-core.c
-- 
2.20.1


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

* [PATCH 5/9] docs/zh_CN: core-api: Update the translation of mm-api.rst to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
                   ` (3 preceding siblings ...)
  2022-06-15  9:24 ` [PATCH 4/9] docs/zh_CN: core-api: Update the translation of kernel-api.rst " Binbin Zhou
@ 2022-06-15  9:24 ` Binbin Zhou
  2022-06-15  9:24 ` [PATCH 6/9] docs/zh_CN: core-api: Update the translation of printk-basics.rst " Binbin Zhou
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15  9:24 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

Synchronous translation from the following commits(Latest in front):

[1]: commit 84dacdbd5352("mm: document and polish read-ahead code")

[2]: commit 2f52578f9c64("mm/util: Add folio_mapping() and
     folio_file_mapping()")

[3]: commit 889a3747b3b7("mm/lru: Add folio LRU functions")

[4]: commit c24016ac3a62("mm: Add folio reference count functions")

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../translations/zh_CN/core-api/mm-api.rst    | 23 ++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/Documentation/translations/zh_CN/core-api/mm-api.rst b/Documentation/translations/zh_CN/core-api/mm-api.rst
index 0ea43dc67953..a732b0eebf16 100644
--- a/Documentation/translations/zh_CN/core-api/mm-api.rst
+++ b/Documentation/translations/zh_CN/core-api/mm-api.rst
@@ -5,6 +5,7 @@
 :翻译:
 
  司延腾 Yanteng Si <siyanteng@loongson.cn>
+ 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
 
 :校译:
 
@@ -66,12 +67,24 @@ mm/vmalloc.c
 
 该API在以下内核代码中:
 
-mm/readahead.c
+文件映射
+--------
 
 mm/filemap.c
 
+预读
+----
+
+mm/readahead.c
+
+回写
+----
+
 mm/page-writeback.c
 
+截断
+----
+
 mm/truncate.c
 
 include/linux/pagemap.h
@@ -105,6 +118,14 @@ mm/mempolicy.c
 
 include/linux/mm_types.h
 
+include/linux/mm_inline.h
+
+include/linux/page-flags.h
+
 include/linux/mm.h
 
+include/linux/page_ref.h
+
 include/linux/mmzone.h
+
+mm/util.c
-- 
2.20.1


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

* [PATCH 6/9] docs/zh_CN: core-api: Update the translation of printk-basics.rst to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
                   ` (4 preceding siblings ...)
  2022-06-15  9:24 ` [PATCH 5/9] docs/zh_CN: core-api: Update the translation of mm-api.rst " Binbin Zhou
@ 2022-06-15  9:24 ` Binbin Zhou
  2022-06-15  9:24 ` [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst " Binbin Zhou
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15  9:24 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

Synchronous translation from upstream commit 7d9e2661f268
("printk: Move the printk() kerneldoc comment to its new home")

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 Documentation/translations/zh_CN/core-api/printk-basics.rst | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Documentation/translations/zh_CN/core-api/printk-basics.rst b/Documentation/translations/zh_CN/core-api/printk-basics.rst
index d574de3167c8..59c6efb3fc41 100644
--- a/Documentation/translations/zh_CN/core-api/printk-basics.rst
+++ b/Documentation/translations/zh_CN/core-api/printk-basics.rst
@@ -6,6 +6,7 @@
 :翻译:
 
  司延腾 Yanteng Si <siyanteng@loongson.cn>
+ 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
 
 .. _cn_printk-basics.rst:
 
@@ -107,6 +108,4 @@ pr_debug()和pr_devel(),除非定义了 ``DEBUG`` (或者在pr_debug()的情
 
 该API在以下内核代码中:
 
-kernel/printk/printk.c
-
 include/linux/printk.h
-- 
2.20.1


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

* [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
                   ` (5 preceding siblings ...)
  2022-06-15  9:24 ` [PATCH 6/9] docs/zh_CN: core-api: Update the translation of printk-basics.rst " Binbin Zhou
@ 2022-06-15  9:24 ` Binbin Zhou
  2022-06-16 23:37   ` Wu XiangCheng
  2022-06-15 13:27 ` [PATCH 8/9] docs/zh_CN: core-api: Update the translation of workqueue.rst " Binbin Zhou
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15  9:24 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

Synchronous translation from the following commits(Latest in front):

[1]: commit 2fbf5241a561("vsprintf: add new `%pA` format specifier")

[2]: commit 6a7ca80f4033("vsprintf: Update %pGp documentation
     about that it prints hex value")

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../translations/zh_CN/core-api/printk-formats.rst  | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/Documentation/translations/zh_CN/core-api/printk-formats.rst b/Documentation/translations/zh_CN/core-api/printk-formats.rst
index ce39c788cf5a..78561c35e528 100644
--- a/Documentation/translations/zh_CN/core-api/printk-formats.rst
+++ b/Documentation/translations/zh_CN/core-api/printk-formats.rst
@@ -5,6 +5,7 @@
 :翻译:
 
  司延腾 Yanteng Si <siyanteng@loongson.cn>
+ 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
 
 .. _cn_printk-formats.rst:
 
@@ -548,7 +549,7 @@ nodemask_pr_args()来方便打印cpumask和nodemask。
 
 ::
 
-	%pGp	referenced|uptodate|lru|active|private|node=0|zone=2|lastcpupid=0x1fffff
+	%pGp	0x17ffffc0002036(referenced|uptodate|lru|active|private|node=0|zone=2|lastcpupid=0x1fffff)
 	%pGg	GFP_USER|GFP_DMA32|GFP_NOWARN
 	%pGv	read|exec|mayread|maywrite|mayexec|denywrite
 
@@ -589,6 +590,16 @@ V4L2和DRM FourCC代码(像素格式)
 	%p4cc	Y10  little-endian (0x20303159)
 	%p4cc	NV12 big-endian (0xb231564e)
 
+Rust
+----
+
+::
+
+       %pA
+
+仅用于Rust代码格式化``core::fmt::Arguments``。
+不能用于C语言。
+
 谢谢
 ====
 
-- 
2.20.1


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

* [PATCH 8/9] docs/zh_CN: core-api: Update the translation of workqueue.rst to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
                   ` (6 preceding siblings ...)
  2022-06-15  9:24 ` [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst " Binbin Zhou
@ 2022-06-15 13:27 ` Binbin Zhou
  2022-06-15 13:27 ` [PATCH 9/9] docs/zh_CN: core-api: Update the translation of xarray.rst " Binbin Zhou
  2022-06-15 15:34 ` [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation " Yanteng Si
  9 siblings, 0 replies; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15 13:27 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

Synchronous translation from upstream commit f9eaaa82b474
("workqueue: doc: Call out the non-reentrance conditions")

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../translations/zh_CN/core-api/workqueue.rst | 21 +++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/Documentation/translations/zh_CN/core-api/workqueue.rst b/Documentation/translations/zh_CN/core-api/workqueue.rst
index e372fa5cf101..f6567cf9d3fb 100644
--- a/Documentation/translations/zh_CN/core-api/workqueue.rst
+++ b/Documentation/translations/zh_CN/core-api/workqueue.rst
@@ -6,6 +6,7 @@
 :翻译:
 
  司延腾 Yanteng Si <siyanteng@loongson.cn>
+ 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
 
 .. _cn_workqueue.rst:
 
@@ -178,10 +179,6 @@ workqueue将自动创建与属性相匹配的后备工作者池。调节并发
 
   这个标志对于未绑定的wq来说是没有意义的。
 
-请注意,标志 ``WQ_NON_REENTRANT`` 不再存在,因为现在所有的工作
-队列都是不可逆的——任何工作项都保证在任何时间内最多被整个系统的一
-个工作者执行。
-
 
 ``max_active``
 --------------
@@ -328,6 +325,22 @@ And with cmwq with ``@max_active`` >= 3, ::
 
 工作项函数在堆栈追踪中应该是微不足道的。
 
+不可重入条件
+============
+
+工作队列保证,如果在工作项排队后满足以下条件,则工作项不能重入:
+
+
+        1. 工作函数没有被改变。
+        2. 没有人将该工作项排到另一个工作队列中。
+        3. 该工作项尚未被重新启动。
+
+换言之,如果上述条件成立,则保证在任何给定时间最多由一个系统范围内的工作程序执行
+该工作项。
+
+请注意,在self函数中将工作项重新排队(到同一队列)不会破坏这些条件,因此可以安全
+地执行此操作。否则在破坏工作函数内部的条件时需要小心。
+
 
 内核内联文档参考
 ================
-- 
2.20.1


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

* [PATCH 9/9] docs/zh_CN: core-api: Update the translation of xarray.rst to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
                   ` (7 preceding siblings ...)
  2022-06-15 13:27 ` [PATCH 8/9] docs/zh_CN: core-api: Update the translation of workqueue.rst " Binbin Zhou
@ 2022-06-15 13:27 ` Binbin Zhou
  2022-06-15 15:34 ` [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation " Yanteng Si
  9 siblings, 0 replies; 18+ messages in thread
From: Binbin Zhou @ 2022-06-15 13:27 UTC (permalink / raw)
  To: alexs, siyanteng; +Cc: corbet, chenhuacai, bobwxc, linux-doc, Binbin Zhou

Synchronous translation from upstream commit ac23d1a96460
("XArray: Document the locking requirement for the xa_state")

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 Documentation/translations/zh_CN/core-api/xarray.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/translations/zh_CN/core-api/xarray.rst b/Documentation/translations/zh_CN/core-api/xarray.rst
index ff2d9bcb7c34..fb19324966ce 100644
--- a/Documentation/translations/zh_CN/core-api/xarray.rst
+++ b/Documentation/translations/zh_CN/core-api/xarray.rst
@@ -6,6 +6,7 @@
 :翻译:
 
  司延腾 Yanteng Si <siyanteng@loongson.cn>
+ 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
 
 :校译:
 
@@ -254,7 +255,8 @@ __xa_set_mark() 和 __xa_clear_mark() 函数也适用于你查找一个条目并
 
 高级API是基于xa_state的。这是一个不透明的数据结构,你使用XA_STATE()宏在堆栈中声明。这个宏初始化了
 xa_state,准备开始在XArray上移动。它被用作一个游标来保持在XArray中的位置,并让你把各种操作组合在一
-起,而不必每次都从头开始。
+起,而不必每次都从头开始。xa_state的内容受rcu_read_lock()或xas_lock()的保护。如果需要删除保护状态
+和树的这些锁中的任何一个,你必须调用xas_pause()以便将来的调用不会依赖于状态中未受保护的部分。
 
 xa_state也被用来存储错误(store errors)。你可以调用xas_error()来检索错误。所有的操作在进行之前都
 会检查xa_state是否处于错误状态,所以你没有必要在每次调用之后检查错误;你可以连续进行多次调用,只在
-- 
2.20.1


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

* Re: [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2
  2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
                   ` (8 preceding siblings ...)
  2022-06-15 13:27 ` [PATCH 9/9] docs/zh_CN: core-api: Update the translation of xarray.rst " Binbin Zhou
@ 2022-06-15 15:34 ` Yanteng Si
  9 siblings, 0 replies; 18+ messages in thread
From: Yanteng Si @ 2022-06-15 15:34 UTC (permalink / raw)
  To: Binbin Zhou, alexs; +Cc: corbet, chenhuacai, bobwxc, linux-doc, bobwxc

On 2022/6/15 下午5:24, Binbin Zhou wrote:
> This series of patches updat the contents of the translated files
Hi Binbin

what is "updat"? ;)

BTW,
Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
to do frotz", as if you are giving orders to the codebase to change
its behaviour.

--CC bobwxc@yeah.net

Thanks,
Yanteng
> in the core-api directory to 5.19-rc2.
> 
> In the next step, I plan to translate the untranslated documents
> in the core-api directory. For details, see TODOLIST in the
> core-api/index.rst file.
> 
> Binbin Zhou (9):
>    docs/zh_CN: core-api: Update the translation of cachetlb.rst to
>      5.19-rc2
>    docs/zh_CN: core-api: Update the translation of cpu_hotplug.rst to
>      5.19-rc2
>    docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst to
>      5.19-rc2
>    docs/zh_CN: core-api: Update the translation of kernel-api.rst to
>      5.19-rc2
>    docs/zh_CN: core-api: Update the translation of mm-api.rst to 5.19-rc2
>    docs/zh_CN: core-api: Update the translation of printk-basics.rst to
>      5.19-rc2
>    docs/zh_CN: core-api: Update the translation of printk-format.rst to
>      5.19-rc2
>    docs/zh_CN: core-api: Update the translation of workqueue.rst to
>      5.19-rc2
>    docs/zh_CN: core-api: Update the translation of xarray.rst to 5.19-rc2
> 
>   .../translations/zh_CN/core-api/cachetlb.rst  |   6 +
>   .../zh_CN/core-api/cpu_hotplug.rst            | 435 +++++++++++++++---
>   .../zh_CN/core-api/irq/irq-domain.rst         |  22 +-
>   .../zh_CN/core-api/kernel-api.rst             |   3 +
>   .../translations/zh_CN/core-api/mm-api.rst    |  23 +-
>   .../zh_CN/core-api/printk-basics.rst          |   3 +-
>   .../zh_CN/core-api/printk-formats.rst         |  13 +-
>   .../translations/zh_CN/core-api/workqueue.rst |  21 +-
>   .../translations/zh_CN/core-api/xarray.rst    |   4 +-
>   9 files changed, 459 insertions(+), 71 deletions(-)
> 


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

* Re: [PATCH 3/9] docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst to 5.19-rc2
  2022-06-15  9:24 ` [PATCH 3/9] docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst " Binbin Zhou
@ 2022-06-16  2:18   ` YanTeng Si
  2022-06-16 10:08     ` 周彬彬
  0 siblings, 1 reply; 18+ messages in thread
From: YanTeng Si @ 2022-06-16  2:18 UTC (permalink / raw)
  To: Binbin Zhou, alexs; +Cc: corbet, chenhuacai, bobwxc, linux-doc


在 2022/6/15 17:24, Binbin Zhou 写道:
> Synchronous translation from the following commits(Latest in front):
>
> [1]: commit 0953fb263714("irq: remove handle_domain_{irq,nmi}()")
>
> [2]: commit 0ddc5e55e6f1("Documentation: Fix irq-domain.rst build warning")
>
> [3]: commit 991007ba6cca("Documentation: Update
>       irq_domain.rst with new lookup APIs")
>
> [4]: commit 405e94e9aed2("irqdomain: Kill irq_domain_add_legacy_isa")
>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>   .../zh_CN/core-api/irq/irq-domain.rst         | 22 +++++++++++++++----
>   1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
> index 7d077742f758..863e4488c36b 100644
> --- a/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
> +++ b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
> @@ -5,6 +5,7 @@
>   :翻译:
>   
>    司延腾 Yanteng Si <siyanteng@loongson.cn>
> + 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
>   
>   .. _cn_irq-domain.rst:
>   
> @@ -52,8 +53,18 @@ irq_domain和一个hwirq号作为参数。 如果hwirq的映射还不存在,
>   一个新的Linux irq_desc,将其与hwirq关联起来,并调用.map()回调,这样驱动
>   程序就可以执行任何必要的硬件设置。
>   
> -当接收到一个中断时,应该使用irq_find_mapping()函数从hwirq号中找到
> -Linux IRQ号。
> +一旦建立了映射,可以通过多种方法检索或使用它:
> +
> +- irq_resolve_mapping()返回一个指向给定域和hwirq的irq_desc结构指针,
> +  如果没有映射则返回NULL。
> +
> +- irq_find_mapping()返回给定域和hwirq的Linux IRQ号,如果没有映射则返回0。
> +
> +- irq_linear_revmap()现与irq_find_mapping()相同,已被废弃。
> +
> +- generic_handle_domain_irq()处理一个由域和hwirq描述的中断。

hwirq号描述的中断。


Thanks,

Yanteng

> +
> +请注意,irq域的查找必须发生在与RCU读临界区兼容的上下文中。
>   
>   在调用irq_find_mapping()之前,至少要调用一次irq_create_mapping()函数,
>   以免描述符不能被分配。
> @@ -119,7 +130,8 @@ irq_domain_add_tree()和irq_domain_create_tree()在功能上是等价的,除
>   Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create_direct_mapping()
>   会分配一个Linux IRQ号,并调用.map()回调,这样驱动就可以将Linux IRQ号编入硬件中。
>   
> -大多数驱动程序不能使用这个映射。
> +大多数驱动程序无法使用此映射,现在它由CONFIG_IRQ_DOMAIN_NOMAP选项控制。
> +请不要引入此API的新用户。
>   
>   传统映射类型
>   ------------
> @@ -128,7 +140,6 @@ Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create
>   
>   	irq_domain_add_simple()
>   	irq_domain_add_legacy()
> -	irq_domain_add_legacy_isa()
>   	irq_domain_create_simple()
>   	irq_domain_create_legacy()
>   
> @@ -137,6 +148,9 @@ Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create
>   一组用于IRQ号的定义(#define),这些定义被传递给struct设备注册。 在这种情况下,
>   不能动态分配Linux IRQ号,应该使用传统映射。
>   
> +顾名思义,\*_legacy()系列函数已被废弃,只是为了方便对古老平台的支持而存在。
> +不应该增加新的用户。当\*_simple()系列函数的使用导致遗留行为时,他们也是如此。
> +
>   传统映射假设已经为控制器分配了一个连续的IRQ号范围,并且可以通过向hwirq号添加一
>   个固定的偏移来计算IRQ号,反之亦然。 缺点是需要中断控制器管理IRQ分配,并且需要为每
>   个hwirq分配一个irq_desc,即使它没有被使用。


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

* Re: Re: [PATCH 2/9] docs/zh_CN: core-api: Update the translation of cpu_hotplug.rst to 5.19-rc2
       [not found]   ` <20220616002137.6614-1-bobwxc@email.cn>
@ 2022-06-16 10:04     ` 周彬彬
  0 siblings, 0 replies; 18+ messages in thread
From: 周彬彬 @ 2022-06-16 10:04 UTC (permalink / raw)
  To: Wu XiangCheng; +Cc: alexs, siyanteng, corbet, chenhuacai, linux-doc

Hi xiangcheng:

&gt; -----原始邮件-----
&gt; 发件人: "Wu XiangCheng" <bobwxc@email.cn>
&gt; 发送时间: 2022-06-16 08:21:38 (星期四)
&gt; 收件人: "Binbin Zhou" <zhoubinbin@loongson.cn>
&gt; 抄送: "Wu X.C." <bobwxc@email.cn>, alexs@kernel.org, siyanteng@loongson.cn, corbet@lwn.net, chenhuacai@loongson.cn, linux-doc@vger.kernel.org
&gt; 主题: Re: [PATCH 2/9] docs/zh_CN: core-api: Update the translation of cpu_hotplug.rst to 5.19-rc2
&gt; 
&gt; From: "Wu X.C." <bobwxc@email.cn>
&gt; 
&gt; Hi Binbin,
&gt; 
&gt; On Wed, Jun 15, 2022 at 05:24:25PM +0800, Binbin Zhou wrote:
&gt; &gt; Synchronous translation from upstream commit c9871c800f65
&gt; &gt; ("Documentation: core-api/cpuhotplug: Rewrite the API section")
&gt; &gt; 
&gt; &gt; Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
&gt; &gt; ---
&gt; &gt;  .../zh_CN/core-api/cpu_hotplug.rst            | 435 +++++++++++++++---
&gt; &gt;  1 file changed, 377 insertions(+), 58 deletions(-)
&gt; &gt; 
&gt; &gt; diff --git a/Documentation/translations/zh_CN/core-api/cpu_hotplug.rst b/Documentation/translations/zh_CN/core-api/cpu_hotplug.rst
&gt; &gt; index 85a264287426..007a58f8086d 100644
&gt; &gt; --- a/Documentation/translations/zh_CN/core-api/cpu_hotplug.rst
&gt; &gt; +++ b/Documentation/translations/zh_CN/core-api/cpu_hotplug.rst
&gt; &gt; @@ -4,6 +4,7 @@
&gt; &gt;  :翻译:
&gt; &gt;  
&gt; &gt;   司延腾 Yanteng Si <siyanteng@loongson.cn>
&gt; &gt; + 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
&gt; &gt;  
&gt; &gt;  :校译:
&gt; &gt;  
&gt; &gt; @@ -15,12 +16,13 @@
&gt; &gt;  内核中的CPU热拔插
&gt; &gt;  =================
&gt; &gt;  
&gt; &gt; -:时间: 2016年12月
&gt; &gt; +:时间: 2021年9月
&gt; &gt;  :作者: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
&gt; &gt; -          Rusty Russell <rusty@rustcorp.com.au>,
&gt; &gt; -          Srivatsa Vaddagiri <vatsa@in.ibm.com>,
&gt; &gt; -          Ashok Raj <ashok.raj@intel.com>,
&gt; &gt; -          Joel Schopp <jschopp@austin.ibm.com>
&gt; &gt; +       Rusty Russell <rusty@rustcorp.com.au>,
&gt; &gt; +       Srivatsa Vaddagiri <vatsa@in.ibm.com>,
&gt; &gt; +       Ashok Raj <ashok.raj@intel.com>,
&gt; &gt; +       Joel Schopp <jschopp@austin.ibm.com>,
&gt; &gt; +       Thomas Gleixner <tglx@linutronix.de>
&gt; &gt;  
&gt; &gt;  简介
&gt; &gt;  ====
&gt; &gt; @@ -139,7 +141,7 @@ CPU的热拔插协作
&gt; &gt;  下线情况
&gt; &gt;  --------
&gt; &gt;  
&gt; &gt; -一旦CPU被逻辑关闭,注册的热插拔状态的清除回调将被调用,从 ``CPUHP_ONLINE`` 开始,在
&gt; &gt; +一旦CPU被逻辑关闭,注册的热插拔状态的清除回调将被调用,从 ``CPUHP_ONLINE`` 开始,到
&gt; &gt;  ``CPUHP_OFFLINE`` 状态结束。这包括:
&gt; &gt;  
&gt; &gt;  * 如果任务因暂停操作而被冻结,那么 *cpuhp_tasks_frozen* 将被设置为true。
&gt; &gt; @@ -154,82 +156,399 @@ CPU的热拔插协作
&gt; &gt;  * 一旦所有的服务被迁移,内核会调用一个特定的例程 ``__cpu_disable()`` 来进行特定的清
&gt; &gt;    理。
&gt; &gt;  
&gt; &gt; -使用热插拔API
&gt; &gt; --------------
&gt; &gt; +CPU热插拔API
&gt; &gt; +============
&gt; &gt; +
&gt; &gt; +CPU热拔插状态机
&gt; &gt; +---------------
&gt; &gt; +
&gt; &gt; +CPU热插拔使用一个从CPUHP_OFFLINE到CPUHP_ONLINE的线性状态空间的普通状态机。每个状态都
&gt; &gt; +有一个startup和teardown的回调。
&gt; &gt; +
&gt; &gt; +当一个CPU上线时,将按顺序调用startup回调,直到达到CPUHP_ONLINE状态。当设置状态的回调
&gt; &gt; +或将实例添加到多实例状态时,也可以调用它们。
&gt; &gt; +
&gt; &gt; +当一个CPU下线时,将按相反的顺序依次调用teardown回调,直到达到CPUHP_OFFLINE状态。当删
&gt; &gt; +除状态的回调或从多实例状态中删除实例时,也可以调用它们。
&gt; &gt; +
&gt; &gt; +如果某个使用场景只需要一个方向的热插拔操作回调(CPU上线或CPU下线),则在设置状态时,
&gt; &gt; +可以将另一个不需要的回调设置为NULL。
&gt; &gt; +
&gt; &gt; +状态空间被划分成三个阶段:
&gt; &gt; +
&gt; &gt; +* PREPARE阶段
&gt; &gt; +
&gt; &gt; +  PREPARE阶段涵盖了从CPUHP_OFFLINE到CPUHP_BRINGUP_CPU之间的状态空间。
&gt; &gt; +
&gt; &gt; +  在该阶段中,startup回调在CPU上线操作启动CPU之前被调用,teardown回调在CPU下线操作使
&gt; &gt; +  CPU功能失调之后被调用。
&gt; 
&gt; dysfunctional -&gt; 失效 ?
&gt; 功能失调 is quite strange, if you agree, repalce all 'dysfunctional'.

Yes,“失效“ is a better translation.
&gt; 
&gt; &gt; +
&gt; &gt; +  这些回调是在控制CPU上调用的,因为它们显然不能在热插拔的CPU上运行,此时热插拔的CPU要
&gt; &gt; +  么还没有启动,要么已经功能失调。
&gt; &gt; +
&gt; &gt; +  startup回调用于设置CPU成功上线所需要的资源。teardown回调用于释放资源或在热插拔的CPU
&gt; &gt; +  不能正常工作后,将待处理的工作转移到在线的CPU上。
&gt; &gt; +
&gt; &gt; +  允许startup回调失败。如果回调失败,CPU上线操作被中止,CPU将再次被降到之前的状态(通
&gt; &gt; +  常是CPUHP_OFFLINE)。
&gt; &gt; +
&gt; &gt; +  本阶段中的teardown回调不允许失败。
&gt; &gt; +
&gt; &gt; +* STARTING阶段
&gt; &gt; +
&gt; &gt; +  STARTING阶段涵盖了CPUHP_BRINGUP_CPU + 1到CPUHP_AP_ONLINE之间的状态空间。
&gt; &gt; +
&gt; &gt; +  该阶段中的startup回调是在早期CPU设置代码中的CPU上线操作期间,禁用中断的情况下在热拔
&gt; &gt; +  插的CPU上被调用。teardown回调是在CPU完全关闭前不久的CPU下线操作期间,禁用中断的情况
&gt; &gt; +  下在热拔插的CPU上被调用。
&gt; &gt; +
&gt; &gt; +  该阶段中的回调不允许失败。
&gt; &gt; +
&gt; &gt; +  回调用于低级别的硬件初始化/关机和核心子系统。
&gt; &gt; +
&gt; &gt; +* ONLINE阶段
&gt; &gt; +
&gt; &gt; +  ONLINE阶段涵盖了CPUHP_AP_ONLINE + 1到CPUHP_ONLINE之间的状态空间。
&gt; &gt; +
&gt; &gt; +  该阶段中的startup回调是在CPU上线时在热插拔的CPU上调用的。teardown回调是在CPU下线操
&gt; &gt; +  作时在热插拔CPU上调用的。
&gt; &gt; +
&gt; &gt; +  回调是在每个CPU热插拔线程的上下文中调用的,该线程绑定在热插拔的CPU上。回调是在启用
&gt; &gt; +  中断和抢占的情况下调用的。
&gt; &gt; +
&gt; &gt; +  允许回调失败。如果回调失败,CPU热插拔操作被中止,CPU将恢复到之前的状态。
&gt; &gt; +
&gt; &gt; +CPU 上线/下线操作
&gt; &gt; +-----------------
&gt; &gt; +
&gt; &gt; +一个成功的上线操作如下::
&gt; &gt; +
&gt; &gt; +  [CPUHP_OFFLINE]
&gt; &gt; +  [CPUHP_OFFLINE + 1]-&gt;startup()       -&gt; 成功
&gt; &gt; +  [CPUHP_OFFLINE + 2]-&gt;startup()       -&gt; 成功
&gt; &gt; +  [CPUHP_OFFLINE + 3]                  -&gt; 略过,因为startup == NULL
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_BRINGUP_CPU]-&gt;startup()       -&gt; 成功
&gt; &gt; +  === PREPARE阶段结束
&gt; &gt; +  [CPUHP_BRINGUP_CPU + 1]-&gt;startup()   -&gt; 成功
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_AP_ONLINE]-&gt;startup()         -&gt; 成功
&gt; &gt; +  === STARTUP阶段结束
&gt; &gt; +  [CPUHP_AP_ONLINE + 1]-&gt;startup()     -&gt; 成功
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_ONLINE - 1]-&gt;startup()        -&gt; 成功
&gt; &gt; +  [CPUHP_ONLINE]
&gt; &gt; +
&gt; &gt; +一个成功的下线操作如下::
&gt; &gt; +
&gt; &gt; +  [CPUHP_ONLINE]
&gt; &gt; +  [CPUHP_ONLINE - 1]-&gt;teardown()       -&gt; 成功
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_AP_ONLINE + 1]-&gt;teardown()    -&gt; 成功
&gt; &gt; +  === STARTUP阶段开始
&gt; &gt; +  [CPUHP_AP_ONLINE]-&gt;teardown()        -&gt; 成功
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_BRINGUP_ONLINE - 1]-&gt;teardown()
&gt; &gt; +  ...
&gt; &gt; +  === PREPARE阶段开始
&gt; &gt; +  [CPUHP_BRINGUP_CPU]-&gt;teardown()
&gt; &gt; +  [CPUHP_OFFLINE + 3]-&gt;teardown()
&gt; &gt; +  [CPUHP_OFFLINE + 2]                  -&gt; 略过,因为teardown == NULL
&gt; &gt; +  [CPUHP_OFFLINE + 1]-&gt;teardown()
&gt; &gt; +  [CPUHP_OFFLINE]
&gt; &gt; +
&gt; &gt; +一个失败的上线操作如下::
&gt; &gt; +
&gt; &gt; +  [CPUHP_OFFLINE]
&gt; &gt; +  [CPUHP_OFFLINE + 1]-&gt;startup()       -&gt; 成功
&gt; &gt; +  [CPUHP_OFFLINE + 2]-&gt;startup()       -&gt; 成功
&gt; &gt; +  [CPUHP_OFFLINE + 3]                  -&gt; 略过,因为startup == NULL
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_BRINGUP_CPU]-&gt;startup()       -&gt; 成功
&gt; &gt; +  === PREPARE阶段结束
&gt; &gt; +  [CPUHP_BRINGUP_CPU + 1]-&gt;startup()   -&gt; 成功
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_AP_ONLINE]-&gt;startup()         -&gt; 成功
&gt; &gt; +  === STARTUP阶段结束
&gt; &gt; +  [CPUHP_AP_ONLINE + 1]-&gt;startup()     -&gt; 成功
&gt; &gt; +  ---
&gt; &gt; +  [CPUHP_AP_ONLINE + N]-&gt;startup()     -&gt; 失败
&gt; &gt; +  [CPUHP_AP_ONLINE + (N - 1)]-&gt;teardown()
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_AP_ONLINE + 1]-&gt;teardown()
&gt; &gt; +  === STARTUP阶段开始
&gt; &gt; +  [CPUHP_AP_ONLINE]-&gt;teardown()
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_BRINGUP_ONLINE - 1]-&gt;teardown()
&gt; &gt; +  ...
&gt; &gt; +  === PREPARE阶段开始
&gt; &gt; +  [CPUHP_BRINGUP_CPU]-&gt;teardown()
&gt; &gt; +  [CPUHP_OFFLINE + 3]-&gt;teardown()
&gt; &gt; +  [CPUHP_OFFLINE + 2]                  -&gt; 略过,因为teardown == NULL
&gt; &gt; +  [CPUHP_OFFLINE + 1]-&gt;teardown()
&gt; &gt; +  [CPUHP_OFFLINE]
&gt; &gt; +
&gt; &gt; +一个失败的下线操作如下::
&gt; &gt; +
&gt; &gt; +  [CPUHP_ONLINE]
&gt; &gt; +  [CPUHP_ONLINE - 1]-&gt;teardown()       -&gt; 成功
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_ONLINE - N]-&gt;teardown()       -&gt; 失败
&gt; &gt; +  [CPUHP_ONLINE - (N - 1)]-&gt;startup()
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_ONLINE - 1]-&gt;startup()
&gt; &gt; +  [CPUHP_ONLINE]
&gt; &gt; +
&gt; &gt; +递归失败不能被合理地处理。
&gt; &gt; +请看下面的例子,由于下线操作失败而导致的递归失败: ::
&gt; &gt; +
&gt; &gt; +  [CPUHP_ONLINE]
&gt; &gt; +  [CPUHP_ONLINE - 1]-&gt;teardown()       -&gt; 成功
&gt; &gt; +  ...
&gt; &gt; +  [CPUHP_ONLINE - N]-&gt;teardown()       -&gt; 失败
&gt; &gt; +  [CPUHP_ONLINE - (N - 1)]-&gt;startup()  -&gt; 成功
&gt; &gt; +  [CPUHP_ONLINE - (N - 2)]-&gt;startup()  -&gt; 失败
&gt; &gt; +
&gt; &gt; +CPU热插拔状态机在此停止,并不试图再次回滚,因为这可能会导致无尽的循环::
&gt; 
&gt; 且不再尝试回滚
&gt; 
&gt; 无尽的循环 -&gt; 死循环 ?

Agress!

&gt; 
&gt; &gt; +
&gt; &gt; +  [CPUHP_ONLINE - (N - 1)]-&gt;teardown() -&gt; 成功
&gt; &gt; +  [CPUHP_ONLINE - N]-&gt;teardown()       -&gt; 失败
&gt; &gt; +  [CPUHP_ONLINE - (N - 1)]-&gt;startup()  -&gt; 成功
&gt; &gt; +  [CPUHP_ONLINE - (N - 2)]-&gt;startup()  -&gt; 失败
&gt; &gt; +  [CPUHP_ONLINE - (N - 1)]-&gt;teardown() -&gt; 成功
&gt; &gt; +  [CPUHP_ONLINE - N]-&gt;teardown()       -&gt; 失败
&gt; &gt; +
&gt; &gt; +擦洗,冲洗,重复。在这种情况下,CPU留在该状态中::
&gt; 
&gt; Lather, rinse and repeat.
&gt; 可意译成 周而复始,不断重复

Perfact!

&gt; 
&gt; &gt; +
&gt; &gt; +  [CPUHP_ONLINE - (N - 1)]
&gt; &gt; +
&gt; &gt; +这至少可以让系统取得进展,让用户有机会进行调试,甚至解决这个问题。
&gt; &gt; +
&gt; &gt; +分配一个状态
&gt; &gt; +------------
&gt; &gt; +
&gt; &gt; +有两种方式分配一个CPU热插拔状态:
&gt; &gt; +
&gt; &gt; +* 静态分配
&gt; &gt; +
&gt; &gt; +  当子系统或驱动程序有相对于其他CPU热插拔状态的排序要求时,必须使用静态分配。例如,
&gt; &gt; +  在CPU上线操作期间,PERF核心startup回调必须在PERF驱动startup回调之前被调用。在CPU
&gt; &gt; +  下线操作中,驱动teardown回调必须在核心teardown回调之前调用。静态分配的状态由
&gt; &gt; +  cpuhp_state枚举中的常量描述,可以在include/linux/cpuhotplug.h中找到。
&gt; &gt; +
&gt; &gt; +  在适当的位置将状态插入枚举中,这样就满足了排序要求。状态常量必须被用于状态的设置
&gt; &gt; +  和移除。
&gt; &gt; +
&gt; &gt; +  当状态回调不是在运行时设置的,并且是kernel/cpu.c中CPU热插拔状态数组初始化的一部分
&gt; &gt; +  时,也需要静态分配。
&gt; &gt; +
&gt; &gt; +* 动态分配
&gt; &gt; +
&gt; &gt; +  当对状态回调没有排序要求时,动态分配是首选方法。状态编号由setup函数分配,并在成功
&gt; &gt; +  后返回给调用者。
&gt; &gt; +
&gt; &gt; +  只有PREPARE和ONLINE阶段提供了一个动态分配范围。STARTING阶段则没有,因为该部分的大多
&gt; &gt; +  数回调都有明确的排序要求。
&gt; &gt; +
&gt; &gt; +CPU热插拔状态的设置
&gt; &gt; +-------------------
&gt; &gt; +
&gt; &gt; +核心代码提供了以下函数用来设置状态:
&gt; &gt; +
&gt; &gt; +* cpuhp_setup_state(state, name, startup, teardown)
&gt; &gt; +* cpuhp_setup_state_nocalls(state, name, startup, teardown)
&gt; &gt; +* cpuhp_setup_state_cpuslocked(state, name, startup, teardown)
&gt; &gt; +* cpuhp_setup_state_nocalls_cpuslocked(state, name, startup, teardown)
&gt; &gt; +
&gt; &gt; +对于一个驱动程序或子系统有多个实例,并且每个实例都需要调用相同的CPU hotplug状态回
&gt; &gt; +调的情况,CPU hotplug核心提供多实例支持。与驱动程序特定的实例列表相比,其优势在于
&gt; &gt; +与实例相关的函数完全针对CPU hotplug操作进行序列化,并在添加和删除时提供状态回调的
&gt; &gt; +自动调用。要设置这样一个多实例状态,可以使用以下函数:
&gt; &gt; +
&gt; &gt; +* cpuhp_setup_state_multi(state, name, startup, teardown)
&gt; &gt; +
&gt; &gt; +@state参数要么是静态分配的状态,要么是动态分配状态(PUHP_PREPARE_DYN,CPUHP_ONLINE_DYN)
&gt; &gt; +的常量之一, 具体取决于应该分配动态状态的状态阶段(PREPARE,ONLINE)。
&gt; &gt; +
&gt; &gt; +@name参数用于sysfs输出和检测。命名惯例是"subsys:mode"或"subsys/driver:mode",
&gt; &gt; +例如 "perf:mode"或"perf/x86:mode"。常见的mode名称有:
&gt; &gt; +
&gt; &gt; +======== ============================================
&gt; &gt; +prepare  对应PREPARE阶段中的状态
&gt; &gt; +
&gt; &gt; +dead     对应PREPARE阶段中不提供startup回调的状态
&gt; &gt; +
&gt; &gt; +starting 对应STARTING阶段中的状态
&gt; &gt; +
&gt; &gt; +dying    对应STARTING阶段中不提供startup回调的状态
&gt; &gt; +
&gt; &gt; +online   对应ONLINE阶段中的状态
&gt; &gt; +
&gt; &gt; +offline  对应ONLINE阶段中不提供startup回调的状态
&gt; &gt; +======== ============================================
&gt; &gt; +
&gt; &gt; +由于@name参数只用于sysfs和检测,如果其他mode描述符比常见的描述符更好地描述状态的性质,
&gt; &gt; +也可以使用。
&gt; &gt; +
&gt; &gt; +@name参数的示例:"perf/online", "perf/x86:prepare", "RCU/tree:dying", "sched/waitempty"
&gt; &gt; +
&gt; &gt; +@startup参数是一个指向回调的函数指针,在CPU上线操作时被调用。若应用不需要startup
&gt; &gt; +回调,则将该指针设为NULL。
&gt; &gt; +
&gt; &gt; +@teardown参数是一个指向回调的函数指针,在CPU下线操作时调用。若应用不需要teardown
&gt; &gt; +回调,则将该指针设为NULL。
&gt; &gt; +
&gt; &gt; +这些函数在处理已注册回调的方式上有所不同:
&gt; &gt; +
&gt; &gt; +  * cpuhp_setup_state_nocalls(), cpuhp_setup_state_nocalls_cpuslocked()和
&gt; &gt; +    cpuhp_setup_state_multi()只注册回调。
&gt; &gt; +
&gt; &gt; +  * cpuhp_setup_state()和cpuhp_setup_state_cpuslocked()注册回调,并对当前状态大于新
&gt; &gt; +    安装状态的所有在线CPU调用@startup回调(如果不是NULL)。根据状态阶段,回调要么在
&gt; &gt; +    当前的CPU上调用(PREPARE阶段),要么在CPU的热插拔线程中调用每个在线CPU(ONLINE阶段)。
&gt; &gt; +
&gt; &gt; +    如果CPU N的回调失败,那么CPU 0...N-1的teardown回调被调用以回滚操作。状态设置失败,
&gt; &gt; +    状态的回调没有被注册,在动态分配的情况下,分配的状态被释放。
&gt; &gt; +
&gt; &gt; +状态设置和回调调用是针对CPU热拔插操作进行序列化的。如果设置函数必须从CPU热插拔的读
&gt; &gt; +锁定区域调用,那么必须使用_cpuslocked()变体。这些函数不能在CPU热拔插回调中使用。
&gt; &gt; +
&gt; &gt; +函数返回值:
&gt; &gt; +  ======== ==========================================================
&gt; &gt; +  0        静态分配的状态设置成功
&gt; &gt; +
&gt; &gt; +  &gt;0       动态分配的状态设置成功
&gt; &gt; +
&gt; &gt; +           返回的数值是被分配的状态编号。如果状态回调后来必须被移除,
&gt; &gt; +           例如模块移除,那么这个数值必须由调用者保存,并作为状态移
&gt; &gt; +           除函数的@state参数。对于多实例状态,动态分配的状态编号也
&gt; &gt; +           需要作为实例添加/删除操作的@state参数。
&gt; &gt; +
&gt; &gt; +  &lt;0	   操作失败
&gt; &gt; +  ======== ==========================================================
&gt; &gt; +
&gt; &gt; +移除CPU热拔插状态
&gt; &gt; +-----------------
&gt; &gt; +
&gt; &gt; +为了移除一个之前设置好的状态,提供了如下函数:
&gt; &gt; +
&gt; &gt; +* cpuhp_remove_state(state)
&gt; &gt; +* cpuhp_remove_state_nocalls(state)
&gt; &gt; +* cpuhp_remove_state_nocalls_cpuslocked(state)
&gt; &gt; +* cpuhp_remove_multi_state(state)
&gt; &gt; +
&gt; &gt; +@state参数要么是静态分配的状态,要么是由cpuhp_setup_state*()在动态范围内分配
&gt; &gt; +的状态编号。如果状态在动态范围内,则状态编号被释放,可再次进行动态分配。
&gt; &gt; +
&gt; &gt; +这些函数在处理已注册回调的方式上有所不同:
&gt; &gt; +
&gt; &gt; +  * cpuhp_remove_state_nocalls(), cpuhp_remove_state_nocalls_cpuslocked()
&gt; &gt; +    和 cpuhp_remove_multi_state()只删除回调。
&gt; &gt; +
&gt; &gt; +  * cpuhp_remove_state()删除回调,并调用所有当前状态大于被删除状态的在线CPU的
&gt; &gt; +    teardown回调(如果不是NULL)。根据状态阶段,回调要么在当前的CPU上调用
&gt; &gt; +    (PREPARE阶段),要么在CPU的热插拔线程中调用每个在线CPU(ONLINE阶段)。
&gt; &gt; +
&gt; &gt; +    为了完成移除工作,teardown回调不能失败。
&gt; &gt; +
&gt; &gt; +状态移除和回调调用是针对CPU热拔插操作进行序列化的。如果移除函数必须从CPU hotplug
&gt; &gt; +读取锁定区域调用,那么必须使用_cpuslocked()变体。这些函数不能从CPU热插拔的回调中使用。
&gt; &gt; +
&gt; &gt; +如果一个多实例的状态被移除,那么调用者必须先移除所有的实例。
&gt; &gt; +
&gt; &gt; +多实例状态实例管理
&gt; &gt; +------------------
&gt; &gt; +
&gt; &gt; +一旦多实例状态被建立,实例就可以被添加到状态中:
&gt; &gt;  
&gt; &gt; -一旦一个CPU下线或上线,就有可能收到通知。这对某些需要根据可用CPU数量执行某种设置或清
&gt; &gt; -理功能的驱动程序来说可能很重要::
&gt; &gt; +  * cpuhp_state_add_instance(state, node)
&gt; &gt; +  * cpuhp_state_add_instance_nocalls(state, node)
&gt; &gt;  
&gt; &gt; -  #include <linux cpuhotplug.h="">
&gt; &gt; +@state参数是一个静态分配的状态或由cpuhp_setup_state_multi()在动态范围内分配的状
&gt; &gt; +态编号。
&gt; &gt;  
&gt; &gt; -  ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "X/Y:online",
&gt; &gt; -                          Y_online, Y_prepare_down);
&gt; &gt; +@node参数是一个指向hlist_node的指针,它被嵌入到实例的数据结构中。这个指针被交给
&gt; &gt; +多实例状态的回调,可以被回调用来通过container_of()检索到实例。
&gt; &gt;  
&gt; &gt; -*X* 是子系统, *Y* 是特定的驱动程序。 *Y_online* 回调将在所有在线CPU的注册过程中被调用。
&gt; &gt; -如果在线回调期间发生错误, *Y_prepare_down*  回调将在所有之前调用过在线回调的CPU上调
&gt; &gt; -用。注册完成后,一旦有CPU上线, *Y_online* 回调将被调用,当CPU关闭时, *Y_prepare_down*
&gt; &gt; -将被调用。所有之前在 *Y_online* 中分配的资源都应该在 *Y_prepare_down* 中释放。如果在
&gt; &gt; -注册过程中发生错误,返回值 *ret* 为负值。否则会返回一个正值,其中包含动态分配状态
&gt; &gt; -( *CPUHP_AP_ONLINE_DYN* )的分配热拔插。对于预定义的状态,它将返回0。
&gt; &gt; +这些函数在处理已注册回调的方式上有所不同:
&gt; &gt;  
&gt; &gt; -该回调可以通过调用 ``cpuhp_remove_state()`` 来删除。如果是动态分配的状态
&gt; &gt; -( *CPUHP_AP_ONLINE_DYN* ),则使用返回的状态。在移除热插拔状态的过程中,将调用拆解回调。
&gt; &gt; +  * cpuhp_state_add_instance_nocalls()只将实例添加到多实例状态的节点列表中。
&gt; &gt;  
&gt; &gt; -多个实例
&gt; &gt; -~~~~~~~~
&gt; &gt; +  * cpuhp_state_add_instance()为所有当前状态大于@state的在线CPU添加实例并调用与
&gt; &gt; +    @state相关的startup回调(如果不是NULL)。该回调只对将要添加的实例进行调用。
&gt; &gt; +    根据状态阶段,回调要么在当前的CPU上调用(PREPARE阶段),要么在CPU的热插拔线
&gt; &gt; +    程中调用每个在线CPU(ONLINE阶段)。
&gt; &gt;  
&gt; &gt; -如果一个驱动程序有多个实例,并且每个实例都需要独立执行回调,那么很可能应该使用
&gt; &gt; -``multi-state`` 。首先需要注册一个多状态的状态::
&gt; &gt; +    如果CPU N的回调失败,那么CPU 0 ... N-1的teardown回调被调用以回滚操作,该函数
&gt; &gt; +    失败,实例不会被添加到多实例状态的节点列表中。
&gt; &gt;  
&gt; &gt; -  ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "X/Y:online,
&gt; &gt; -                                Y_online, Y_prepare_down);
&gt; &gt; -  Y_hp_online = ret;
&gt; &gt; +要从状态的节点列表中删除一个实例,可以使用这些函数:
&gt; &gt;  
&gt; &gt; -``cpuhp_setup_state_multi()`` 的行为与 ``cpuhp_setup_state()`` 类似,只是它
&gt; &gt; -为多状态准备了回调,但不调用回调。这是一个一次性的设置。
&gt; &gt; -一旦分配了一个新的实例,你需要注册这个新实例::
&gt; &gt; +  * cpuhp_state_remove_instance(state, node)
&gt; &gt; +  * cpuhp_state_remove_instance_nocalls(state, node)
&gt; &gt;  
&gt; &gt; -  ret = cpuhp_state_add_instance(Y_hp_online, &amp;d-&gt;node);
&gt; &gt; +参数与上述cpuhp_state_add_instance*()变体相同。
&gt; &gt;  
&gt; &gt; -这个函数将把这个实例添加到你先前分配的 ``Y_hp_online`` 状态,并在所有在线的
&gt; &gt; -CPU上调用先前注册的回调( ``Y_online`` )。 *node* 元素是你的每个实例数据结构
&gt; &gt; -中的一个 ``struct hlist_node`` 成员。
&gt; &gt; +这些函数在处理已注册回调的方式上有所不同:
&gt; &gt;  
&gt; &gt; -在移除该实例时::
&gt; &gt; +  * cpuhp_state_remove_instance_nocalls()只从状态的节点列表中删除实例。
&gt; &gt;  
&gt; &gt; -  cpuhp_state_remove_instance(Y_hp_online, &amp;d-&gt;node)
&gt; &gt; +  * cpuhp_state_remove_instance()删除实例并调用与@state相关的回调(如果不是NULL),
&gt; &gt; +    用于所有当前状态大于@state的在线CPU。 该回调只对将要被移除的实例进行调用。
&gt; &gt; +    根据状态阶段,回调要么在当前的CPU上调用(PREPARE阶段),要么在CPU的热插拔
&gt; &gt; +    线程中调用每个在线CPU(ONLINE阶段)。
&gt; &gt;  
&gt; &gt; -应该被调用,这将在所有在线CPU上调用拆分回调。
&gt; &gt; +    为了完成移除工作,teardown回调不能失败。
&gt; &gt;  
&gt; &gt; -手动设置
&gt; &gt; -~~~~~~~~
&gt; &gt; +节点列表的添加/删除操作和回调调用是针对CPU热拔插操作进行序列化。这些函数不能在
&gt; &gt; +CPU hotplug回调和CPU hotplug读取锁定区域内使用。
&gt; &gt;  
&gt; &gt; -通常情况下,在注册或移除状态时调用setup和teamdown回调是很方便的,因为通常在CPU上线
&gt; &gt; -(下线)和驱动的初始设置(关闭)时需要执行该操作。然而,每个注册和删除功能也有一个
&gt; &gt; -_nocalls的后缀,如果不希望调用回调,则不调用所提供的回调。在手动设置(或关闭)期间,
&gt; &gt; -应该使用 ``get_online_cpus()`` 和 ``put_online_cpus()`` 函数来抑制CPU热插拔操作。
&gt; &gt; +例证
&gt; 
&gt; 例子 or 样例

“样例“ maybe the better choice.

&gt; 
&gt; &gt; +----
&gt; &gt;  
&gt; &gt; +在STARTING阶段设置和取消静态分配的状态,以获取上线和下线操作的通知::
&gt; &gt;  
&gt; &gt; -事件的顺序
&gt; &gt; -----------
&gt; &gt; +   ret = cpuhp_setup_state(CPUHP_SUBSYS_STARTING, "subsys:starting", subsys_cpu_starting, subsys_cpu_dying);
&gt; &gt; +   if (ret &lt; 0)
&gt; &gt; +        return ret;
&gt; &gt; +   ....
&gt; &gt; +   cpuhp_remove_state(CPUHP_SUBSYS_STARTING);
&gt; &gt;  
&gt; &gt; -热插拔状态被定义在 ``include/linux/cpuhotplug.h``:
&gt; &gt; +在ONLINE阶段设置和取消动态分配的状态,以获取下线操作的通知::
&gt; &gt;  
&gt; &gt; -* ``CPUHP_OFFLINE`` ... ``CPUHP_AP_OFFLINE`` 状态是在CPU启动前调用的。
&gt; &gt; +   state = cpuhp_setup_state(CPUHP_ONLINE_DYN, "subsys:offline", NULL, subsys_cpu_offline);
&gt; &gt; +   if (state &lt; 0)
&gt; &gt; +       return state;
&gt; &gt; +   ....
&gt; &gt; +   cpuhp_remove_state(state);
&gt; &gt;  
&gt; &gt; -* ``CPUHP_AP_OFFLINE`` ... ``CPUHP_AP_ONLINE`` 状态是在CPU被启动后被调用的。
&gt; &gt; -  中断是关闭的,调度程序还没有在这个CPU上活动。从 ``CPUHP_AP_OFFLINE`` 开始,
&gt; &gt; -  回调被调用到目标CPU上。
&gt; &gt; +在ONLINE阶段设置和取消动态分配的状态,以获取有关上线操作的通知,而无需调用回调::
&gt; &gt;  
&gt; &gt; -* ``CPUHP_AP_ONLINE_DYN`` 和 ``CPUHP_AP_ONLINE_DYN_END`` 之间的状态被保留
&gt; &gt; -  给动态分配。
&gt; &gt; +   state = cpuhp_setup_state_nocalls(CPUHP_ONLINE_DYN, "subsys:online", subsys_cpu_online, NULL);
&gt; &gt; +   if (state &lt; 0)
&gt; &gt; +       return state;
&gt; &gt; +   ....
&gt; &gt; +   cpuhp_remove_state_nocalls(state);
&gt; &gt;  
&gt; &gt; -* 这些状态在CPU关闭时以相反的顺序调用,从 ``CPUHP_ONLINE`` 开始,在 ``CPUHP_OFFLINE``
&gt; &gt; -  停止。这里的回调是在将被关闭的CPU上调用的,直到 ``CPUHP_AP_OFFLINE`` 。
&gt; &gt; +在ONLINE阶段设置、使用和取消动态分配的多实例状态,以获得上线和下线操作的通知::
&gt; &gt;  
&gt; &gt; -通过 ``CPUHP_AP_ONLINE_DYN`` 动态分配的状态通常已经足够了。然而,如果在启动或关闭
&gt; &gt; -期间需要更早的调用,那么应该获得一个显式状态。如果热拔插事件需要相对于另一个热拔插事
&gt; &gt; -件的特定排序,也可能需要一个显式状态。
&gt; &gt; +   state = cpuhp_setup_state_multi(CPUHP_ONLINE_DYN, "subsys:online", subsys_cpu_online, subsys_cpu_offline);
&gt; &gt; +   if (state &lt; 0)
&gt; &gt; +       return state;
&gt; &gt; +   ....
&gt; &gt; +   ret = cpuhp_state_add_instance(state, &amp;inst1-&gt;node);
&gt; &gt; +   if (ret)
&gt; &gt; +        return ret;
&gt; &gt; +   ....
&gt; &gt; +   ret = cpuhp_state_add_instance(state, &amp;inst2-&gt;node);
&gt; &gt; +   if (ret)
&gt; &gt; +        return ret;
&gt; &gt; +   ....
&gt; &gt; +   cpuhp_remove_instance(state, &amp;inst1-&gt;node);
&gt; &gt; +   ....
&gt; &gt; +   cpuhp_remove_instance(state, &amp;inst2-&gt;node);
&gt; &gt; +   ....
&gt; &gt; +   remove_multi_state(state);
&gt; &gt;  
&gt; &gt;  测试热拔插状态
&gt; &gt;  ==============
&gt; &gt; -- 
&gt; &gt; 2.20.1
&gt; 
&gt; Good job, thanks!
&gt;         Wu

Thanks your review!

Binbin</linux></tglx@linutronix.de></jschopp@austin.ibm.com></ashok.raj@intel.com></vatsa@in.ibm.com></rusty@rustcorp.com.au></jschopp@austin.ibm.com></ashok.raj@intel.com></vatsa@in.ibm.com></rusty@rustcorp.com.au></bigeasy@linutronix.de></zhoubinbin@loongson.cn></siyanteng@loongson.cn></zhoubinbin@loongson.cn></bobwxc@email.cn></bobwxc@email.cn></zhoubinbin@loongson.cn></bobwxc@email.cn>

本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it. 

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

* Re: Re: [PATCH 3/9] docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst to 5.19-rc2
  2022-06-16  2:18   ` YanTeng Si
@ 2022-06-16 10:08     ` 周彬彬
  0 siblings, 0 replies; 18+ messages in thread
From: 周彬彬 @ 2022-06-16 10:08 UTC (permalink / raw)
  To: YanTeng Si; +Cc: alexs, corbet, chenhuacai, bobwxc, linux-doc




&gt; -----原始邮件-----
&gt; 发件人: "YanTeng Si" <siyanteng@loongson.cn>
&gt; 发送时间: 2022-06-16 10:18:54 (星期四)
&gt; 收件人: "Binbin Zhou" <zhoubinbin@loongson.cn>, alexs@kernel.org
&gt; 抄送: corbet@lwn.net, chenhuacai@loongson.cn, bobwxc@email.cn, linux-doc@vger.kernel.org
&gt; 主题: Re: [PATCH 3/9] docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst to 5.19-rc2
&gt; 
&gt; 
&gt; 在 2022/6/15 17:24, Binbin Zhou 写道:
&gt; &gt; Synchronous translation from the following commits(Latest in front):
&gt; &gt;
&gt; &gt; [1]: commit 0953fb263714("irq: remove handle_domain_{irq,nmi}()")
&gt; &gt;
&gt; &gt; [2]: commit 0ddc5e55e6f1("Documentation: Fix irq-domain.rst build warning")
&gt; &gt;
&gt; &gt; [3]: commit 991007ba6cca("Documentation: Update
&gt; &gt;       irq_domain.rst with new lookup APIs")
&gt; &gt;
&gt; &gt; [4]: commit 405e94e9aed2("irqdomain: Kill irq_domain_add_legacy_isa")
&gt; &gt;
&gt; &gt; Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
&gt; &gt; ---
&gt; &gt;   .../zh_CN/core-api/irq/irq-domain.rst         | 22 +++++++++++++++----
&gt; &gt;   1 file changed, 18 insertions(+), 4 deletions(-)
&gt; &gt;
&gt; &gt; diff --git a/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
&gt; &gt; index 7d077742f758..863e4488c36b 100644
&gt; &gt; --- a/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
&gt; &gt; +++ b/Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
&gt; &gt; @@ -5,6 +5,7 @@
&gt; &gt;   :翻译:
&gt; &gt;   
&gt; &gt;    司延腾 Yanteng Si <siyanteng@loongson.cn>
&gt; &gt; + 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
&gt; &gt;   
&gt; &gt;   .. _cn_irq-domain.rst:
&gt; &gt;   
&gt; &gt; @@ -52,8 +53,18 @@ irq_domain和一个hwirq号作为参数。 如果hwirq的映射还不存在,
&gt; &gt;   一个新的Linux irq_desc,将其与hwirq关联起来,并调用.map()回调,这样驱动
&gt; &gt;   程序就可以执行任何必要的硬件设置。
&gt; &gt;   
&gt; &gt; -当接收到一个中断时,应该使用irq_find_mapping()函数从hwirq号中找到
&gt; &gt; -Linux IRQ号。
&gt; &gt; +一旦建立了映射,可以通过多种方法检索或使用它:
&gt; &gt; +
&gt; &gt; +- irq_resolve_mapping()返回一个指向给定域和hwirq的irq_desc结构指针,
&gt; &gt; +  如果没有映射则返回NULL。
&gt; &gt; +
&gt; &gt; +- irq_find_mapping()返回给定域和hwirq的Linux IRQ号,如果没有映射则返回0。
&gt; &gt; +
&gt; &gt; +- irq_linear_revmap()现与irq_find_mapping()相同,已被废弃。
&gt; &gt; +
&gt; &gt; +- generic_handle_domain_irq()处理一个由域和hwirq描述的中断。
&gt; 
&gt; hwirq号描述的中断。

OK,I see.

Thanks,
Binbin
&gt; 
&gt; 
&gt; Thanks,
&gt; 
&gt; Yanteng
&gt; 
&gt; &gt; +
&gt; &gt; +请注意,irq域的查找必须发生在与RCU读临界区兼容的上下文中。
&gt; &gt;   
&gt; &gt;   在调用irq_find_mapping()之前,至少要调用一次irq_create_mapping()函数,
&gt; &gt;   以免描述符不能被分配。
&gt; &gt; @@ -119,7 +130,8 @@ irq_domain_add_tree()和irq_domain_create_tree()在功能上是等价的,除
&gt; &gt;   Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create_direct_mapping()
&gt; &gt;   会分配一个Linux IRQ号,并调用.map()回调,这样驱动就可以将Linux IRQ号编入硬件中。
&gt; &gt;   
&gt; &gt; -大多数驱动程序不能使用这个映射。
&gt; &gt; +大多数驱动程序无法使用此映射,现在它由CONFIG_IRQ_DOMAIN_NOMAP选项控制。
&gt; &gt; +请不要引入此API的新用户。
&gt; &gt;   
&gt; &gt;   传统映射类型
&gt; &gt;   ------------
&gt; &gt; @@ -128,7 +140,6 @@ Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create
&gt; &gt;   
&gt; &gt;   	irq_domain_add_simple()
&gt; &gt;   	irq_domain_add_legacy()
&gt; &gt; -	irq_domain_add_legacy_isa()
&gt; &gt;   	irq_domain_create_simple()
&gt; &gt;   	irq_domain_create_legacy()
&gt; &gt;   
&gt; &gt; @@ -137,6 +148,9 @@ Linux IRQ号编入硬件本身,这样就不需要映射了。 调用irq_create
&gt; &gt;   一组用于IRQ号的定义(#define),这些定义被传递给struct设备注册。 在这种情况下,
&gt; &gt;   不能动态分配Linux IRQ号,应该使用传统映射。
&gt; &gt;   
&gt; &gt; +顾名思义,\*_legacy()系列函数已被废弃,只是为了方便对古老平台的支持而存在。
&gt; &gt; +不应该增加新的用户。当\*_simple()系列函数的使用导致遗留行为时,他们也是如此。
&gt; &gt; +
&gt; &gt;   传统映射假设已经为控制器分配了一个连续的IRQ号范围,并且可以通过向hwirq号添加一
&gt; &gt;   个固定的偏移来计算IRQ号,反之亦然。 缺点是需要中断控制器管理IRQ分配,并且需要为每
&gt; &gt;   个hwirq分配一个irq_desc,即使它没有被使用。
</zhoubinbin@loongson.cn></siyanteng@loongson.cn></zhoubinbin@loongson.cn></zhoubinbin@loongson.cn></siyanteng@loongson.cn>

本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it. 

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

* Re: [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst to 5.19-rc2
  2022-06-15  9:24 ` [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst " Binbin Zhou
@ 2022-06-16 23:37   ` Wu XiangCheng
  2022-06-17  0:32     ` 周彬彬
  2022-06-17 13:55     ` Jonathan Corbet
  0 siblings, 2 replies; 18+ messages in thread
From: Wu XiangCheng @ 2022-06-16 23:37 UTC (permalink / raw)
  To: Binbin Zhou; +Cc: alexs, siyanteng, corbet, chenhuacai, linux-doc

On Wed, Jun 15, 2022 at 05:24:30PM +0800, Binbin Zhou wrote:
> Synchronous translation from the following commits(Latest in front):
> 
> [1]: commit 2fbf5241a561("vsprintf: add new `%pA` format specifier")

^ this commit is from rust-next and not appeared in master or
jc/docs-next yet, so please drop it.

Thanks,
	Wu

> 
> [2]: commit 6a7ca80f4033("vsprintf: Update %pGp documentation
>      about that it prints hex value")
> 
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>  .../translations/zh_CN/core-api/printk-formats.rst  | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/translations/zh_CN/core-api/printk-formats.rst b/Documentation/translations/zh_CN/core-api/printk-formats.rst
> index ce39c788cf5a..78561c35e528 100644
> --- a/Documentation/translations/zh_CN/core-api/printk-formats.rst
> +++ b/Documentation/translations/zh_CN/core-api/printk-formats.rst
> @@ -5,6 +5,7 @@
>  :翻译:
>  
>   司延腾 Yanteng Si <siyanteng@loongson.cn>
> + 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
>  
>  .. _cn_printk-formats.rst:
>  
> @@ -548,7 +549,7 @@ nodemask_pr_args()来方便打印cpumask和nodemask。
>  
>  ::
>  
> -	%pGp	referenced|uptodate|lru|active|private|node=0|zone=2|lastcpupid=0x1fffff
> +	%pGp	0x17ffffc0002036(referenced|uptodate|lru|active|private|node=0|zone=2|lastcpupid=0x1fffff)
>  	%pGg	GFP_USER|GFP_DMA32|GFP_NOWARN
>  	%pGv	read|exec|mayread|maywrite|mayexec|denywrite
>  
> @@ -589,6 +590,16 @@ V4L2和DRM FourCC代码(像素格式)
>  	%p4cc	Y10  little-endian (0x20303159)
>  	%p4cc	NV12 big-endian (0xb231564e)
>  
> +Rust
> +----
> +
> +::
> +
> +       %pA
> +
> +仅用于Rust代码格式化``core::fmt::Arguments``。
> +不能用于C语言。
> +
>  谢谢
>  ====
>  
> -- 
> 2.20.1


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

* Re: Re: [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst to 5.19-rc2
  2022-06-16 23:37   ` Wu XiangCheng
@ 2022-06-17  0:32     ` 周彬彬
  2022-06-17 13:55     ` Jonathan Corbet
  1 sibling, 0 replies; 18+ messages in thread
From: 周彬彬 @ 2022-06-17  0:32 UTC (permalink / raw)
  To: Wu XiangCheng; +Cc: alexs, siyanteng, corbet, chenhuacai, linux-doc




&gt; -----原始邮件-----
&gt; 发件人: "Wu XiangCheng" <bobwxc@email.cn>
&gt; 发送时间: 2022-06-17 07:37:43 (星期五)
&gt; 收件人: "Binbin Zhou" <zhoubinbin@loongson.cn>
&gt; 抄送: alexs@kernel.org, siyanteng@loongson.cn, corbet@lwn.net, chenhuacai@loongson.cn, linux-doc@vger.kernel.org
&gt; 主题: Re: [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst to 5.19-rc2
&gt; 
&gt; On Wed, Jun 15, 2022 at 05:24:30PM +0800, Binbin Zhou wrote:
&gt; &gt; Synchronous translation from the following commits(Latest in front):
&gt; &gt; 
&gt; &gt; [1]: commit 2fbf5241a561("vsprintf: add new `%pA` format specifier")
&gt; 
&gt; ^ this commit is from rust-next and not appeared in master or
&gt; jc/docs-next yet, so please drop it.
&gt; 
&gt; Thanks,
&gt; 	Wu

OK, I see.

Thanks,
Binbin
&gt; 
&gt; &gt; 
&gt; &gt; [2]: commit 6a7ca80f4033("vsprintf: Update %pGp documentation
&gt; &gt;      about that it prints hex value")
&gt; &gt; 
&gt; &gt; Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
&gt; &gt; ---
&gt; &gt;  .../translations/zh_CN/core-api/printk-formats.rst  | 13 ++++++++++++-
&gt; &gt;  1 file changed, 12 insertions(+), 1 deletion(-)
&gt; &gt; 
&gt; &gt; diff --git a/Documentation/translations/zh_CN/core-api/printk-formats.rst b/Documentation/translations/zh_CN/core-api/printk-formats.rst
&gt; &gt; index ce39c788cf5a..78561c35e528 100644
&gt; &gt; --- a/Documentation/translations/zh_CN/core-api/printk-formats.rst
&gt; &gt; +++ b/Documentation/translations/zh_CN/core-api/printk-formats.rst
&gt; &gt; @@ -5,6 +5,7 @@
&gt; &gt;  :翻译:
&gt; &gt;  
&gt; &gt;   司延腾 Yanteng Si <siyanteng@loongson.cn>
&gt; &gt; + 周彬彬 Binbin Zhou <zhoubinbin@loongson.cn>
&gt; &gt;  
&gt; &gt;  .. _cn_printk-formats.rst:
&gt; &gt;  
&gt; &gt; @@ -548,7 +549,7 @@ nodemask_pr_args()来方便打印cpumask和nodemask。
&gt; &gt;  
&gt; &gt;  ::
&gt; &gt;  
&gt; &gt; -	%pGp	referenced|uptodate|lru|active|private|node=0|zone=2|lastcpupid=0x1fffff
&gt; &gt; +	%pGp	0x17ffffc0002036(referenced|uptodate|lru|active|private|node=0|zone=2|lastcpupid=0x1fffff)
&gt; &gt;  	%pGg	GFP_USER|GFP_DMA32|GFP_NOWARN
&gt; &gt;  	%pGv	read|exec|mayread|maywrite|mayexec|denywrite
&gt; &gt;  
&gt; &gt; @@ -589,6 +590,16 @@ V4L2和DRM FourCC代码(像素格式)
&gt; &gt;  	%p4cc	Y10  little-endian (0x20303159)
&gt; &gt;  	%p4cc	NV12 big-endian (0xb231564e)
&gt; &gt;  
&gt; &gt; +Rust
&gt; &gt; +----
&gt; &gt; +
&gt; &gt; +::
&gt; &gt; +
&gt; &gt; +       %pA
&gt; &gt; +
&gt; &gt; +仅用于Rust代码格式化``core::fmt::Arguments``。
&gt; &gt; +不能用于C语言。
&gt; &gt; +
&gt; &gt;  谢谢
&gt; &gt;  ====
&gt; &gt;  
&gt; &gt; -- 
&gt; &gt; 2.20.1
</zhoubinbin@loongson.cn></siyanteng@loongson.cn></zhoubinbin@loongson.cn></zhoubinbin@loongson.cn></bobwxc@email.cn>

本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it. 

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

* Re: [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst to 5.19-rc2
  2022-06-16 23:37   ` Wu XiangCheng
  2022-06-17  0:32     ` 周彬彬
@ 2022-06-17 13:55     ` Jonathan Corbet
  2022-06-22 10:18       ` zhoubinbin
  1 sibling, 1 reply; 18+ messages in thread
From: Jonathan Corbet @ 2022-06-17 13:55 UTC (permalink / raw)
  To: Wu XiangCheng, Binbin Zhou; +Cc: alexs, siyanteng, chenhuacai, linux-doc

Wu XiangCheng <bobwxc@email.cn> writes:

> On Wed, Jun 15, 2022 at 05:24:30PM +0800, Binbin Zhou wrote:
>> Synchronous translation from the following commits(Latest in front):
>> 
>> [1]: commit 2fbf5241a561("vsprintf: add new `%pA` format specifier")
>
> ^ this commit is from rust-next and not appeared in master or
> jc/docs-next yet, so please drop it.

An alternative is to take the changes relative to that commit (only) and
send a patch for inclusion in the Rust tree.

Thanks,

jon

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

* Re: [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst to 5.19-rc2
  2022-06-17 13:55     ` Jonathan Corbet
@ 2022-06-22 10:18       ` zhoubinbin
  0 siblings, 0 replies; 18+ messages in thread
From: zhoubinbin @ 2022-06-22 10:18 UTC (permalink / raw)
  To: Jonathan Corbet, Wu XiangCheng; +Cc: alexs, siyanteng, chenhuacai, linux-doc


在 2022/6/17 下午9:55, Jonathan Corbet 写道:
> Wu XiangCheng<bobwxc@email.cn>  writes:
>
>> On Wed, Jun 15, 2022 at 05:24:30PM +0800, Binbin Zhou wrote:
>>> Synchronous translation from the following commits(Latest in front):
>>>
>>> [1]: commit 2fbf5241a561("vsprintf: add new `%pA` format specifier")
>> ^ this commit is from rust-next and not appeared in master or
>> jc/docs-next yet, so please drop it.
> An alternative is to take the changes relative to that commit (only) and
> send a patch for inclusion in the Rust tree.

Hi, Jon:

Sorry for my late reply, I will reorganize this part into a patch and 
submit it to thr Rust tree.

Thanks  for your comments.

Binbin


> Thanks,
>
> jon


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

end of thread, other threads:[~2022-06-22 10:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15  9:24 [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation to 5.19-rc2 Binbin Zhou
2022-06-15  9:24 ` [PATCH 1/9] docs/zh_CN: core-api: Update the translation of cachetlb.rst " Binbin Zhou
2022-06-15  9:24 ` [PATCH 2/9] docs/zh_CN: core-api: Update the translation of cpu_hotplug.rst " Binbin Zhou
     [not found]   ` <20220616002137.6614-1-bobwxc@email.cn>
2022-06-16 10:04     ` 周彬彬
2022-06-15  9:24 ` [PATCH 3/9] docs/zh_CN: core-api: Update the translation of irq/irq-domain.rst " Binbin Zhou
2022-06-16  2:18   ` YanTeng Si
2022-06-16 10:08     ` 周彬彬
2022-06-15  9:24 ` [PATCH 4/9] docs/zh_CN: core-api: Update the translation of kernel-api.rst " Binbin Zhou
2022-06-15  9:24 ` [PATCH 5/9] docs/zh_CN: core-api: Update the translation of mm-api.rst " Binbin Zhou
2022-06-15  9:24 ` [PATCH 6/9] docs/zh_CN: core-api: Update the translation of printk-basics.rst " Binbin Zhou
2022-06-15  9:24 ` [PATCH 7/9] docs/zh_CN: core-api: Update the translation of printk-format.rst " Binbin Zhou
2022-06-16 23:37   ` Wu XiangCheng
2022-06-17  0:32     ` 周彬彬
2022-06-17 13:55     ` Jonathan Corbet
2022-06-22 10:18       ` zhoubinbin
2022-06-15 13:27 ` [PATCH 8/9] docs/zh_CN: core-api: Update the translation of workqueue.rst " Binbin Zhou
2022-06-15 13:27 ` [PATCH 9/9] docs/zh_CN: core-api: Update the translation of xarray.rst " Binbin Zhou
2022-06-15 15:34 ` [PATCH 0/9] docs/zh_CN: core-api: Update the partial translation " 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.