Skip to contentSkip to conversation

Xenomai on Linux 3.18 on Zynq

Xenomai Andreas Galauner 3 participants 9 messages Apr 10, 2015

lore
Share & tools
lore
#0 lore raw

Hi all,

I'm playing around with Xenomai for a few months now on and off and I want to get Xenomai running on the Xilinx 3.18 Kernel to use it on a Zynq board. I had it running with 3.14, but I need the Xilinx Video Pipeline drivers which only work for me on 3.18.

Now I've been keeping an eye on the i-pipe 3.18 branch for a while and I've been trying to run it on my board, but I keep having massive problems during bootup when Xenomai is enabled.

Most of the time it just freezes at some point in time during bootup. Sometimes it boots completely and then freezes afterwards.

The funniest thing we saw was, that it booted completely, we quickly logged in, ran xeno-test which seemed to work fine until Linux processes seem to be hanging randomly, but then it recovered after a few seconds, ran for a few seconds, hang again etc.

I tried all kinds of things to find out where this hanging comes from. I disabled all kinds of peripherals, because I suspected drivers to behave in a wrong way during interrupt handling, I tried to debug it via JTAG, but because I don't even know where to start that didn't help at all. I also tried Xenomai 2.6 and 3. All the same.

Just to be sure: Was the 3.18 kernel with i-pipe patches ever tested with Xenomai on real hardware? Because I'm not sure if I'm searching for a bug in the Xilinx part or in the general i-pipe/Xenomai part of the kernel. I know, that the 3.18 kernel unstable, that's why I'm asking. Should I keep looking or just wait?

On a sidenote: That patch
https://git.xenomai.org/ipipe-gch.git/commit/?h=for-ipipe-3.18&id=f98b6d95359ea0429307d98759357d54dcfba7e8
makes the board stop directly after the bootloader jumps into the kernel. Without it, it panics with a NULL-pointer deref on 3.18.10. All patches before that lead to the mentioned freezing-behaviour.

Any pointers in any direction where to start looking would be great!

- Andy

#1 lore raw

Hi Andy,

Quoted 29 lines · Andreas Galauner

I'm playing around with Xenomai for a few months now on and off and I want to get Xenomai running on the Xilinx 3.18 Kernel to use it on a Zynq board. I had it running with 3.14, but I need the Xilinx Video Pipeline drivers which only work for me on 3.18.

Now I've been keeping an eye on the i-pipe 3.18 branch for a while and I've been trying to run it on my board, but I keep having massive problems during bootup when Xenomai is enabled.

Most of the time it just freezes at some point in time during bootup. Sometimes it boots completely and then freezes afterwards.

The funniest thing we saw was, that it booted completely, we quickly logged in, ran xeno-test which seemed to work fine until Linux processes seem to be hanging randomly, but then it recovered after a few seconds, ran for a few seconds, hang again etc.

I tried all kinds of things to find out where this hanging comes from. I disabled all kinds of peripherals, because I suspected drivers to behave in a wrong way during interrupt handling, I tried to debug it via JTAG, but because I don't even know where to start that didn't help at all. I also tried Xenomai 2.6 and 3. All the same.

Just to be sure: Was the 3.18 kernel with i-pipe patches ever tested with Xenomai on real hardware? Because I'm not sure if I'm searching for a bug in the Xilinx part or in the general i-pipe/Xenomai part of the kernel. I know, that the 3.18 kernel unstable, that's why I'm asking. Should I keep looking or just wait?

Quoted 7 lines

On a sidenote: That patch
https://git.xenomai.org/ipipe-gch.git/commit/?h=for-ipipe-3.18&id=f98b6d95359ea0429307d98759357d54dcfba7e8
makes the board stop directly after the bootloader jumps into the kernel. Without it, it panics with a NULL-pointer deref on 3.18.10. All patches before that lead to the mentioned freezing-behaviour.

Any pointers in any direction where to start looking would be great!

This might be a problem with your kernel configuration. Please send me your .config and I'll take a look at it...

Thanks,
Stefan

#2 lore raw
Quoted 2 lines · Stefan Roese

This might be a problem with your kernel configuration. Please send me your .config and I'll take a look at it...

I attached it for you.
CPU Frequency scaling is disabled if it's what you had in mind.

Thanks!
- Andy

-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.gz
Type: application/gzip
Size: 18640 bytes
Desc: not available
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150410/f79ee954/attachment.bin>

#3 lore raw
Quoted 6 lines · Andreas Galauner
Quoted 2 lines · Stefan Roese

This might be a problem with your kernel configuration. Please send me your .config and I'll take a look at it...

I attached it for you.
CPU Frequency scaling is disabled if it's what you had in mind.

Yes, this was exactly what I had in mind. Too bad, I have no quick idea then.

Thanks,
Stefan

#4 lore raw
In reply to Andreas Galauner
Quoted 4 lines · Andreas Galauner

On a sidenote: That patch
https://git.xenomai.org/ipipe-gch.git/commit/?h=for-ipipe-3.18&id=f98b6d95359ea0429307d98759357d54dcfba7e8
makes the board stop directly after the bootloader jumps into the kernel.

This has already been reported and is probably really easy to debug on real hardware, but I am not going to be able to do that before some time. The patch is the way to go for processors using DT, and which have a non zero "cluster ID", so it has to be applied, revert it is not an option.

Signature · 1 line
					    Gilles.
#5 lore raw
In reply to Andreas Galauner
Quoted 14 lines · Andreas Galauner

Hi all,

I'm playing around with Xenomai for a few months now on and off and I want to get Xenomai running on the Xilinx 3.18 Kernel to use it on a Zynq board. I had it running with 3.14, but I need the Xilinx Video Pipeline drivers which only work for me on 3.18.

Now I've been keeping an eye on the i-pipe 3.18 branch for a while and I've been trying to run it on my board, but I keep having massive problems during bootup when Xenomai is enabled.

Most of the time it just freezes at some point in time during bootup. Sometimes it boots completely and then freezes afterwards.

Quoted 7 lines

The funniest thing we saw was, that it booted completely, we quickly logged in, ran xeno-test which seemed to work fine until Linux processes seem to be hanging randomly, but then it recovered after a few seconds, ran for a few seconds, hang again etc.

I tried all kinds of things to find out where this hanging comes from.

Maybe you already tried since you tried "all kinds of things", but better be sure, have you tried enabling Xenomai and I-pipe debugging options?

Signature · 1 line
					    Gilles.
#6 lore raw
Quoted 3 lines · Gilles Chanteperdrix

Maybe you already tried since you tried "all kinds of things", but better be sure, have you tried enabling Xenomai and I-pipe debugging options?

Sorry for that sloppy phrase, it's a side project and I lost track what exactly I did over the last weekends.

I just enabled the I-pipe debugging features. I didn't know that they are under "Kernel hacking". The Xenomai debugging features were enabled all the time.

Sadly, I don't get any messages that may relate to my system behaviour. Actually no messages at all except the initialization messages of i-pipe and Xenomai.

What I forgot to mention is, that it's not a complete freeze. It seems to me, that the system just gets horribly slow. The heartbeat LED stops blinking and I get occasional terminal output (1-2 lines) until it stops completely.

There seem to be three points where the kernel may hang:
1) Somewhere in the driver init phase
2) While mounting the rootfs
3) At the login prompt or idle shell

And as I said, sometimes I get a few more lines from the kernel after a while.

One example:

Quoted 11 lines
[    1.648675] mmcblk0: mmc0:b368 USD   7.46 GiB 
[    1.654727]  mmcblk0: p1 p2
[    1.660107] EXT3-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (240)
[    1.670176] EXT2-fs (mmcblk0p2): error: couldn't mount because of unsupported optional features (244)
[   64.605360] EXT4-fs (mmcblk0p2): recovery complete
[   64.612160] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[   64.620218] VFS: Mounted root (ext4 filesystem) on device 179:2.
[   64.635207] devtmpfs: mounted
[   64.638469] Freeing unused kernel memory: 276K (c05f7000 - c063c000)

INIT: version 2.88 booting

- Andy

#7 lore raw
Quoted 21 lines · Andreas Galauner
Quoted 3 lines · Gilles Chanteperdrix

Maybe you already tried since you tried "all kinds of things", but better be sure, have you tried enabling Xenomai and I-pipe debugging options?

Sorry for that sloppy phrase, it's a side project and I lost track what exactly I did over the last weekends.

I just enabled the I-pipe debugging features. I didn't know that they are under "Kernel hacking". The Xenomai debugging features were enabled all the time.

Sadly, I don't get any messages that may relate to my system behaviour. Actually no messages at all except the initialization messages of i-pipe and Xenomai.

What I forgot to mention is, that it's not a complete freeze. It seems to me, that the system just gets horribly slow. The heartbeat LED stops blinking and I get occasional terminal output (1-2 lines) until it stops completely.

Quoted 7 lines

There seem to be three points where the kernel may hang:
1) Somewhere in the driver init phase
2) While mounting the rootfs
3) At the login prompt or idle shell

And as I said, sometimes I get a few more lines from the kernel after a while.

The classical issues to check are irq issues and timer issues. Since you are using a non mainline kernel (I guess), you may simply lack some changes to the code added by your non mainline kernel. To fix that, you can use the following document:

https://xenomai.org/2014/09/porting-xenomai-dual-kernel-to-a-new-arm-soc/

Signature · 1 line
					    Gilles.
#8 lore raw
In reply to Andreas Galauner
Quoted 4 lines · Andreas Galauner

On a sidenote: That patch
https://git.xenomai.org/ipipe-gch.git/commit/?h=for-ipipe-3.18&id=f98b6d95359ea0429307d98759357d54dcfba7e8
makes the board stop directly after the bootloader jumps into the kernel.

Please try branch for-ipipe-3.18 in ipipe-gch.git, it contains a totally untested, not even compiled patch for fixing this particular issue.

In short, I believe kmalloc may be using percpu, so ends-up using ipipe_processor_id() which ends up dereferencing the NULL __cpu_reverse_map, so I temporarily set __cpu_reverse_map to __cpu_logical_map before calling kmalloc.

This is correct, because at this point in the code we can rely on __cpu_logical_map to contain what is necessary to be used as a reverse map.

If the kernel still crashes, then the problem does not come from kmalloc using per-cpu data.

Signature · 1 line
					    Gilles.