* [PATCH] dma-buf: Implement simple read/write vfs ops
@ 2019-09-19 15:08 Chris Wilson
2019-09-19 15:28 ` Daniel Vetter
2019-09-19 20:22 ` ✗ Fi.CI.BAT: failure for " Patchwork
0 siblings, 2 replies; 6+ messages in thread
From: Chris Wilson @ 2019-09-19 15:08 UTC (permalink / raw)
To: dri-devel; +Cc: Daniel Vetter, intel-gfx, Sean Paul, Laura Abbott, Sumit Semwal
It is expected that processes will pass dma-buf fd between drivers, and
only using the fd themselves for mmaping and synchronisation ioctls.
However, it may be convenient for an application to read/write into the
dma-buf, for instance a test case to check the internal
dma_buf->ops->kmap interface. There may also be a small advantage to
avoiding the mmap() for very simple/small operations.
Note in particular, synchronisation with the device is left to the
caller with an explicit DMA_BUF_IOCTL_SYNC, rather than done implicitly
inside the read/write, so that the user can avoid synchronisation if
they so choose.
"It is easier to add synchronisation later, than it is to take it away."
v2: Lots of little fixes, plus a real llseek() implements so that the
first basic little test cases work!
Testcase: igt/prime_rw
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Tested-by: Laura Abbott <labbott@redhat.com>
---
Dusting this off again as it would be nice as a user to operate on dmabuf
agnostic to the underyling driver. We have mmap, so naturally we would
like to have read/write as well!
---
drivers/dma-buf/dma-buf.c | 108 ++++++++++++++++++++++++++++++++------
1 file changed, 93 insertions(+), 15 deletions(-)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 433d91d710e4..a19fc881a99c 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -135,28 +135,104 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
static loff_t dma_buf_llseek(struct file *file, loff_t offset, int whence)
{
- struct dma_buf *dmabuf;
- loff_t base;
+ struct dma_buf *dmabuf = file->private_data;
if (!is_dma_buf_file(file))
return -EBADF;
- dmabuf = file->private_data;
+ return fixed_size_llseek(file, offset, whence, dmabuf->size);
+}
- /* only support discovering the end of the buffer,
- but also allow SEEK_SET to maintain the idiomatic
- SEEK_END(0), SEEK_CUR(0) pattern */
- if (whence == SEEK_END)
- base = dmabuf->size;
- else if (whence == SEEK_SET)
- base = 0;
- else
- return -EINVAL;
+static ssize_t dma_buf_read(struct file *file,
+ char __user *ubuf, size_t remain,
+ loff_t *offset)
+{
+ struct dma_buf *dmabuf = file->private_data;
+ unsigned long idx;
+ unsigned int start;
+ size_t total;
- if (offset != 0)
- return -EINVAL;
+ if (!is_dma_buf_file(file))
+ return -EBADF;
+
+ total = 0;
+ idx = *offset >> PAGE_SHIFT;
+ start = offset_in_page(*offset);
+ while (remain) {
+ unsigned int len = min_t(size_t, remain, PAGE_SIZE - start);
+ unsigned int copied;
+ void *vaddr;
+
+ if (*offset >= dmabuf->size)
+ return total;
+
+ vaddr = dma_buf_kmap(dmabuf, idx);
+ if (!vaddr)
+ return total ?: -EIO;
+
+ copied = copy_to_user(ubuf, vaddr + start, len);
+ dma_buf_kunmap(dmabuf, idx, vaddr);
+
+ total += copied ?: len;
+ if (copied) {
+ *offset += copied;
+ return total ?: -EFAULT;
+ }
+
+ remain -= len;
+ *offset += len;
+ ubuf += len;
+ start = 0;
+ idx++;
+ }
+
+ return total;
+}
+
+static ssize_t dma_buf_write(struct file *file,
+ const char __user *ubuf, size_t remain,
+ loff_t *offset)
+{
+ struct dma_buf *dmabuf = file->private_data;
+ unsigned long idx;
+ unsigned int start;
+ size_t total;
+
+ if (!is_dma_buf_file(file))
+ return -EBADF;
+
+ total = 0;
+ idx = *offset >> PAGE_SHIFT;
+ start = offset_in_page(*offset);
+ while (remain) {
+ unsigned int len = min_t(size_t, remain, PAGE_SIZE - start);
+ unsigned int copied;
+ void *vaddr;
+
+ if (*offset >= dmabuf->size)
+ return total;
+
+ vaddr = dma_buf_kmap(dmabuf, idx);
+ if (!vaddr)
+ return total ?: -EIO;
+
+ copied = copy_from_user(vaddr + start, ubuf, len);
+ dma_buf_kunmap(dmabuf, idx, vaddr);
+
+ total += copied ?: len;
+ if (copied) {
+ *offset += copied;
+ return total ?: -EFAULT;
+ }
+
+ remain -= len;
+ *offset += len;
+ ubuf += len;
+ start = 0;
+ idx++;
+ }
- return base + offset;
+ return total;
}
/**
@@ -413,6 +489,8 @@ static const struct file_operations dma_buf_fops = {
.release = dma_buf_release,
.mmap = dma_buf_mmap_internal,
.llseek = dma_buf_llseek,
+ .read = dma_buf_read,
+ .write = dma_buf_write,
.poll = dma_buf_poll,
.unlocked_ioctl = dma_buf_ioctl,
#ifdef CONFIG_COMPAT
--
2.23.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] dma-buf: Implement simple read/write vfs ops
2019-09-19 15:08 [PATCH] dma-buf: Implement simple read/write vfs ops Chris Wilson
@ 2019-09-19 15:28 ` Daniel Vetter
2019-09-19 15:52 ` Chris Wilson
2019-09-19 20:22 ` ✗ Fi.CI.BAT: failure for " Patchwork
1 sibling, 1 reply; 6+ messages in thread
From: Daniel Vetter @ 2019-09-19 15:28 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, dri-devel, Sean Paul, Laura Abbott, Sumit Semwal
On Thu, Sep 19, 2019 at 5:09 PM Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> It is expected that processes will pass dma-buf fd between drivers, and
> only using the fd themselves for mmaping and synchronisation ioctls.
> However, it may be convenient for an application to read/write into the
> dma-buf, for instance a test case to check the internal
> dma_buf->ops->kmap interface. There may also be a small advantage to
> avoiding the mmap() for very simple/small operations.
>
> Note in particular, synchronisation with the device is left to the
> caller with an explicit DMA_BUF_IOCTL_SYNC, rather than done implicitly
> inside the read/write, so that the user can avoid synchronisation if
> they so choose.
>
> "It is easier to add synchronisation later, than it is to take it away."
Hm for mmap I think the explicit sync makes sense (we might even want
to do it in userspace). Not so sure it's a great idea for read/write
... I guess we'd need to see what people have/had in mind for the
userspace for this to decide.
Only other thought I have on this is that many dma-buf exporters don't
bother with the kmap/kunmap interface (probably fewer than those who
bother with kernel vmap and mmap), maybe we want at least a vmap
fallback for this. Or maybe just use that as an excuse to get more
people to wire up the kmap stuff :-)
-Daniel
> v2: Lots of little fixes, plus a real llseek() implements so that the
> first basic little test cases work!
>
> Testcase: igt/prime_rw
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Laura Abbott <labbott@redhat.com>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sean Paul <seanpaul@chromium.org>
> Cc: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
> Tested-by: Laura Abbott <labbott@redhat.com>
> ---
> Dusting this off again as it would be nice as a user to operate on dmabuf
> agnostic to the underyling driver. We have mmap, so naturally we would
> like to have read/write as well!
>
> ---
> drivers/dma-buf/dma-buf.c | 108 ++++++++++++++++++++++++++++++++------
> 1 file changed, 93 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 433d91d710e4..a19fc881a99c 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -135,28 +135,104 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
>
> static loff_t dma_buf_llseek(struct file *file, loff_t offset, int whence)
> {
> - struct dma_buf *dmabuf;
> - loff_t base;
> + struct dma_buf *dmabuf = file->private_data;
>
> if (!is_dma_buf_file(file))
> return -EBADF;
>
> - dmabuf = file->private_data;
> + return fixed_size_llseek(file, offset, whence, dmabuf->size);
> +}
>
> - /* only support discovering the end of the buffer,
> - but also allow SEEK_SET to maintain the idiomatic
> - SEEK_END(0), SEEK_CUR(0) pattern */
> - if (whence == SEEK_END)
> - base = dmabuf->size;
> - else if (whence == SEEK_SET)
> - base = 0;
> - else
> - return -EINVAL;
> +static ssize_t dma_buf_read(struct file *file,
> + char __user *ubuf, size_t remain,
> + loff_t *offset)
> +{
> + struct dma_buf *dmabuf = file->private_data;
> + unsigned long idx;
> + unsigned int start;
> + size_t total;
>
> - if (offset != 0)
> - return -EINVAL;
> + if (!is_dma_buf_file(file))
> + return -EBADF;
> +
> + total = 0;
> + idx = *offset >> PAGE_SHIFT;
> + start = offset_in_page(*offset);
> + while (remain) {
> + unsigned int len = min_t(size_t, remain, PAGE_SIZE - start);
> + unsigned int copied;
> + void *vaddr;
> +
> + if (*offset >= dmabuf->size)
> + return total;
> +
> + vaddr = dma_buf_kmap(dmabuf, idx);
> + if (!vaddr)
> + return total ?: -EIO;
> +
> + copied = copy_to_user(ubuf, vaddr + start, len);
> + dma_buf_kunmap(dmabuf, idx, vaddr);
> +
> + total += copied ?: len;
> + if (copied) {
> + *offset += copied;
> + return total ?: -EFAULT;
> + }
> +
> + remain -= len;
> + *offset += len;
> + ubuf += len;
> + start = 0;
> + idx++;
> + }
> +
> + return total;
> +}
> +
> +static ssize_t dma_buf_write(struct file *file,
> + const char __user *ubuf, size_t remain,
> + loff_t *offset)
> +{
> + struct dma_buf *dmabuf = file->private_data;
> + unsigned long idx;
> + unsigned int start;
> + size_t total;
> +
> + if (!is_dma_buf_file(file))
> + return -EBADF;
> +
> + total = 0;
> + idx = *offset >> PAGE_SHIFT;
> + start = offset_in_page(*offset);
> + while (remain) {
> + unsigned int len = min_t(size_t, remain, PAGE_SIZE - start);
> + unsigned int copied;
> + void *vaddr;
> +
> + if (*offset >= dmabuf->size)
> + return total;
> +
> + vaddr = dma_buf_kmap(dmabuf, idx);
> + if (!vaddr)
> + return total ?: -EIO;
> +
> + copied = copy_from_user(vaddr + start, ubuf, len);
> + dma_buf_kunmap(dmabuf, idx, vaddr);
> +
> + total += copied ?: len;
> + if (copied) {
> + *offset += copied;
> + return total ?: -EFAULT;
> + }
> +
> + remain -= len;
> + *offset += len;
> + ubuf += len;
> + start = 0;
> + idx++;
> + }
>
> - return base + offset;
> + return total;
> }
>
> /**
> @@ -413,6 +489,8 @@ static const struct file_operations dma_buf_fops = {
> .release = dma_buf_release,
> .mmap = dma_buf_mmap_internal,
> .llseek = dma_buf_llseek,
> + .read = dma_buf_read,
> + .write = dma_buf_write,
> .poll = dma_buf_poll,
> .unlocked_ioctl = dma_buf_ioctl,
> #ifdef CONFIG_COMPAT
> --
> 2.23.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] dma-buf: Implement simple read/write vfs ops
2019-09-19 15:28 ` Daniel Vetter
@ 2019-09-19 15:52 ` Chris Wilson
2019-09-19 16:18 ` Daniel Vetter
0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2019-09-19 15:52 UTC (permalink / raw)
To: Daniel Vetter; +Cc: intel-gfx, dri-devel, Sean Paul, Laura Abbott, Sumit Semwal
Quoting Daniel Vetter (2019-09-19 16:28:41)
> On Thu, Sep 19, 2019 at 5:09 PM Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >
> > It is expected that processes will pass dma-buf fd between drivers, and
> > only using the fd themselves for mmaping and synchronisation ioctls.
> > However, it may be convenient for an application to read/write into the
> > dma-buf, for instance a test case to check the internal
> > dma_buf->ops->kmap interface. There may also be a small advantage to
> > avoiding the mmap() for very simple/small operations.
> >
> > Note in particular, synchronisation with the device is left to the
> > caller with an explicit DMA_BUF_IOCTL_SYNC, rather than done implicitly
> > inside the read/write, so that the user can avoid synchronisation if
> > they so choose.
> >
> > "It is easier to add synchronisation later, than it is to take it away."
>
> Hm for mmap I think the explicit sync makes sense (we might even want
> to do it in userspace). Not so sure it's a great idea for read/write
> ... I guess we'd need to see what people have/had in mind for the
> userspace for this to decide.
There's an O_SYNC flag for open(2):
O_SYNC Write operations on the file will complete according to the
requirements of synchronized I/O file integrity completion (by
contrast with the synchronized I/O data integrity completion
provided by O_DSYNC.)
By the time write(2) (or similar) returns, the output data and
associated file metadata have been transferred to the underly‐
ing hardware (i.e., as though each write(2) was followed by a
call to fsync(2)).
That seems applicable here?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] dma-buf: Implement simple read/write vfs ops
2019-09-19 15:52 ` Chris Wilson
@ 2019-09-19 16:18 ` Daniel Vetter
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2019-09-19 16:18 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, Laura Abbott, Sean Paul, Sumit Semwal, dri-devel
On Thu, Sep 19, 2019 at 5:53 PM Chris Wilson <chris@chris-wilson.co.uk> wrote:
>
> Quoting Daniel Vetter (2019-09-19 16:28:41)
> > On Thu, Sep 19, 2019 at 5:09 PM Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > >
> > > It is expected that processes will pass dma-buf fd between drivers, and
> > > only using the fd themselves for mmaping and synchronisation ioctls.
> > > However, it may be convenient for an application to read/write into the
> > > dma-buf, for instance a test case to check the internal
> > > dma_buf->ops->kmap interface. There may also be a small advantage to
> > > avoiding the mmap() for very simple/small operations.
> > >
> > > Note in particular, synchronisation with the device is left to the
> > > caller with an explicit DMA_BUF_IOCTL_SYNC, rather than done implicitly
> > > inside the read/write, so that the user can avoid synchronisation if
> > > they so choose.
> > >
> > > "It is easier to add synchronisation later, than it is to take it away."
> >
> > Hm for mmap I think the explicit sync makes sense (we might even want
> > to do it in userspace). Not so sure it's a great idea for read/write
> > ... I guess we'd need to see what people have/had in mind for the
> > userspace for this to decide.
>
> There's an O_SYNC flag for open(2):
>
> O_SYNC Write operations on the file will complete according to the
> requirements of synchronized I/O file integrity completion (by
> contrast with the synchronized I/O data integrity completion
> provided by O_DSYNC.)
>
> By the time write(2) (or similar) returns, the output data and
> associated file metadata have been transferred to the underly‐
> ing hardware (i.e., as though each write(2) was followed by a
> call to fsync(2)).
>
> That seems applicable here?
Hm yeah, sounds like a neat idea to use O_SYNC to decide whether
writes/reads flushes or not. It's a bit a stretch since !O_SYNC would
also give you un-coherent reads (or could at least).
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* ✗ Fi.CI.BAT: failure for dma-buf: Implement simple read/write vfs ops
2019-09-19 15:08 [PATCH] dma-buf: Implement simple read/write vfs ops Chris Wilson
2019-09-19 15:28 ` Daniel Vetter
@ 2019-09-19 20:22 ` Patchwork
1 sibling, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-09-19 20:22 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: dma-buf: Implement simple read/write vfs ops
URL : https://patchwork.freedesktop.org/series/66941/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_6925 -> Patchwork_14460
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_14460 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_14460, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_14460:
### IGT changes ###
#### Possible regressions ####
* igt@prime_self_import@basic-llseek-bad:
- fi-skl-guc: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-skl-guc/igt@prime_self_import@basic-llseek-bad.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-skl-guc/igt@prime_self_import@basic-llseek-bad.html
- fi-cfl-guc: [PASS][3] -> [FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-cfl-guc/igt@prime_self_import@basic-llseek-bad.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-cfl-guc/igt@prime_self_import@basic-llseek-bad.html
- fi-ivb-3770: [PASS][5] -> [FAIL][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-ivb-3770/igt@prime_self_import@basic-llseek-bad.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-ivb-3770/igt@prime_self_import@basic-llseek-bad.html
- fi-cml-u2: [PASS][7] -> [FAIL][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-cml-u2/igt@prime_self_import@basic-llseek-bad.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-cml-u2/igt@prime_self_import@basic-llseek-bad.html
- fi-kbl-7500u: [PASS][9] -> [FAIL][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-kbl-7500u/igt@prime_self_import@basic-llseek-bad.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-kbl-7500u/igt@prime_self_import@basic-llseek-bad.html
- fi-hsw-4770: [PASS][11] -> [FAIL][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-hsw-4770/igt@prime_self_import@basic-llseek-bad.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-hsw-4770/igt@prime_self_import@basic-llseek-bad.html
- fi-kbl-guc: [PASS][13] -> [FAIL][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-kbl-guc/igt@prime_self_import@basic-llseek-bad.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-kbl-guc/igt@prime_self_import@basic-llseek-bad.html
- fi-glk-dsi: [PASS][15] -> [FAIL][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-glk-dsi/igt@prime_self_import@basic-llseek-bad.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-glk-dsi/igt@prime_self_import@basic-llseek-bad.html
- fi-bdw-5557u: [PASS][17] -> [FAIL][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-bdw-5557u/igt@prime_self_import@basic-llseek-bad.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-bdw-5557u/igt@prime_self_import@basic-llseek-bad.html
- fi-apl-guc: [PASS][19] -> [FAIL][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-apl-guc/igt@prime_self_import@basic-llseek-bad.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-apl-guc/igt@prime_self_import@basic-llseek-bad.html
- fi-cfl-8109u: [PASS][21] -> [FAIL][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-cfl-8109u/igt@prime_self_import@basic-llseek-bad.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-cfl-8109u/igt@prime_self_import@basic-llseek-bad.html
- fi-skl-6600u: [PASS][23] -> [FAIL][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-skl-6600u/igt@prime_self_import@basic-llseek-bad.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-skl-6600u/igt@prime_self_import@basic-llseek-bad.html
- fi-pnv-d510: NOTRUN -> [FAIL][25]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-pnv-d510/igt@prime_self_import@basic-llseek-bad.html
- fi-bsw-kefka: [PASS][26] -> [FAIL][27]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-bsw-kefka/igt@prime_self_import@basic-llseek-bad.html
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-bsw-kefka/igt@prime_self_import@basic-llseek-bad.html
- fi-blb-e6850: [PASS][28] -> [FAIL][29]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-blb-e6850/igt@prime_self_import@basic-llseek-bad.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-blb-e6850/igt@prime_self_import@basic-llseek-bad.html
- fi-skl-6700k2: [PASS][30] -> [FAIL][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-skl-6700k2/igt@prime_self_import@basic-llseek-bad.html
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-skl-6700k2/igt@prime_self_import@basic-llseek-bad.html
- fi-elk-e7500: [PASS][32] -> [FAIL][33]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-elk-e7500/igt@prime_self_import@basic-llseek-bad.html
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-elk-e7500/igt@prime_self_import@basic-llseek-bad.html
- fi-skl-iommu: [PASS][34] -> [FAIL][35]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-skl-iommu/igt@prime_self_import@basic-llseek-bad.html
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-skl-iommu/igt@prime_self_import@basic-llseek-bad.html
- fi-skl-6260u: [PASS][36] -> [FAIL][37]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-skl-6260u/igt@prime_self_import@basic-llseek-bad.html
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-skl-6260u/igt@prime_self_import@basic-llseek-bad.html
- fi-snb-2600: [PASS][38] -> [FAIL][39]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-snb-2600/igt@prime_self_import@basic-llseek-bad.html
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-snb-2600/igt@prime_self_import@basic-llseek-bad.html
- fi-whl-u: [PASS][40] -> [FAIL][41]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-whl-u/igt@prime_self_import@basic-llseek-bad.html
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-whl-u/igt@prime_self_import@basic-llseek-bad.html
- fi-skl-6770hq: [PASS][42] -> [FAIL][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-skl-6770hq/igt@prime_self_import@basic-llseek-bad.html
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-skl-6770hq/igt@prime_self_import@basic-llseek-bad.html
- fi-byt-n2820: [PASS][44] -> [FAIL][45]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-byt-n2820/igt@prime_self_import@basic-llseek-bad.html
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-byt-n2820/igt@prime_self_import@basic-llseek-bad.html
- fi-bwr-2160: [PASS][46] -> [FAIL][47]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-bwr-2160/igt@prime_self_import@basic-llseek-bad.html
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-bwr-2160/igt@prime_self_import@basic-llseek-bad.html
- fi-kbl-r: [PASS][48] -> [FAIL][49]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-kbl-r/igt@prime_self_import@basic-llseek-bad.html
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-kbl-r/igt@prime_self_import@basic-llseek-bad.html
- fi-skl-lmem: [PASS][50] -> [FAIL][51]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-skl-lmem/igt@prime_self_import@basic-llseek-bad.html
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-skl-lmem/igt@prime_self_import@basic-llseek-bad.html
- fi-kbl-8809g: [PASS][52] -> [FAIL][53]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-kbl-8809g/igt@prime_self_import@basic-llseek-bad.html
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-kbl-8809g/igt@prime_self_import@basic-llseek-bad.html
- fi-snb-2520m: [PASS][54] -> [FAIL][55]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-snb-2520m/igt@prime_self_import@basic-llseek-bad.html
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-snb-2520m/igt@prime_self_import@basic-llseek-bad.html
- fi-gdg-551: [PASS][56] -> [FAIL][57]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-gdg-551/igt@prime_self_import@basic-llseek-bad.html
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-gdg-551/igt@prime_self_import@basic-llseek-bad.html
- fi-cfl-8700k: [PASS][58] -> [FAIL][59]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-cfl-8700k/igt@prime_self_import@basic-llseek-bad.html
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-cfl-8700k/igt@prime_self_import@basic-llseek-bad.html
- fi-icl-u2: [PASS][60] -> [FAIL][61]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-icl-u2/igt@prime_self_import@basic-llseek-bad.html
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-icl-u2/igt@prime_self_import@basic-llseek-bad.html
- fi-hsw-peppy: [PASS][62] -> [FAIL][63]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-hsw-peppy/igt@prime_self_import@basic-llseek-bad.html
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-hsw-peppy/igt@prime_self_import@basic-llseek-bad.html
- fi-kbl-x1275: [PASS][64] -> [FAIL][65]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-kbl-x1275/igt@prime_self_import@basic-llseek-bad.html
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-kbl-x1275/igt@prime_self_import@basic-llseek-bad.html
- fi-bdw-gvtdvm: [PASS][66] -> [FAIL][67]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-bdw-gvtdvm/igt@prime_self_import@basic-llseek-bad.html
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-bdw-gvtdvm/igt@prime_self_import@basic-llseek-bad.html
- fi-ilk-650: [PASS][68] -> [FAIL][69]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-ilk-650/igt@prime_self_import@basic-llseek-bad.html
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-ilk-650/igt@prime_self_import@basic-llseek-bad.html
- fi-bsw-n3050: [PASS][70] -> [FAIL][71]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-bsw-n3050/igt@prime_self_import@basic-llseek-bad.html
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-bsw-n3050/igt@prime_self_import@basic-llseek-bad.html
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses.
They do not affect the overall result.
* igt@prime_self_import@basic-llseek-bad:
- {fi-cml-s}: [PASS][72] -> [FAIL][73]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-cml-s/igt@prime_self_import@basic-llseek-bad.html
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-cml-s/igt@prime_self_import@basic-llseek-bad.html
- {fi-icl-guc}: [PASS][74] -> [FAIL][75]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-icl-guc/igt@prime_self_import@basic-llseek-bad.html
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-icl-guc/igt@prime_self_import@basic-llseek-bad.html
- {fi-icl-u4}: [PASS][76] -> [FAIL][77]
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-icl-u4/igt@prime_self_import@basic-llseek-bad.html
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-icl-u4/igt@prime_self_import@basic-llseek-bad.html
- {fi-icl-dsi}: [PASS][78] -> [FAIL][79]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-icl-dsi/igt@prime_self_import@basic-llseek-bad.html
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-icl-dsi/igt@prime_self_import@basic-llseek-bad.html
- {fi-tgl-u2}: [PASS][80] -> [FAIL][81]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-tgl-u2/igt@prime_self_import@basic-llseek-bad.html
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-tgl-u2/igt@prime_self_import@basic-llseek-bad.html
- {fi-tgl-u}: [PASS][82] -> [FAIL][83]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-tgl-u/igt@prime_self_import@basic-llseek-bad.html
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-tgl-u/igt@prime_self_import@basic-llseek-bad.html
- {fi-kbl-soraka}: [PASS][84] -> [FAIL][85]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-kbl-soraka/igt@prime_self_import@basic-llseek-bad.html
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-kbl-soraka/igt@prime_self_import@basic-llseek-bad.html
- {fi-cml-h}: [PASS][86] -> [FAIL][87]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-cml-h/igt@prime_self_import@basic-llseek-bad.html
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-cml-h/igt@prime_self_import@basic-llseek-bad.html
Known issues
------------
Here are the changes found in Patchwork_14460 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_linear_blits@basic:
- fi-icl-u3: [PASS][88] -> [DMESG-WARN][89] ([fdo#107724])
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-icl-u3/igt@gem_linear_blits@basic.html
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-icl-u3/igt@gem_linear_blits@basic.html
* igt@prime_self_import@basic-llseek-bad:
- fi-icl-u3: [PASS][90] -> [DMESG-FAIL][91] ([fdo#107724])
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-icl-u3/igt@prime_self_import@basic-llseek-bad.html
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-icl-u3/igt@prime_self_import@basic-llseek-bad.html
#### Possible fixes ####
* igt@gem_cpu_reloc@basic:
- fi-bxt-dsi: [INCOMPLETE][92] ([fdo#103927]) -> [PASS][93]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-bxt-dsi/igt@gem_cpu_reloc@basic.html
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-bxt-dsi/igt@gem_cpu_reloc@basic.html
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-icl-u2: [FAIL][94] ([fdo#109483]) -> [PASS][95] +1 similar issue
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-icl-u2/igt@kms_chamelium@hdmi-hpd-fast.html
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-icl-u2/igt@kms_chamelium@hdmi-hpd-fast.html
* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u2: [FAIL][96] ([fdo#103167]) -> [PASS][97]
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-icl-u2/igt@kms_frontbuffer_tracking@basic.html
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-icl-u2/igt@kms_frontbuffer_tracking@basic.html
* igt@prime_vgem@basic-busy-default:
- fi-icl-u3: [DMESG-WARN][98] ([fdo#107724]) -> [PASS][99] +2 similar issues
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-icl-u3/igt@prime_vgem@basic-busy-default.html
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-icl-u3/igt@prime_vgem@basic-busy-default.html
#### Warnings ####
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][100] ([fdo#111407]) -> [FAIL][101] ([fdo#111096])
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6925/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/fi-kbl-7500u/igt@kms_chamelium@hdmi-hpd-fast.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
[fdo#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
[fdo#106350]: https://bugs.freedesktop.org/show_bug.cgi?id=106350
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109483]: https://bugs.freedesktop.org/show_bug.cgi?id=109483
[fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
Participating hosts (53 -> 46)
------------------------------
Additional (1): fi-pnv-d510
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-byt-j1900 fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_6925 -> Patchwork_14460
CI-20190529: 20190529
CI_DRM_6925: ccd2c9cb3fd35f9654cdf6743bdecfb489fba70a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5193: 924e5c59dbb82938e743efd6b0812eeb5760b70d @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14460: 7507ac39469e1ee1cced85d6f115d795375c7730 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
7507ac39469e dma-buf: Implement simple read/write vfs ops
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14460/index.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] dma-buf: Implement simple read/write vfs ops
@ 2017-04-07 19:32 Chris Wilson
0 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2017-04-07 19:32 UTC (permalink / raw)
To: dri-devel; +Cc: Daniel Vetter
It is expected that processes will pass dma-buf fd between drivers, and
only using the fd themselves for mmaping and synchronisation ioctls.
However, it may be convenient for an application to read/write into the
dma-buf, for instance a test case to check the internal
dma_buf->ops->kmap interface. There may also be a small advantage to
avoiding the mmap() for very simple/small operations.
Note in particular, synchronisation with the device is left to the
caller with an explicit DMA_BUF_IOCTL_SYNC, rather than done implicitly
inside the read/write, so that the user can avoid synchronisation if
they so choose.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sean Paul <seanpaul@chromium.org>
---
drivers/dma-buf/dma-buf.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 1ce7974a28a3..e4388d5258ed 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -124,6 +124,92 @@ static loff_t dma_buf_llseek(struct file *file, loff_t offset, int whence)
return base + offset;
}
+static ssize_t dma_buf_read(struct file *file,
+ char __user *ubuf, size_t remain,
+ loff_t *offset)
+{
+ struct dma_buf *dmabuf = file->private_data;
+ unsigned long idx;
+ unsigned int start;
+ size_t written;
+
+ if (!is_dma_buf_file(file))
+ return -EBADF;
+
+ written = 0;
+ idx = *offset >> PAGE_SHIFT;
+ start = offset_in_page(*offset);
+ while (remain) {
+ unsigned int len = min_t(size_t, remain, PAGE_SIZE - start);
+ unsigned int copied;
+ void *vaddr;
+
+ vaddr = dma_buf_kmap(dmabuf, idx);
+ if (!vaddr)
+ return written ?: -EIO;
+
+ copied = copy_to_user(vaddr, ubuf, len);
+ dma_buf_kunmap(dmabuf, idx, vaddr);
+
+ written += copied ?: len;
+ if (copied) {
+ *offset += copied;
+ return written ?: -EFAULT;
+ }
+
+ remain -= len;
+ *offset += len;
+ ubuf += len;
+ start = 0;
+ idx++;
+ }
+
+ return written;
+}
+
+static ssize_t dma_buf_write(struct file *file,
+ const char __user *ubuf, size_t remain,
+ loff_t *offset)
+{
+ struct dma_buf *dmabuf = file->private_data;
+ unsigned long idx;
+ unsigned int start;
+ size_t written;
+
+ if (!is_dma_buf_file(file))
+ return -EBADF;
+
+ written = 0;
+ idx = *offset >> PAGE_SHIFT;
+ start = offset_in_page(*offset);
+ while (remain) {
+ unsigned int len = min_t(size_t, remain, PAGE_SIZE - start);
+ unsigned int copied;
+ void *vaddr;
+
+ vaddr = dma_buf_kmap(dmabuf, idx);
+ if (!vaddr)
+ return written ?: -EIO;
+
+ copied = copy_from_user(vaddr, ubuf, len);
+ dma_buf_kunmap(dmabuf, idx, vaddr);
+
+ written += copied ?: len;
+ if (copied) {
+ *offset += copied;
+ return written ?: -EFAULT;
+ }
+
+ remain -= len;
+ *offset += len;
+ ubuf += len;
+ start = 0;
+ idx++;
+ }
+
+ return written;
+}
+
/**
* DOC: fence polling
*
@@ -318,6 +404,8 @@ static const struct file_operations dma_buf_fops = {
.release = dma_buf_release,
.mmap = dma_buf_mmap_internal,
.llseek = dma_buf_llseek,
+ .read = dma_buf_read,
+ .write = dma_buf_write,
.poll = dma_buf_poll,
.unlocked_ioctl = dma_buf_ioctl,
#ifdef CONFIG_COMPAT
--
2.11.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-09-19 20:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-19 15:08 [PATCH] dma-buf: Implement simple read/write vfs ops Chris Wilson
2019-09-19 15:28 ` Daniel Vetter
2019-09-19 15:52 ` Chris Wilson
2019-09-19 16:18 ` Daniel Vetter
2019-09-19 20:22 ` ✗ Fi.CI.BAT: failure for " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2017-04-07 19:32 [PATCH] " Chris Wilson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.