My point is that it is not reasonable for the device manufacturers to expect desktop OS applications to be able to always respond within milliseconds, because they never have. The other option is to say that OSes are buggy, because they cannot guarantee such low latencies. Both are valid viewpoints, as there are reasons for and against for both.
USB has always been designed to be cheap. USB devices are meant to be cheap and they are not expected to buffer more than a few packets worth of data, certainly not more than a (micro)frame worth. Hosts are supposed to poll them often enough for that not to be an issue. Host controllers are cheap too and they use system RAM for transfer buffers, and they have the important property that they accept packet queues in the form of linked lists of arbitrary length (not entirely true for periodic transfers before XHCI, but you could still queue many milliseconds ahead). It's the software's job to queue enough data buffers to cover its latency.
This is perfectly doable and hardly unique to SDR. When you play or record audio with a USB soundcard, you have many milliseconds worth of packets queued and you don't hear glitches when you resize a GUI window. Hell, even Windows probably gets it right or users would be whining loudly. There is no reason serial couldn't do it too.
Perhaps. These USB devices are also prone to stop working (or being yanked out) at any moment, and it is even more important to not lock up (even temporarily) when that happens, or gobble up unlimited amounts of RAM (especially on routers and appliances with very limited amounts available). You can see this all over the Linux USB device drivers, what with timeouts and automatic backoffs (1ms backoff/latency added whenever USB device NAKs a packet).
Thus, I'm hesitant to fully agree. I'd need to see/hear it done
right on a desktop OS first, to believe it can be done significantly better.
The wrench in the cogs in Linux/Android/Mac/BSDs is the tty layer. It is traditionally capped at 4096 bytes of buffer, and just isn't designed for high throughput. (You can observe this by creating a simple pseudoterminal pair, and push data through locally. The bandwidth you can achieve is surprisingly low, compared to e.g. a socket pair or a pipe.) When using USB 2.0 HS (480 Mbit/s) microcontrollers, it becomes a bottleneck.
Because of Teensy 4, I've played with a number of possible solutions, suitable for CDC ACM (and close enough converter chips like some PL2303 variants). The bulk data is trivial via a simple character device driver, and configuration via ioctls (even reusing the termios tty ones). Even a pair of vendor commands could be reasonably implemented via ioctls, with just the actual USB message format varied depending on
vendor:
product or quirk. Notifications are what has given me a bit of a pause, because you can easily get 8000 of them per second. POSIX signals are an obvious choice, with dedicated ioctl receiving the off-band message, but considering the possible frequency, it isn't optimal. Obtaining a secondary descriptor for notifications would be better, but this is unusual, so proper destruction especially when the bulk one is closed first gets a bit complicated. And then there are more abstract issues, like whether packet boundaries should be respected with read():
yes allows for datagram approaches,
no is better for bulk bandwidth. Linux input subsystem (using whole
struct input_event datagrams only) shows how useful the datagram approach is, being rock solid for a quarter of a century now, and yet easily extended. And we do have both datagram and stream local/UNIX domain sockets for a reason.
Sorry, that's nonsense. You seem to confuse task scheduling with interrupt handling.
You seem to forget the effect of the tty layer and softirq handling in between the userspace process and the USB device.
Because this is not a Linux kernel developer forum, I'm
not trying to be technically correct: I'm trying to describe
the observable behaviour of the system, not its implementation details. Just pointing out I'm technically wrong is not helping anyone: at minimum, you should provide the correct description.
In particular, see for yourself the difference between
CONFIG_HZ=250 and CONFIG_HZ=1000, specifically the difference in latency from the USB device point of view when using USB serial (CDC ACM or vendor driver, doesn't matter). If we take your post as the whole truth, then there would be no difference, would there?
I do err quite often, and I'm ready to acknowledge my errors. Fact is, if we ignore the liberties I've taken with the technical descriptions, I still stand by the cause-and-effect chain/interactions I've tried to explain here. Whether it is the actual interrupt latency, or the latency at which the softirq task in the tty layer manages to push data forwards allowing further transfers to occur, is simply irrelevant to me at the level of complexity/abstraction we're discussing here. If you can describe it better,
please do, and don't just strike down others who try.