lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9644b2fa60b308010c4fb5602a4c3083027f1027.camel@mediatek.com>
Date:   Mon, 19 Dec 2022 06:42:31 +0000
From:   Yunfei Dong (董云飞) 
        <Yunfei.Dong@...iatek.com>
To:     "wenst@...omium.org" <wenst@...omium.org>,
        Tiffany Lin (林慧珊) 
        <tiffany.lin@...iatek.com>,
        "nicolas@...fresne.ca" <nicolas@...fresne.ca>,
        "angelogioacchino.delregno@...labora.com" 
        <angelogioacchino.delregno@...labora.com>,
        "benjamin.gaignard@...labora.com" <benjamin.gaignard@...labora.com>,
        "hverkuil-cisco@...all.nl" <hverkuil-cisco@...all.nl>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mediatek@...ts.infradead.org" 
        <linux-mediatek@...ts.infradead.org>,
        "frkoenig@...omium.org" <frkoenig@...omium.org>,
        "stevecho@...omium.org" <stevecho@...omium.org>,
        "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "mchehab@...nel.org" <mchehab@...nel.org>,
        "daniel@...ll.ch" <daniel@...ll.ch>,
        Project_Global_Chrome_Upstream_Group 
        <Project_Global_Chrome_Upstream_Group@...iatek.com>,
        "hsinyi@...omium.org" <hsinyi@...omium.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "matthias.bgg@...il.com" <matthias.bgg@...il.com>
Subject: Re: [PATCH 1/5] media: mediatek: vcodec: add params to record lat and
 core lat_buf count

Hi Angelo,

Thanks for your suggestion.
On Tue, 2022-12-13 at 10:09 +0100, AngeloGioacchino Del Regno wrote:
> Il 10/12/22 08:32, Yunfei Dong ha scritto:
> > Using lat_buf to share decoder information between lat and core
> > work
> > queue, adding params to record the buf count.
> > 
> > Fixes: 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core
> > hardware decode")
> > Signed-off-by: Yunfei Dong <yunfei.dong@...iatek.com>
> > ---
> >   .../platform/mediatek/vcodec/vdec_msg_queue.c | 32
> > ++++++++++++++++++-
> >   .../platform/mediatek/vcodec/vdec_msg_queue.h |  9 ++++++
> >   2 files changed, 40 insertions(+), 1 deletion(-)
> > 
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
> > b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
> > index dc2004790a47..af7ddba1923a 100644
> > --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
> > +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c
> > @@ -52,6 +52,30 @@ static struct list_head *vdec_get_buf_list(int
> > hardware_index, struct vdec_lat_b
> >   	}
> >   }
> >   
> > +static void vdec_msg_queue_inc(struct vdec_msg_queue *msg_queue,
> > int hardware_index)
> > +{
> > +	mutex_lock(&msg_queue->list_cnt_mutex);
> 
> I doubt that you need to use this mutex, as you're using atomics...
> 
Can be removed.
> > +
> > +	if (hardware_index == MTK_VDEC_CORE)
> > +		atomic_inc(&msg_queue->core_list_cnt);
> > +	else
> > +		atomic_inc(&msg_queue->lat_list_cnt);
> > +
> 
> This branch (with the relevant appropriate changes) can be simplified
> as
> 
> 	atomic_inc(&msg_queue->list_cnt[hardware_index]);
> 
> ...where list_cnt is an array, and hardware_index is an enumeration.	
> 
Only use lat and core, no need to using a array for every hardware.

Best Regards,
Yunfei Dong
> > +	mutex_unlock(&msg_queue->list_cnt_mutex);
> > +}
> > +
> > +static void vdec_msg_queue_dec(struct vdec_msg_queue *msg_queue,
> > int hardware_index)
> > +{
> > +	mutex_lock(&msg_queue->list_cnt_mutex);
> > +
> > +	if (hardware_index == MTK_VDEC_CORE)
> > +		atomic_dec(&msg_queue->core_list_cnt);
> > +	else
> > +		atomic_dec(&msg_queue->lat_list_cnt);
> 
> Same here.
> 
> > +
> > +	mutex_unlock(&msg_queue->list_cnt_mutex);
> > +}
> > +
> 
> Regards,
> Angelo
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ