Message ID | 1426584645-28828-3-git-send-email-mukawa@igel.co.jp (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 763E99AAA; Tue, 17 Mar 2015 10:31:13 +0100 (CET) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by dpdk.org (Postfix) with ESMTP id C28379AA5 for <dev@dpdk.org>; Tue, 17 Mar 2015 10:31:09 +0100 (CET) Received: by padcy3 with SMTP id cy3so4628020pad.3 for <dev@dpdk.org>; Tue, 17 Mar 2015 02:31:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ks++GGnax/5qz8f9XRfyYZhZdUe3HL+5wz/GuaOR6jo=; b=lxx5377DM0tY9zZNDar4wt66ylZOf1EqPS30lKIfBP+6AedQyRPHoXhSEhXLcyhOP9 LbrQlerwUJSGqZZXaiEBXhzvWJjiEXCZINW9s5CA/vvp0W+Rz3Z3xK5l16u20WpOZ91q NvJElmihAA9w6g8OrHAbxabhAHn3cU3ChvN+9LZ/jBhqkU63+mpoyD6lB/546K89sF6K aolpvUxbv2wvaalu/4xqovySBHZZsctLg3HEPy/9IwHL7ZgZbv9yyBr+KV1KEfiBl9YR +GrmKM12DJfK+4uFKPFa5aLmeXjG+baCkQa5DkfvJpC1n8SgITccnbvtMFH69yhce5pR Et6g== X-Gm-Message-State: ALoCoQkSaYJhMuHkluPXPvm9GGb98fg/O9VEJK/HJIMUBypNGhN1HhG+JsJgYVo09cudSCIMHXEg X-Received: by 10.66.100.138 with SMTP id ey10mr142569720pab.142.1426584669121; Tue, 17 Mar 2015 02:31:09 -0700 (PDT) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id ce1sm21354243pdb.34.2015.03.17.02.31.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Mar 2015 02:31:08 -0700 (PDT) From: Tetsuya Mukawa <mukawa@igel.co.jp> To: dev@dpdk.org Date: Tue, 17 Mar 2015 18:30:41 +0900 Message-Id: <1426584645-28828-3-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426584645-28828-1-git-send-email-mukawa@igel.co.jp> References: <1426155474-1596-4-git-send-email-mukawa@igel.co.jp> <1426584645-28828-1-git-send-email-mukawa@igel.co.jp> Subject: [dpdk-dev] [PATCH 2/6] eal: Close file descriptor of uio configuration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Tetsuya Mukawa
March 17, 2015, 9:30 a.m. UTC
When pci_uio_unmap_resource() is called, a file descriptor that is used
for uio configuration should be closed.
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Comments
On Tue, Mar 17, 2015 at 10:30 AM, Tetsuya Mukawa <mukawa@igel.co.jp> wrote: > When pci_uio_unmap_resource() is called, a file descriptor that is used > for uio configuration should be closed. > > Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp> > --- > 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_eal/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 */ > close(dev->intr_handle.fd); > - > dev->intr_handle.fd = -1; > + > + /* close cfg_fd if in primary process */ + if (dev->intr_handle.uio_cfg_fd >= 0) { > + close(dev->intr_handle.uio_cfg_fd); > + dev->intr_handle.uio_cfg_fd = -1; > + } > + > dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; > } > #endif /* RTE_LIBRTE_EAL_HOTPLUG */ > Hum, why check for < 0 value ? There is no such check for intr_handle.fd and I can see no reason why we should behave differently.
> -----Original Message----- > From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp] > Sent: Tuesday, March 17, 2015 9:31 AM > To: dev@dpdk.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 used for uio configuration should be > closed. > > Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp> > --- > 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_eal/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? Regards, Bernard. > close(dev->intr_handle.fd); > - > dev->intr_handle.fd = -1; > + > + /* close cfg_fd if in primary process */ > + if (dev->intr_handle.uio_cfg_fd >= 0) { > + close(dev->intr_handle.uio_cfg_fd); > + dev->intr_handle.uio_cfg_fd = -1; > + } > + > dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; } #endif /* > RTE_LIBRTE_EAL_HOTPLUG */ > -- > 1.9.1
On 2015/03/19 0:19, David Marchand wrote: > On Tue, Mar 17, 2015 at 10:30 AM, Tetsuya Mukawa <mukawa@igel.co.jp > <mailto:mukawa@igel.co.jp>> wrote: > > When pci_uio_unmap_resource() is called, a file descriptor that is > used > for uio configuration should be closed. > > Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp > <mailto:mukawa@igel.co.jp>> > --- > 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_eal/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 */ > close(dev->intr_handle.fd); > - > dev->intr_handle.fd = -1; > + > + /* close cfg_fd if in primary process */ > > + if (dev->intr_handle.uio_cfg_fd >= 0) { > + close(dev->intr_handle.uio_cfg_fd); > + dev->intr_handle.uio_cfg_fd = -1; > + } > + > dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; > } > #endif /* RTE_LIBRTE_EAL_HOTPLUG */ > > > Hum, why check for < 0 value ? > There is no such check for intr_handle.fd and I can see no reason why > we should behave differently. > Hi David, There is a reason, but 'if-condition' should move to later patch. When we move this function to eal common, bsdapp will not use cfg_fd at all. (Nic uio of BSD will not use this file descriptor.) So I added the 'if-condition' like above. But, I will move this fixing in later patch that actually consolidate this function. Thanks, Tetsuya > > -- > David Marchand
On 2015/03/20 1:04, Iremonger, Bernard wrote: >> -----Original Message----- >> From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp] >> Sent: Tuesday, March 17, 2015 9:31 AM >> To: dev@dpdk.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 used for uio configuration should be >> closed. >> >> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp> >> --- >> 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_eal/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 = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list); if (dev == NULL) return; /* find an entry for the device */ uio_res = pci_uio_find_resource(dev); if (uio_res == NULL) return; /* secondary processes - just free maps */ if (rte_eal_process_type() != 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 = -1; (snip) } Regards, Tetsuya > Regards, > > Bernard. > >> close(dev->intr_handle.fd); >> - >> dev->intr_handle.fd = -1; >> + >> + /* close cfg_fd if in primary process */ >> + if (dev->intr_handle.uio_cfg_fd >= 0) { >> + close(dev->intr_handle.uio_cfg_fd); >> + dev->intr_handle.uio_cfg_fd = -1; >> + } >> + >> dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; } #endif /* >> RTE_LIBRTE_EAL_HOTPLUG */ >> -- >> 1.9.1
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/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 */ close(dev->intr_handle.fd); - dev->intr_handle.fd = -1; + + /* close cfg_fd if in primary process */ + if (dev->intr_handle.uio_cfg_fd >= 0) { + close(dev->intr_handle.uio_cfg_fd); + dev->intr_handle.uio_cfg_fd = -1; + } + dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; } #endif /* RTE_LIBRTE_EAL_HOTPLUG */