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=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 208A6C433E1 for ; Mon, 20 Jul 2020 03:03:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D5741208B3 for ; Mon, 20 Jul 2020 03:03:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="myC+IRvR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5741208B3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6FAE56B0003; Sun, 19 Jul 2020 23:03:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AA8F6B0005; Sun, 19 Jul 2020 23:03:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5996D6B0006; Sun, 19 Jul 2020 23:03:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id 404A76B0003 for ; Sun, 19 Jul 2020 23:03:57 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B9DC98248047 for ; Mon, 20 Jul 2020 03:03:56 +0000 (UTC) X-FDA: 77056959672.17.nerve68_3009d1e26f21 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 7EE1318037BE6 for ; Mon, 20 Jul 2020 03:03:10 +0000 (UTC) X-HE-Tag: nerve68_3009d1e26f21 X-Filterd-Recvd-Size: 4986 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jul 2020 03:03:09 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id p3so9642769pgh.3 for ; Sun, 19 Jul 2020 20:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=lpszrUk3g++VjwDkyO+kB0nakBB1oFxNo5alny9wgU0=; b=myC+IRvRSrv66HdgEQPlUWHOsZTOJPaMknWaQKmuH5kea7GMJebrhfBfK5shocJ7PE PbTFzBcDYU6JsNuY0veglvqtKVZRc2OdteWXoXs6j1LUMLCxWBGNex5bm7LZAznIww+M DedHXMjUF0Hhn3VXVH6FSTFq7opNi8xo0u1GLPHi0XR+wLucj198wmueAIfPYaYh/8Fg 8jlF5d8e7TD837BcvSgddivhN74F2jWyzVvtNisugRI1YKExssY/BOpG2zSuAIz/rjwL q3Nr+g54MEA0pJwLAnuUqZILGu8bacFa705Ph3pT0sYF0FPwYnzyfXi4jHkqUTeM/gm0 BqSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=lpszrUk3g++VjwDkyO+kB0nakBB1oFxNo5alny9wgU0=; b=RQ93vrNNjAc1Xz+Nwl9YqXdi0sjOAhht8fv33St3Ddn+nKDgu3gpYk04Cn6OJ5toPs K6mRYGGUaMOUEZ6Pn79YBkRbQCNfcm6GBOlJt6oOif4Uw5JA30bVFIXmd26U9UothY1J CchxnkpMnxQwElrEHiHGD9cQNSrGkFUzkYAsHeYBlTM/HAg0HxaWkfRcvjnj3LjOxWkU 3aox2cURlcyUK3wbFs9C609QschYHqbP++Erj8OMmCe3h0pVsWxiOP9P4Muhnl2irJI5 m7H8rSeXOpw363MFIUyMEWodi4xWfn2eVY+a3piK0DzpEL6m0FdERhJhWpbqEGW4WshK KVng== X-Gm-Message-State: AOAM531kQhu6VuefRaoGTemAGcnIuCEaNpQphJL2H9B87dwoYo1xRA0l wO/2Ducyw5sGT9ST0M0JDmc= X-Google-Smtp-Source: ABdhPJwMg06qZ+4wVzgvV5FRM4DFOwuOxF3uoQRaPM8dKXqbFpuZN/leQ1NFOn0AUHknX5kL6q7syw== X-Received: by 2002:a63:d02:: with SMTP id c2mr16849420pgl.338.1595214188892; Sun, 19 Jul 2020 20:03:08 -0700 (PDT) Received: from localhost (110-174-173-27.tpgi.com.au. [110.174.173.27]) by smtp.gmail.com with ESMTPSA id u66sm14887329pfb.191.2020.07.19.20.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jul 2020 20:03:08 -0700 (PDT) Date: Mon, 20 Jul 2020 13:03:03 +1000 From: Nicholas Piggin Subject: Re: [RFC PATCH 4/7] x86: use exit_lazy_tlb rather than membarrier_mm_sync_core_before_usermode To: Mathieu Desnoyers Cc: Anton Blanchard , Arnd Bergmann , linux-arch , linux-kernel , linux-mm , linuxppc-dev , Andy Lutomirski , Andy Lutomirski , Peter Zijlstra , x86 , Jens Axboe References: <1594868476.6k5kvx8684.astroid@bobo.none> <20200716085032.GO10769@hirez.programming.kicks-ass.net> <1594892300.mxnq3b9a77.astroid@bobo.none> <20200716110038.GA119549@hirez.programming.kicks-ass.net> <1594906688.ikv6r4gznx.astroid@bobo.none> <1314561373.18530.1594993363050.JavaMail.zimbra@efficios.com> In-Reply-To: <1314561373.18530.1594993363050.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Message-Id: <1595213677.kxru89dqy2.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 7EE1318037BE6 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Excerpts from Mathieu Desnoyers's message of July 17, 2020 11:42 pm: > ----- On Jul 16, 2020, at 7:26 PM, Nicholas Piggin npiggin@gmail.com wrot= e: > [...] >>=20 >> membarrier does replace barrier instructions on remote CPUs, which do >> order accesses performed by the kernel on the user address space. So >> membarrier should too I guess. >>=20 >> Normal process context accesses like read(2) will do so because they >> don't get filtered out from IPIs, but kernel threads using the mm may >> not. >=20 > But it should not be an issue, because membarrier's ordering is only with= respect > to submit and completion of io_uring requests, which are performed throug= h > system calls from the context of user-space threads, which are called fro= m the > right mm. Is that true? Can io completions be written into an address space via a kernel thread? I don't know the io_uring code well but it looks like=20 that's asynchonously using the user mm context. How about other memory accesses via kthread_use_mm? Presumably there is=20 still ordering requirement there for membarrier, so I really think it's a fragile interface with no real way for the user to know how=20 kernel threads may use its mm for any particular reason, so membarrier should synchronize all possible kernel users as well. Thanks, Nick