Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp22650ybc; Fri, 22 Nov 2019 01:21:47 -0800 (PST) X-Google-Smtp-Source: APXvYqysVj/aq5VNLAd0LO2wUNqDzw+HC8bG/xxYPJ4LQi++Z/HCYezNcnap7vL2k3UTd3QVadeF X-Received: by 2002:a17:906:6093:: with SMTP id t19mr20876649ejj.50.1574414507036; Fri, 22 Nov 2019 01:21:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574414507; cv=none; d=google.com; s=arc-20160816; b=oYLF5vTAn14lFemMYJASAgAE692cFuglcohKqXH4R2Qt8m/s3QO7oTK6qw+5AhWh0I M4wzyPmtrsIIXsY1S5wzz8sMSOZJsLAc/3/ZwIxCL6aJ8Ym4JvcTQ+89qHgC4ipejr+S /erope0FEt0eq/nLWYoiruOcNpuBicz3cY94rJdHUrLmxTUKMh2gNaCq9rzTC7ZvDKeb RaYf2wabKETCAGpHlsDwTbuFhIaO6HNt2DwzfqOCu8hC+AZKtxm1FoIP09dArc2WFna1 kEOYWwMUv3qG02+kJWZH6Oulw3p/M96+tKz7O7PcEK3CkVKzk3G4YRykGfFAOwFXJlsI 7imA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pzjjzH4UgTeG40VA2UV6AHDBfr0Ocw4jXqlZWXYFvJ8=; b=O+gqIFusEoRB63PaEgOYOzdvkUQPakQBFEbceGjO7oeWjrpGKJ9qUjM7SVW7SgTLsY QgHN+9nHlqffzqU40TR8qNNrrLLp/X0SHnZkvfz7sFKmabmjkeati5QCN+fYNy4H0N9z LSk6cP41+e63CGFnfl2qomfgHIYMA0fnKKccLfVqimwqfiCd5ejtdgM1vk22b3JeJ5IS YpFxfXgk/U8+5tu+1vFcVXDU83wufXPKTSdb+lLhZtERkSgaRpDAjUoD7Xsiap8mtmgj Iika4lKlPIlAKJG4d+ar5FP5vXgdD2HxOE/I35ESFxgbGbAlOQdHjLEKK+KFA3sSnNsC +V8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=PuTHrRo6; 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 z15si1677130edd.8.2019.11.22.01.21.21; Fri, 22 Nov 2019 01:21:47 -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=@ffwll.ch header.s=google header.b=PuTHrRo6; 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 S1726638AbfKVJRj (ORCPT + 99 others); Fri, 22 Nov 2019 04:17:39 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:36641 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726364AbfKVJRi (ORCPT ); Fri, 22 Nov 2019 04:17:38 -0500 Received: by mail-ot1-f65.google.com with SMTP id f10so5605979oto.3 for ; Fri, 22 Nov 2019 01:17:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pzjjzH4UgTeG40VA2UV6AHDBfr0Ocw4jXqlZWXYFvJ8=; b=PuTHrRo6gLJNu4P4PUUZivkRf9R8+X7UdnrZdLbDNmrrt/TpJ5FOmxGiHBbktnLk7p 0L/NwFPVLdJbjnvUE+rXbTFVQk2JD4/qkscDImWPNAQqc2A2LZeJ94l8S2wH6NIG/TjM Lguv1/sk/Rm80MHeMl/ogckNAQlZmDWVrIRac= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pzjjzH4UgTeG40VA2UV6AHDBfr0Ocw4jXqlZWXYFvJ8=; b=TB/VgF7nKWN6SippWRWQJA5SaNJTaDGjVily4aHOprsyJAZPTHEcnif/rxICE8jQYP +t6+PVWnzlBdBjNz5AR1goXNQoMoCKST+gsxJZ50M/CmHgXgRbpsiBR04AupbdIYTArq 1041VrEg3nQvuWWEOuPbEu3N0vgJ7fu9A0jetx404KJDHeBz22gawn7lkk0u4z85gsnd bOuBoNa4rgZUOlihSvL0zAyGTYPT7/2SWa3GOB2As8Vw/VG67o9/Efztzv4u9JzjuG3o ZuSATKYMDS1s3aajnL6dBxrRwHiIle7FBKXpZsX9dmwF8umDwmhR8008Ce6D2fF5App/ DkFg== X-Gm-Message-State: APjAAAXwaVztIGs+8Aw+PxAiktqDS4cXq/HTXZX6N7sWnusBd8zLOC3q 0qAfUqnZYKJWpBHqs3kjrBNeQdp8wgaej/d+bKBMPA== X-Received: by 2002:a05:6830:1649:: with SMTP id h9mr10352872otr.281.1574414257767; Fri, 22 Nov 2019 01:17:37 -0800 (PST) MIME-Version: 1.0 References: <20191122063749.27113-1-kraxel@redhat.com> <20191122063749.27113-3-kraxel@redhat.com> In-Reply-To: <20191122063749.27113-3-kraxel@redhat.com> From: Daniel Vetter Date: Fri, 22 Nov 2019 10:17:27 +0100 Message-ID: Subject: Re: [PATCH v2 2/2] drm: share address space for dma bufs To: Gerd Hoffmann Cc: dri-devel , Rob Herring , intel-gfx , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , "David (ChunMing) Zhou" , David Airlie , Maarten Lankhorst , Maxime Ripard , "open list:RADEON and AMDGPU DRM DRIVERS" , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 22, 2019 at 7:37 AM Gerd Hoffmann wrote: > > Use the shared address space of the drm device (see drm_open() in > drm_file.c) for dma-bufs too. That removes a difference betweem drm > device mmap vmas and dma-buf mmap vmas and fixes corner cases like > dropping ptes (using madvise(DONTNEED) for example) not working > properly. > > Also remove amdgpu driver's private dmabuf update. It is not needed > any more now that we are doing this for everybody. > > Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel Vetter But I think you want at least an ack from amd guys for double checking here. -Daniel > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 4 +--- > drivers/gpu/drm/drm_prime.c | 4 +++- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c > index d5bcdfefbad6..586db4fb46bd 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c > @@ -361,10 +361,8 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_gem_object *gobj, > return ERR_PTR(-EPERM); > > buf = drm_gem_prime_export(gobj, flags); > - if (!IS_ERR(buf)) { > - buf->file->f_mapping = gobj->dev->anon_inode->i_mapping; > + if (!IS_ERR(buf)) > buf->ops = &amdgpu_dmabuf_ops; > - } > > return buf; > } > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c > index a9633bd241bb..c3fc341453c0 100644 > --- a/drivers/gpu/drm/drm_prime.c > +++ b/drivers/gpu/drm/drm_prime.c > @@ -240,6 +240,7 @@ void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv) > struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, > struct dma_buf_export_info *exp_info) > { > + struct drm_gem_object *obj = exp_info->priv; > struct dma_buf *dma_buf; > > dma_buf = dma_buf_export(exp_info); > @@ -247,7 +248,8 @@ struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, > return dma_buf; > > drm_dev_get(dev); > - drm_gem_object_get(exp_info->priv); > + drm_gem_object_get(obj); > + dma_buf->file->f_mapping = obj->dev->anon_inode->i_mapping; > > return dma_buf; > } > -- > 2.18.1 > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch