Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1428037ybh; Sun, 19 Jul 2020 20:03:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4Us3nKKvv/Ew3ixA/4GyG39IxBva8/WVq4ID2FEM/m+MxsT4GOp7Wj6+WTItfs0jVyHbN X-Received: by 2002:a17:906:abc9:: with SMTP id kq9mr19338113ejb.493.1595214230513; Sun, 19 Jul 2020 20:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595214230; cv=none; d=google.com; s=arc-20160816; b=MUDnnAA9ePTx5GKam/bLV8BYhgGCjdCRi27BIyz26Vxf4UmU8xTEAGA3PzPi7qoo6/ bJ2ew0onDx+9rRixfqs/6vTkzheXftxH3h6DEXbGRRmMCt20+oGSJOJdkcEDwJkjwm25 ehksPBRn5WApq3SStJdCGkZHi6pkRYjtQwcLRCtf5QDM8XX8tU8pyUf3xt91K50Ba4+/ oA4gCbiruFKd0h1pvAD7mjP52BVWT5Op6mH/x1LMDgW+3V8DE9JcQi+uTaNxCakhzbZs GvNEm250/7yMLbymZzAAYU+UDmr4Ni+3mmyNdYG7Y8s34N7wPU/RfK1Q+ThI3Z5FSsbj 3uVQ== 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:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=lpszrUk3g++VjwDkyO+kB0nakBB1oFxNo5alny9wgU0=; b=eRfb/4UtZSlcwL8wtimLkpnEJ8+YPSd3fF/0W7ZIERwxKSCc4aViCHw35cbQ585nP3 4ZnR7OCnBqi21QKFEvJqRzAuX52gisrwf+Pe/7BhEPqA5lekeLpg1XO5yw5unIpdCPlX gLgdiI188YpFv/XnDXE1Q7mkePIZlShbSZk5/3NaylWnvxMJM8yzM+n34TUKTlb1WcP6 a9Y6aDeurS2H3td6KFAWq36GKShQsrNNLew9nEhQm9fLDX0JtBg589Fzt6DjFGkCAgTf O+Qum5CW/QabO8PqNS5yg4eZwTeQtKhuE/JrAzg1NOtNu+6C6cNgbHWVSqr5DT14/fMo rliQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=myC+IRvR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gy14si9102513ejb.313.2020.07.19.20.03.27; Sun, 19 Jul 2020 20:03:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=myC+IRvR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726687AbgGTDDJ (ORCPT + 99 others); Sun, 19 Jul 2020 23:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726312AbgGTDDJ (ORCPT ); Sun, 19 Jul 2020 23:03:09 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BE72C0619D2; Sun, 19 Jul 2020 20:03:09 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id 1so8339881pfn.9; 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=NkRrWLPtgcOSzPrmXjckX9ROSAOWSiCMVHUyhlNsG+rQNYF2OyRBgQpe6p76FuoqnL e3DP5XY98nnyf+4ReTfO/+Gcu1TwEW/m+i3zFEavaGMHu+b0tCi033dMa04LurtZOmdr 7s4K4k5mvG2ZOZBp4HBClNazzFRqmjsacRSS9XDz79wX/Dwj+B0gAAb8+hlwQk0196Hf wLtxZpOQqeC/IrPIiaUy6MzhN+q6BqY9reZNeFcu+Dr7MurK8knVZRRMwAJCBK2HCTF+ hvpu3wkxWxJTPs2Hr2tCaZH04L2RrnP28d/iKMi6Wv6Xg4wFzb9yoqJHeZHEXksufLmK nqyQ== X-Gm-Message-State: AOAM531UVCqmJXd6otWtAfAqA4J9CvQROtsY+OYisSNPspgjpc+D55e+ C2ktY/IHYZ0NyGtRHWoFLvM= 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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