Repository navigation
wdt: the same fixes for hi3516cv100, built from source instead of the vendor blob - #302
Conversation
… vendor blob Fixes OpenIPC/firmware#1534. hi3516cv100 was the generation #235 left out: its kbuild linked the vendor wdt.o, so the source beside it was reference and reached no board. The module hisilicon-opensdk installs as wdt.ko on hi3516cv100/hi3518cv100 was that blob, with the vendor behaviour the rest of the tree has had fixed. Measured on a hi3518cv100 (XM N51813L) running today's firmware, before: - majestic frozen (SIGSTOP), holding /dev/watchdog, 150 s: no reset. The driver's [hidog] thread went on feeding. - majestic's clean stop, which writes "V" ("magic close supported"): "HiDog: Unexpected close, not stopping watchdog!" -- the magic close inverted as on cv200 -- and the module's reference count stayed at 1, so rmmod failed with EAGAIN for the rest of the boot. The cv100 copy differed from cv200's pre-#235 hi_wdt.c by twelve lines (casts on ioremap_nocache, an IS_ERR typo, iounmap order, the author); the SP805 is at the same 0x20040000 with the same clock gate at 0x20050000. So it now carries the fixed cv200 driver verbatim and the kbuild builds it, retiring obj/hi3516cv100/wdt.o and its init wrapper. After, same board, the module in place of the firmware's wdt.ko and majestic's own defaults (300 s, fed every 150 s): - crash (SIGSEGV): S95majestic restarted majestic after 5 s, it re-armed the watchdog, no reset. - clean stop, then 330 s with nothing open: "Watchdog is disabled!", no reset. - hang (SIGSTOP): the board reset and was back 287 s after the stop. The kernel thread still feeds from load until userspace opens the device, so a boot or an update that runs without majestic is as safe as before -- the concern that has held #1534's nodeamon=1 back. Built against the firmware's Linux 3.0.8 (hi3518cv100_lite); the only warnings are the -Wmissing-attributes on module_init/module_exit every module in the tree gets with this compiler.
PR Summary by QodoBuild the fixed hi3516cv100 watchdog driver from source
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
…p on a failed load, time left reads 0 when stopped, serialised SETTIMEOUT Review on #302, in all four V2 copies (hi3516cv100, hi3516cv200, hi3516av100, hi3520dv200), so they stay one driver: - WDIOS_ENABLECARD takes hidog_lifecycle and refuses once the reboot notifier has run, as hidog_open() already did: an open descriptor could arm the watchdog again in the middle of a shutdown. - The reboot notifier also handles SYS_POWER_OFF, so a poweroff with the board still powered does not leave the dog armed to reset it. - watchdog_init()'s error path unmaps both register regions, which the comment in hidog_init() already said it did. - WDIOC_GETTIMELEFT answers 0 while HIWDT_CTRL has the timer disabled; hidog_stop() parks the load at the maximum, which read as a deadline. - WDIOC_SETTIMEOUT sets and reads back the margin under hidog_lifecycle, so two callers sharing a descriptor cannot leave cur_margin and the hardware disagreeing. Re-checked on the hi3518cv100: majestic arms it and reads back 300 s, a crash is restarted by the supervisor without a reset, a hang resets the board.
|
Review addressed in 8839773. All five findings were valid. They live in the V2 driver this PR copies from cv200, so the fix goes into all four V2 copies (hi3516cv100, hi3516cv200, hi3516av100, hi3520dv200) to keep them one driver:
Re-checked on the hi3518cv100 with the rebuilt module:
|
Fixes OpenIPC/firmware#1534.
hi3516cv100 is the generation #235 left out. Its kbuild linked the vendor
wdt.o, so thewdt.kothat hisilicon-opensdk installs on hi3516cv100/hi3518cv100 still behaved like the vendor driver.Before, measured on a hi3518cv100 (XM N51813L) running today's firmware:
/dev/watchdog, for 150 s: no reset. The driver's[hidog]thread kept feeding.HiDog: Unexpected close, not stopping watchdog!(the magic close inverted, as on cv200). The module's reference count stayed at 1, sormmodfailed with EAGAIN.Change: the cv100 copy differed from cv200's pre-#235
hi_wdt.cby only twelve cosmetic lines, and the SP805 sits at the same0x20040000with the same clock gate at0x20050000. So cv100 now carries the fixed cv200 driver verbatim, and the kbuild builds it from source, retiringobj/hi3516cv100/wdt.oand its init wrapper.After, same board, this module in place of the firmware's
wdt.ko, with majestic's defaults (300 s, fed every 150 s):Watchdog is disabled!, no resetThe kernel thread still feeds from module load until userspace opens the device. A boot, or an update that runs without majestic, is therefore as safe as before. That was the concern holding back #1534's
nodeamon=1.Built against the firmware's Linux 3.0.8 (
hi3518cv100_lite). The only warnings are the-Wmissing-attributesonmodule_init/module_exitthat every module in the tree gets with this compiler.