From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Kocialkowski Subject: Re: [PATCH v6 4/8] media: platform: Add Cedrus VPU decoder driver Date: Wed, 08 Aug 2018 11:28:55 +0200 Message-ID: References: <20180725100256.22833-1-paul.kocialkowski@bootlin.com> <20180725100256.22833-5-paul.kocialkowski@bootlin.com> <130e4f08534d0dfbd26f97f9b95d533ce86ceada.camel@bootlin.com> Reply-To: paul.kocialkowski-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-oFjxIpdcI3M+8NHK4cGK" Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org In-Reply-To: <130e4f08534d0dfbd26f97f9b95d533ce86ceada.camel-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Ezequiel Garcia , linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org Cc: Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Greg Kroah-Hartman , Thomas Petazzoni , linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Hugues Fruchet , Randy Li , Hans Verkuil , Tomasz Figa , Alexandre Courbot , Philipp Zabel , Laurent Pinchart , Sakari Ailus List-Id: devicetree@vger.kernel.org --=-oFjxIpdcI3M+8NHK4cGK Content-Type: text/plain; charset="UTF-8" Hi, On Mon, 2018-08-06 at 16:21 +0200, Paul Kocialkowski wrote: > Hi, > > On Fri, 2018-08-03 at 17:49 -0300, Ezequiel Garcia wrote: > > On Wed, 2018-07-25 at 12:02 +0200, Paul Kocialkowski wrote: > > > This introduces the Cedrus VPU driver that supports the VPU found in > > > Allwinner SoCs, also known as Video Engine. It is implemented through > > > a v4l2 m2m decoder device and a media device (used for media requests). > > > So far, it only supports MPEG2 decoding. > > > > > > Since this VPU is stateless, synchronization with media requests is > > > required in order to ensure consistency between frame headers that > > > contain metadata about the frame to process and the raw slice data that > > > is used to generate the frame. > > > > > > This driver was made possible thanks to the long-standing effort > > > carried out by the linux-sunxi community in the interest of reverse > > > engineering, documenting and implementing support for Allwinner VPU. > > > > > > Signed-off-by: Paul Kocialkowski > > > > [..] > > > +static int cedrus_probe(struct platform_device *pdev) > > > +{ > > > + struct cedrus_dev *dev; > > > + struct video_device *vfd; > > > + int ret; > > > + > > > + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); > > > + if (!dev) > > > + return -ENOMEM; > > > + > > > + dev->dev = &pdev->dev; > > > + dev->pdev = pdev; > > > + > > > + ret = cedrus_hw_probe(dev); > > > + if (ret) { > > > + dev_err(&pdev->dev, "Failed to probe hardware\n"); > > > + return ret; > > > + } > > > + > > > + dev->dec_ops[CEDRUS_CODEC_MPEG2] = &cedrus_dec_ops_mpeg2; > > > + > > > + mutex_init(&dev->dev_mutex); > > > + spin_lock_init(&dev->irq_lock); > > > + > > > > A minor thing. > > > > I believe this spinlock is not needed. All the data structures > > it's accessing are already protected, and some operations > > (stop_streaming) are guaranteed to not run at the same > > time as a job. > > I think we were afraid of this kind of scenario happening, but > everything seems to indicate that these data structures are already > properly protected by the core, as you're suggesting. > > Removing the lock does not cause any noticeable issue at first try, but > I'd like to test decoding for a few hours in a row to reduce the > probability of missing a corner case that our lock was preventing. After testing for several hours in a row, I got some cases of CPU stall which did not happen with the driver lock. So it seems safer to keep the lock around for now and maybe revisit this later, when there is time to investigate why it is needed. Cheers, Paul > If that goes well, I guess we can remove it from our driver. > > Cheers, > > Paul > -- Paul Kocialkowski, Bootlin (formerly Free Electrons) Embedded Linux and kernel engineering https://bootlin.com --=-oFjxIpdcI3M+8NHK4cGK--