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.6 required=3.0 tests=DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,T_DKIM_INVALID autolearn=ham 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 2017DC5CFC0 for ; Mon, 18 Jun 2018 07:57:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C25F7208E9 for ; Mon, 18 Jun 2018 07:57:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="E4QTvqFf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C25F7208E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933012AbeFRH5C (ORCPT ); Mon, 18 Jun 2018 03:57:02 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44322 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932612AbeFRH5A (ORCPT ); Mon, 18 Jun 2018 03:57:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hENXOClsqJEU2jmZa+oceeGUcBXz3vHMStrmn8fXNjE=; b=E4QTvqFfMxS6kh5FFOvo4w1aN 3QMomXA/dUPmwcQ4XobotHHgYyhgKGQzCa+k9SSwCEmnPlRJ/XH0IxY7i3qrVZxJgVsXEEo2v3trU +qn1bUKCgEOHgsfhxmhOFFCrIEsAyhhej2YjyWjrQZkiZ68FrDGp87xmgwBEM1XEqEgiSbcyM/LH3 dy2iTF+qhCnLBTSHxVp98IhchtP1IJUY/5vzN88ryDnW3I6FZSf4EyIRMHQLmdSQmRmijNwPTyEBA uQB522chTQcheFY/EhllKTrI8LhljugfkgE+gYnaSLDE38hSwA1LaK77I3g2pH1+QIpEi1IUE+ks0 BecwnMgnw==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUp1u-0007e6-Vm; Mon, 18 Jun 2018 07:56:50 +0000 Date: Mon, 18 Jun 2018 00:56:50 -0700 From: Christoph Hellwig To: john.hubbard@gmail.com Cc: Matthew Wilcox , Michal Hocko , Christopher Lameter , Jason Gunthorpe , Dan Williams , Jan Kara , linux-mm@kvack.org, LKML , linux-rdma , John Hubbard Subject: Re: [PATCH 2/2] mm: set PG_dma_pinned on get_user_pages*() Message-ID: <20180618075650.GA7300@infradead.org> References: <20180617012510.20139-1-jhubbard@nvidia.com> <20180617012510.20139-3-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180617012510.20139-3-jhubbard@nvidia.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 16, 2018 at 06:25:10PM -0700, john.hubbard@gmail.com wrote: > From: John Hubbard > > This fixes a few problems that come up when using devices (NICs, GPUs, > for example) that want to have direct access to a chunk of system (CPU) > memory, so that they can DMA to/from that memory. Problems [1] come up > if that memory is backed by persistence storage; for example, an ext4 > file system. I've been working on several customer bugs that are hitting > this, and this patchset fixes those bugs. What happens if we do get_user_page from two different threads or even processes on the same page? As far as I can tell from your patch the first one finishing the page will clear the bit and then we are back to no protection. Note that you can reproduce such a condition trivially using direct I/O reads or writes.