* [PATCH 0/2] Trivial CIO2 patches
@ 2018-10-10 8:32 Sakari Ailus
2018-10-10 8:32 ` [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources Sakari Ailus
2018-10-10 8:32 ` [PATCH 2/2] ipu3-cio2: Use cio2_queues_exit Sakari Ailus
0 siblings, 2 replies; 9+ messages in thread
From: Sakari Ailus @ 2018-10-10 8:32 UTC (permalink / raw)
To: linux-media
Cc: rajmohan.mani, yong.zhi, bingbu.cao, tian.shu.qiu, jian.xu.zheng
Hi,
Here are two simple cio2 patches. Slightly safer module removal plus a
cleanup.
Sakari Ailus (2):
ipu3-cio2: Unregister device nodes first, then release resources
ipu3-cio2: Use cio2_queues_exit
drivers/media/pci/intel/ipu3/ipu3-cio2.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources
2018-10-10 8:32 [PATCH 0/2] Trivial CIO2 patches Sakari Ailus
@ 2018-10-10 8:32 ` Sakari Ailus
2018-10-11 9:15 ` Bing Bu Cao
2018-10-15 7:15 ` Bing Bu Cao
2018-10-10 8:32 ` [PATCH 2/2] ipu3-cio2: Use cio2_queues_exit Sakari Ailus
1 sibling, 2 replies; 9+ messages in thread
From: Sakari Ailus @ 2018-10-10 8:32 UTC (permalink / raw)
To: linux-media
Cc: rajmohan.mani, yong.zhi, bingbu.cao, tian.shu.qiu, jian.xu.zheng
While there are issues related to object lifetime management, unregister
the media device first, followed immediately by other device nodes when
the driver is being unbound. Only then the resources needed by the driver
may be released. This is slightly safer.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 452eb9b42140..723022ef3662 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -1846,12 +1846,12 @@ static void cio2_pci_remove(struct pci_dev *pci_dev)
struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
unsigned int i;
+ media_device_unregister(&cio2->media_dev);
cio2_notifier_exit(cio2);
- cio2_fbpt_exit_dummy(cio2);
for (i = 0; i < CIO2_QUEUES; i++)
cio2_queue_exit(cio2, &cio2->queue[i]);
+ cio2_fbpt_exit_dummy(cio2);
v4l2_device_unregister(&cio2->v4l2_dev);
- media_device_unregister(&cio2->media_dev);
media_device_cleanup(&cio2->media_dev);
mutex_destroy(&cio2->lock);
}
--
2.11.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] ipu3-cio2: Use cio2_queues_exit
2018-10-10 8:32 [PATCH 0/2] Trivial CIO2 patches Sakari Ailus
2018-10-10 8:32 ` [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources Sakari Ailus
@ 2018-10-10 8:32 ` Sakari Ailus
2018-10-11 9:16 ` Bing Bu Cao
1 sibling, 1 reply; 9+ messages in thread
From: Sakari Ailus @ 2018-10-10 8:32 UTC (permalink / raw)
To: linux-media
Cc: rajmohan.mani, yong.zhi, bingbu.cao, tian.shu.qiu, jian.xu.zheng
The ipu3-cio2 driver has a function to tear down video devices as well as
the associated video buffer queues. Use it.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 723022ef3662..447baaebca44 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -1844,12 +1844,10 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
static void cio2_pci_remove(struct pci_dev *pci_dev)
{
struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
- unsigned int i;
media_device_unregister(&cio2->media_dev);
cio2_notifier_exit(cio2);
- for (i = 0; i < CIO2_QUEUES; i++)
- cio2_queue_exit(cio2, &cio2->queue[i]);
+ cio2_queues_exit(cio2);
cio2_fbpt_exit_dummy(cio2);
v4l2_device_unregister(&cio2->v4l2_dev);
media_device_cleanup(&cio2->media_dev);
--
2.11.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources
2018-10-10 8:32 ` [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources Sakari Ailus
@ 2018-10-11 9:15 ` Bing Bu Cao
2018-10-15 7:15 ` Bing Bu Cao
1 sibling, 0 replies; 9+ messages in thread
From: Bing Bu Cao @ 2018-10-11 9:15 UTC (permalink / raw)
To: Sakari Ailus, linux-media
Cc: rajmohan.mani, yong.zhi, bingbu.cao, tian.shu.qiu, jian.xu.zheng
Tested-by: Bingbu Cao <bingbu.cao@intel.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
On 10/10/2018 04:32 PM, Sakari Ailus wrote:
> While there are issues related to object lifetime management, unregister
> the media device first, followed immediately by other device nodes when
> the driver is being unbound. Only then the resources needed by the driver
> may be released. This is slightly safer.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
> drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> index 452eb9b42140..723022ef3662 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -1846,12 +1846,12 @@ static void cio2_pci_remove(struct pci_dev *pci_dev)
> struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
> unsigned int i;
>
> + media_device_unregister(&cio2->media_dev);
> cio2_notifier_exit(cio2);
> - cio2_fbpt_exit_dummy(cio2);
> for (i = 0; i < CIO2_QUEUES; i++)
> cio2_queue_exit(cio2, &cio2->queue[i]);
> + cio2_fbpt_exit_dummy(cio2);
> v4l2_device_unregister(&cio2->v4l2_dev);
> - media_device_unregister(&cio2->media_dev);
> media_device_cleanup(&cio2->media_dev);
> mutex_destroy(&cio2->lock);
> }
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] ipu3-cio2: Use cio2_queues_exit
2018-10-10 8:32 ` [PATCH 2/2] ipu3-cio2: Use cio2_queues_exit Sakari Ailus
@ 2018-10-11 9:16 ` Bing Bu Cao
2018-10-13 20:15 ` Sakari Ailus
0 siblings, 1 reply; 9+ messages in thread
From: Bing Bu Cao @ 2018-10-11 9:16 UTC (permalink / raw)
To: Sakari Ailus, linux-media
Cc: rajmohan.mani, yong.zhi, bingbu.cao, tian.shu.qiu, jian.xu.zheng
Tested-by: Bingbu Cao <bingbu.cao@intel.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
On 10/10/2018 04:32 PM, Sakari Ailus wrote:
> The ipu3-cio2 driver has a function to tear down video devices as well as
> the associated video buffer queues. Use it.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
> drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> index 723022ef3662..447baaebca44 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -1844,12 +1844,10 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
> static void cio2_pci_remove(struct pci_dev *pci_dev)
> {
> struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
> - unsigned int i;
>
> media_device_unregister(&cio2->media_dev);
> cio2_notifier_exit(cio2);
> - for (i = 0; i < CIO2_QUEUES; i++)
> - cio2_queue_exit(cio2, &cio2->queue[i]);
> + cio2_queues_exit(cio2);
> cio2_fbpt_exit_dummy(cio2);
> v4l2_device_unregister(&cio2->v4l2_dev);
> media_device_cleanup(&cio2->media_dev);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] ipu3-cio2: Use cio2_queues_exit
2018-10-11 9:16 ` Bing Bu Cao
@ 2018-10-13 20:15 ` Sakari Ailus
0 siblings, 0 replies; 9+ messages in thread
From: Sakari Ailus @ 2018-10-13 20:15 UTC (permalink / raw)
To: Bing Bu Cao
Cc: linux-media, rajmohan.mani, yong.zhi, bingbu.cao, tian.shu.qiu,
jian.xu.zheng
On Thu, Oct 11, 2018 at 05:16:30PM +0800, Bing Bu Cao wrote:
> Tested-by: Bingbu Cao <bingbu.cao@intel.com>
> Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Thanks!!
--
Sakari Ailus
sakari.ailus@linux.intel.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources
2018-10-10 8:32 ` [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources Sakari Ailus
2018-10-11 9:15 ` Bing Bu Cao
@ 2018-10-15 7:15 ` Bing Bu Cao
2018-10-15 8:39 ` Sakari Ailus
1 sibling, 1 reply; 9+ messages in thread
From: Bing Bu Cao @ 2018-10-15 7:15 UTC (permalink / raw)
To: Sakari Ailus, linux-media
Cc: rajmohan.mani, yong.zhi, bingbu.cao, tian.shu.qiu, jian.xu.zheng
On 10/10/2018 04:32 PM, Sakari Ailus wrote:
> While there are issues related to object lifetime management, unregister
> the media device first, followed immediately by other device nodes when
> the driver is being unbound. Only then the resources needed by the driver
> may be released. This is slightly safer.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
> drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> index 452eb9b42140..723022ef3662 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -1846,12 +1846,12 @@ static void cio2_pci_remove(struct pci_dev *pci_dev)
> struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
> unsigned int i;
>
> + media_device_unregister(&cio2->media_dev);
> cio2_notifier_exit(cio2);
> - cio2_fbpt_exit_dummy(cio2);
> for (i = 0; i < CIO2_QUEUES; i++)
> cio2_queue_exit(cio2, &cio2->queue[i]);
> + cio2_fbpt_exit_dummy(cio2);
Hi, Sakari,
The fbpt dummy pages cleanup does not matter much before/after queues
exit, right?
> v4l2_device_unregister(&cio2->v4l2_dev);
> - media_device_unregister(&cio2->media_dev);
> media_device_cleanup(&cio2->media_dev);
> mutex_destroy(&cio2->lock);
> }
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources
2018-10-15 7:15 ` Bing Bu Cao
@ 2018-10-15 8:39 ` Sakari Ailus
2018-10-15 9:15 ` Bing Bu Cao
0 siblings, 1 reply; 9+ messages in thread
From: Sakari Ailus @ 2018-10-15 8:39 UTC (permalink / raw)
To: Bing Bu Cao
Cc: linux-media, rajmohan.mani, yong.zhi, bingbu.cao, tian.shu.qiu,
jian.xu.zheng
Hi Bingbu,
On Mon, Oct 15, 2018 at 03:15:05PM +0800, Bing Bu Cao wrote:
>
> On 10/10/2018 04:32 PM, Sakari Ailus wrote:
> > While there are issues related to object lifetime management, unregister
> > the media device first, followed immediately by other device nodes when
> > the driver is being unbound. Only then the resources needed by the driver
> > may be released. This is slightly safer.
> >
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> > drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > index 452eb9b42140..723022ef3662 100644
> > --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> > @@ -1846,12 +1846,12 @@ static void cio2_pci_remove(struct pci_dev *pci_dev)
> > struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
> > unsigned int i;
> >
> > + media_device_unregister(&cio2->media_dev);
> > cio2_notifier_exit(cio2);
> > - cio2_fbpt_exit_dummy(cio2);
> > for (i = 0; i < CIO2_QUEUES; i++)
> > cio2_queue_exit(cio2, &cio2->queue[i]);
> > + cio2_fbpt_exit_dummy(cio2);
> Hi, Sakari,
> The fbpt dummy pages cleanup does not matter much before/after queues
> exit, right?
cio2_queue_exit() will unregister the video device and the video buffer
queue. Up to this point it's possible to open the video device and start
streaming on it. While this patch does not fully address the issue it makes
it a slightly lesser issue.
> > v4l2_device_unregister(&cio2->v4l2_dev);
> > - media_device_unregister(&cio2->media_dev);
> > media_device_cleanup(&cio2->media_dev);
> > mutex_destroy(&cio2->lock);
> > }
>
--
Sakari Ailus
sakari.ailus@linux.intel.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources
2018-10-15 8:39 ` Sakari Ailus
@ 2018-10-15 9:15 ` Bing Bu Cao
0 siblings, 0 replies; 9+ messages in thread
From: Bing Bu Cao @ 2018-10-15 9:15 UTC (permalink / raw)
To: Sakari Ailus
Cc: linux-media, rajmohan.mani, yong.zhi, bingbu.cao, tian.shu.qiu,
jian.xu.zheng
On 10/15/2018 04:39 PM, Sakari Ailus wrote:
> Hi Bingbu,
>
> On Mon, Oct 15, 2018 at 03:15:05PM +0800, Bing Bu Cao wrote:
>> On 10/10/2018 04:32 PM, Sakari Ailus wrote:
>>> While there are issues related to object lifetime management, unregister
>>> the media device first, followed immediately by other device nodes when
>>> the driver is being unbound. Only then the resources needed by the driver
>>> may be released. This is slightly safer.
>>>
>>> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>>> ---
>>> drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
>>> index 452eb9b42140..723022ef3662 100644
>>> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
>>> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
>>> @@ -1846,12 +1846,12 @@ static void cio2_pci_remove(struct pci_dev *pci_dev)
>>> struct cio2_device *cio2 = pci_get_drvdata(pci_dev);
>>> unsigned int i;
>>>
>>> + media_device_unregister(&cio2->media_dev);
>>> cio2_notifier_exit(cio2);
>>> - cio2_fbpt_exit_dummy(cio2);
>>> for (i = 0; i < CIO2_QUEUES; i++)
>>> cio2_queue_exit(cio2, &cio2->queue[i]);
>>> + cio2_fbpt_exit_dummy(cio2);
>> Hi, Sakari,
>> The fbpt dummy pages cleanup does not matter much before/after queues
>> exit, right?
> cio2_queue_exit() will unregister the video device and the video buffer
> queue. Up to this point it's possible to open the video device and start
> streaming on it. While this patch does not fully address the issue it makes
> it a slightly lesser issue.
Okay, thanks for your explanation.
>>> v4l2_device_unregister(&cio2->v4l2_dev);
>>> - media_device_unregister(&cio2->media_dev);
>>> media_device_cleanup(&cio2->media_dev);
>>> mutex_destroy(&cio2->lock);
>>> }
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-10-15 16:56 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 8:32 [PATCH 0/2] Trivial CIO2 patches Sakari Ailus
2018-10-10 8:32 ` [PATCH 1/2] ipu3-cio2: Unregister device nodes first, then release resources Sakari Ailus
2018-10-11 9:15 ` Bing Bu Cao
2018-10-15 7:15 ` Bing Bu Cao
2018-10-15 8:39 ` Sakari Ailus
2018-10-15 9:15 ` Bing Bu Cao
2018-10-10 8:32 ` [PATCH 2/2] ipu3-cio2: Use cio2_queues_exit Sakari Ailus
2018-10-11 9:16 ` Bing Bu Cao
2018-10-13 20:15 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).