public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Andreas Oberritter <obi@linuxtv.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, HoP <jpetrous@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] vtunerc: virtual DVB device - is it ok to NACK driver because of worrying about possible misusage?
Date: Tue, 06 Dec 2011 12:13:04 -0200	[thread overview]
Message-ID: <4EDE22F0.30909@redhat.com> (raw)
In-Reply-To: <4EDE1A06.1060108@linuxtv.org>

On 06-12-2011 11:35, Andreas Oberritter wrote:
> On 06.12.2011 14:10, Mauro Carvalho Chehab wrote:
>> On 06-12-2011 10:01, Andreas Oberritter wrote:
>>> On 06.12.2011 12:18, Mark Brown wrote:
>>>> On Mon, Dec 05, 2011 at 10:20:03PM +0100, Andreas Oberritter wrote:
>>>>> On 05.12.2011 21:55, Alan Cox wrote:
>>>>>> The USB case is quite different because your latency is very tightly
>>>>>> bounded, your dead device state is rigidly defined, and your loss of
>>>>>> device is accurately and immediately signalled.
>>>>
>>>>>> Quite different.
>>>>
>>>>> How can usbip work if networking and usb are so different and what's so
>>>>> different between vtunerc and usbip, that made it possible to put usbip
>>>>> into drivers/staging?
>>>>
>>>> USB-IP is a hack that will only work well on a tightly bounded set of
>>>> networks - if you run it over a lightly loaded local network it can
>>>> work adequately.  This starts to break down as you vary the network
>>>> configuration.
>>>
>>> I see. So it has problems that vtunerc doesn't have.
>>
>> The vtunerc has the same issues. High latency (due to high loads,  high
>> latency links or whatever) affects it badly, and may cause application
>> breakages if if the device is opened are using O_NONBLOCK mode [1].
>
> O_NONBLOCK doesn't mean that an ioctl must consume zero time. It just
> means that it should return instead of waiting for (more) data to become
> available or writeable.

O_NONBLOCK means (http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html#tag_16_412):


O_NONBLOCK
     When opening a FIFO with O_RDONLY or O_WRONLY set:

         If O_NONBLOCK is set, an open() for reading-only shall return without delay. An open() for writing-only shall return an error if no process currently has the file open for reading.

         If O_NONBLOCK is clear, an open() for reading-only shall block the calling thread until a thread opens the file for writing. An open() for writing-only shall block the calling thread until a thread opens the file for reading.

     When opening a block special or character special file that supports non-blocking opens:

         If O_NONBLOCK is set, the open() function shall return without blocking for the device to be ready or available. Subsequent behavior of the device is device-specific.

         If O_NONBLOCK is clear, the open() function shall block the calling thread until the device is ready or available before returning.

     Otherwise, the behavior of O_NONBLOCK is unspecified.

Basically, syscall should not block waiting for some data to be read (or written).
The ioctl definition defines [EAGAIN] error code, if, for any reason, an
ioctl would block.

Btw, the vtunerc doesn't handle O_NONBLOCK flag. For each DVB ioctl, for example
read_snr[1], it calls wait_event_interruptible()[2], even if the application opens
it with O_NONBLOCK flag. So, it is likely that non-blocking-mode applications
will break.

[1] http://code.google.com/p/vtuner/source/browse/vtunerc_proxyfe.c?repo=linux-driver#75
[2] http://code.google.com/p/vtuner/source/browse/vtunerc_ctrldev.c?repo=linux-driver#420

> Mauro, if the network is broken, any application using the network will
> break. No specially designed protocol will fix that.

A high delay network (even a congested one) is not broken, if it can
still provide the throughput required by the application, and a latency/QoS
that would fit.

> If you want to enforce strict maximum latencies, you can do that in the
> userspace daemon using the vtunerc interface. It has all imaginable
> possibilities to control data flow over the network and to return errors
> to vtunerc.

Yes, you can do anything you want at the userspace daemon, but the
non-userspace daemon aware applications will know nothing about it, and
this is the flaw on this design: Applications can't negotiate what network
parameters are ok or not for its usecase.

> For a DVB API application it doesn't matter whether a tuning
> request fails with EIO because a USB device has been removed, a PCI
> device encountered an I2C error or because the vtuner userspace daemon
> returned an error.

When you go to network, there are several errors that are transitory. For example,
a dropped link may cause the routing protocol (RIP, BGP or whatever) to re-direct
several routes (or, on a LAN, a spanning-tree re-negotiation), causing a temporary
failure to deliver a few packets. All network-based application are written
to consider temporary failures.

This is fundamentally different than an application designed to talk directly with
the hardware, where an error is generally fatal.

>> [1] Btw, if some DVB ioctl currently waits in O_NONBLOCK, this is a POSIX
>> violation that needs to be fixed.
>
> To the best of my knowledge, this doesn't happen.
>
> I think we all realized some days ago that the code is not going to be
> merged upstream anytime in the foreseeable future. You can stop using
> such pointless arguments.

Agreed.

Regards,
Mauro

  reply	other threads:[~2011-12-06 14:13 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30 21:38 [RFC] vtunerc: virtual DVB device - is it ok to NACK driver because of worrying about possible misusage? HoP
2011-11-30 21:52 ` Michael Krufky
2011-12-01  0:09 ` Andreas Oberritter
2011-12-01 11:04   ` Mauro Carvalho Chehab
2011-12-01 14:58     ` HoP
2011-12-01 17:38       ` Mauro Carvalho Chehab
2011-12-01 19:59         ` HoP
2011-12-01 20:38           ` Mauro Carvalho Chehab
2011-12-01 22:55             ` Andreas Oberritter
2011-12-02 11:14               ` Mauro Carvalho Chehab
2011-12-02 11:48                 ` Andreas Oberritter
2011-12-02 11:57                 ` HoP
2011-12-02 17:33                   ` Mauro Carvalho Chehab
2011-12-02 17:49           ` Rémi Denis-Courmont
2011-12-02 18:16             ` Andreas Oberritter
2011-12-02 18:28               ` Andreas Oberritter
2011-12-02 23:19       ` Alan Cox
2011-12-03  0:37         ` HoP
2011-12-05 10:21           ` Florian Fainelli
2011-12-05 14:28             ` HoP
2011-12-05 15:16               ` Alan Cox
2011-12-05 15:18               ` Michael Krufky
2011-12-06  0:16                 ` HoP
2011-12-05 17:39               ` Mauro Carvalho Chehab
2011-12-05 20:41                 ` Andreas Oberritter
2011-12-05 20:55                   ` Alan Cox
2011-12-05 21:20                     ` Andreas Oberritter
2011-12-05 21:54                       ` Alan Cox
2011-12-06 11:18                       ` Mark Brown
2011-12-06 12:01                         ` Andreas Oberritter
2011-12-06 13:10                           ` Mauro Carvalho Chehab
2011-12-06 13:35                             ` Andreas Oberritter
2011-12-06 14:13                               ` Mauro Carvalho Chehab [this message]
2011-12-06 14:38                                 ` Andreas Oberritter
2011-12-06 15:06                                   ` Mauro Carvalho Chehab
2011-12-06 15:36                                     ` Manu Abraham
2011-12-06 11:21                   ` Mark Brown
2011-12-06 12:01                     ` Andreas Oberritter
2011-12-06 14:19                       ` Mark Brown
2011-12-06 14:48                         ` Andreas Oberritter
2011-12-07 13:49                           ` Mark Brown
2011-12-07 14:01                             ` Andreas Oberritter
2011-12-07 16:10                               ` Mark Brown
2011-12-07 16:56                                 ` Andreas Oberritter
2011-12-07 16:58                                 ` Andreas Oberritter
2011-12-07 21:48                               ` Patrick Dickey
2011-12-07 22:53                                 ` Honza Petrouš
2011-12-07 23:24                                   ` Peter Kolta
2011-12-07 23:55                                 ` Andreas Oberritter
2011-12-11 18:45                               ` Peter martin
2011-12-12 10:31                                 ` Alan Cox
2011-12-06 17:19                         ` Manu Abraham
2011-12-06  0:07                 ` HoP
2011-12-06 13:22                   ` Mauro Carvalho Chehab
2011-12-06 13:49                     ` Andreas Oberritter
2011-12-06 14:19                       ` Rémi Denis-Courmont
2011-12-06 15:05                         ` Andreas Oberritter
2011-12-06 14:20                       ` Mauro Carvalho Chehab
2011-12-06 15:00                         ` Andreas Oberritter
2011-12-06 17:35                           ` HoP
2011-12-03 16:13         ` Andreas Oberritter
2011-12-03 16:42           ` Alan Cox
2011-12-03 17:38             ` Andreas Oberritter
2011-12-03 17:21           ` VDR User
2011-12-03 17:42             ` Alan Cox
2011-12-03 17:48               ` Devin Heitmueller
2011-12-04 23:54                 ` HoP
2011-12-03 18:13               ` Hans Petter Selasky
2011-12-05  0:05                 ` HoP
2011-12-03 18:17               ` Andreas Oberritter
2011-12-03 23:30             ` Walter Van Eetvelt
2011-12-04  0:14               ` VDR User
2011-12-04 14:44                 ` Alan Cox
2011-12-04 23:22             ` HoP
2011-12-05  1:45               ` VDR User
2011-12-05  6:20                 ` HoP
2011-12-02 18:32 ` VDR User

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EDE22F0.30909@redhat.com \
    --to=mchehab@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=f.fainelli@gmail.com \
    --cc=jpetrous@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=obi@linuxtv.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox