Closed FPtje closed 7 years ago
Thanks for the issue. I'm not good at English. Please forgive me if it is difficult to read.
There is something I want you to tell me.
Did this happen with the linux kernel you built? This problem was not reproduced in the Linux kernel provided by this repository (target/de0-nano-soc/boot/zImage-4.8.17-armv7-fpga) .
If you build a kernel, please execute the following command and tell me what configuration was done.
zcat /proc/config.gz | grep -i CONFIG_OF
By the way, in the kernel built with this repository, it becomes as follows.
zcat /proc/config.gz | grep -i CONFIG_OF
CONFIG_OF=y
# CONFIG_OF_UNITTEST is not set
CONFIG_OF_FLATTREE=y
CONFIG_OF_EARLY_FLATTREE=y
CONFIG_OF_DYNAMIC=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_ADDRESS_PCI=y
CONFIG_OF_IRQ=y
CONFIG_OF_NET=y
CONFIG_OF_MDIO=y
CONFIG_OF_PCI=y
CONFIG_OF_PCI_IRQ=y
CONFIG_OF_MTD=y
CONFIG_OF_RESERVED_MEM=y
CONFIG_OF_RESOLVE=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_GPIO=y
Perhaps there is something wrong with the configuration.
Thanks for the reply!
Yes, it happens with a kernel I built. Sadly, I cannot use the Linux kernel from this repository.
The configuration is sadly the same, except for CONFIG_OF_IOMMU
:
# zcat /proc/config.gz | grep -i CONFIG_OF
CONFIG_OF=y
# CONFIG_OF_UNITTEST is not set
CONFIG_OF_FLATTREE=y
CONFIG_OF_EARLY_FLATTREE=y
CONFIG_OF_DYNAMIC=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_ADDRESS_PCI=y
CONFIG_OF_IRQ=y
CONFIG_OF_NET=y
CONFIG_OF_MDIO=y
CONFIG_OF_PCI=y
CONFIG_OF_PCI_IRQ=y
CONFIG_OF_MTD=y
CONFIG_OF_RESERVED_MEM=y
CONFIG_OF_RESOLVE=y
CONFIG_OF_OVERLAY=y
CONFIG_OF_GPIO=y
CONFIG_OF_IOMMU=y
Also, the code in the stack trace refers to CONFIG_SYSFS
, which is also turned on.
# zcat /proc/config.gz | grep -i CONFIG_SYSFS
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_SYSFS_SYSCALL=y
CONFIG_SYSFS=y
uum...
I put the configuration of the linux kernel used in this repository in the following place.
If you compare with the configuration used there, you may find something.
Also, if there is a difference, it is a device tree. . .
The device tree of de0-nano-soc
provided in this repository is target/de0-nano-soc/boot/devicetree-4.8.17-socfpga.dts
. Is there a difference from the device tree there?
The dtb loaded by NixOS is from Linux-4.8.17, which I think is this one.
I downloaded devicetree-4.8.17-socfpga.dtb
and told U-Boot to boot using that dtb
. It boots fine, but the exact same kernel oops happens.
The kernel is being recompiled with some options found in your gist, most notably CONFIG_CONFIGFS_FS
. Here's to hoping it'll work
I've tried turning on pretty much all the options you have on, but it doesn't work. Still the same error. I still think it has something to do with the /config mountpoint. Somehow it's mounted at /sys/kernel/config
, and /config
is shows this in the mount command:
configfs on /sys/kernel/config type configfs (rw,relatime)
none on /config type configfs (rw,relatime)
Debian8-rootfs provided by this repository, fstab has the following settings.
debian8-rootfs# cat <<EOT > /etc/fstab
/dev/mmcblk0p1 /boot auto defaults 0 0
none /config configfs defaults 0 0
EOT
Huh, that looks the same.
I've tried unmounting /sys/kernel/config
, but that doesn't fix the error. I'm also currently compiling 4.10 to see if the added stuff for Altera works natively.
I understand you are very busy.
I want to see dts (device-tree-source) of altera-hps2fpga
for debugging.
Can you replace altera-hps2fpga.rb there with this and try it out?
If you execute this script with --install, /var/log/altera-hps2fpga.dts
is generated.
Please tell me the contents of /var/log/altera-hps2fpga.dts
.
Thanks! Unfortunately, it was the same as my dts.
Please tell me about your .config.
# zcat /proc/config.gz > your_config
Thanks a lot for the help, by the way!
my .config
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
your .config
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
The kernel internal error seems to be occurring in __kmalloc_track_caller() in mm/slub.c. This may be a clue to the solution.
Please replace the "altera-hps2fpga.rb" with the following one and try it.
https://gist.github.com/ikwzm/c274c8d13c32a13e78a94eec83b3b3d9
Recompiling the kernel with CONFIG_SLAB=y
has solved the kernel panic problem. Woohoo! Thanks for the help!
I still get the following error, though:
[ 86.743488] fpga bridge driver
[ 86.751289] altera_hps2fpga_bridge soc:fpgabridge@0: fpga bridge [hps2fpga] registered as device hps2fpga
[ 86.751303] altera_hps2fpga_bridge soc:fpgabridge@0: init-val not specified
[ 86.751938] altera_hps2fpga_bridge soc:fpgabridge@1: fpga bridge [lwhps2fpga] registered as device lwhps2fpga
[ 86.751951] altera_hps2fpga_bridge soc:fpgabridge@1: init-val not specified
[ 86.752533] altera_hps2fpga_bridge soc:fpgabridge@2: fpga bridge [fpga2hps] registered as device fpga2hps
[ 86.752546] altera_hps2fpga_bridge soc:fpgabridge@2: init-val not specified
With some debugging I found that the error (info rather) is thrown in altera-hps2fpga.c
, line 162 (not altera-fpga2sdram.c
).
Your replacement altera-hps2fpga.rb
does the same.
Also, I've updated to 0a372b4870b70591916cdc28e0a8cc649dcfb4ff
Oh, that was good.
I also built the kernel with CONFIG_SLUB=y
, the kernel panicked like you.
Although the root cause is still unknown, apparently when the property names of the device tree overlay overlap, it seems that the allocation of memory fails and the kernel panicks.
Therefore, when deleting duplicate #address-cells = <0x1>;
and #size-cells = <0x1>;
in the new altera-hps2fpga.rb
, the kernel no longer panicks.
After some searches on Google I found that the init-val
error must come from using a bad device tree. Somehow, I'm using a dtb where "init-val" is not set, while your Debian does have init-val set, somewhere. The strange thing is that target/de0-nano-soc/boot/devicetree-4.8.17-socfpga.dts
has no mention of init-val
, so it must be set somewhere else.
I'm still researching this issue. I found some documentation on init-val
here
Since init-val
is optional, it does not matter if you do not set it.
If you are worried, please do altera-hps2fpga.rb
as follows.
https://gist.github.com/ikwzm/ffb190ad6824505fd8febf38063b28ed
This script sets init-val = <0>;
in the device tree.
You are awesome. It totally works. Thanks so much!
Kernel:
Device: Altera de0-nano-soc
Revision: 17c09587b5cd797b314dcdcfc7a4c144e3b645e3
Immediately after issuing
altera-hps2fpga.rb --install
I get the following error:I don't know what to do with this. I'll try different versions, but otherwise I have no idea.
Edit: It also happens for 7b166af5be65da271d90530fa95bec5edc948fd8, which I reckon is the earliest commit that I can switch to, considering I'm running 4.8.17.
Also: