Re: [PATCH 3/3] mailbox: pcc: Fix command timeout due to missed interrupt

From: Sudeep Holla

Date: Thu Jul 23 2026 - 15:58:16 EST


On Thu, Jul 23, 2026 at 11:57:58AM -0400, Adam Young wrote:
>
> On 7/23/26 05:16, Sudeep Holla wrote:
> > On Wed, Jul 22, 2026 at 11:10:51PM -0400, Adam Young wrote:
> > > + /*
> > > + * Set chan_in_use before ringing the doorbell so a fast completion
> > > + * interrupt is not mistaken for a shared interrupt from another
> > > + * subspace. Use WRITE_ONCE() for the lockless flag update. The
> > > + * ordered MMIO accessor used to ring the doorbell keeps this store
> > > + * visible before the platform is notified.
> > > + */
> > > + if (pchan->plat_irq > 0)
> > > + WRITE_ONCE(pchan->chan_in_use, true);
> > > ret = pcc_chan_reg_read_modify_write(&pchan->db);
> > > if (!ret && pchan->plat_irq > 0)
> > > - pchan->chan_in_use = true;
> > > + WRITE_ONCE(pchan->chan_in_use, false);
> > > return ret;
> > > }
> > > --
> > > 2.43.0
> > > iAt the end of the above code,
> > > WRITE_ONCE(pchan->chan_in_use, false);
> > > should be
> > > WRITE_ONCE(pchan->chan_in_use, true);
> > >
> > > In order to keep the original semantics. The flag is cleared when the
> > > messages is ACKed, not here. This version causes a hang.
> > >
> > Did you run and seeing hang or just code inspection. If latter, have you
> > considered that modified code sets it true before doorbell is rung and
> > set to false only if there is a failure to ring the doorbell ?
> >
> Yes, I saw the hang, and debugged to see this line semantically different. 
> I changed it to true and things resumed working.  !ret is 0  so that happens
> in the success case.
>

My mistake, I must pay more attention 🙁. I wanted it to be error case
and always read it as if(ret..) instead of if(!ret..), sorry for that.

--
Regards,
Sudeep