<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div dir="auto">
<div><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">Am 26.06.2018 09:20 schrieb Alex Williamson <alex.williamson@redhat.com>:<br type="attribution">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font size="2"><span style="font-size:11pt">
<div>On Mon, 25 Jun 2018 08:44:52 +0200<br>
Gerd Hoffmann <kraxel@redhat.com> wrote:<br>
<br>
> There is no default implementation for dma_buf_ops->unmap.<br>
> So add a function unmapping the page, otherwise we'll leak them.<br>
> <br>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com><br>
> ---<br>
>  samples/vfio-mdev/mbochs.c | 7 +++++++<br>
>  1 file changed, 7 insertions(+)<br>
> <br>
> diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c<br>
> index aa25cda21d..85ac603769 100644<br>
> --- a/samples/vfio-mdev/mbochs.c<br>
> +++ b/samples/vfio-mdev/mbochs.c<br>
> @@ -811,11 +811,18 @@ static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)<br>
>        return kmap(page);<br>
>  }<br>
>  <br>
> +static void mbochs_kunmap_dmabuf(struct dma_buf *buf, unsigned long page_num,<br>
> +                              void *vaddr)<br>
> +{<!-- --><br>
> +     kunmap(vaddr);<br>
> +}<br>
> +<br>
>  static struct dma_buf_ops mbochs_dmabuf_ops = {<!-- --><br>
>        .map_dma_buf      = mbochs_map_dmabuf,<br>
>        .unmap_dma_buf    = mbochs_unmap_dmabuf,<br>
>        .release          = mbochs_release_dmabuf,<br>
>        .map              = mbochs_kmap_dmabuf,<br>
> +     .unmap            = mbochs_kunmap_dmabuf,<br>
>        .mmap             = mbochs_mmap_dmabuf,<br>
>  };<br>
>  <br>
<br>
Is this a fix for v4.18?  AFAICT, the kmap_atomic removal is only in<br>
next, not yet upstream and hopefully includes this sample driver before<br>
hitting mainline.  Should we therefore have a v4.18-rc based patch for<br>
this to include before v4.18 to resolve this?  Thanks,<br>
</div>
</span></font></div>
</blockquote>
</div>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">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.</div>
<div dir="auto"><br>
</div>
<div dir="auto">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.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Christian.</div>
<div dir="auto">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><font size="2"><span style="font-size:11pt">
<div><br>
Alex<br>
</div>
</span></font></div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>