[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <43d3d88e292c3aaf25eda8514451ef1949612620.camel@collabora.com>
Date: Wed, 28 May 2025 09:49:18 -0400
From: Nicolas Dufresne <nicolas.dufresne@...labora.com>
To: "jackson.lee" <jackson.lee@...psnmedia.com>, "mchehab@...nel.org"
<mchehab@...nel.org>, "hverkuil-cisco@...all.nl"
<hverkuil-cisco@...all.nl>, "bob.beckett@...labora.com"
<bob.beckett@...labora.com>
Cc: "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"lafley.kim" <lafley.kim@...psnmedia.com>, "b-brnich@...com"
<b-brnich@...com>, "hverkuil@...all.nl" <hverkuil@...all.nl>, Nas Chung
<nas.chung@...psnmedia.com>
Subject: Re: [PATCH v2 4/7] media: chips-media: wave5: Use spinlock whenever
statue is changed
Le mardi 27 mai 2025 à 05:02 +0000, jackson.lee a écrit :
> Hi Nicolas
>
> > -----Original Message-----
> > From: Nicolas Dufresne <nicolas.dufresne@...labora.com>
> > Sent: Saturday, May 24, 2025 2:41 AM
> > To: jackson.lee <jackson.lee@...psnmedia.com>; mchehab@...nel.org;
> > hverkuil-cisco@...all.nl; sebastian.fricke@...labora.com;
> > bob.beckett@...labora.com; dafna.hirschfeld@...labora.com
> > Cc: linux-media@...r.kernel.org; linux-kernel@...r.kernel.org; lafley.kim
> > <lafley.kim@...psnmedia.com>; b-brnich@...com; hverkuil@...all.nl; Nas
> > Chung <nas.chung@...psnmedia.com>
> > Subject: Re: [PATCH v2 4/7] media: chips-media: wave5: Use spinlock
> > whenever statue is changed
> >
> > Hi,
> >
> > Le jeudi 22 mai 2025 à 16:26 +0900, Jackson.lee a écrit :
> > > From: Jackson Lee <jackson.lee@...psnmedia.com>
> > >
> > > The device_run and finish_decode is not any more synchronized, so lock
> > > was needed in the device_run whenever state was changed.
> >
> > Can you try to introduce the locking ahead of the patches, otherwise this
> > break bisectability as the in-between become racy.
>
>
> Do you want to introduce this patch ahead of the performance patch?
I'm sure you can find the right anwser if you understand why I'm asking this. The way
patchset should be layout is so that at any step applying the set, the driver
should remain stable. If one patch above breaks something, and you fix it in the
next patch, this is not a bisectable set.
git bisect does not know about "sets" and shouldn't need to know about it either.
regards,
Nicolas
>
> Thanks
> Jackson
>
> >
> > Nicolas
> >
> > >
> > > Signed-off-by: Jackson Lee <jackson.lee@...psnmedia.com>
> > > Signed-off-by: Nas Chung <nas.chung@...psnmedia.com>
> > > ---
> > > drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c | 8 +++++++-
> > > 1 file changed, 7 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
> > > b/drivers/media/platform/chips- media/wave5/wave5-vpu-dec.c index
> > > 42981c3b49bc..719c5527eb7f 100644
> > > --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
> > > +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
> > > @@ -1577,6 +1577,7 @@ static void wave5_vpu_dec_device_run(void *priv)
> > > struct queue_status_info q_status;
> > > u32 fail_res = 0;
> > > int ret = 0;
> > > + unsigned long flags;
> > >
> > > dev_dbg(inst->dev->dev, "%s: Fill the ring buffer with new
> > bitstream data", __func__);
> > > pm_runtime_resume_and_get(inst->dev->dev);
> > > @@ -1617,7 +1618,9 @@ static void wave5_vpu_dec_device_run(void *priv)
> > > }
> > > spin_unlock_irqrestore(&inst->state_spinlock, flags);
> > > } else {
> > > + spin_lock_irqsave(&inst->state_spinlock, flags);
> > > switch_state(inst, VPU_INST_STATE_INIT_SEQ);
> > > + spin_unlock_irqrestore(&inst->state_spinlock, flags);
> > > }
> > >
> > > break;
> > > @@ -1628,8 +1631,9 @@ static void wave5_vpu_dec_device_run(void *priv)
> > > * we had a chance to switch, which leads to an invalid state
> > > * change.
> > > */
> > > + spin_lock_irqsave(&inst->state_spinlock, flags);
> > > switch_state(inst, VPU_INST_STATE_PIC_RUN);
> > > -
> > > + spin_unlock_irqrestore(&inst->state_spinlock, flags);
> > > /*
> > > * During DRC, the picture decoding remains pending, so just
> > leave the job
> > > * active until this decode operation completes.
> > > @@ -1643,7 +1647,9 @@ static void wave5_vpu_dec_device_run(void *priv)
> > > ret = wave5_prepare_fb(inst);
> > > if (ret) {
> > > dev_warn(inst->dev->dev, "Framebuffer preparation,
> > fail: %d\n",
> > > ret);
> > > + spin_lock_irqsave(&inst->state_spinlock, flags);
> > > switch_state(inst, VPU_INST_STATE_STOP);
> > > + spin_unlock_irqrestore(&inst->state_spinlock, flags);
> > > break;
> > > }
> > >
Powered by blists - more mailing lists