One firmware timeout kills the camera until the module is reloaded - #332
Conversation
f42421f to
8772242
Compare
|
Thanks for taking #328 and #330. Master has moved since these were opened, so I re-checked: all five of the One thing I would rather say out loud before this one goes in, because it is If you would rather see it fail and recover before taking it, I can add a And if anything in the other four needs changing, just say what and I will |
| * by it and is what returns the entry to BUF_FREE. The | ||
| * buffer never made it out of the hardware, so report it | ||
| * as an error rather than as done. | ||
| */ |
There was a problem hiding this comment.
There is no need to explain how the code was fixed here. What you have written in the commit message is enough. It makes the code harder to understand and maintain, without any additional benefit. The fix itself is fine. Nice catch.
There was a problem hiding this comment.
Comment dropped — the commit message carries it.
When fthd_stop_channel() fails, fthd_stop_streaming() walks the buffer contexts and does: vb2_buffer_done(ctx->vb, VB2_BUF_STATE_DONE); ctx->vb = NULL; Two things are wrong with that. DONE tells userspace the buffer holds a frame, but it never made it out of the hardware, so it should be ERROR. And clearing ctx->vb is what leaves the camera dead. fthd_buffer_cleanup() looks the entry up by vb and returns early when it cannot find one, so the entry never goes back to BUF_FREE and its IOMMU mapping and DMA descriptor are never released. The driver then has no usable buffers until the module is reloaded. Keep ctx->vb and report the buffer as an error. Not reproduced on hardware: it needs a firmware that stops responding, and injecting one would test the injection rather than the bug. Signed-off-by: Viorel Cernateanu <vrilutza@gmail.com>
8772242 to
4ddea9f
Compare
When
fthd_stop_channel()fails — firmware not responding —fthd_stop_streaming()does:Two things are wrong.
DONEtells the application the buffer holds a frame, but the hardware never wrote it; it should beERROR.And clearing
ctx->vbis what leaves the camera dead.fthd_buffer_cleanup()looks the entry up byvb:With
vbcleared it never matches, so the entry never returns toBUF_FREEand its IOMMU mapping and DMA descriptor are never released. After that the driver has no usable buffers until the module is reloaded.Keep
ctx->vband report the buffer as an error.Not reproduced on hardware, and I would rather say so: it needs a firmware that stops responding, and injecting one would test the injection rather than the bug. The argument is the two code paths above.
The series
Seven PRs on this driver, all on master (
364b1c6), all found while debugging a camera problem on a MacBookPro14,1:break, hardcoded buffer countVIDIOC_STREAMONcmd.y1never assigned in the crop command — one lineALIGN(width, 7)aligns nothing; second commit re-does 545cb18 and should waitThey can be taken in any order, with one exception: the second commit of #331 should not be taken yet — reasons in that PR.
(Until 23 August there was a second exception: #328 and #334 both carried the same
mdelay→msleepcommit, so whichever merged first made the other conflict. I have dropped it from #328; it lives in #334. The seven are now independent of each other.)There is one more patch not sent yet: the channel-start crop returns the top left corner of the frame at any size below the sensor. It is measured and ready, and it sits on top of #330. I am holding it back rather than adding an eighth PR to the pile.