xtvdt
Posts: 3
Joined: Wed Mar 18, 2020 10:07 am

TV-Hat high load issue with tvheadend

Wed Mar 18, 2020 10:48 am

Hi,
I recently decided to upgrade an RPi2, that I was previously using with a USB TV tuner, with a brand new TV-Hat.
Thus I removed the old USB TV dongle and mounted the new TV-Hat, upgraded the system to the latest version (up to date buster and tv-headend from the official RPi repository).
The configuration was smooth and tvheadend works perfectly, however I noticed that since the upgrade the load queue is stuck to "1.00" when apparently the RPi is doing nothing.

With the old configuration the RPi load was between "0.00" and "0.05", then, with tvheadend started, is between "1.00" and "1.05".
This happens only when tvheadend service is running. If I stop the service the load goes back to about 0.

It looks like there is something in the TV-Hat driver that permanently keeps something in the CPU execution queue with priority over anything else.

Why is that?

I'm sure that it's not the (huge) logging of tvheadend since I've moved the logging to a small RAM drive synced periodically to the disk (confirmed below with "0,0 wa").

Also the CPU temperature profile seems to confirm that even with load "1.00" the CPU is actually doing nothing (the temperature, registered on cacti on a different Pi, is consistent with the previous setup).

Code: Select all

top - 11:22:30 up 1 day, 16:11,  1 user,  load average: 1,00, 1,02, 1,00
Tasks: 128 total,   1 running, 127 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0,2 us,  0,5 sy,  0,0 ni, 99,3 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
MiB Mem :    874,5 total,    390,5 free,    206,7 used,    277,3 buff/cache
MiB Swap:    100,0 total,    100,0 free,      0,0 used.    595,4 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                          
27409 root      20   0   10504   3036   2504 R   0,7   0,3   0:00.25 top                                              
  288 root      20   0       0      0      0 S   0,3   0,0   1:20.21 RTW_CMD_THREAD                                   
  442 hts       20   0  266836  41948   5568 S   0,3   4,7  17:33.62 tvheadend                                        
 4133 mysql     20   0  658892 152604  10456 S   0,3  17,0   9:11.75 mysqld                                           
27219 root      20   0       0      0      0 D   0,3   0,0   0:00.80 cxd2880_ts_read                                  
27258 user      20   0   12864   3648   2848 S   0,3   0,4   0:00.12 sshd                                             
    1 root      20   0   34908   6428   5012 S   0,0   0,7   0:59.97 systemd                                          
    2 root      20   0       0      0      0 S   0,0   0,0   0:00.52 kthreadd                                         
    3 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_gp
    4 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_par_gp

bregale
Posts: 2
Joined: Sat Nov 17, 2012 1:56 pm

Re: TV-Hat high load issue with tvheadend

Mon Mar 30, 2020 3:21 pm

hi,
not sure if i have the same problem i also have the tv hat to stream to my local network
but the through put or streaming ability is very poor with blocking and freezing of the channel being
watched . however mine is using pi 3 , tried looking on net but no results ,

xtvdt
Posts: 3
Joined: Wed Mar 18, 2020 10:07 am

Re: TV-Hat high load issue with tvheadend

Mon Mar 30, 2020 7:48 pm

bregale wrote:
Mon Mar 30, 2020 3:21 pm
not sure if i have the same problem i also have the tv hat to stream to my local network
but the through put or streaming ability is very poor with blocking and freezing of the channel being
watched . however mine is using pi 3 , tried looking on net but no results ,
You can double check if it's the same case by:
- at a moment when you are not streaming or recording anything
- log to a shell on RPi and issue the command

Code: Select all

# top
As you can see, in my case the load average is about "1", while it should be about "0" (since nothing is running).

Looking that the process list, the only thing that seems a bit strange is that the process "cxd2880_ts_read" is permanently in status "D" .

Now, "D" means "Uninterruptible sleep", or that it's locked waiting for I/O, which could be normal since this is probably due to the communication between the RPi and the Hat. However it's strange that it seems to be stuck on "D", as it should move in and out from D status as data flows.

Possibly the load "1" is due to that, but also means that the process queue is permanently jammed?
Not sure if that's expected or not...

snowballEarth
Posts: 39
Joined: Wed Feb 18, 2015 9:05 pm

Re: TV-Hat high load issue with tvheadend

Sun Apr 05, 2020 11:03 am

bregale wrote:
Mon Mar 30, 2020 3:21 pm
hi,
not sure if i have the same problem i also have the tv hat to stream to my local network
but the through put or streaming ability is very poor with blocking and freezing of the channel being
watched . however mine is using pi 3 , tried looking on net but no results ,
Could be a signal reception issue. Is it rooftop or indoor aerial? Is it optimally placed? Are you using a signal splitter somewhere up the line? Interference along the cable from electrical sources? Are wires shielded? Do you need signal boosting etc. etc.

Are you using wireless or wired ethernet from server to client?

xtvdt
Posts: 3
Joined: Wed Mar 18, 2020 10:07 am

Re: TV-Hat high load issue with tvheadend

Tue Apr 07, 2020 9:40 am

xtvdt wrote:
Wed Mar 18, 2020 10:48 am
With the old configuration the RPi load was between "0.00" and "0.05", then, with tvheadend started, is between "1.00" and "1.05".
This happens only when tvheadend service is running. If I stop the service the load goes back to about 0.

It looks like there is something in the TV-Hat driver that permanently keeps something in the CPU execution queue with priority over anything else.

One extra bit of information...

I've noticed that the load issue is indeed linked to the process cxd2880_ts_read.

Moreover, restarting the RPi without the antenna cable connected the load remains low as expected (and the process cxd2880_ts_read is not running at all), but when connecting the antenna cable the process cxd2880_ts_read starts and begins to fill up the execution queue.

Topfield
Posts: 1
Joined: Mon Apr 20, 2020 7:25 pm

Re: TV-Hat high load issue with tvheadend

Mon Apr 20, 2020 7:34 pm

Just spent two days trying to set up TVHeadend with the TV HAT on
my PI 3. As pointed out in this thread the loading does increase
when you stream a channel. Loading further increases when you
use the Watch TV option. So much so that it stutters / freezes every
10 seconds. Spent ages on this problem and then came to realise that
TVHeadend on my PI 3 can just be used to create a video stream to watch on
another computer, perhaps with a better use interface like Kodi.

I would suggest a retune for the blocky image but search through
all the frequencies. You can select
the initial start up wizard again by logging in to TVHeadend.
Select Configuration (Top row). Now on the forth row you will
find Select Start Wizard. As you go through the startup, at the
screen Assign Predefined Muxes to Networks select Generic: Auto-Default
where as before you may have previously selected United Kingdom Emilymoor.
This wizard option seems only to be available just after logging in.

I also have a Pi4 which runs VLC. They are connected wirelessly.
Logging into TVHeadend from the PI 4, I was able to stream to VLC with
no problems.

Hope you get your problems sorted.

Return to “HATs and other add-ons”