Re: [PATCH v3 3/5] media: qcom: camss: vfe: Fix VFE reset while another line is streaming

From: Hitesh Patel

Date: Mon Sep 28 2026 - 06:22:21 EST


On 28/09/2026 10:49, Bryan O'Donoghue wrote:
> NAK.
>
> This can't be correct, in fact its very racy and will break.

You are right, thanks for spelling out the interleaving. Sampling
stream_count before the decrement, and outside the lock that protects
it, lets both callers conclude they are not the last one and the reset
is then never done.

I have taken your diff as is for v4: vfe_disable_output() only stops the
write masters, and vfe_disable() does

if (--vfe->stream_count == 0)
ret = vfe_reset(vfe);

inside stream_lock. Keeping the reset under the lock also closes a
second window I had left open, since vfe_enable_v2() increments
stream_count under the same lock and then configures the output after
releasing it, so a line could have started coming up while the reset
ran.

Retested on the RB3 Gen2 with both cameras aggregated as VC0 and VC1 on
one CSIPHY, so that CSID0 feeds RDI0 and RDI1 of the same VFE: the two
stream concurrently (60/60 frames each) and VC1 restarts five times out
of five while VC0 keeps streaming, 200 frames without a gap and no
"VFE reset timeout".

v4 sent as a new thread.

Thanks,
Hitesh