Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp549784imu; Thu, 3 Jan 2019 02:52:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN7bM97YNRU4AE22RQY7c1SQtSfNfSmIkcaep4fV0PUwcZKZZgu1JEhI+gysKKMUvEzf8a+L X-Received: by 2002:a63:2109:: with SMTP id h9mr16583709pgh.277.1546512776039; Thu, 03 Jan 2019 02:52:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546512776; cv=none; d=google.com; s=arc-20160816; b=UIbQWDr2mnRg0VgzElVUeWuhIyGBMRBmdUt9x8ri53hbjTlUJW+aO8FIs62p9n6Xmt Kim+WIciq6xntjUZe7JOUa4jOI6BP+FBeqiqJ4iytxCq1zgbIW98ROQa2sogf6cL6aAv TgRxAUXV9eO5R1Nlf0xit8dAZNnsPRbkzNgkxLNPvvF3xyvHH+qcs8wOS5VeK3K7aXDC QX4y7Ii2GVDjSJpePvyW0fEKYwVDud2tYU2kjQWieMXtFOt2uWP7cno+c0ex6K66banx 0cbgW3LrjF7Lxuu5ZK2IwwXslDxaOfMH3iutj0KIf0iiOO8OWbyvsG1drtVmDyNE2dRd DV2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=yd8r2MiTHdsMrSfjqskC33uh01XZdzGww5hWJ63EZqY=; b=AoJKC9t0lBFbWILxMA+rBPz5QYIxVFmrOv/aZ7X12YdchCUkb9BAUVHEXzJ2aEiyFU lnUQkj5EESP+F/G735D0PCGjcYYUHSX7dJ/t8YLjZaCLDrtAjI02CgZ2ZT0ET/FKqjvB +a5L4eTLAI+W+rEHOKERq7vRWBwbMTbKhC7py9qrrXFKHwZgnhbWNbvz+R4M9XKXmX1X +0Yq6Ug4xCYlpy88ISTGowplRKlGT1jqoMdn89iyTgqYDiafC8MgH1DrXU/g173dontv vjazfrrCN/m+ayMnJvc+emhAQlVfArEYbfCYXsLY4sIuHR7DJZTZ9cg9KOp6OxSxEpwO yQMA== 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 be11si49549833plb.134.2019.01.03.02.52.37; Thu, 03 Jan 2019 02:52:55 -0800 (PST) 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 S1726741AbfACHzJ (ORCPT + 99 others); Thu, 3 Jan 2019 02:55:09 -0500 Received: from mail4.tencent.com ([183.57.53.109]:58309 "EHLO mail4.tencent.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbfACHzI (ORCPT ); Thu, 3 Jan 2019 02:55:08 -0500 X-Greylist: delayed 695 seconds by postgrey-1.27 at vger.kernel.org; Thu, 03 Jan 2019 02:55:06 EST Received: from EXHUB-SZMail03.tencent.com (unknown [10.14.6.33]) by mail4.tencent.com (Postfix) with ESMTP id AE77651937; Thu, 3 Jan 2019 15:43:18 +0800 (CST) Received: from EXMBX-SZMAIL006.tencent.com ([fe80::79d2:3448:1596:46df]) by EXHUB-SZMail03.tencent.com ([::1]) with mapi id 14.03.0415.000; Thu, 3 Jan 2019 15:43:17 +0800 From: "xiaoguangrong(Xiao Guangrong)" To: Kees Cook , "yulei.kernel@gmail.com" , Stefani Seibold , "Peter Zijlstra" , Will Deacon , "Paul E. McKenney" CC: "mkelly@xevo.com" , Jiri Kosina , LKML , =?gb2312?B?eXVsZWl4emhhbmco1cXT/sDaKQ==?= Subject: Re: [PATCH] kfifo: add memory barrier in kfifo to prevent data loss Thread-Topic: [PATCH] kfifo: add memory barrier in kfifo to prevent data loss Thread-Index: AQHUozf33AH3O8/3KkWVpzcIpc/egQ== Date: Thu, 3 Jan 2019 07:43:10 +0000 Message-ID: <019819C6E743904A88B43F7DDEED99BBA7E74E37@EXMBX-SZMAIL006.tencent.com> References: <20181211034032.32338-1-yuleixzhang@tencent.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.14.36.108] Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org T24gMTIvMTIvMTggODo1MCBBTSwgS2VlcyBDb29rIHdyb3RlOgo+IE9uIE1vbiwgRGVjIDEwLCAy MDE4IGF0IDc6NDEgUE0gPHl1bGVpLmtlcm5lbEBnbWFpbC5jb20+IHdyb3RlOgo+Pgo+PiBGcm9t OiBZdWxlaSBaaGFuZyA8eXVsZWl4emhhbmdAdGVuY2VudC5jb20+Cj4+Cj4+IEVhcmx5IHRoaXMg eWVhciB3ZSBzcG90IHRoZXJlIG1heSBiZSB0d28gaXNzdWVzIGluIGtlcm5lbAo+PiBrZmlmby4K Pj4KPj4gT25lIGlzIHJlcG9ydGVkIGJ5IFhpYW8gR3Vhbmdyb25nIHRvIGxpbnV4IGtlcm5lbC4K Pj4gaHR0cHM6Ly9sa21sLm9yZy9sa21sLzIwMTgvNS8xMS81OAo+PiBJbiBjdXJyZW50IGtmaWZv IGltcGxlbWVudGF0aW9uIHRoZXJlIGFyZSBtaXNzaW5nIG1lbW9yeQo+PiBiYXJyaWVyIGluIHRo ZSByZWFkIHNpZGUsIHNvIHRoYXQgd2l0aG91dCBwcm9wZXIgYmFycmllcgo+PiBiZXR3ZWVuIHJl YWRpbmcgdGhlIGtmaWZvLT5pbiBhbmQgZmV0Y2hpbmcgdGhlIGRhdGEgdGhlcmUKPj4gaXMgcG90 ZW50aWFsIG9yZGVyaW5nIGlzc3VlLgo+Pgo+PiBCZXNpZGUgdGhhdCwgdGhlcmUgaXMgYW5vdGhl ciBwb3RlbnRpYWwgaXNzdWUgaW4ga2ZpZm8sCj4+IHBsZWFzZSBjb25zaWRlciB0aGUgZm9sbG93 aW5nIGNhc2U6Cj4+IGF0IHRoZSBiZWdpbm5pbmcKPj4gcmluZy0+c2l6ZSA9IDQKPj4gcmluZy0+ b3V0ID0gMAo+PiByaW5nLT5pbiA9IDQKPj4KPj4gICAgICBDb25zdW1lciAgICAgICAgICAgICAg ICAgICAgICAgIFByb2R1Y2VyCj4+IC0tLS0tLS0tLS0tLS0tLSAgICAgICAgICAgICAgICAgIC0t LS0tLS0tLS0tLS0tCj4+IGluZGV4ID0gcmluZy0+b3V0OyAvKiBpbmRleCA9PSAwICovCj4+IHJp bmctPm91dCsrOyAvKiByaW5nLT5vdXQgPT0gMSAqLwo+PiA8IFJlLU9yZGVyID4KPj4gICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dCA9IHJpbmctPm91dDsKPj4gICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyaW5nLT5pbiAtIG91dCA+PSByaW5nLT5tYXNr KQo+PiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtRUZVTEw7 Cj4+ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKiBzZWUgdGhlIHJpbmcgaXMg bm90IGZ1bGwgKi8KPj4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4ID0g cmluZy0+aW4gJiByaW5nLT5tYXNrOwo+PiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgLyogaW5kZXggPT0gMCAqLwo+PiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg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