From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,PDS_TONAME_EQ_TOLOCAL_SHORT,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1422FC433E0 for ; Sun, 14 Jun 2020 14:10:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E99802053B for ; Sun, 14 Jun 2020 14:10:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725949AbgFNOKn (ORCPT ); Sun, 14 Jun 2020 10:10:43 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:52211 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbgFNOKn (ORCPT ); Sun, 14 Jun 2020 10:10:43 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=xiaoguang.wang@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0U.WpbUT_1592143839; Received: from 30.0.130.156(mailfrom:xiaoguang.wang@linux.alibaba.com fp:SMTPD_---0U.WpbUT_1592143839) by smtp.aliyun-inc.com(127.0.0.1); Sun, 14 Jun 2020 22:10:40 +0800 To: io-uring Cc: "axboe@kernel.dk" , joseph qi From: Xiaoguang Wang Subject: Does need memory barrier to synchronize req->result with req->iopoll_completed Message-ID: Date: Sun, 14 Jun 2020 22:10:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org hi, I have taken some further thoughts about previous IPOLL race fix patch, if io_complete_rw_iopoll() is called in interrupt context, "req->result = res" and "WRITE_ONCE(req->iopoll_completed, 1);" are independent store operations. So in io_do_iopoll(), if iopoll_completed is ture, can we make sure that req->result has already been perceived by the cpu executing io_do_iopoll()? Regards, Xiaoguang Wang