[dpdk-dev,v3] Restore support for virtio on FreeBSD

Message ID 1428927569-98070-1-git-send-email-razamir22@gmail.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Raz Amir April 13, 2015, 12:19 p.m. UTC
  Fixes: 8a312224bcde ("eal/bsd: fix fd leak")

Signed-off-by: Raz Amir <razamir22@gmail.com>
---
 lib/librte_eal/bsdapp/eal/eal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon April 13, 2015, 12:54 p.m. UTC | #1
Please provide more information in the commit message.
We need to know what was the problem (crash) in the git history.
Then when doing git blame, we'll have the full explanation.

2015-04-13 15:19, Raz Amir:
> Fixes: 8a312224bcde ("eal/bsd: fix fd leak")
> 
> Signed-off-by: Raz Amir <razamir22@gmail.com>
> ---
>  lib/librte_eal/bsdapp/eal/eal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
> index 871d5f4..e20f915 100644
> --- a/lib/librte_eal/bsdapp/eal/eal.c
> +++ b/lib/librte_eal/bsdapp/eal/eal.c
> @@ -426,7 +426,7 @@ rte_eal_iopl_init(void)
>  	fd = open("/dev/io", O_RDWR);
>  	if (fd < 0)
>  		return -1;
> -	close(fd);
> +	/* keep fd open for iopl */

Yes we need a comment but "for iopl" is not descriptive and
not very accurate as iopl is a Linux mechanism.

>  	return 0;
>  }

Thanks
  
Ouyang Changchun April 14, 2015, 2:32 a.m. UTC | #2
Hi 

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Monday, April 13, 2015 8:55 PM
> To: Raz Amir
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3] Restore support for virtio on FreeBSD
> 
> Please provide more information in the commit message.
> We need to know what was the problem (crash) in the git history.
> Then when doing git blame, we'll have the full explanation.
> 
> 2015-04-13 15:19, Raz Amir:
> > Fixes: 8a312224bcde ("eal/bsd: fix fd leak")
> >
> > Signed-off-by: Raz Amir <razamir22@gmail.com>
> > ---
> >  lib/librte_eal/bsdapp/eal/eal.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/bsdapp/eal/eal.c
> > b/lib/librte_eal/bsdapp/eal/eal.c index 871d5f4..e20f915 100644
> > --- a/lib/librte_eal/bsdapp/eal/eal.c
> > +++ b/lib/librte_eal/bsdapp/eal/eal.c
> > @@ -426,7 +426,7 @@ rte_eal_iopl_init(void)
> >  	fd = open("/dev/io", O_RDWR);
> >  	if (fd < 0)
> >  		return -1;
> > -	close(fd);
> > +	/* keep fd open for iopl */

Copy and paste my comment into this new patch:
Would you pls think about this solution?
Declare a static var to keep the fd which is opened for freebsd;
Then define a deinit function for virtio device, Inside the deinit function, close the fd which was opened in init stage.
Done.

thanks
Changchun
  
Raz Amir April 14, 2015, 4:07 p.m. UTC | #3
Thomas, I will add more information to the commit message, but regarding
your feedback on the iopl comment, it is called also iopl on FreeBSD.
See this link to FreeBSD source code, for the io driver code - the flag name
is PSL_IOPL:
https://github.com/freebsd/freebsd/blob/master/sys/i386/i386/io.c#L38

Ouyang, I will implement your suggestion in the next patch version I submit.


-----Original Message-----
From: Ouyang, Changchun [mailto:changchun.ouyang@intel.com] 
Sent: 14 April 2015 05:33
To: Thomas Monjalon; Raz Amir
Cc: dev@dpdk.org; Ouyang, Changchun
Subject: RE: [dpdk-dev] [PATCH v3] Restore support for virtio on FreeBSD

Hi 

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Monday, April 13, 2015 8:55 PM
> To: Raz Amir
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3] Restore support for virtio on 
> FreeBSD
> 
> Please provide more information in the commit message.
> We need to know what was the problem (crash) in the git history.
> Then when doing git blame, we'll have the full explanation.
> 
> 2015-04-13 15:19, Raz Amir:
> > Fixes: 8a312224bcde ("eal/bsd: fix fd leak")
> >
> > Signed-off-by: Raz Amir <razamir22@gmail.com>
> > ---
> >  lib/librte_eal/bsdapp/eal/eal.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/librte_eal/bsdapp/eal/eal.c 
> > b/lib/librte_eal/bsdapp/eal/eal.c index 871d5f4..e20f915 100644
> > --- a/lib/librte_eal/bsdapp/eal/eal.c
> > +++ b/lib/librte_eal/bsdapp/eal/eal.c
> > @@ -426,7 +426,7 @@ rte_eal_iopl_init(void)
> >  	fd = open("/dev/io", O_RDWR);
> >  	if (fd < 0)
> >  		return -1;
> > -	close(fd);
> > +	/* keep fd open for iopl */

Copy and paste my comment into this new patch:
Would you pls think about this solution?
Declare a static var to keep the fd which is opened for freebsd; Then define
a deinit function for virtio device, Inside the deinit function, close the
fd which was opened in init stage.
Done.

thanks
Changchun
  

Patch

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 871d5f4..e20f915 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -426,7 +426,7 @@  rte_eal_iopl_init(void)
 	fd = open("/dev/io", O_RDWR);
 	if (fd < 0)
 		return -1;
-	close(fd);
+	/* keep fd open for iopl */
 	return 0;
 }