Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1284397ybh; Sat, 14 Mar 2020 23:10:25 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuQ2aPdzUl4CxqA/l2CK6Z0BVAwlgtnRQqA50Ah0CrhtyJdvfd2Uib/rjt2ni6WhJpugYe1 X-Received: by 2002:aca:d503:: with SMTP id m3mr11938901oig.165.1584252625708; Sat, 14 Mar 2020 23:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584252625; cv=none; d=google.com; s=arc-20160816; b=WSUPNEtoPGpOrwtHrC2rEfMat978N+9uRqae3CNTwCN7qdccsIleZtBjIswHzjXAL9 0tYZfp93VQhOMyUV9GYXe424rpzFx232+M1uDUgcPL2b99iKqedmDg7YmGGhR8ym65s2 yIUdn2rkAOtbza/TbvHHfXxQYnBu/dNeERxYvitkNS8CCtqVAWBtKH1djB3Z5ROTc7y7 FyVqTWXqsgclW+Ry6vqqs1JOwnUj6lbBppAYpTQ7vFDcrRD0DBKXucLK+EBL7BRiTgOf are56UbS2N4lrC22lEPgzBYGxH4sIxgFOFoN5YT9FCzGGr8Ff0dKlzj2hE4Qv6ibyx7L 2qBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=103TU6dXFgy6PyDIik7/gTGidcBVeZ3cRBes27JiR1A=; b=K34V+m7/M2V2r5oFQ1cWU9OMrQqd5eH0PhnxMZJrkgkorxgl1nFsP8o2bUKQLqQQpf fXnY1xWS3IUEST2DjtyRpO1pTTn9mZohDhngGl2s5SEeNBgygDsbeF4tWl8GXBfh65U9 ddolGU+MEEXGI0xj/HeOrtyiLPqaIhBGziS4W+9oXrSWXIC0ex+DcRr0e0lr1c2qt+S3 biAIhnqTvPKvbwYvqjCLarP2ZH7ME0hm5Na2Z/n3baz9oQxHDkA+6sgq4WeuJUDziDTG i+GUV4EHQzrll53bb4kUwktO2V4tt99WAwa7YhT/Ht/ySOBE2rl/Ebv+qpbWsz8AhU2m sH0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si2159355oib.46.2020.03.14.23.10.00; Sat, 14 Mar 2020 23:10:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727127AbgCOGJX (ORCPT + 99 others); Sun, 15 Mar 2020 02:09:23 -0400 Received: from m17617.mail.qiye.163.com ([59.111.176.17]:59772 "EHLO m17617.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726963AbgCOGJX (ORCPT ); Sun, 15 Mar 2020 02:09:23 -0400 Received: from ubuntu.localdomain (unknown [58.251.74.226]) by m17617.mail.qiye.163.com (Hmail) with ESMTPA id 8C94D260F36; Sun, 15 Mar 2020 14:09:08 +0800 (CST) From: Wang Wenhu To: Harry Wei , Alex Shi , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel@vivo.com, Wang Wenhu Subject: [PATCH v2,RESEND] doc: zh_CN: fix style problems for io_ordering.txt Date: Sat, 14 Mar 2020 23:08:55 -0700 Message-Id: <20200315060857.82880-1-wenhu.wang@vivo.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZTlVPSUxCQkJCTEhJQkxKSVlXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NAw6MRw4GjgzEjdLLU4VSRAZ GjQKFAtVSlVKTkNPSU5JTk5KS01JVTMWGhIXVQweFRMOVQwaFRw7DRINFFUYFBZFWVdZEgtZQVlO Q1VJTkpVTE9VSUlNWVdZCAFZQU9NTU03Bg++ X-HM-Tid: 0a70dccf76c39375kuws8c94d260f36 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Problems exist in the Chinese translation of io_ordering.txt. Partly for the difference between Chinese and English character encoding format, and the others are of the failure to comply with the ReST markups. Signed-off-by: Wang Wenhu --- v2: resend for the failure of delivering. .../translations/zh_CN/io_ordering.txt | 72 ++++++++++++------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/Documentation/translations/zh_CN/io_ordering.txt b/Documentation/translations/zh_CN/io_ordering.txt index 1f8127bdd415..080ed2911db0 100644 --- a/Documentation/translations/zh_CN/io_ordering.txt +++ b/Documentation/translations/zh_CN/io_ordering.txt @@ -29,39 +29,59 @@ Documentation/io_ordering.txt 的中文翻译 这也可以保证后面的写操作只在前面的写操作之后到达设备(这非常类似于内存 屏障操作,mb(),不过仅适用于I/O)。 +A more concrete example from a hypothetical device driver:: + + ... + CPU A: spin_lock_irqsave(&dev_lock, flags) + CPU A: val = readl(my_status); + CPU A: ... + CPU A: writel(newval, ring_ptr); + CPU A: spin_unlock_irqrestore(&dev_lock, flags) + ... + CPU B: spin_lock_irqsave(&dev_lock, flags) + CPU B: val = readl(my_status); + CPU B: ... + CPU B: writel(newval2, ring_ptr); + CPU B: spin_unlock_irqrestore(&dev_lock, flags) + ... + + 假设一个设备驱动程的具体例子: +:: + ... + CPU A: spin_lock_irqsave(&dev_lock, flags) + CPU A: val = readl(my_status); + CPU A: ... + CPU A: writel(newval, ring_ptr); + CPU A: spin_unlock_irqrestore(&dev_lock, flags) + ... + CPU B: spin_lock_irqsave(&dev_lock, flags) + CPU B: val = readl(my_status); + CPU B: ... + CPU B: writel(newval2, ring_ptr); + CPU B: spin_unlock_irqrestore(&dev_lock, flags) ... -CPU A: spin_lock_irqsave(&dev_lock, flags) -CPU A: val = readl(my_status); -CPU A: ... -CPU A: writel(newval, ring_ptr); -CPU A: spin_unlock_irqrestore(&dev_lock, flags) - ... -CPU B: spin_lock_irqsave(&dev_lock, flags) -CPU B: val = readl(my_status); -CPU B: ... -CPU B: writel(newval2, ring_ptr); -CPU B: spin_unlock_irqrestore(&dev_lock, flags) - ... + 上述例子中,设备可能会先接收到newval2的值,然后接收到newval的值,问题就 发生了。不过很容易通过下面方法来修复: +:: - ... -CPU A: spin_lock_irqsave(&dev_lock, flags) -CPU A: val = readl(my_status); -CPU A: ... -CPU A: writel(newval, ring_ptr); -CPU A: (void)readl(safe_register); /* 配置寄存器?*/ -CPU A: spin_unlock_irqrestore(&dev_lock, flags) - ... -CPU B: spin_lock_irqsave(&dev_lock, flags) -CPU B: val = readl(my_status); -CPU B: ... -CPU B: writel(newval2, ring_ptr); -CPU B: (void)readl(safe_register); /* 配置寄存器?*/ -CPU B: spin_unlock_irqrestore(&dev_lock, flags) + ... + CPU A: spin_lock_irqsave(&dev_lock, flags) + CPU A: val = readl(my_status); + CPU A: ... + CPU A: writel(newval, ring_ptr); + CPU A: (void)readl(safe_register); /* 配置寄存器?*/ + CPU A: spin_unlock_irqrestore(&dev_lock, flags) + ... + CPU B: spin_lock_irqsave(&dev_lock, flags) + CPU B: val = readl(my_status); + CPU B: ... + CPU B: writel(newval2, ring_ptr); + CPU B: (void)readl(safe_register); /* 配置寄存器?*/ + CPU B: spin_unlock_irqrestore(&dev_lock, flags) 在解决方案中,读取safe_register寄存器,触发IO芯片清刷未处理的写操作, 再处理后面的读操作,防止引发数据不一致问题。 -- 2.17.1