Librtlsdr zerocopy buffers not working on Tinkerboard Armbian
0xloem at gmail.com
Fri Oct 5 12:30:29 UTC 2018
I just wanted to offer, if time and energy is short, I'd be willing to
spend some time narrowing down this issue, given shell access to one
of the failing systems.
Sounds like a bug in either the kernel or libusb.
On 10/2/18, Carl Laufer <admin at rtl-sdr.com> wrote:
> I did some more tests. I upgraded the OS on my Odroid XU4 to Ubuntu 18.04,
> and this has libusb 1.0.21 in the repo's (the previous one I was using had
> libusb 1.0.20). Now I get the same continuous lost sample bytes problem on
> the XU4 as on the Tinkerboard - a huge amount of dropped samples with
> zerocopy enabled.
> However, on the latest Raspbian on the Rpi3, I don't see the problem. On
> the Pi3 rtl_test returns only one line of dropped samples, then no more.
> Allocating 15 zero-copy buffers
> lost at least 156 bytes
> On the Odroid and Tinkerboard it's more like:
> Allocating 15 zero-copy buffers
> lost at least 13617588 bytes
> lost at least 12326518 bytes
> lost at least 13208366 bytes
> lost at least 13301044 bytes
> ...and so on forever
> No other error messages are seen, and disabling the usbfs_memory_mb limit
> by setting it to zero doesn't get rid of the problem.
> I'm not too sure about the CMA stuff, i'm just using the default OS images
> provided for the Tinkerboard and XU4, and standard Ubuntu 18.04 on my
> Carl Laufer
> On Tue, Oct 2, 2018 at 10:28 AM Steve Markgraf <steve at steve-m.de> wrote:
>> Hi Carl,
>> On 01.10.2018 05:42, Carl Laufer wrote:
>> > I did a diff against Keenerds and discovered the new zerocopy buffer
>> > code in the Osmocom drivers. After commenting that out, the Osmocom
>> > drivers work fine on the Tinkerboard with Armbian and there is no
>> > sample
>> > loss.
>> That's very strange, because from an rtl-sdr point of view it is just
>> regular memory that was allocated by the Kernel (and happens to be
>> DMA-able) and mapped into userspace. So my first guess is that something
>> must be going wrong either inside the Kernel or libusb.
>> > Strangely, on TinkerOS and Ubuntu OS for Tinkerboard, all of which run
>> > Kernel 4.4, I do not get sample loss with the Osmocom drivers and the
>> > zerocopy code enabled.
>> Yes, as 4.4 doesn't support usbfs zerocopy.
>> > I'm also running the Osmocom drivers on an Odroid XU4 with Ubuntu which
>> > is also running Kernel 4.14, and on Raspbian, and on those there is no
>> > sample loss. So it seems to be something specific to the Tinkerboard
>> > and
>> > Armbian with Kernel 4.14y.
>> > Not sure if the zerocopy code is just not getting activated on those
>> > other OSes or what. How do I check if the installed libusb API version
>> > is >= 0x01000105?
>> I've put that information into the commit message:
>> > Requires Linux >= 4.6 and libusb >= 1.0.21.
>> So it's enabled if both versions are there.
>> > Any ideas what could cause the zero copy code to result in the lost
>> Do you get any error messages when the library is loaded? What is the
>> value of /sys/module/usbcore/parameters/usbfs_memory_mb, and can you try
>> to increase it or set it to 0 to disable the limit?
>> Was the Kernel built with CONFIG_CMA=y, and what is the value of
>> If any of this isn't right, there normally should appear a warning and
>> "falling back to buffers in userspace" when starting the application,
>> but maybe there is something going wrong...
More information about the osmocom-sdr