DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Tetsuya Mukawa <tetsuya.mukawa.1@gmail.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] About 'CONFIG_RTE_EAL_UNBIND_PORTS'
Date: Mon, 2 Sep 2013 17:57:38 +0200	[thread overview]
Message-ID: <201309021757.38807.thomas.monjalon@6wind.com> (raw)
In-Reply-To: <CANCx15TfHxEYyiX+c4oma7R+yma0FXnJ9+QGT_fwk6OPZp2Wow@mail.gmail.com>

29/08/2013 09:54, Tetsuya Mukawa :
> Someone, could you please let me know what is a case that I need to
> enable 'CONFIG_RTE_EAL_UNBIND_PORTS'?

In DPDK 1.3, the UNBIND option is intended to restore the previous state
when exiting a DPDK application.
In case of devices bound to igb_uio, it will re-bind them to their original 
driver (e1000/igb/ixgbe).
It has no effect with virtio.

The bug that you have described does not appear with igb_uio drivers because 
fd is initialized in pci_map_resource().
But in case of virtio, pci_map_resource() is not called.

> I guess that the fd should be initialized as '-1', but actually it is
> initialized as '0'.
> So during finalization, pci_exit_process() may try to close STDIN.
> (But I am not sure why closing STDIN returns error. STDIN might be
> already closed by somewhere?)
> 
> Anyway, here is a patch I wrote to fix the issue.
> Is this correct?
> --------------------------------------
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c
> b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index c793148..7bb03e9 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -519,6 +519,8 @@ pci_scan_one(const char *dirname, uint16_t domain,
> uint8_t bus,
>         dev->addr.devid = devid;
>         dev->addr.function = function;
> 
> +       dev->intr_handle.fd = -1;
> +
>         /* get vendor id */
>         rte_snprintf(filename, sizeof(filename), "%s/vendor", dirname);
>         if (eal_parse_sysfs_value(filename, &tmp) < 0) {
> @@ -718,7 +720,8 @@ pci_exit_process(struct rte_pci_device *dev)
>                 RTE_LOG(ERR, EAL, "Error with munmap\n");
>                 return -1;
>         }
> -       if (close(dev->intr_handle.fd) == -1){
> +       if ((dev->intr_handle.fd != -1) &&
> +               (close(dev->intr_handle.fd) == -1)) {
>                 RTE_LOG(ERR, EAL, "Error closing interrupt handle\n");
>                 return -1;
>         }
> --------------------------------------

It looks good.
Could you send it as a real patch with a commit log ?

Thank you
-- 
Thomas

  reply	other threads:[~2013-09-02 15:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29  7:54 Tetsuya Mukawa
2013-09-02 15:57 ` Thomas Monjalon [this message]
2013-09-03  1:39   ` Tetsuya Mukawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201309021757.38807.thomas.monjalon@6wind.com \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    --cc=tetsuya.mukawa.1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).