Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3037307ybt; Mon, 22 Jun 2020 13:18:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzq6CCTC/C501h/fBVj4/hX1Kxc6uYZWx4trRquF2nc3QXLJ6Hh8q1SO1FzQiPzGnVJSFcR X-Received: by 2002:a17:906:6453:: with SMTP id l19mr16665518ejn.262.1592857081091; Mon, 22 Jun 2020 13:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592857081; cv=none; d=google.com; s=arc-20160816; b=lDK2xdVxybIUWkmB405uPiOb/WlzsxKcKnrtG19ks0EcQF83JF0E0a2R4bksBVVwKW A8RFzHLRAMg7Mn6Xixa+7OJ5eN6QomaqZH90+kMiCn60bokgk6Ty9FcgV4FnXVPdqesJ TcB6aTAnRJdaHsfxZB9/rISnODDdE6/pHFDXt9qKBWkmQC+ZODjx8k3Cb290dn+k0FX+ NxO8DPZCiTJAuz4oACgB5NFYJ2tFiymC5oRulCzdy96rx1epjpn+3Fbd6tz6ABni0zTT 8bh0W3whxn2wvljBmeY2SQfw+SN2DmBElaRgfI6FBFrELBeV38AbDMqcq578Yf5ybCso d+fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TSUweuZT4DKGDzPl0W0mgX7uetKvmHq3b3GY3r5obEQ=; b=zLbyghsbU/aQfVlbuZsrWml88ZmXv/Pn4ViwpGgliNsJWYW7SsiYon1z9WVVTSrdhb Z+Y9/BhB0IPcDQBF7kwRcDKGG55wj8ONygTIDwtlzGdn13S8K5G7BflV05ehG97rZSYd Y0QFa8nJb3qFHzcrC8FI9cgN8zYIXexa0pEW47mvZTntS7/LCv7mBRs3L0u74zLTUO85 MSCXO3lGS8kiS2S9u4jEFNEVPnM136MGfyxaiFA20d3kXrjjq6oQxHzDMMrOl1Ioc3NK MGGzktTM99rTN7gDKQbQ50EfhpaSK6A7erS/S1dqo08jOp8QeInT7H71qT0FwYe3w36V C7zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AvujDWVv; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx26si5307316edb.241.2020.06.22.13.17.37; Mon, 22 Jun 2020 13:18:01 -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=@redhat.com header.s=mimecast20190719 header.b=AvujDWVv; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728477AbgFVUPx (ORCPT + 99 others); Mon, 22 Jun 2020 16:15:53 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:60841 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728333AbgFVUPw (ORCPT ); Mon, 22 Jun 2020 16:15:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592856951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TSUweuZT4DKGDzPl0W0mgX7uetKvmHq3b3GY3r5obEQ=; b=AvujDWVv1fJT1dJn+N4SkW5GMmDU7IzbCKKcFRWYUi39vcyRdTrOXRiPgl3E7M3zge/VvR ZkRQMMmnk1YvVdlxpk+BsrqFbmZI7D1S3R3L9QdDGE/3EqgrbhDjYqVmFyvP22lTRRtz4m 8LgSdLETYuzgVcOxuBQArD3DxdwY2O0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-420-f7cc3XQuNW-UeEjQYsAiCA-1; Mon, 22 Jun 2020 16:15:47 -0400 X-MC-Unique: f7cc3XQuNW-UeEjQYsAiCA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03BD218FF665; Mon, 22 Jun 2020 20:15:45 +0000 (UTC) Received: from redhat.com (ovpn-119-159.rdu2.redhat.com [10.10.119.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8972560F89; Mon, 22 Jun 2020 20:15:42 +0000 (UTC) Date: Mon, 22 Jun 2020 16:15:40 -0400 From: Jerome Glisse To: Jason Gunthorpe Cc: Felix Kuehling , linux-rdma , Thomas =?iso-8859-1?Q?Hellstr=F6m_=28Intel=29?= , Maarten Lankhorst , LKML , DRI Development , Christian =?iso-8859-1?Q?K=F6nig?= , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Thomas Hellstrom , amd-gfx list , Daniel Vetter , Daniel Vetter , Mika Kuoppala , Intel Graphics Development , "open list:DMA BUFFER SHARING FRAMEWORK" Subject: Re: [Linaro-mm-sig] [PATCH 04/18] dma-fence: prime lockdep annotations Message-ID: <20200622201540.GB9708@redhat.com> References: <20200619151551.GP6578@ziepe.ca> <20200619172308.GQ6578@ziepe.ca> <20200619180935.GA10009@redhat.com> <20200619181849.GR6578@ziepe.ca> <56008d64-772d-5757-6136-f20591ef71d2@amd.com> <20200619195538.GT6578@ziepe.ca> <20200619203147.GC13117@redhat.com> <20200622114617.GU6578@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200622114617.GU6578@ziepe.ca> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 22, 2020 at 08:46:17AM -0300, Jason Gunthorpe wrote: > On Fri, Jun 19, 2020 at 04:31:47PM -0400, Jerome Glisse wrote: > > Not doable as page refcount can change for things unrelated to GUP, with > > John changes we can identify GUP and we could potentialy copy GUPed page > > instead of COW but this can potentialy slow down fork() and i am not sure > > how acceptable this would be. Also this does not solve GUP against page > > that are already in fork tree ie page P0 is in process A which forks, > > we now have page P0 in process A and B. Now we have process A which forks > > again and we have page P0 in A, B, and C. Here B and C are two branches > > with root in A. B and/or C can keep forking and grow the fork tree. > > For a long time now RDMA has broken COW pages when creating user DMA > regions. > > The problem has been that fork re-COW's regions that had their COW > broken. > > So, if you break the COW upon mapping and prevent fork (and others) > from copying DMA pinned then you'd cover the cases. I am not sure we want to prevent COW for pinned GUP pages, this would change current semantic and potentialy break/slow down existing apps. Anyway i think we focus too much on fork/COW, it is just an unfixable broken corner cases, mmu notifier allows you to avoid it. Forcing real copy on fork would likely be seen as regression by most people. > > Semantic was change with 17839856fd588f4ab6b789f482ed3ffd7c403e1f to some > > what "fix" that but GUP fast is still succeptible to this. > > Ah, so everyone breaks the COW now, not just RDMA.. > > What do you mean 'GUP fast is still succeptible to this' ? Not all GUP fast path are updated (intentionaly) __get_user_pages_fast() for instance still keeps COW intact. People using GUP should really knows what they are doing. Cheers, J?r?me