Re: [PATCH] dma-buf: Update docs for SYNC ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey

On Mon, Mar 21, 2016 at 6:14 PM, Daniel Vetter <daniel@xxxxxxxx> wrote:
> On Mon, Mar 21, 2016 at 01:26:58PM +0100, David Herrmann wrote:
>> Hi
>>
>> On Mon, Mar 21, 2016 at 8:51 AM, Daniel Vetter <daniel.vetter@xxxxxxxx> wrote:
>> > Just a bit of wording polish plus mentioning that it can fail and must
>> > be restarted.
>> >
>> > Requested by Sumit.
>> >
>> > v2: Fix them typos (Hans).
>> >
>> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
>> > Cc: Tiago Vignatti <tiago.vignatti@xxxxxxxxx>
>> > Cc: Stéphane Marchesin <marcheu@xxxxxxxxxxxx>
>> > Cc: David Herrmann <dh.herrmann@xxxxxxxxx>
>> > Cc: Sumit Semwal <sumit.semwal@xxxxxxxxxx>
>> > Cc: Daniel Vetter <daniel.vetter@xxxxxxxxx>
>> > CC: linux-media@xxxxxxxxxxxxxxx
>> > Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
>> > Cc: linaro-mm-sig@xxxxxxxxxxxxxxxx
>> > Cc: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
>> > Cc: devel@xxxxxxxxxxxxxxxxxxxx
>> > Cc: Hans Verkuil <hverkuil@xxxxxxxxx>
>> > Acked-by: Sumit Semwal <sumit.semwal@xxxxxxxxxx>
>> > Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
>> > ---
>> >  Documentation/dma-buf-sharing.txt | 11 ++++++-----
>> >  drivers/dma-buf/dma-buf.c         |  2 +-
>> >  2 files changed, 7 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/Documentation/dma-buf-sharing.txt b/Documentation/dma-buf-sharing.txt
>> > index 32ac32e773e1..ca44c5820585 100644
>> > --- a/Documentation/dma-buf-sharing.txt
>> > +++ b/Documentation/dma-buf-sharing.txt
>> > @@ -352,7 +352,8 @@ Being able to mmap an export dma-buf buffer object has 2 main use-cases:
>> >
>> >     No special interfaces, userspace simply calls mmap on the dma-buf fd, making
>> >     sure that the cache synchronization ioctl (DMA_BUF_IOCTL_SYNC) is *always*
>> > -   used when the access happens. This is discussed next paragraphs.
>> > +   used when the access happens. Note that DMA_BUF_IOCTL_SYNC can fail with
>> > +   -EAGAIN or -EINTR, in which case it must be restarted.
>>
>> What is "restart on EAGAIN" supposed to mean? Or more generally, what
>> does EAGAIN tell the caller?
>
> Do what drmIoctl does essentially.
>
> while (ret == -1 && (errno == EAGAIN || errno == EINTR)
>         ret = ioctl();
>
> Typed from memery, too lazy to look it up in the source ;-) I'm trying to
> sell the idea of a real dma-buf manpage to Sumit, we should clarify this
> in detail there.

My question was rather about why we do this? Semantics for EINTR are
well defined, and with SA_RESTART (default on linux) user-space can
ignore it. However, looping on EAGAIN is very uncommon, and it is not
at all clear why it is needed?

Returning an error to user-space makes sense if user-space has a
reason to react to it. I fail to see how EAGAIN on a cache-flush/sync
operation helps user-space at all? As someone without insight into the
driver implementation, it is hard to tell why.. Any hints?

Thanks
David
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux