From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tetsuya Mukawa Subject: Re: [PATCH 2/6] eal: Close file descriptor of uio configuration Date: Fri, 20 Mar 2015 10:54:37 +0900 Message-ID: <550B7DDD.8020100@igel.co.jp> References: <1426155474-1596-4-git-send-email-mukawa@igel.co.jp> <1426584645-28828-1-git-send-email-mukawa@igel.co.jp> <1426584645-28828-3-git-send-email-mukawa@igel.co.jp> <8CEF83825BEC744B83065625E567D7C2049F3B56@IRSMSX108.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable To: "Iremonger, Bernard" , "dev-VfR2kkLFssw@public.gmane.org" Return-path: In-Reply-To: <8CEF83825BEC744B83065625E567D7C2049F3B56-kPTMFJFq+rEMvF1YICWikbfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On 2015/03/20 1:04, Iremonger, Bernard wrote: >> -----Original Message----- >> From: Tetsuya Mukawa [mailto:mukawa-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org] >> Sent: Tuesday, March 17, 2015 9:31 AM >> To: dev-VfR2kkLFssw@public.gmane.org >> Cc: Iremonger, Bernard; Richardson, Bruce; Tetsuya Mukawa >> Subject: [PATCH 2/6] eal: Close file descriptor of uio configuration >> >> When pci_uio_unmap_resource() is called, a file descriptor that is use= d for uio configuration should be >> closed. >> >> Signed-off-by: Tetsuya Mukawa >> --- >> lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_ea= l/linuxapp/eal/eal_pci_uio.c >> index 9cdf24f..b971ec9 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c >> +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c >> @@ -459,8 +459,14 @@ pci_uio_unmap_resource(struct rte_pci_device *dev= ) >> >> /* close fd if in primary process */ > Hi Tetsuya, > > Should there be a check for the primary process before closing both of = the these files? Hi Bernard, Yes, the check is done like below. (But it doesn't appear in this patch.) void pci_uio_unmap_resource(struct rte_pci_device *dev) { struct mapped_pci_resource *uio_res; struct mapped_pci_res_list *uio_res_list =3D RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); if (dev =3D=3D NULL) return; /* find an entry for the device */ uio_res =3D pci_uio_find_resource(dev); if (uio_res =3D=3D NULL) return; /* secondary processes - just free maps */ if (rte_eal_process_type() !=3D RTE_PROC_PRIMARY) return pci_uio_unmap(uio_res); TAILQ_REMOVE(uio_res_list, uio_res, next); (snip) /* close fd if in primary process */ close(dev->intr_handle.fd); dev->intr_handle.fd =3D -1; (snip) } Regards, Tetsuya > Regards, > > Bernard. > >> close(dev->intr_handle.fd); >> - >> dev->intr_handle.fd =3D -1; >> + >> + /* close cfg_fd if in primary process */ >> + if (dev->intr_handle.uio_cfg_fd >=3D 0) { >> + close(dev->intr_handle.uio_cfg_fd); >> + dev->intr_handle.uio_cfg_fd =3D -1; >> + } >> + >> dev->intr_handle.type =3D RTE_INTR_HANDLE_UNKNOWN; } #endif /* >> RTE_LIBRTE_EAL_HOTPLUG */ >> -- >> 1.9.1