Created attachment 249745 [details] Kernel config I run FreeBSD on this NAS SBC for several years now: https://wiki.kobol.io/helios4/intro/ It has a Marvell Armada 385 SOC. After updating to 14.0 and issuing "sysctl -a" I get this kernel panic: panic: clkdev_device_lock not implemented cpuid = 1 time = 1712347555 KDB: stack backtrace: #0 0xc029ad50 at kdb_backtrace+0x40 #1 0xc0243adc at vpanic+0x140 #2 0xc024399c at vpanic+0 #3 0xc007e4d4 at clkdev_default_device_unlock+0 #4 0xc007f5b0 at clknode_gate_get_gate+0x68 #5 0xc007bd24 at clknode_sysctl+0x164 #6 0xc0257c9c at sysctl_root_handler_locked+0x10c #7 0xc02570f4 at sysctl_root+0x220 #8 0xc0257710 at userland_sysctl+0x178 #9 0xc0257554 at sys___sysctl+0x7c #10 0xc0586738 at swi_handler+0x148 #11 0xc05677c4 at swi_exit+0 My kernel config (attached) is very close to "sys/arm/conf/ARMADA38X", so this might be a bug.
Created attachment 250030 [details] implement armada38x_gateclk clkdev methods Are you able to test changes easily? The attached change will, I believe, resolve the problem. I do not have access to this hardware myself, however. The commit 1a74d77f85121 seems to have introduced new sysctl nodes exporting the status of gated clocks. The relevant clock driver for this hardware appears incomplete, and so we see the resulting panic.
Hi Mitchell, thank you for your work. I am able to test kernel code changes, just not easily. Will definitely try it asap.
(In reply to solo_code from comment #2) Have you had a chance to test the patch?
Hi Mark, sorry for taking so long. Every time it costs me a lot of effort to boot myself into system building. I'm already planning to do a rebuild for this machine in the holiday season around years change. Maybe even in the next days. Will definitely do it as I rely on this machine.
Created attachment 256018 [details] add support for the Kobol Helios4 NAS
Hi Mitchell, Mark, the patch indeed solves the issue. Awesome! I applied it to a clean checkout of releng/14.2 and built kernel and base. Please incorporate this into 14 and hopefully 15 too. The Marvell Armada platform is in good shape again. If you want to work on other bits too, you can have me test it within a few days. I also attached a small patch with kernel config and dts selection that allows to directly build a kernel for the Kobol Helios 4 NAS. Do you see a chance for this to be included into kernel source? Anyway, thanks for your work. You rock!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=6f2775548278c76e7c33b15aaaaa759270a8dcd5 commit 6f2775548278c76e7c33b15aaaaa759270a8dcd5 Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2024-04-15 20:18:25 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2025-01-16 17:27:00 +0000 armada38x: implement gateclk clkdev methods Implement basic clkdev methods required by the generic clk_gate device. This should make it functional, and prevent panics when invoking the clock's CLKNODE_GET_GATE method (e.g. with `sysctl -a`). Additionally, we need to fill in other key fields of the clk_gate_def structure before registering each clk. PR: 278188 Reported by: solo_code@protonmail.com Tested by: solo_code@protonmail.com MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48419 sys/arm/mv/clk/armada38x_gateclk.c | 99 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 5 deletions(-)
(In reply to solo_code from comment #6) Thanks a lot for reporting back! The code will land in stable/14 next week.
^Triage: set MFC flags as reminder.
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=d09ec2eeb0d81528066fdb05db8a121f0f1e0c01 commit d09ec2eeb0d81528066fdb05db8a121f0f1e0c01 Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2024-04-15 20:18:25 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2025-03-04 15:11:46 +0000 armada38x: implement gateclk clkdev methods Implement basic clkdev methods required by the generic clk_gate device. This should make it functional, and prevent panics when invoking the clock's CLKNODE_GET_GATE method (e.g. with `sysctl -a`). Additionally, we need to fill in other key fields of the clk_gate_def structure before registering each clk. PR: 278188 Reported by: solo_code@protonmail.com Tested by: solo_code@protonmail.com MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48419 (cherry picked from commit 6f2775548278c76e7c33b15aaaaa759270a8dcd5) sys/arm/mv/clk/armada38x_gateclk.c | 99 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 5 deletions(-)
(In reply to Mark Linimon from comment #9) Thanks for the ping, Mark.