Commit 6bc0fac
Unblocks the gate from #182 and re-enables the openipc_frame_ts MIPI_FS
hook on cv200 / hi3518ev200 without bricking /image.jpg.
PR #155 (firmware bump #2126) introduced a synchronous
openipc_frame_ts_push() call inside ISP_ISR's u32PortIntStatus branch;
#178 extended it. The few µs added to the cv200 ISR top half tipped a
timing race downstream in the vendor VPSS / VENC chn 1 startup, raising
the /image.jpg HTTP-000 brick rate on hi3518ev200 from ~20 % (latent
baseline) to ~60 %. firmware#2128 urgently reverted; #182 gated the
cv200 hook off.
The brick mechanism is NOT the rt_mutex_trylock WARN at rtmutex.c:1545
that #183 originally blamed. We confirmed empirically: deferring the
i2c writes to a workqueue (cv500-pattern) silences the WARN but makes
the brick *worse* (40-60 % rate). The race is purely about µs cost in
the cv200 ISR hot path before the synchronous ISP_IntBottomHalf runs.
Fix: replace the direct openipc_frame_ts_push() with tasklet_hi_schedule().
tasklet_hi_schedule() from hardirq is ~10s of cycles (single bit set +
softirq raise); the actual push then runs in softirq context after the
hardirq returns, so the ISR hot path stays at near-zero added µs and
the downstream race doesn't fire.
Empirical validation on dlab hi3518ev200 (JXF22 sensor, kernel 4.9.37),
10 power-cycles per state, /image.jpg http_code via init-script-started
majestic:
| state | success | brick |
| baseline (no hook, with #182 gate on) | 8/10 | 20% |
| push direct in ISR + cv500-style i2c defer | 4/10 | 60% |
| tasklet defer for push + cv500-style i2c defer | 6/10 | 40% |
| this patch — tasklet defer alone (no i2c changes) | 10/10 | 0% |
The tasklet-defer-alone fix is BETTER than baseline (which still
intermittently bricks 20 % from the pre-frame_ts era) AND keeps the
frame_ts hook enabled on cv200.
Timestamp precision: the push reads sched_clock() at tasklet-run time
(~µs after the IRQ rather than inside it). Negligible for 30 fps
frame-edge events on a 33 ms cadence. openipc_frame_ts_push() already
has a per-event-type dedupe window absorbing any coalescing from
multiple ISR firings between tasklet runs.
The rt_mutex_trylock WARN still fires once per boot on cv200 — it's
cosmetic, not the brick cause. A cv500-pattern workqueue defer for
i2c-from-hardirq to silence the WARN was prototyped and tested; it
regresses the brick rate so it does NOT land here. Tracked as future
work in openhisilicon#185.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 14fc195 commit 6bc0fac
1 file changed
Lines changed: 57 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
137 | 173 | | |
138 | 174 | | |
139 | 175 | | |
| |||
2628 | 2664 | | |
2629 | 2665 | | |
2630 | 2666 | | |
2631 | | - | |
2632 | | - | |
2633 | | - | |
2634 | | - | |
2635 | | - | |
2636 | | - | |
2637 | | - | |
2638 | | - | |
2639 | | - | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
2640 | 2673 | | |
2641 | | - | |
2642 | | - | |
2643 | | - | |
2644 | | - | |
2645 | | - | |
2646 | | - | |
2647 | | - | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
2648 | 2678 | | |
2649 | | - | |
| 2679 | + | |
2650 | 2680 | | |
2651 | 2681 | | |
2652 | 2682 | | |
| |||
2968 | 2998 | | |
2969 | 2999 | | |
2970 | 3000 | | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
2971 | 3006 | | |
2972 | 3007 | | |
2973 | 3008 | | |
| |||
2987 | 3022 | | |
2988 | 3023 | | |
2989 | 3024 | | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
2990 | 3030 | | |
2991 | 3031 | | |
2992 | 3032 | | |
| |||
0 commit comments