mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

newbie question: vchiq not working with RT_PREEMPT kernel

Mon May 27, 2013 12:36 pm

I have a 3.2.27 kernel (from the rpi kernel git repo) patched with RT_PREEMPT (rt-40 patch from kernel.org)and config'd for fully preemptible real time.

My problem is that it does not seem to allow pi3d demos to run.....

I have changed permissions and even "mknod /dev/vchiq c 252 0" to make sure major minor are correct..

error message is : "failed to open vchiq instance"

grep dmesg for vchiq is :
[ 1.323566] vcos: [1]: vchiq_init_state: slot_zero = 0xffd80000, is_master = 0
[ 1.323674] vcos: [1]: vchiq_init_state: called
[ 1.324414] vcos: [1]: vchiq: initialised - version 2 (min 2), device 252.0
[ 234.340231] vchiq_get_state: g_state.remote->initialised != 1 (0)
[ 234.340255] vcos: [2032]: vchiq has no connection to VideoCore
[ 249.617210] vchiq_get_state: g_state.remote->initialised != 1 (0)
[ 249.617288] vcos: [2037]: vchiq has no connection to VideoCore


Running /opt/vc/bin/vchiq_test -t 1 gives output, other options seem to fail with same error message.

I could grep the kernel source for "g_state.remote->initialised" and see if it give any clues, but I am not a kernel hacker, does anyone have any ideas about this?

Any explaination what may be problem and an outline of how the vchiq works (I don't even know what vchiq acronym means 'Video Core Hardware Interrupt Queue' was my initial guess????).

Is it going to cause major problems with real time kernels?

I have done a brief google and found nothing, so I am betting its easier I ask here, I am going to maybe throw a few hours at this next weekend, but I doubt I will ever know enough to fix it unless its something easy.

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: newbie question: vchiq not working with RT_PREEMPT kerne

Mon May 27, 2013 7:09 pm

mhm i have a 3.8 rt kernel on my pi,
can you give me the commands to run to see if its working?

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: newbie question: vchiq not working with RT_PREEMPT kerne

Mon May 27, 2013 9:28 pm

aaa801 wrote:mhm i have a 3.8 rt kernel on my pi,
can you give me the commands to run to see if its working?
hahaha......

If I knew about RT_PREEMPT I would not have put "newbie question" in the thread title!

I am going to answer your question and show my own lack of knowledge.

How to see if a kernel is working...
1)Does it boot?
2)Can you login?
3)Do all commands seem to work normally?
4)Does all hardware seem to work normally?

Now if you can answer yes to all those you move onto the RT scheduling

Check:
https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO
https://rt.wiki.kernel.org/index.php/Cyclictest

use 'ps -ef' to list processes and all kernel processes should be shown with priority they have.

then use 'cyclic-test' to see what latency you get while thrashing your system with a few resource hungry apps.

This should give you details of the maximum time latency in microseconds that a real-time thread will execute after it is supposed to.

If it is within the period required by your application then its probably working okay for your particular application.

That is pretty much the sum total of my real time kernel RT_PREEMPT knowledge, I am just assuming that the patches from kernel.org work and the correct cpu clock stuff has been been done by someone more knowledgable than I.

I only need millisecond guaranteed scheduling (I think) and cyclic-test seemed to show this was possible. I am just compiling other peoples software so assume that is correct, but I want to integrate some gles code into the system and at this point I discover vchiq problems. As said I know nothing about vchiq I assume it communicates with the firmware blob, I have done some minor google searches with no luck, I have tried all the available 'start.elf' files I could find but this does not help.....

I really have no idea and I am not a kernel hacker and have no expertise in RT_PREEMPT.

How did you get your 3.8-rt kernel to compile?, I tried the 3.6 a couple of weeks ago but got nowhere with it so went back to looking at the 3.2.27 kernel as I knew it at least booted okay. The problem comes in trying to run the pi3d demos.

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: newbie question: vchiq not working with RT_PREEMPT kerne

Tue May 28, 2013 1:17 pm

I may have a look at drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c


Any bcm2708 experts have advice?

federicob
Posts: 5
Joined: Fri Sep 21, 2012 4:58 pm

Re: newbie question: vchiq not working with RT_PREEMPT kerne

Fri May 31, 2013 10:44 pm

Last time I tried to do this it failed badly point 1, in the mmc driver loading.
I used the kernel 3.2.27 (c58d10edc9fb05282128e58d3acb589010a72281).
I'd guess RT_PREEMPT doesn't work properly on 3.2 rpi kernel. Though it could be working in future version which should be more "upstreamed".

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: newbie question: vchiq not working with RT_PREEMPT kerne

Sun Jun 02, 2013 2:04 pm

federicob wrote:Last time I tried to do this it failed badly point 1, in the mmc driver loading.
I used the kernel 3.2.27 (c58d10edc9fb05282128e58d3acb589010a72281).
I'd guess RT_PREEMPT doesn't work properly on 3.2 rpi kernel. Though it could be working in future version which should be more "upstreamed".
i have root fs on usb

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: newbie question: vchiq not working with RT_PREEMPT kerne

Thu Jun 06, 2013 1:53 pm

Has anyone tested vchiq functions on other RT_PREEMPT kernels?

Basically just a case of running the demos to see if they work:

Code: Select all

cd /opt/vc/src/hello_pi
./rebuild.sh
Then test the executable files in the subdirectories.

I have not managed to get any further with the 3.2.27 patched kernel (3.2.27 seems to boot from SD, this maybe due to it not having good RT performance)

I found running cyclictest on the RT_PREEMPT 2.2.27 only gives marginally better performance than a standard raspbian kernel, what sort latency does cyclictest show on other kernel versions?

aaa801
Posts: 428
Joined: Mon Jun 04, 2012 9:06 pm
Location: Berkshire

Re: newbie question: vchiq not working with RT_PREEMPT kerne

Thu Jun 06, 2013 6:20 pm

mung wrote:Has anyone tested vchiq functions on other RT_PREEMPT kernels?

Basically just a case of running the demos to see if they work:

Code: Select all

cd /opt/vc/src/hello_pi
./rebuild.sh
Then test the executable files in the subdirectories.

I have not managed to get any further with the 3.2.27 patched kernel (3.2.27 seems to boot from SD, this maybe due to it not having good RT performance)

I found running cyclictest on the RT_PREEMPT 2.2.27 only gives marginally better performance than a standard raspbian kernel, what sort latency does cyclictest show on other kernel versions?


pi@raspberrypi /opt/vc/src/hello_pi/hello_triangle $
* failed to open vchiq instance
pi@raspberrypi /opt/vc/src/hello_pi/hello_triangle $ uname -a
Linux raspberrypi 3.8.13-rt8aaa801+ #2 PREEMPT RT Sun May 19 02:39:41 BST 2013 armv6l GNU/Linux

[ 33.677169] Adding 102396k swap on /var/swap. Priority:-1 extents:143 across:1697768k
[ 224.401158] vchiq_get_state: g_state.remote->initialised != 1 (0)
[ 224.401287] vchiq: vchiq has no connection to VideoCore
[ 227.399003] vchiq_get_state: g_state.remote->initialised != 1 (0)
[ 227.399032] vchiq: vchiq has no connection to VideoCore

so aparantly it sbecause the boot files were out of sync with the kernel and library version, running rpi-update and going to check then

mung
Posts: 506
Joined: Fri Nov 18, 2011 10:49 am

Re: newbie question: vchiq not working with RT_PREEMPT kerne

Mon Jul 15, 2013 12:16 pm

aaa801 wrote: pi@raspberrypi /opt/vc/src/hello_pi/hello_triangle $
* failed to open vchiq instance
pi@raspberrypi /opt/vc/src/hello_pi/hello_triangle $ uname -a
Linux raspberrypi 3.8.13-rt8aaa801+ #2 PREEMPT RT Sun May 19 02:39:41 BST 2013 armv6l GNU/Linux

[ 33.677169] Adding 102396k swap on /var/swap. Priority:-1 extents:143 across:1697768k
[ 224.401158] vchiq_get_state: g_state.remote->initialised != 1 (0)
[ 224.401287] vchiq: vchiq has no connection to VideoCore
[ 227.399003] vchiq_get_state: g_state.remote->initialised != 1 (0)
[ 227.399032] vchiq: vchiq has no connection to VideoCore

so aparantly it sbecause the boot files were out of sync with the kernel and library version, running rpi-update and going to check then
Only just noticed your reply as I was looking at RT_PREEMPT again over the weekend...

I think you will find rpi-update will install new firmware and kernel so the real time kernel will be over written, I am not sure about how it works, but assumed the 'firmware blob' was on the fat partition names start.elf or something like that, it configures the vpu to allow the ARM core to run linux and deal with interupts/dma/framebuffer etc...

As said before I tried downloading all the previous revisions of start.elf to see if different firmswares may help, none that I could find fixed the problem.

I assume you are right in saying the bcm code in the linux kernel expects certain replies from the firmware code and they are not what correct due to the kernel code and firmware being out of sync.

The fact that the vpu is really the supervisor in charge of the system makes me wonder if broadcom could not get a vpu expert to write a special real time bcm vpu firmware that allows linux ARM code to ask for realtime priority access or prefered scheduling?

I have no idea if or how this would work, but maybe there are some experts that do?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23687
Joined: Sat Jul 30, 2011 7:41 pm

Re: newbie question: vchiq not working with RT_PREEMPT kerne

Mon Jul 15, 2013 12:48 pm

I don't think changes to the VC4 firmware would make any difference to the ability or not to get RTPREMPT working in the kernel. This just looks like a basic api compatibility issue when talking to the vchiq libraries.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Return to “Linux Kernel”