Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1126508ybh; Sat, 14 Mar 2020 18:46:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsGNUgIezVYkpkM2cv869NTvYIpOtm5Iy/XjWMz0T8Kk9yTMMM2gx9K/loyQrzYwsHUSgt6 X-Received: by 2002:aca:d50f:: with SMTP id m15mr11954358oig.19.1584236809458; Sat, 14 Mar 2020 18:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584236809; cv=none; d=google.com; s=arc-20160816; b=xB23ShlIVMbe2n8WyQSFhVeZrAHJDwoOITSYWkg5J/lHHTFUDb+ip3lrR7zYMYFb5s 0qgSEYGv4QU8PHaUgU13M3Rfn4Z4LzxEmPRqKENJQfbctcIWvLq34R9Cwlv+AYrPZujO 1rVMimLzXTDv8iHx3TDV+1TDp1v9Bg+8F3PnlyRCJnNofqk0IQ+RK8uQeeJLGSN8qyu5 o4IBlvsPOMpGIDil1RQYkkkNna4PpK3xA3ZodGBzoCLkFI9aBfao3MNyseBG80b0Hu3M d4G7CqunNHmsTsS/KJTSuGgVkzPSn/sa3Cw+WBzH/8xXnqo8TEPFxRzoDIKV8TPZvCzI pWlw== 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=3RKvWh/y1gKnOXaEindlt8xrXnm0QS1lx2aeFASuC3M=; b=060jerh+xQ2thF4QbQjdND79UDsN9/JaCjA18XYwJbP9EKkTcn5HDjm31SxU4iH9ID VA3SyD9IGsOBSmLMMO/CnAME8TgTvQlUm/DEZsEdX63fsZZfhWdBjr6yzh4cf/L6j4JF Cier0P5nWPRsLKxuzd+ewY/1NMd+ImhZ8af7z6SoJb0lrBrBslob0Rb/WjH+kB+WT0nL R2j5RPMG9bgMn8mWjBfQbw+EuUSTrO52nxb4hhTCwvC44mCfOZwUKiPu3NAFSWRGUDJ+ MegJJ+vjyJcQ/yeRkVPlC7vmALN9bWv78RnnQ4A/MALsNIlv4Bt+QugKGCbD0SapKNCt db0A== 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 u136si5700659oif.197.2020.03.14.18.46.37; Sat, 14 Mar 2020 18:46:49 -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 S1727421AbgCOBqL (ORCPT + 99 others); Sat, 14 Mar 2020 21:46:11 -0400 Received: from m17617.mail.qiye.163.com ([59.111.176.17]:12052 "EHLO m17617.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726556AbgCOBqI (ORCPT ); Sat, 14 Mar 2020 21:46:08 -0400 Received: from ubuntu.localdomain (unknown [58.251.74.227]) by m17617.mail.qiye.163.com (Hmail) with ESMTPA id C1204260FF6; Sat, 14 Mar 2020 23:07:12 +0800 (CST) From: Wang Wenhu To: Harry Wei , Alex Shi , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-kernel@zh-kernel.org, kernel@vivo.com, Wang Wenhu Subject: [PATCH] doc: zh_CN: fix style problems for io_ordering.txt Date: Sat, 14 Mar 2020 08:07:05 -0700 Message-Id: <20200314150706.73955-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: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZTlVIQ01CQkJNS0xLQ01KQ1lXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6PFE6DRw6Fjg3NDdCAyMfTDMy MitPCjNVSlVKTkNPSkJDT0hNSUtNVTMWGhIXVQweFRMOVQwaFRw7DRINFFUYFBZFWVdZEgtZQVlO Q1VJTkpVTE9VSUlMWVdZCAFZQU9NTkI3Bg++ X-HM-Tid: 0a70d995b9439375kuwsc1204260ff6 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 --- .../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