From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Andreas Helbech Kleist <andreaskleist@gmail.com>
Cc: bingbu.cao@intel.com, linux-media@vger.kernel.org,
laurent.pinchart@ideasonboard.com,
andriy.shevchenko@linux.intel.com, hdegoede@redhat.com,
ilpo.jarvinen@linux.intel.com, claus.stovgaard@gmail.com,
tomi.valkeinen@ideasonboard.com, tfiga@chromium.org,
senozhatsky@chromium.org, bingbu.cao@linux.intel.com,
tian.shu.qiu@intel.com, hongju.wang@intel.com
Subject: Re: [PATCH v3 10/17] media: intel/ipu6: add input system driver
Date: Thu, 15 Feb 2024 08:06:04 +0000 [thread overview]
Message-ID: <Zc3F7On4kghB_PWW@kekkonen.localdomain> (raw)
In-Reply-To: <2f407c0a4f1d7deb4c3fa8e5005caa513c688e6d.camel@gmail.com>
Hi Andreas,
On Thu, Feb 15, 2024 at 07:43:59AM +0100, Andreas Helbech Kleist wrote:
> Hi Sakari,
>
> On Mon, 2024-02-12 at 18:31 +0000, Sakari Ailus wrote:
> > Hi Andreas,
> >
> > On Wed, Feb 07, 2024 at 10:36:15AM +0100, Andreas Helbech Kleist wrote:
> > > Hi Bingbu,
> > >
> > > Thank you for the patch series, I haven't had a chance to look at v3 in
> > > detail yet, so this is just a small comment from my testing on v2 +
> > > IPU4 hacks, which I can see is also here in v3.
> > >
> > > On Thu, 2024-01-11 at 14:55 +0800, bingbu.cao@intel.com wrote:
> > > > From: Bingbu Cao <bingbu.cao@intel.com>
> > > >
> > > > Input system driver do basic isys hardware setup and irq handling
> > > > and work with fwnode and v4l2 to register the ISYS v4l2 devices.
> > > >
> > > > Signed-off-by: Bingbu Cao <bingbu.cao@intel.com>
> > > > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > > > ---
> > > > drivers/media/pci/intel/ipu6/ipu6-isys.c | 1353 ++++++++++++++++++++++
> > > > drivers/media/pci/intel/ipu6/ipu6-isys.h | 207 ++++
> > > > 2 files changed, 1560 insertions(+)
> > > > create mode 100644 drivers/media/pci/intel/ipu6/ipu6-isys.c
> > > > create mode 100644 drivers/media/pci/intel/ipu6/ipu6-isys.h
> > > >
> > > > diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys.c b/drivers/media/pci/intel/ipu6/ipu6-isys.c
> > >
> > > ...
> > >
> > > > +static void isys_unregister_devices(struct ipu6_isys *isys)
> > > > +{
> > > > + isys_unregister_video_devices(isys);
> > > > + isys_csi2_unregister_subdevices(isys);
> > > > + v4l2_device_unregister(&isys->v4l2_dev);
> > > > + media_device_unregister(&isys->media_dev);
> > > > + media_device_cleanup(&isys->media_dev);
> > > > +}
> > >
> > > ...
> > >
> > > > +static void isys_remove(struct auxiliary_device *auxdev)
> > > > +{
> > > > + struct ipu6_bus_device *adev = auxdev_to_adev(auxdev);
> > > > + struct ipu6_isys *isys = dev_get_drvdata(&auxdev->dev);
> > > > + struct ipu6_device *isp = adev->isp;
> > > > + struct isys_fw_msgs *fwmsg, *safe;
> > > > + unsigned int i;
> > > > +
> > > > + list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist, head)
> > > > + dma_free_attrs(&auxdev->dev, sizeof(struct isys_fw_msgs),
> > > > + fwmsg, fwmsg->dma_addr, 0);
> > > > +
> > > > + list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist_fw, head)
> > > > + dma_free_attrs(&auxdev->dev, sizeof(struct isys_fw_msgs),
> > > > + fwmsg, fwmsg->dma_addr, 0);
> > >
> > > I experienced a crash in ipu6_get_fw_msg_buf when unbinding the PCI
> > > driver while streaming.
> > >
> > > It happens because the above two lists are still used at this point. I
> > > believe it is safe to free the fw msgs after the
> > > isys_unregister_devices(isys) call below.
> >
> > Probably yes, indeed.
> >
> > However there's no support for unbinding a driver from a device while
> > streaming apart from plain V4L2 drivers. This needs to be addressed but we
> > can't address it driver by driver when the framework won't help with that,
> > it requires a comprehensive approach and support for this in MC and V4L2
> > sub-device frameworks.
>
> Thank you for the information. I'll try to lower my expectations ;)
This has been the case since the very beginning of V4L2 sub-device nodes
and Media controller. At the time the use case involved devices that could
not be physically removed and managing the lifetime of the objects was seen
complex, so instead an assumption was made they'll always stay. And of
course it's now much, much harder to fix.
This set goes some way addressing this but it's really only a start:
<URL:https://lore.kernel.org/linux-media/20231220103713.113386-1-sakari.ailus@linux.intel.com/>
>
> > >
> > > > +
> > > > + isys_unregister_devices(isys);
> > > > + isys_notifier_cleanup(isys);
> > > > +
> > > > + cpu_latency_qos_remove_request(&isys->pm_qos);
> > > > +
> > > > + if (!isp->secure_mode) {
> > > > + ipu6_cpd_free_pkg_dir(adev);
> > > > + ipu6_buttress_unmap_fw_image(adev, &adev->fw_sgt);
> > > > + release_firmware(adev->fw);
> > > > + }
> > > > +
> > > > + for (i = 0; i < IPU6_ISYS_MAX_STREAMS; i++)
> > > > + mutex_destroy(&isys->streams[i].mutex);
> > > > +
> > > > + isys_iwake_watermark_cleanup(isys);
> > > > + mutex_destroy(&isys->stream_mutex);
> > > > + mutex_destroy(&isys->mutex);
> > > > +}
> > >
> > > /Andreas
> >
>
--
Regards,
Sakari Ailus
next prev parent reply other threads:[~2024-02-15 8:06 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-11 6:55 [PATCH v3 00/15] Intel IPU6 and IPU6 input system drivers bingbu.cao
2024-01-11 6:55 ` [PATCH v3 01/17] media: intel/ipu6: add Intel IPU6 PCI device driver bingbu.cao
2024-01-15 13:36 ` Hans de Goede
2024-01-15 13:45 ` Sakari Ailus
2024-01-11 6:55 ` [PATCH v3 02/17] media: intel/ipu6: add IPU auxiliary devices bingbu.cao
2024-01-11 6:55 ` [PATCH v3 03/17] media: intel/ipu6: add IPU6 buttress interface driver bingbu.cao
2024-01-11 6:55 ` [PATCH v3 04/17] media: intel/ipu6: CPD parsing for get firmware components bingbu.cao
2024-01-11 6:55 ` [PATCH v3 05/17] media: intel/ipu6: add IPU6 DMA mapping API and MMU table bingbu.cao
2024-01-11 6:55 ` [PATCH v3 06/17] media: intel/ipu6: add syscom interfaces between firmware and driver bingbu.cao
2024-01-11 6:55 ` [PATCH v3 07/17] media: intel/ipu6: input system ABI " bingbu.cao
2024-01-15 12:17 ` Sakari Ailus
2024-01-11 6:55 ` [PATCH v3 08/17] media: intel/ipu6: add IPU6 CSI2 receiver v4l2 sub-device bingbu.cao
2024-01-11 6:55 ` [PATCH v3 09/17] media: intel/ipu6: add the CSI2 DPHY implementation bingbu.cao
2024-01-11 6:55 ` [PATCH v3 10/17] media: intel/ipu6: add input system driver bingbu.cao
2024-01-11 14:05 ` Sakari Ailus
2024-02-07 9:36 ` Andreas Helbech Kleist
2024-02-12 18:31 ` Sakari Ailus
2024-02-15 6:43 ` Andreas Helbech Kleist
2024-02-15 8:06 ` Sakari Ailus [this message]
2024-01-11 6:55 ` [PATCH v3 11/17] media: intel/ipu6: input system video capture nodes bingbu.cao
2024-03-08 9:58 ` Andreas Helbech Kleist
2024-01-11 6:55 ` [PATCH v3 12/17] media: add Kconfig and Makefile for IPU6 bingbu.cao
2024-01-11 6:55 ` [PATCH v3 13/17] MAINTAINERS: add maintainers for Intel IPU6 input system driver bingbu.cao
2024-01-11 6:55 ` [PATCH v3 14/17] Documentation: add Intel IPU6 ISYS driver admin-guide doc bingbu.cao
2024-01-11 6:55 ` [PATCH v3 15/17] Documentation: add documentation of Intel IPU6 driver and hardware overview bingbu.cao
2024-01-11 6:55 ` [PATCH v3 16/17] media: ipu6/isys: support line-based metadata capture support bingbu.cao
2024-01-11 12:52 ` Sakari Ailus
2024-01-11 21:20 ` kernel test robot
2024-01-12 3:31 ` kernel test robot
2024-01-11 6:55 ` [PATCH v3 17/17] media: ipu6/isys: support new v4l2 subdev state APIs bingbu.cao
2024-01-11 12:37 ` Sakari Ailus
2024-01-16 16:12 ` [PATCH v3 00/15] Intel IPU6 and IPU6 input system drivers Hans de Goede
2024-01-16 16:18 ` Laurent Pinchart
2024-01-16 16:38 ` Hans de Goede
2024-01-16 16:42 ` Laurent Pinchart
2024-01-16 16:43 ` Hans de Goede
2024-01-16 16:54 ` Sakari Ailus
2024-01-16 16:57 ` Hans de Goede
2024-01-16 17:48 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zc3F7On4kghB_PWW@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=andreaskleist@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bingbu.cao@intel.com \
--cc=bingbu.cao@linux.intel.com \
--cc=claus.stovgaard@gmail.com \
--cc=hdegoede@redhat.com \
--cc=hongju.wang@intel.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=tfiga@chromium.org \
--cc=tian.shu.qiu@intel.com \
--cc=tomi.valkeinen@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox