DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH] pci:don't insert an unbound device to pci_device_list in pci_scan_one
@ 2016-06-25 16:53 Rugang Chen
  2016-06-27 10:31 ` Ferruh Yigit
  0 siblings, 1 reply; 4+ messages in thread
From: Rugang Chen @ 2016-06-25 16:53 UTC (permalink / raw)
  To: dev; +Cc: Rugang Chen

Hi all,

Can you take a look at the patch and send out your comments?

It's first time for me to work with git as this way, not sure if I'm doing
right on the process.

There're two emails for this patch. The second one is to correct the first
one.

On Saturday, June 25, 2016, Rugang Chen <rugangchen2011@gmail.com> wrote:

> If a device isn't bound by any uio driver (vfio-pci, igb_uio,
> uio_pci_generic)
> and is expected to owned by a kernel space driver, here it's still
> inserted to
> pci_device_list.
>
> This may cause application based on dpdk fetch the device by accident and
> then
> the device is hanlded by dpdk.
>
> For safe, skip it from pci_device_list as if it's unbound, dpdk won't want
> to
> use it.
> ---
>  lib/librte_eal/linuxapp/eal/eal_pci.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c
> b/lib/librte_eal/linuxapp/eal/eal_pci.c
> index f63febc..432d2e8 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> @@ -392,8 +392,12 @@ pci_scan_one(const char *dirname, uint16_t domain,
> uint8_t bus,
>          * fetch it from pci_device_list by accident and then dpdk handles
> it. Kernel
>          * space driver maybe wants to own it.
>          */
> -       if (dev->kdrv == RTE_KDRV_NONE)
> +       if (dev->kdrv == RTE_KDRV_NONE) {
> +               RTE_LOG(WARNING, EAL, "Skip ubound device\n");
> +               free(dev);
>                 return 0;
> +       }
> +
>         /* device is valid, add in list (sorted) */
>         if (TAILQ_EMPTY(&pci_device_list)) {
>                 TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
> --
> 2.1.4
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] pci:don't insert an unbound device to pci_device_list in pci_scan_one
  2016-06-25 16:53 [dpdk-dev] [PATCH] pci:don't insert an unbound device to pci_device_list in pci_scan_one Rugang Chen
@ 2016-06-27 10:31 ` Ferruh Yigit
  0 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2016-06-27 10:31 UTC (permalink / raw)
  To: Rugang Chen, dev

On 6/25/2016 5:53 PM, Rugang Chen wrote:
> Hi all,
> 
> Can you take a look at the patch and send out your comments?
> 
> It's first time for me to work with git as this way, not sure if I'm doing
> right on the process.
> 
> There're two emails for this patch. The second one is to correct the first
> one.
> 

Hi Rugang,

Since your second patch updates (only) your changes in first patch, I
think you can merge them into single patch and send as v2 of first patch.

Please remember to run checkpatch and check-git-log on your patches and
be sure there is no error to not lose time.

More detail on:
http://dpdk.org/doc/guides/contributing/patches.html

Thanks,
ferruh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH] pci: don't insert an unbound device to pci_device_list in pci_scan_one
  2016-06-25  0:45 Rugang Chen
@ 2016-06-25 10:30 ` Rugang Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Rugang Chen @ 2016-06-25 10:30 UTC (permalink / raw)
  To: dev; +Cc: Rugang Chen

If a device isn't bound by any uio driver (vfio-pci, igb_uio, uio_pci_generic)
and is expected to owned by a kernel space driver, here it's still inserted to
pci_device_list.

This may cause application based on dpdk fetch the device by accident and then
the device is hanlded by dpdk.

For safe, skip it from pci_device_list as if it's unbound, dpdk won't want to
use it.
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f63febc..432d2e8 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -392,8 +392,12 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
 	 * fetch it from pci_device_list by accident and then dpdk handles it. Kernel
 	 * space driver maybe wants to own it.
 	 */
-	if (dev->kdrv == RTE_KDRV_NONE)
+	if (dev->kdrv == RTE_KDRV_NONE) {
+		RTE_LOG(WARNING, EAL, "Skip ubound device\n");
+		free(dev);
 		return 0;
+	}
+
 	/* device is valid, add in list (sorted) */
 	if (TAILQ_EMPTY(&pci_device_list)) {
 		TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
-- 
2.1.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH] pci:don't insert an unbound device to pci_device_list in pci_scan_one
@ 2016-06-25  0:45 Rugang Chen
  2016-06-25 10:30 ` [dpdk-dev] [PATCH] pci: don't " Rugang Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Rugang Chen @ 2016-06-25  0:45 UTC (permalink / raw)
  To: dev; +Cc: Rugang Chen

If a device isn't bound by any uio driver (vfio-pci, igb_uio, uio_pci_generic)
and is expected to owned by a kernel space driver, here it's still inserted to
pci_device_list.

This may cause application based on dpdk fetch the device by accident and then
the device is hanlded by dpdk.

For safe, skip it from pci_device_list as if it's unbound, dpdk won't want to
use it.

Signed-off-by: Rugang Chen <rugangchen2011@gmail.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index f9c3efd..f63febc 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -388,6 +388,12 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
 	} else
 		dev->kdrv = RTE_KDRV_NONE;
 
+	/* Ignore device that isn't bound with any uio driver, then application won't
+	 * fetch it from pci_device_list by accident and then dpdk handles it. Kernel
+	 * space driver maybe wants to own it.
+	 */
+	if (dev->kdrv == RTE_KDRV_NONE)
+		return 0;
 	/* device is valid, add in list (sorted) */
 	if (TAILQ_EMPTY(&pci_device_list)) {
 		TAILQ_INSERT_TAIL(&pci_device_list, dev, next);
-- 
2.1.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-27 10:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-25 16:53 [dpdk-dev] [PATCH] pci:don't insert an unbound device to pci_device_list in pci_scan_one Rugang Chen
2016-06-27 10:31 ` Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2016-06-25  0:45 Rugang Chen
2016-06-25 10:30 ` [dpdk-dev] [PATCH] pci: don't " Rugang Chen

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).