/lib/eal: fix failed to stop device monitor error

Message ID 20220211084131.72606-1-wenxuanx.wu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series /lib/eal: fix failed to stop device monitor error |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Wu, WenxuanX Feb. 11, 2022, 8:41 a.m. UTC
  From: Wenxuan Wu <wenxuanx.wu@intel.com>

The ret value in rte_dev_event_monitor_stop stands for whether the
monitor has been successfully closed ,and should not bind with
rte_intr_callback_unregister,so once it goes to the right exit point of
rte_dev_event_monitor, the ret value should be set to 0.

Also ,the refmonitor count has been carefully evaluated ,the value
change from 1 to 0 ,so there is no potential memory leak failure.

Fixes: 1fef6ced07f3 ("eal/linux: allow multiple starts of event monitor")
Cc:stable@intel.com

Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
 lib/eal/linux/eal_dev.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Thomas Monjalon Feb. 13, 2022, 11:29 a.m. UTC | #1
+Cc Harman, maintainer of interrupt subsystem.

11/02/2022 09:41, wenxuanx.wu@intel.com:
> From: Wenxuan Wu <wenxuanx.wu@intel.com>
> 
> The ret value in rte_dev_event_monitor_stop stands for whether the
> monitor has been successfully closed ,and should not bind with
> rte_intr_callback_unregister,so once it goes to the right exit point of
> rte_dev_event_monitor, the ret value should be set to 0.
> 
> Also ,the refmonitor count has been carefully evaluated ,the value
> change from 1 to 0 ,so there is no potential memory leak failure.
> 
> Fixes: 1fef6ced07f3 ("eal/linux: allow multiple starts of event monitor")
> Cc:stable@intel.com
> 
> Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
> ---
>  lib/eal/linux/eal_dev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
> index bde55a3d92..4646e8a550 100644
> --- a/lib/eal/linux/eal_dev.c
> +++ b/lib/eal/linux/eal_dev.c
> @@ -384,6 +384,7 @@ rte_dev_event_monitor_stop(void)
>  	close(rte_intr_fd_get(intr_handle));
>  	rte_intr_instance_free(intr_handle);
>  	intr_handle = NULL;
> +	ret = 0;
>  
>  	monitor_refcount--;
>  
>
  
Wu, WenxuanX March 1, 2022, 9:38 a.m. UTC | #2
Let's start a talk about this patch.

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: 2022年2月13日 19:30
> To: Wu, WenxuanX <wenxuanx.wu@intel.com>
> Cc: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>; dev@dpdk.org; david.marchand@redhat.com;
> Harman Kalra <hkalra@marvell.com>
> Subject: Re: [DPDK] /lib/eal: fix failed to stop device monitor error
> 
> +Cc Harman, maintainer of interrupt subsystem.
> 
> 11/02/2022 09:41, wenxuanx.wu@intel.com:
> > From: Wenxuan Wu <wenxuanx.wu@intel.com>
> >
> > The ret value in rte_dev_event_monitor_stop stands for whether the
> > monitor has been successfully closed ,and should not bind with
> > rte_intr_callback_unregister,so once it goes to the right exit point
> > of rte_dev_event_monitor, the ret value should be set to 0.
> >
> > Also ,the refmonitor count has been carefully evaluated ,the value
> > change from 1 to 0 ,so there is no potential memory leak failure.
> >
> > Fixes: 1fef6ced07f3 ("eal/linux: allow multiple starts of event
> > monitor") Cc:stable@intel.com
> >
> > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
> > ---
> >  lib/eal/linux/eal_dev.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index
> > bde55a3d92..4646e8a550 100644
> > --- a/lib/eal/linux/eal_dev.c
> > +++ b/lib/eal/linux/eal_dev.c
> > @@ -384,6 +384,7 @@ rte_dev_event_monitor_stop(void)
> >  	close(rte_intr_fd_get(intr_handle));
> >  	rte_intr_instance_free(intr_handle);
> >  	intr_handle = NULL;
> > +	ret = 0;
> >
> >  	monitor_refcount--;
> >
> >
> 
> 
> 
>
  
David Marchand March 1, 2022, 9:57 a.m. UTC | #3
Hello,


The title should start with eal/linux:

On Fri, Feb 11, 2022 at 10:01 AM <wenxuanx.wu@intel.com> wrote:
>
> From: Wenxuan Wu <wenxuanx.wu@intel.com>
>
> The ret value in rte_dev_event_monitor_stop stands for whether the
> monitor has been successfully closed ,and should not bind with
> rte_intr_callback_unregister,so once it goes to the right exit point of
> rte_dev_event_monitor, the ret value should be set to 0.
>
> Also ,the refmonitor count has been carefully evaluated ,the value
> change from 1 to 0 ,so there is no potential memory leak failure.

Please, fix formatting around ',': a space should be after.


Is it a real issue you noticed? Or a theoretical issue based on code
review, reported by a static code analysis tool?


>
> Fixes: 1fef6ced07f3 ("eal/linux: allow multiple starts of event monitor")
> Cc:stable@intel.com

stable@dpdk.org

>
> Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>



> ---
>  lib/eal/linux/eal_dev.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
> index bde55a3d92..4646e8a550 100644
> --- a/lib/eal/linux/eal_dev.c
> +++ b/lib/eal/linux/eal_dev.c
> @@ -384,6 +384,7 @@ rte_dev_event_monitor_stop(void)
>         close(rte_intr_fd_get(intr_handle));
>         rte_intr_instance_free(intr_handle);
>         intr_handle = NULL;
> +       ret = 0;
>
>         monitor_refcount--;
>

This change looks ok to me.
Harman, Long, wdyt?
  
Long Li March 2, 2022, 10:53 a.m. UTC | #4
> Subject: Re: [DPDK] /lib/eal: fix failed to stop device monitor error
> 
> Hello,
> 
> 
> The title should start with eal/linux:
> 
> On Fri, Feb 11, 2022 at 10:01 AM <wenxuanx.wu@intel.com> wrote:
> >
> > From: Wenxuan Wu <wenxuanx.wu@intel.com>
> >
> > The ret value in rte_dev_event_monitor_stop stands for whether the
> > monitor has been successfully closed ,and should not bind with
> > rte_intr_callback_unregister,so once it goes to the right exit point
> > of rte_dev_event_monitor, the ret value should be set to 0.
> >
> > Also ,the refmonitor count has been carefully evaluated ,the value
> > change from 1 to 0 ,so there is no potential memory leak failure.
> 
> Please, fix formatting around ',': a space should be after.
> 
> 
> Is it a real issue you noticed? Or a theoretical issue based on code review,
> reported by a static code analysis tool?
> 
> 
> >
> > Fixes: 1fef6ced07f3 ("eal/linux: allow multiple starts of event
> > monitor") Cc:stable@intel.com
> 
> stable@dpdk.org
> 
> >
> > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
> 
> 
> 
> > ---
> >  lib/eal/linux/eal_dev.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index
> > bde55a3d92..4646e8a550 100644
> > --- a/lib/eal/linux/eal_dev.c
> > +++ b/lib/eal/linux/eal_dev.c
> > @@ -384,6 +384,7 @@ rte_dev_event_monitor_stop(void)
> >         close(rte_intr_fd_get(intr_handle));
> >         rte_intr_instance_free(intr_handle);
> >         intr_handle = NULL;
> > +       ret = 0;
> >
> >         monitor_refcount--;
> >
> 
> This change looks ok to me.
> Harman, Long, wdyt?

The change looks good to me.

Long
  
Thomas Monjalon March 7, 2022, 5:04 p.m. UTC | #5
02/03/2022 11:53, Long Li:
> > Subject: Re: [DPDK] /lib/eal: fix failed to stop device monitor error
> > 
> > Hello,
> > 
> > 
> > The title should start with eal/linux:
> > 
> > On Fri, Feb 11, 2022 at 10:01 AM <wenxuanx.wu@intel.com> wrote:
> > >
> > > From: Wenxuan Wu <wenxuanx.wu@intel.com>
> > >
> > > The ret value in rte_dev_event_monitor_stop stands for whether the
> > > monitor has been successfully closed ,and should not bind with
> > > rte_intr_callback_unregister,so once it goes to the right exit point
> > > of rte_dev_event_monitor, the ret value should be set to 0.
> > >
> > > Also ,the refmonitor count has been carefully evaluated ,the value
> > > change from 1 to 0 ,so there is no potential memory leak failure.
> > 
> > Please, fix formatting around ',': a space should be after.
> > 
> > 
> > Is it a real issue you noticed? Or a theoretical issue based on code review,
> > reported by a static code analysis tool?
> > 
> > 
> > >
> > > Fixes: 1fef6ced07f3 ("eal/linux: allow multiple starts of event
> > > monitor") Cc:stable@intel.com
> > 
> > stable@dpdk.org
> > 
> > >
> > > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
> > 
> > 
> > 
> > > ---
> > >  lib/eal/linux/eal_dev.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c index
> > > bde55a3d92..4646e8a550 100644
> > > --- a/lib/eal/linux/eal_dev.c
> > > +++ b/lib/eal/linux/eal_dev.c
> > > @@ -384,6 +384,7 @@ rte_dev_event_monitor_stop(void)
> > >         close(rte_intr_fd_get(intr_handle));
> > >         rte_intr_instance_free(intr_handle);
> > >         intr_handle = NULL;
> > > +       ret = 0;
> > >
> > >         monitor_refcount--;
> > >
> > 
> > This change looks ok to me.
> > Harman, Long, wdyt?
> 
> The change looks good to me.

Applied, thanks.
  

Patch

diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index bde55a3d92..4646e8a550 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -384,6 +384,7 @@  rte_dev_event_monitor_stop(void)
 	close(rte_intr_fd_get(intr_handle));
 	rte_intr_instance_free(intr_handle);
 	intr_handle = NULL;
+	ret = 0;
 
 	monitor_refcount--;