Linux-Next discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf
@ 2018-06-25  6:44 Gerd Hoffmann
  2018-06-25  6:44 ` [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf Gerd Hoffmann
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Gerd Hoffmann @ 2018-06-25  6:44 UTC (permalink / raw)
  To: alex.williamson
  Cc: open list:VFIO MEDIATED DEVICE DRIVERS, airlied, daniel.vetter,
	linux-kernel, dri-devel, Kirti Wankhede, linux-next,
	Gerd Hoffmann, christian.koenig

Atomic mapping interface for dmabufs will be removed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 samples/vfio-mdev/mbochs.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index 2960e26c6e..aa25cda21d 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -803,15 +803,6 @@ static void mbochs_release_dmabuf(struct dma_buf *buf)
 	mutex_unlock(&mdev_state->ops_lock);
 }
 
-static void *mbochs_kmap_atomic_dmabuf(struct dma_buf *buf,
-				       unsigned long page_num)
-{
-	struct mbochs_dmabuf *dmabuf = buf->priv;
-	struct page *page = dmabuf->pages[page_num];
-
-	return kmap_atomic(page);
-}
-
 static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
 {
 	struct mbochs_dmabuf *dmabuf = buf->priv;
@@ -824,7 +815,6 @@ static struct dma_buf_ops mbochs_dmabuf_ops = {
 	.map_dma_buf	  = mbochs_map_dmabuf,
 	.unmap_dma_buf	  = mbochs_unmap_dmabuf,
 	.release	  = mbochs_release_dmabuf,
-	.map_atomic	  = mbochs_kmap_atomic_dmabuf,
 	.map		  = mbochs_kmap_dmabuf,
 	.mmap		  = mbochs_mmap_dmabuf,
 };
-- 
2.9.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf
  2018-06-25  6:44 [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf Gerd Hoffmann
@ 2018-06-25  6:44 ` Gerd Hoffmann
  2018-06-26  7:20   ` Alex Williamson
  2018-06-25 15:43 ` [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf Koenig, Christian
  2018-06-26  7:16 ` Alex Williamson
  2 siblings, 1 reply; 8+ messages in thread
From: Gerd Hoffmann @ 2018-06-25  6:44 UTC (permalink / raw)
  To: alex.williamson
  Cc: open list:VFIO MEDIATED DEVICE DRIVERS, airlied, daniel.vetter,
	linux-kernel, dri-devel, Kirti Wankhede, linux-next,
	Gerd Hoffmann, christian.koenig

There is no default implementation for dma_buf_ops->unmap.
So add a function unmapping the page, otherwise we'll leak them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 samples/vfio-mdev/mbochs.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index aa25cda21d..85ac603769 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -811,11 +811,18 @@ static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
 	return kmap(page);
 }
 
+static void mbochs_kunmap_dmabuf(struct dma_buf *buf, unsigned long page_num,
+				 void *vaddr)
+{
+	kunmap(vaddr);
+}
+
 static struct dma_buf_ops mbochs_dmabuf_ops = {
 	.map_dma_buf	  = mbochs_map_dmabuf,
 	.unmap_dma_buf	  = mbochs_unmap_dmabuf,
 	.release	  = mbochs_release_dmabuf,
 	.map		  = mbochs_kmap_dmabuf,
+	.unmap		  = mbochs_kunmap_dmabuf,
 	.mmap		  = mbochs_mmap_dmabuf,
 };
 
-- 
2.9.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf
  2018-06-25  6:44 [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf Gerd Hoffmann
  2018-06-25  6:44 ` [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf Gerd Hoffmann
@ 2018-06-25 15:43 ` Koenig, Christian
  2018-06-26  7:16 ` Alex Williamson
  2 siblings, 0 replies; 8+ messages in thread
From: Koenig, Christian @ 2018-06-25 15:43 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: open list:VFIO MEDIATED DEVICE DRIVERS, airlied@linux.ie,
	daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, alex.williamson@redhat.com,
	linux-next@vger.kernel.org, Kirti Wankhede


[-- Attachment #1.1: Type: text/plain, Size: 1429 bytes --]

Acked-by: Christian König <christian.koenig@amd.com>

Am 25.06.2018 08:45 schrieb Gerd Hoffmann <kraxel@redhat.com>:
Atomic mapping interface for dmabufs will be removed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 samples/vfio-mdev/mbochs.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index 2960e26c6e..aa25cda21d 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -803,15 +803,6 @@ static void mbochs_release_dmabuf(struct dma_buf *buf)
         mutex_unlock(&mdev_state->ops_lock);
 }

-static void *mbochs_kmap_atomic_dmabuf(struct dma_buf *buf,
-                                      unsigned long page_num)
-{
-       struct mbochs_dmabuf *dmabuf = buf->priv;
-       struct page *page = dmabuf->pages[page_num];
-
-       return kmap_atomic(page);
-}
-
 static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
 {
         struct mbochs_dmabuf *dmabuf = buf->priv;
@@ -824,7 +815,6 @@ static struct dma_buf_ops mbochs_dmabuf_ops = {
         .map_dma_buf      = mbochs_map_dmabuf,
         .unmap_dma_buf    = mbochs_unmap_dmabuf,
         .release          = mbochs_release_dmabuf,
-       .map_atomic       = mbochs_kmap_atomic_dmabuf,
         .map              = mbochs_kmap_dmabuf,
         .mmap             = mbochs_mmap_dmabuf,
 };
--
2.9.3


[-- Attachment #1.2: Type: text/html, Size: 3049 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf
  2018-06-25  6:44 [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf Gerd Hoffmann
  2018-06-25  6:44 ` [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf Gerd Hoffmann
  2018-06-25 15:43 ` [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf Koenig, Christian
@ 2018-06-26  7:16 ` Alex Williamson
  2 siblings, 0 replies; 8+ messages in thread
From: Alex Williamson @ 2018-06-26  7:16 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: open list:VFIO MEDIATED DEVICE DRIVERS, airlied, daniel.vetter,
	linux-kernel, dri-devel, Kirti Wankhede, linux-next,
	christian.koenig

On Mon, 25 Jun 2018 08:44:51 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:

> Atomic mapping interface for dmabufs will be removed.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Fixes: f664a5269542 ("dma-buf: remove kmap_atomic interface")

Though really the above commit needs to be updated to include this fix
to preserve bisection since the mbochs sample driver is already
upstream, suggests we only compile tested removing kmap_atomic without
looking for other users.  drm folks, please update.  Thanks,

Alex

> ---
>  samples/vfio-mdev/mbochs.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
> index 2960e26c6e..aa25cda21d 100644
> --- a/samples/vfio-mdev/mbochs.c
> +++ b/samples/vfio-mdev/mbochs.c
> @@ -803,15 +803,6 @@ static void mbochs_release_dmabuf(struct dma_buf *buf)
>  	mutex_unlock(&mdev_state->ops_lock);
>  }
>  
> -static void *mbochs_kmap_atomic_dmabuf(struct dma_buf *buf,
> -				       unsigned long page_num)
> -{
> -	struct mbochs_dmabuf *dmabuf = buf->priv;
> -	struct page *page = dmabuf->pages[page_num];
> -
> -	return kmap_atomic(page);
> -}
> -
>  static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
>  {
>  	struct mbochs_dmabuf *dmabuf = buf->priv;
> @@ -824,7 +815,6 @@ static struct dma_buf_ops mbochs_dmabuf_ops = {
>  	.map_dma_buf	  = mbochs_map_dmabuf,
>  	.unmap_dma_buf	  = mbochs_unmap_dmabuf,
>  	.release	  = mbochs_release_dmabuf,
> -	.map_atomic	  = mbochs_kmap_atomic_dmabuf,
>  	.map		  = mbochs_kmap_dmabuf,
>  	.mmap		  = mbochs_mmap_dmabuf,
>  };

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf
  2018-06-25  6:44 ` [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf Gerd Hoffmann
@ 2018-06-26  7:20   ` Alex Williamson
  2018-06-26  7:32     ` Gerd Hoffmann
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Williamson @ 2018-06-26  7:20 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: open list:VFIO MEDIATED DEVICE DRIVERS, airlied, daniel.vetter,
	linux-kernel, dri-devel, Kirti Wankhede, linux-next,
	christian.koenig

On Mon, 25 Jun 2018 08:44:52 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:

> There is no default implementation for dma_buf_ops->unmap.
> So add a function unmapping the page, otherwise we'll leak them.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  samples/vfio-mdev/mbochs.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
> index aa25cda21d..85ac603769 100644
> --- a/samples/vfio-mdev/mbochs.c
> +++ b/samples/vfio-mdev/mbochs.c
> @@ -811,11 +811,18 @@ static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
>  	return kmap(page);
>  }
>  
> +static void mbochs_kunmap_dmabuf(struct dma_buf *buf, unsigned long page_num,
> +				 void *vaddr)
> +{
> +	kunmap(vaddr);
> +}
> +
>  static struct dma_buf_ops mbochs_dmabuf_ops = {
>  	.map_dma_buf	  = mbochs_map_dmabuf,
>  	.unmap_dma_buf	  = mbochs_unmap_dmabuf,
>  	.release	  = mbochs_release_dmabuf,
>  	.map		  = mbochs_kmap_dmabuf,
> +	.unmap		  = mbochs_kunmap_dmabuf,
>  	.mmap		  = mbochs_mmap_dmabuf,
>  };
>  

Is this a fix for v4.18?  AFAICT, the kmap_atomic removal is only in
next, not yet upstream and hopefully includes this sample driver before
hitting mainline.  Should we therefore have a v4.18-rc based patch for
this to include before v4.18 to resolve this?  Thanks,

Alex
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf
  2018-06-26  7:20   ` Alex Williamson
@ 2018-06-26  7:32     ` Gerd Hoffmann
  2018-06-27  1:55       ` Alex Williamson
  0 siblings, 1 reply; 8+ messages in thread
From: Gerd Hoffmann @ 2018-06-26  7:32 UTC (permalink / raw)
  To: Alex Williamson
  Cc: open list:VFIO MEDIATED DEVICE DRIVERS, airlied, daniel.vetter,
	linux-kernel, dri-devel, Kirti Wankhede, linux-next,
	christian.koenig

> >  	.map		  = mbochs_kmap_dmabuf,
> > +	.unmap		  = mbochs_kunmap_dmabuf,
> >  	.mmap		  = mbochs_mmap_dmabuf,
> >  };
> >  
> 
> Is this a fix for v4.18?

Yes.

> AFAICT, the kmap_atomic removal is only in
> next, not yet upstream and hopefully includes this sample driver before
> hitting mainline.  Should we therefore have a v4.18-rc based patch for
> this to include before v4.18 to resolve this?

The kmap_atomic interface will be removed in 4.19 because nobody uses
it, so dropping the mbochs implementation already in 4.18 should not
cause any issues.

So just queue both for 4.18 would be the easiest way do deal with the
dependency I think.

cheers,
  Gerd

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf
@ 2018-06-26  7:33 Koenig, Christian
  0 siblings, 0 replies; 8+ messages in thread
From: Koenig, Christian @ 2018-06-26  7:33 UTC (permalink / raw)
  To: Alex Williamson
  Cc: open list:VFIO MEDIATED DEVICE DRIVERS, airlied@linux.ie,
	daniel.vetter@ffwll.ch, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, Kirti Wankhede,
	linux-next@vger.kernel.org, Gerd Hoffmann


[-- Attachment #1.1: Type: text/plain, Size: 1891 bytes --]



Am 26.06.2018 09:20 schrieb Alex Williamson <alex.williamson@redhat.com>:
On Mon, 25 Jun 2018 08:44:52 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:

> There is no default implementation for dma_buf_ops->unmap.
> So add a function unmapping the page, otherwise we'll leak them.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  samples/vfio-mdev/mbochs.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
> index aa25cda21d..85ac603769 100644
> --- a/samples/vfio-mdev/mbochs.c
> +++ b/samples/vfio-mdev/mbochs.c
> @@ -811,11 +811,18 @@ static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
>        return kmap(page);
>  }
>
> +static void mbochs_kunmap_dmabuf(struct dma_buf *buf, unsigned long page_num,
> +                              void *vaddr)
> +{
> +     kunmap(vaddr);
> +}
> +
>  static struct dma_buf_ops mbochs_dmabuf_ops = {
>        .map_dma_buf      = mbochs_map_dmabuf,
>        .unmap_dma_buf    = mbochs_unmap_dmabuf,
>        .release          = mbochs_release_dmabuf,
>        .map              = mbochs_kmap_dmabuf,
> +     .unmap            = mbochs_kunmap_dmabuf,
>        .mmap             = mbochs_mmap_dmabuf,
>  };
>

Is this a fix for v4.18?  AFAICT, the kmap_atomic removal is only in
next, not yet upstream and hopefully includes this sample driver before
hitting mainline.  Should we therefore have a v4.18-rc based patch for
this to include before v4.18 to resolve this?  Thanks,

That actually doesn't looks like it has something to do with the kmap_atomic removal. More like a general bug fix to existing code.

BTW: The kmap_atomic removal was based on an older kernel version and I've forgotten to check for new DMA-buf implementation during rebase. So sorry for the noise.

Christian.

Alex


[-- Attachment #1.2: Type: text/html, Size: 3885 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf
  2018-06-26  7:32     ` Gerd Hoffmann
@ 2018-06-27  1:55       ` Alex Williamson
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Williamson @ 2018-06-27  1:55 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: open list:VFIO MEDIATED DEVICE DRIVERS, airlied, daniel.vetter,
	linux-kernel, dri-devel, Kirti Wankhede, linux-next,
	christian.koenig

On Tue, 26 Jun 2018 09:32:33 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:

> > >  	.map		  = mbochs_kmap_dmabuf,
> > > +	.unmap		  = mbochs_kunmap_dmabuf,
> > >  	.mmap		  = mbochs_mmap_dmabuf,
> > >  };
> > >    
> > 
> > Is this a fix for v4.18?  
> 
> Yes.
> 
> > AFAICT, the kmap_atomic removal is only in
> > next, not yet upstream and hopefully includes this sample driver before
> > hitting mainline.  Should we therefore have a v4.18-rc based patch for
> > this to include before v4.18 to resolve this?  
> 
> The kmap_atomic interface will be removed in 4.19 because nobody uses
> it, so dropping the mbochs implementation already in 4.18 should not
> cause any issues.
> 
> So just queue both for 4.18 would be the easiest way do deal with the
> dependency I think.

Ok, so I'll drop the fixes tag and apply both to my for-linus branch
for v4.18 and then Christian won't need to include it for the v4.19
patch.  Thanks,

Alex
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-06-27  1:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-25  6:44 [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf Gerd Hoffmann
2018-06-25  6:44 ` [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf Gerd Hoffmann
2018-06-26  7:20   ` Alex Williamson
2018-06-26  7:32     ` Gerd Hoffmann
2018-06-27  1:55       ` Alex Williamson
2018-06-25 15:43 ` [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf Koenig, Christian
2018-06-26  7:16 ` Alex Williamson
  -- strict thread matches above, loose matches on Subject: below --
2018-06-26  7:33 [PATCH 2/2] sample/mdev/mbochs: add mbochs_kunmap_dmabuf Koenig, Christian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox