Skip to content

feat: enable kprobes/ftrace on hi3516cv500 family, mirror #1982#2095

Merged
widgetii merged 3 commits into
OpenIPC:masterfrom
widgetii:cv500-enable-kprobes-ftrace
May 14, 2026
Merged

feat: enable kprobes/ftrace on hi3516cv500 family, mirror #1982#2095
widgetii merged 3 commits into
OpenIPC:masterfrom
widgetii:cv500-enable-kprobes-ftrace

Conversation

@widgetii
Copy link
Copy Markdown
Member

Mirrors #1982's kprobe/ftrace enablement onto the cv500 / av300 family. Lets us kprobe the vendor `open_ive.ko` on a running av300 board to RE field maps for follow-up cv500 IVE-op work in openhisilicon (LBP output anomaly, EqualizeHist `node[7]=0x61` + LUT-remap path, KCF_Process HW dispatch, etc.).

Generic configs (hi3516av300.generic.config + hi3516cv500.generic.config)

Same set of flips as #1982 did for `hi3516ev300.generic.config`:

  • `CONFIG_KALLSYMS_ALL`: not set → y (kprobes needs full symbol table)
  • `CONFIG_SLUB_DEBUG`: y → not set (image size)
  • `CONFIG_KPROBES`: not set → y (the load-bearing flag)
  • `CONFIG_DEBUG_FS`: not set → y (`/sys/kernel/debug` needed for tracefs)
  • `CONFIG_DEBUG_MEMORY_INIT`: y → not set (image size)
  • `CONFIG_FTRACE`: not set → y (function tracer + kprobes companion)

Leaving the `RD_GZIP/BZIP2/LZMA/LZO/LZ4 → not set` claw-back from #1982 alone for cv500 — those affected ev300 because the initramfs moved to XZ-only there. cv500 firmware compression isn't necessarily the same; conservative to keep all decompressors enabled and let a follow-up trim if image size becomes an issue.

Neo (7.0 kernel) config

`hi3516av300.neo.config` explicitly turned off kprobes/ftrace/kallsyms "to save kernel size" — this PR re-enables them with a comment explaining that the av300 lab board is what we'll be kprobing.

S29debugfs

Already present at `general/overlay/etc/init.d/S29debugfs` (added by #1982, shared across all platforms) — no additional file needed.

Testing

Verified the kernel config flags apply cleanly. Local kernel build hits an unrelated pre-existing `spi-nor.c:2385: 'i' undeclared` error in the buildroot output dir (stale state) — CI should validate against a clean tree.

Mirrors the kprobe/ftrace enablement OpenIPC#1982 did for ev200/ev300 onto
cv500 / av300. Lets us kprobe the vendor open_ive.ko on a running
av300 board to RE field maps for follow-up cv500 IVE-op work in
openhisilicon (LBP output anomaly, EqualizeHist node[7]=0x61 + LUT
remap, KCF_Process HW dispatch, etc.).

## Generic configs (hi3516av300.generic.config + hi3516cv500.generic.config)
Same set of flips as OpenIPC#1982 did for hi3516ev300.generic.config:
  CONFIG_KALLSYMS_ALL: not set → y     (kprobes needs full symbol table)
  CONFIG_SLUB_DEBUG: y → not set       (image size)
  CONFIG_KPROBES: not set → y          (the load-bearing flag)
  CONFIG_DEBUG_FS: not set → y         (/sys/kernel/debug needed for tracefs)
  CONFIG_DEBUG_MEMORY_INIT: y → not set (image size)
  CONFIG_FTRACE: not set → y           (function tracer + kprobes companion)

Leaving the RD_GZIP/BZIP2/LZMA/LZO/LZ4 → not set claw-back from
OpenIPC#1982 alone for cv500 — those affected ev300 because the initramfs
moved to XZ-only. cv500 firmware compression isn't necessarily
the same; conservative to keep all decompressors enabled and let
a follow-up trim if size becomes an issue.

## Neo (7.0 kernel) config
hi3516av300.neo.config explicitly turned off kprobes/ftrace/kallsyms
"to save kernel size" — re-enables them with comment explaining
that the av300 lab board is what we'll be kprobing.

## S29debugfs
Already present at general/overlay/etc/init.d/S29debugfs (shared
across all platforms) — no additional file needed.
widgetii and others added 2 commits May 13, 2026 22:19
The neo firmware doesn't need kprobes — it builds the clean-room
openhisilicon replacement modules from source. Only the lite firmware
runs the vendor open_ive.ko blob that needs live RE.

PR OpenIPC#1982 (which this PR mirrors for cv500) only touched
hi3516ev300.generic.config (lite), never the neo config — extending
the flips to hi3516av300.neo.config was overreach and pushed the
uImage from 2048 KB to 2398 KB (-- size exceeded by 350KB).

Generic-config flips for hi3516av300/hi3516cv500 stay; those mirror
OpenIPC#1982 and unblock kprobe-based RE of the vendor blob on the lite path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The full kprobe set (KPROBES + FTRACE + KALLSYMS_ALL + DEBUG_FS)
that PR OpenIPC#1982 enabled on ev300 blew the av300/cv500 lite image
budget by 184/194 KB respectively — av300/cv500 baseline kernels
are already closer to the 2048 KB ceiling than ev300.

Local rebuild of hi3516av300_lite confirms the trim: keeping only
CONFIG_KPROBES + CONFIG_KALLSYMS (dropping FTRACE, KALLSYMS_ALL,
DEBUG_FS) gives a 1978 KB uImage with 70 KB headroom under the
2048 KB cap.

Trade-off vs the full set:
- Lose `/sys/kernel/debug/tracing/kprobe_events` tracefs interface
  (FTRACE-gated). The dynamic-probe-via-echo workflow is gone.
- Lose KALLSYMS_ALL (static-symbol visibility). Vendor `hi_ive.ko`
  exports symbols through the standard module symbol table though,
  so `kallsyms_lookup_name()` from an RE module still works.
- Lose `/sys/kernel/debug`.
- Keep KPROBES + KALLSYMS. The RE workflow becomes "write a tiny
  `kprobe_dump.ko` that takes `symbol=ive_fill_X` as a module
  parameter, registers a pre-handler that dumps regs to dmesg,
  unregisters on rmmod". Classic kprobe-from-module pattern,
  sufficient for dumping vendor field maps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@widgetii widgetii merged commit 81f24b3 into OpenIPC:master May 14, 2026
91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant