Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3198581imu; Mon, 19 Nov 2018 12:13:00 -0800 (PST) X-Google-Smtp-Source: AJdET5fmxsR8MajYp1sC+a5U/++0UoBarUtFtqNQajj1IJdTwfQ5IERrzEwzkLAH+/6UeG0qkxer X-Received: by 2002:a63:e101:: with SMTP id z1mr21399417pgh.310.1542658380261; Mon, 19 Nov 2018 12:13:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542658380; cv=none; d=google.com; s=arc-20160816; b=EpPpl2bIG20h63TB0bt4N/skKcnzJghETf/xxd2iVEh/DaIiItn8wYZOcxitUkYqfR HWv0wpPijb6v2YQppvV5+YNzImZ2spH4RdmbzMVyIpsKNtWm4j6TV6mPXV+1jzw/Zv1A jrhPwwElmkzXGFH4WP7dUwGLCoQaderieexHOcYIpo5HmLRTbnF9OTfMB0RRWMEQVTYT NTyKxbS2eofZuY0i906ecUWvOE0bLFid5XXItubxSOWFnl89IyJQwNlOi0xPdS+vWn0+ lcGoMOxrYe0vNecqsHnTOc3tez+x3hdaU4FDOqZx9l6bFB2b97SlkD/m2QwfZrwMfcUN bMqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uvRC36rXsNXiZnvvRR40e4FzmmdFK6vqRNz0Zao0K2M=; b=RbLtP6Tf84MEHvIeh7uYiec/cTCXb74/h7SiyG4bDmzR+ag4RsS51muuipvInmKSwL 1r77WvFuU1942G/J4RGQV2LdSAT7YHZTp1IhP/PRgyuWsuuxZ38fswmBcx+HHvA5bI5N 3ihaR19BnIMIbfZq0T0RtMfoth/Ni5At4SLgM2gB2qrZi2Cb9UARhgubavsFFoJQk2MX x+mIWCJ3lK54VzV0uUvTSp5R+bIpfgYk0w0FUv7sIdD2OySjKK5XaLyjit2SGIIs0t7v XYOty+KN/inlrdcJdzLKnh84k9HHWMRMlIPHAkFhXZ3XHjuX0QmYHBO0mHnB31FCReU7 IuLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=nO5L3dEg; 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 g71si7316361pgc.419.2018.11.19.12.12.45; Mon, 19 Nov 2018 12:13:00 -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; dkim=pass header.i=@ziepe.ca header.s=google header.b=nO5L3dEg; 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 S1730602AbeKTGhM (ORCPT + 99 others); Tue, 20 Nov 2018 01:37:12 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:36023 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729957AbeKTGhM (ORCPT ); Tue, 20 Nov 2018 01:37:12 -0500 Received: by mail-pg1-f194.google.com with SMTP id n2so7135238pgm.3 for ; Mon, 19 Nov 2018 12:11:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uvRC36rXsNXiZnvvRR40e4FzmmdFK6vqRNz0Zao0K2M=; b=nO5L3dEgm53OeydXNSnYxOhNHwB2KJu3TRJvXtRmJYt7kt3qK31s+d0CyL1V2AepsW HLS6K57IqygFI2omIJZxzr/QJ59Dt6pNAMYH5HG3lA9Zw0GCv36/y5YHmhFD0BUkgPiG T5rExH+g8/UFLKbhUy6yak75l+1NZTkaVhiFjGVK1Wheio4lbHDxkxBr3TgXEFidI5QV ++XkWPzyammbQKtvd1xqRvbQeEUy4utW13WViotpKw0eAu9yi6Og6gUCUjwYHPl66X6S 6ZNi50xl9v3/F6C8Emo8SHuYzzueZTBTo/DaTiw2nMELJUkFiiB6SOtzTf39+snTHCbl grtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uvRC36rXsNXiZnvvRR40e4FzmmdFK6vqRNz0Zao0K2M=; b=EkA8g0tSbPDI6w6b51MMNmYalazoR7DV6dFV//2dNDyqjkzJqFZLYTb+nKk4/A9Uj1 u8XqVTMKd2bOJ/9p8ha+XpZH5cNy610ev+4jZNKWYiSj5W119jVvPVjNFDpLKiMiYPQl ufCudKX6Ojzd+7e0Kbad+dqDE5u/Ag7Ph0tOVnOoFZF7Exi0T7RpKMus5e06xANpiMBv WqHp/XvqX/R45ysWRGY7wk2xWUV2QleW0bQq+AbnmYhNt4e/QmxzrtxKikm9Su8Tu6GR VfSvy72YAN3flyKaG+KXWDYxOiEgW4Qi4ZPh1MJFePBEgBQDy2wRcWMCVsc5tjPchp/v Zi2A== X-Gm-Message-State: AGRZ1gLwsQsjbeuglCoxid26UlD8OjPqXJ+b5kCC+uMBDN2XWWuTQntv yHg+D1G9Sn98PNj+tG6rqFmUPQ== X-Received: by 2002:a63:1204:: with SMTP id h4mr21425509pgl.51.1542658317828; Mon, 19 Nov 2018 12:11:57 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id x27sm56696559pfe.178.2018.11.19.12.11.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Nov 2018 12:11:56 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1gOptk-0005xv-3X; Mon, 19 Nov 2018 13:11:56 -0700 Date: Mon, 19 Nov 2018 13:11:56 -0700 From: Jason Gunthorpe To: Jerome Glisse Cc: Leon Romanovsky , Kenneth Lee , Tim Sell , linux-doc@vger.kernel.org, Alexander Shishkin , Zaibo Xu , zhangfei.gao@foxmail.com, linuxarm@huawei.com, haojian.zhuang@linaro.org, Christoph Lameter , Hao Fang , Gavin Schenk , RDMA mailing list , Zhou Wang , Doug Ledford , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , David Kershner , Kenneth Lee , Johan Hovold , Cyrille Pitchen , Sagar Dharia , Jens Axboe , guodong.xu@linaro.org, linux-netdev , Randy Dunlap , linux-kernel@vger.kernel.org, Vinod Koul , linux-crypto@vger.kernel.org, Philippe Ombredanne , Sanyog Kale , "David S. Miller" , linux-accelerators@lists.ozlabs.org Subject: Re: [RFCv3 PATCH 1/6] uacce: Add documents for WarpDrive/uacce Message-ID: <20181119201156.GG4890@ziepe.ca> References: <20181119091405.GE157308@Turing-Arch-b> <20181119091910.GF157308@Turing-Arch-b> <20181119104801.GF8268@mtr-leonro.mtl.com> <20181119164853.GA4593@redhat.com> <20181119182752.GA4890@ziepe.ca> <20181119184215.GB4593@redhat.com> <20181119185333.GC4890@ziepe.ca> <20181119191721.GC4593@redhat.com> <20181119192702.GD4890@ziepe.ca> <20181119194631.GE4593@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181119194631.GE4593@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 19, 2018 at 02:46:32PM -0500, Jerome Glisse wrote: > > ?? How can O_DIRECT be fine but RDMA not? They use exactly the same > > get_user_pages flow, right? Can we do what O_DIRECT does in RDMA and > > be fine too? > > > > AFAIK the only difference is the length of the race window. You'd have > > to fork and fault during the shorter time O_DIRECT has get_user_pages > > open. > > Well in O_DIRECT case there is only one page table, the CPU > page table and it gets updated during fork() so there is an > ordering there and the race window is small. Not really, in O_DIRECT case there is another 'page table', we just call it a DMA scatter/gather list and it is sent directly to the block device's DMA HW. The sgl plays exactly the same role as the various HW page list data structures that underly RDMA MRs. It is not a page table that matters here, it is if the DMA address of the page is active for DMA on HW. Like you say, the only difference is that the race is hopefully small with O_DIRECT (though that is not really small, NVMeof for instance has windows as large as connection timeouts, if you try hard enough) So we probably can trigger this trouble with O_DIRECT and fork(), and I would call it a bug :( > > Why? Keep track in each mm if there are any active get_user_pages > > FOLL_WRITE pages in the mm, if yes then sweep the VMAs and fix the > > issue for the FOLL_WRITE pages. > > This has a cost and you don't want to do it for O_DIRECT. I am pretty > sure that any such patch to modify fork() code path would be rejected. > At least i would not like it and vote against. I was thinking the incremental cost on top of what John is already doing would be very small in the common case and only be triggered in cases that matter (which apps should avoid anyhow). Jason