From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51]) by dpdk.org (Postfix) with ESMTP id 48B1E1F3 for ; Mon, 2 Sep 2013 17:57:15 +0200 (CEST) Received: by mail-ee0-f51.google.com with SMTP id c1so2403130eek.24 for ; Mon, 02 Sep 2013 08:57:48 -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:organization:to:subject:date:user-agent:cc :references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=mx4bqMFqUqB4sBSjCZugzh38+gi50rEwX7fVOlDqm1I=; b=hms6cxw64k5P+F2e8bYnuKRaCsCDqO0Z95pajEPw98hKJkhgO+O5wfH7nimtxkHZ5i c55ZjkL4I9MAQSJKq4Bwj/jQxBc+mrfRVy17ADfEekGJicFMbe/wcUczB3v/41DHMrzf tYJaLlHT36AenEWlB3ySAZjAgyanGwzUiNtGNmSqNWCWjr1utn4jqdKyt09z+i5/el15 cENT4eZzdgDnbFoLGB6Zc+rv9AUnnyu7WPWQvFmccjLJuTnhh0cN2XaVq0RsKxyPKEnI kTQA2HW6A6b18jTFs4XjhKVtQb7eAeRaHnojNVNzvIPNWKSpoXnbLQDN2Db2hlX9R445 fkkQ== X-Gm-Message-State: ALoCoQlIg8QK/N3YbXWbm6UOPmt1/aoPV7G+M6Ccyq/euYdnH8Gqzfvv36uR+ehOJVyssKAAeH3k X-Received: by 10.14.181.132 with SMTP id l4mr3805241eem.77.1378137468597; Mon, 02 Sep 2013 08:57:48 -0700 (PDT) Received: from angus.localnet (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id t6sm23299976eel.12.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Sep 2013 08:57:47 -0700 (PDT) From: Thomas Monjalon Organization: 6WIND To: Tetsuya Mukawa Date: Mon, 2 Sep 2013 17:57:38 +0200 User-Agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201309021757.38807.thomas.monjalon@6wind.com> Cc: dev@dpdk.org Subject: Re: [dpdk-dev] About 'CONFIG_RTE_EAL_UNBIND_PORTS' X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Sep 2013 15:57:15 -0000 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