Received: by 10.213.65.68 with SMTP id h4csp2330318imn; Mon, 9 Apr 2018 01:25:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx48TYEsGJ1l6/8GXzazkxey9D6AX5MxoayrTuQJX1f7L796DrjxjPssOynHbNqe1WURfXgp8 X-Received: by 10.98.163.74 with SMTP id s71mr19170473pfe.72.1523262347921; Mon, 09 Apr 2018 01:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523262347; cv=none; d=google.com; s=arc-20160816; b=zBFaVvpNbGugYTrQEV+VRxcxS7mAlGxy9XCRLK9xglS4nqyI2gLX2vzROZXWiVM0vH oihjVGL9dprYuJcV01qgasVxdos+YzWSrtE0+uk19xrMrLlY24yVYy/2UqJBcQoZTYkb ya/b1JqCQZtuBKA33yR5NwPxEIXILP6n6uMw7d9DGgoQm4Q1k7yrdviTVPzCg4WnGLOp mkZkMs2V61G39E+TyRA2rDgI3vr1HehFiRRFZhouvqNYN+CQoB/3kDwYTbY+mfp9G3b1 UIUOPox69CH8lCwU6/W83fkMnB+2gQWg513PgPDFUlv2BIFAWMC8fc34C0F+s7joHXfo q54w== 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-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=cQBZP35S3UjPvguXqvhThvmIplmxdWE+tY4cybMLoDY=; b=KbJneHDY3XAUDxHh5OmSEL2H0a/0H8z7Dtqlvnj8mCNDrjQgST+2R20zKmkSf3Lt98 qvx0M2Vj3zwUIoXY/1Ta0iNE8qEYg1Ng5r8t76xV46yYmLQ+65I7F/qd9U3/bjHFa51M bTbFAORqpYJrPnBH5TTgw+s90jJ06qOsHZqlY1ELRElPUjesdYoeHUknDl8zu8RGGwGp Vg/tkD5K5krv3MPsvRwYkwEdUNjE3w9YV2pWtfFpNPCTfaEwcXNhMpuE11N/p3jJA9Gh NXLNydcT2X9X0vISM7Aw6E2clceVLHlfJkdGHUz9gyCi5A4/ZCDy+FcgsTBWt2zfpWiZ n7rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=J8g9Kn+Q; 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 i71si10718350pgc.718.2018.04.09.01.25.10; Mon, 09 Apr 2018 01:25:47 -0700 (PDT) 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=fail header.i=@ffwll.ch header.s=google header.b=J8g9Kn+Q; 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 S1751942AbeDIIVi (ORCPT + 99 others); Mon, 9 Apr 2018 04:21:38 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:39091 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751663AbeDIIVf (ORCPT ); Mon, 9 Apr 2018 04:21:35 -0400 Received: by mail-wm0-f51.google.com with SMTP id f125so14725874wme.4 for ; Mon, 09 Apr 2018 01:21:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=cQBZP35S3UjPvguXqvhThvmIplmxdWE+tY4cybMLoDY=; b=J8g9Kn+QbBm2ks+ZL1XDa9FfrQaPAYFY0yEy2sSI2yNPniyuLonU99kSWY14blleut SQus3VFCNAMQtm+pPw7KAu4iPki1PjSGy2mAu9VYGFfkP9j7IxHbymGLdoXq1nST1QEE N6fX2S9XGq8qxhVMdNZDORs6dOxq6VPDRfIvA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=cQBZP35S3UjPvguXqvhThvmIplmxdWE+tY4cybMLoDY=; b=lA/c+JD4Em5kOSTnrwg7rM+LUGhNv7zPO7XiSfdX4dyd4F4ICLaBhYwzeA2h1DOn5M 02FvBjcwj1m3hMVoCYuHYAK/+e+HlS55+FQHDtLM5g/jj7W1q67cFapqVhL1+GRNynJi lXgJEpIThRy/F2NPSfLSq9Az4EpoyLGIq5L0EyaIX611v4Csrib6K8AlN7/PHQgLtd2h mf+XNdAgsnNZWySCZ0aOCnlX/VMjRkxI2WGCsHaGwlsc9kw6IJczCiMdFTQrywBKxOFI 5OHouJZjsq9jUB28xKyLRVNRs4pFL/lhFFhtCobH7xDZCwVrKn8nuIOapyMIiaITJIhI U7sQ== X-Gm-Message-State: ALQs6tAoE3HxYrSQGZzvL9gfqKbZc23giPiJyPUqlA2zUSo/uk47taHM Yufi/IjMaeSB6WdWrNXjZ4Xfew== X-Received: by 10.80.202.8 with SMTP id d8mr20698216edi.227.1523262094274; Mon, 09 Apr 2018 01:21:34 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id l1sm49475edi.54.2018.04.09.01.21.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Apr 2018 01:21:33 -0700 (PDT) Date: Mon, 9 Apr 2018 10:21:31 +0200 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Gerd Hoffmann , dri-devel@lists.freedesktop.org, Daniel Vetter , Tomeu Vizoso , David Airlie , open list , qemu-devel@nongnu.org, "moderated list:DMA BUFFER SHARING FRAMEWORK" , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan , "open list:DMA BUFFER SHARING FRAMEWORK" Subject: Re: [PATCH v2] Add udmabuf misc device Message-ID: <20180409082131.GF31310@phenom.ffwll.local> Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , Gerd Hoffmann , dri-devel@lists.freedesktop.org, Tomeu Vizoso , David Airlie , open list , qemu-devel@nongnu.org, "moderated list:DMA BUFFER SHARING FRAMEWORK" , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan , "open list:DMA BUFFER SHARING FRAMEWORK" References: <20180316074650.5415-1-kraxel@redhat.com> <7547e99b-0e3c-264e-e52b-40ad5d52b49a@gmail.com> <20180406093307.s7wkhpmddd5d4r7a@sirius.home.kraxel.org> <5d88baad-a956-6bd5-e0d6-aabae6647f3e@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5d88baad-a956-6bd5-e0d6-aabae6647f3e@amd.com> X-Operating-System: Linux phenom 4.15.0-1-amd64 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 Fri, Apr 06, 2018 at 02:24:46PM +0200, Christian K?nig wrote: > Am 06.04.2018 um 11:33 schrieb Gerd Hoffmann: > > Hi, > > > > > The pages backing a DMA-buf are not allowed to move (at least not without a > > > patch set I'm currently working on), but for certain MM operations to work > > > correctly you must be able to modify the page tables entries and move the > > > pages backing them around. > > > > > > For example try to use fork() with some copy on write pages with this > > > approach. You will find that you have only two options to correctly handle > > > this. > > The fork() issue should go away with shared memory pages (no cow). > > I guess this is the reason why vgem is internally backed by shmem. > > Yes, exactly that is also an approach which should work fine. Just don't try > to get this working with get_user_pages(). > > > > > Hmm. So I could try to limit the udmabuf driver to shmem too (i.e. > > have the ioctl take a shmem filehandle and offset instead of a virtual > > address). > > > > But maybe it is better then to just extend vgem, i.e. add support to > > create gem objects from existing shmem. > > > > Comments? > > Yes, extending vgem instead of creating something new sounds like a good > idea to me as well. +1 on adding a vgem "import from shmem/memfd" ioctl. Sounds like a good idea, and generally useful. We might want to limit to memfd though for semantic reasons: dma-buf have invariant size, shmem not so much. memfd can be locked down to not change their size anymore. And iirc the core mm page invalidation protocol around truncate() is about as bad as get_user_pages vs cow :-) -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch