Skip to contentSkip to conversation

nfp driver fixes

RFC In review Aaron Conole 4 participants 22 messages Apr 12, 2018 – Apr 20, 2018 Network drivers

lore
Share & tools
lore
#0 lore raw

cover nfp driver fixes

Two fixes, one which is fairly obvious (1/2), the other which may allow support of non-root users. These patches are only compile tested which is why they are submitted as RFC. After a proper test, will resubmit them as PATCH (with any suggested / recommended changes).

Aaron Conole (2):
nfp: unlink the appropriate lock file
nfp: allow for non-root user

 drivers/net/nfp/nfp_nfpu.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
Signature · 1 line
2.14.3
#1 lore raw

RFC 1/2 nfp: unlink the appropriate lock file

The nfpu_close needs to unlink the lock file associated with the nfp descriptor, not lock file 0.

Fixes d12206e00590 ("net/nfp: add NSP user space interface")
---
 drivers/net/nfp/nfp_nfpu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/nfp/nfp_nfpu.c +5 -1
index f11afef35..2ed985ff4 100644
@@ -101,8 +101,12 @@ nfpu_open(struct rte_pci_device *pci_dev, nfpu_desc_t *desc, int nfp)
 int
 nfpu_close(nfpu_desc_t *desc)
 {
+	char lockname[30];
+
 	rte_free(desc->nspu);
 	close(desc->lock);
-	unlink("/var/lock/nfp0");
+
+	snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
+	unlink(lockname);
 	return 0;
 }
Signature · 1 line
2.14.3
#2 lore raw

Re: [RFC 1/2] nfp: unlink the appropriate lock file

Although the patch is correct, the truth is there was not option for locks but "nfp0", because the PMD did not support more than one NFP card.

After commit with CPP support, the PMD can support more than one NFP card, but this interface is not supported anymore and this file was removed.

is this patch coming from some code revision or from a problem you found?

Quoted 34 lines · Aaron Conole

The nfpu_close needs to unlink the lock file associated with the nfp descriptor, not lock file 0.

Fixes d12206e00590 ("net/nfp: add NSP user space interface")
---
 drivers/net/nfp/nfp_nfpu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/nfp/nfp_nfpu.c +5 -1
index f11afef35..2ed985ff4 100644
@@ -101,8 +101,12 @@ nfpu_open(struct rte_pci_device *pci_dev, nfpu_desc_t
 *desc, int nfp)
 int
 nfpu_close(nfpu_desc_t *desc)
 {
+       char lockname[30];
+
        rte_free(desc->nspu);
        close(desc->lock);
-       unlink("/var/lock/nfp0");
+
+       snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
+       unlink(lockname);
        return 0;

}
--
2.14.3

#3 lore raw

Re: [RFC 1/2] nfp: unlink the appropriate lock file

Quoted 7 lines · Alejandro Lucero

Although the patch is correct, the truth is there was not option for locks but "nfp0", because the PMD did not support more than one NFP card.

After commit with CPP support, the PMD can support more than one NFP card, but this interface is not supported anymore and this file was removed.

is this patch coming from some code revision or from a problem you found?

Just a code review - we were reported a problem initializing the driver, and in looking at the lock/unlock code, it seems that it was always releasing the nfp0 lock. Good to know that in practice it likely wouldn't cause real harm. I intend to resubmit this as is.

Thanks, Alejandro!

Quoted 34 lines · Aaron Conole

The nfpu_close needs to unlink the lock file associated with the nfp descriptor, not lock file 0.

Fixes d12206e00590 ("net/nfp: add NSP user space interface")

---

  drivers/net/nfp/nfp_nfpu.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_nfpu.c b/drivers/net/nfp/nfp_nfpu.c index f11afef35..2ed985ff4 100644
--- a/drivers/net/nfp/nfp_nfpu.c
+++ b/drivers/net/nfp/nfp_nfpu.c
@@ -101,8 +101,12 @@ nfpu_open(struct rte_pci_device *pci_dev, nfpu_desc_t *desc, int nfp)
int
nfpu_close(nfpu_desc_t *desc)
{
+ char lockname[30];
+

         rte_free(desc->nspu);
         close(desc->lock);
 -       unlink("/var/lock/nfp0");
 +
 +       snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
 +       unlink(lockname);
         return 0;

}
--
2.14.3

#4 lore raw

RFC 2/2 nfp: allow for non-root user

In reply to Aaron Conole

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root. However, some distributions and applications (notably ovs 2.8+ on RHEL/Fedora) run as a non-root user.

---
 drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/net/nfp/nfp_nfpu.c +18 -5
index 2ed985ff4..ae2e07220 100644
@@ -18,6 +18,22 @@
 #define NFP_CFG_EXP_BAR         7
 
 #define NFP_CFG_EXP_BAR_CFG_BASE	0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */
+static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t *desc)
+{
+	const char *dir = "/var/lock";
+	const char *home_dir = getenv("HOME");
+
+	if (getuid() != 0 && home_dir != NULL)
+		dir = home_dir;
+
+	/* use current prefix as file path */
+	snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+			desc->nfp);
+}
 
 /* There could be other NFP userspace tools using the NSP interface.
  * Make sure there is no other process using it and locking the access for
@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)
 	struct flock lock;
 	char lockname[30];
 
-	memset(&lock, 0, sizeof(lock));
-
-	snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
+	nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
 
 	/* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH */
 	desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
@@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
 	rte_free(desc->nspu);
 	close(desc->lock);
 
-	snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
-	unlink(lockname);
+	nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
 	return 0;
 }
Signature · 1 line
2.14.3
#5 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

Again, this patch is correct, but because NFP PMD needs to access /sys/bus/pci/devices/$DEVICE_PCI_STRING/resource$RESOURCE_ID, and these files have just read/write accesses for root, I do not know if this is really necessary.

Being honest, I have not used a DPDK app with NFP PMD and not being root. Does it work with non-root users and other PMDs with same requirements regarding sysfs resource files?

Quoted 62 lines · Aaron Conole

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root. However, some distributions and applications (notably ovs 2.8+ on RHEL/Fedora) run as a non-root user.

---
 drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/net/nfp/nfp_nfpu.c +17 -3
index 2ed985ff4..ae2e07220 100644
@@ -18,6 +18,22 @@
 #define NFP_CFG_EXP_BAR         7
 
 #define NFP_CFG_EXP_BAR_CFG_BASE       0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */
+static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t *desc)
+{
+       const char *dir = "/var/lock";
+       const char *home_dir = getenv("HOME");
+
+       if (getuid() != 0 && home_dir != NULL)
+               dir = home_dir;
+
+       /* use current prefix as file path */
+       snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+                       desc->nfp);
+}
 
 /* There could be other NFP userspace tools using the NSP interface.
  * Make sure there is no other process using it and locking the access for
@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)
        struct flock lock;
        char lockname[30];
 
-       memset(&lock, 0, sizeof(lock));
-
-       snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
+       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
 
        /* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
 */
        desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
drivers/net/nfp/nfp_nfpu.c +1 -3
@@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
        rte_free(desc->nspu);
        close(desc->lock);
 
-       snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
-       unlink(lockname);
+       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
        return 0;
 }
--

2.14.3

#6 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

Quoted 6 lines · Alejandro Lucero

Again, this patch is correct, but because NFP PMD needs to access /sys/bus/pci/devices/$DEVICE_PCI_STRING/resource$RESOURCE_ID, and these files have just read/write accesses for root, I do not know if this is really necessary.

Being honest, I have not used a DPDK app with NFP PMD and not being root. Does it work with non-root users and other PMDs with same requirements regarding sysfs resource files?

We do run as non-root user definitely with Intel PMDs.

I'm not very sure about other vendors, but I think mlx pmd runs as non-root user (and it was modified to move off of sysfs for that reason[1]).

I'll continue to push for more information from the testing side to find out though.

[1]: http://dpdk.org/ml/archives/dev/2018-February/090586.html

Quoted 61 lines · Aaron Conole

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root. However, some distributions and applications (notably ovs 2.8+ on RHEL/Fedora) run as a non-root user.

---

  drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/nfp_nfpu.c b/drivers/net/nfp/nfp_nfpu.c index 2ed985ff4..ae2e07220 100644
--- a/drivers/net/nfp/nfp_nfpu.c
+++ b/drivers/net/nfp/nfp_nfpu.c
@@ -18,6 +18,22 @@
#define NFP_CFG_EXP_BAR 7

#define NFP_CFG_EXP_BAR_CFG_BASE 0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */ +static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t *desc) +{
+ const char *dir = "/var/lock";
+ const char *home_dir = getenv("HOME");
+
+ if (getuid() != 0 && home_dir != NULL)
+ dir = home_dir;
+
+ /* use current prefix as file path */
+ snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+ desc->nfp);
+}

/* There could be other NFP userspace tools using the NSP interface.
* Make sure there is no other process using it and locking the access for
@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)

         struct flock lock;
         char lockname[30];

- memset(&lock, 0, sizeof(lock));
-
- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
+ nspu_get_lockfile_path(lockname, sizeof(lockname), desc);

         /* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH */
         desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
 @@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
         rte_free(desc->nspu);
         close(desc->lock);
 -       snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
 -       unlink(lockname);
 +       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
         return 0;

}
--
2.14.3

#7 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

Quoted 9 lines · Aaron Conole
Quoted 2 lines · Alejandro Lucero

Again, this patch is correct, but because NFP PMD needs to access /sys/bus/pci/devices/$DEVICE_PCI_STRING/resource$RESOURCE_ID, and these

files have just

Quoted 3 lines

read/write accesses for root, I do not know if this is really necessary.

Being honest, I have not used a DPDK app with NFP PMD and not being

root. Does it work

Quoted 10 lines
Quoted 1 line

with non-root users and other PMDs with same requirements regarding

sysfs resource files?

We do run as non-root user definitely with Intel PMDs.

I'm not very sure about other vendors, but I think mlx pmd runs as non-root user (and it was modified to move off of sysfs for that reason[1]).

It is possible to not rely on sysfs resource files if device is attached to VFIO, but I think that is a must with UIO.

Quoted 72 lines

I'll continue to push for more information from the testing side to find out though.

[1]: http://dpdk.org/ml/archives/dev/2018-February/090586.html

Quoted 1 line

On Fri, Apr 13, 2018 at 12:22 AM, Aaron Conole <[email protected]>

Quoted 36 lines · wrote:

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root. However, some distributions and applications (notably ovs 2.8+ on RHEL/Fedora) run as a non-root user.

---

  drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/nfp_nfpu.c b/drivers/net/nfp/nfp_nfpu.c index 2ed985ff4..ae2e07220 100644
--- a/drivers/net/nfp/nfp_nfpu.c
+++ b/drivers/net/nfp/nfp_nfpu.c
@@ -18,6 +18,22 @@
#define NFP_CFG_EXP_BAR 7

#define NFP_CFG_EXP_BAR_CFG_BASE 0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */ +static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t *desc) +{
+ const char *dir = "/var/lock";
+ const char *home_dir = getenv("HOME");
+
+ if (getuid() != 0 && home_dir != NULL)
+ dir = home_dir;
+
+ /* use current prefix as file path */
+ snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+ desc->nfp);
+}

Quoted 2 lines

/* There could be other NFP userspace tools using the NSP interface.
* Make sure there is no other process using it and locking the access

for

Quoted 7 lines

@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)

         struct flock lock;
         char lockname[30];

- memset(&lock, 0, sizeof(lock));
-
- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 3 lines

+ nspu_get_lockfile_path(lockname, sizeof(lockname), desc);

         /* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |

S_IWOTH */

Quoted 6 lines
         desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
 @@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
         rte_free(desc->nspu);
         close(desc->lock);

- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 6 lines

- unlink(lockname);

 +       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
         return 0;

}
--
2.14.3

#8 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

I have seen that VFIO also requires explicitly to set the right permissions for non-root users to VFIO groups under /dev/vfio.

I assume then that running OVS or other DPDK apps as non-root is possible, although requiring those explicit permissions changes, and therefore this patch is necessary.

Adding stable@ and Thomas for discussing how can this be added to stable DPDK versions even if this is not going to be a patch for current DPDK version.

Quoted 102 lines · Alejandro Lucero
Quoted 9 lines · Aaron Conole
Quoted 2 lines · Alejandro Lucero

Again, this patch is correct, but because NFP PMD needs to access /sys/bus/pci/devices/$DEVICE_PCI_STRING/resource$RESOURCE_ID, and

these files have just

Quoted 3 lines

read/write accesses for root, I do not know if this is really necessary.

Being honest, I have not used a DPDK app with NFP PMD and not being

root. Does it work

Quoted 10 lines
Quoted 1 line

with non-root users and other PMDs with same requirements regarding

sysfs resource files?

We do run as non-root user definitely with Intel PMDs.

I'm not very sure about other vendors, but I think mlx pmd runs as non-root user (and it was modified to move off of sysfs for that reason[1]).

It is possible to not rely on sysfs resource files if device is attached to VFIO, but I think that is a must with UIO.

Quoted 72 lines

I'll continue to push for more information from the testing side to find out though.

[1]: http://dpdk.org/ml/archives/dev/2018-February/090586.html

Quoted 1 line

On Fri, Apr 13, 2018 at 12:22 AM, Aaron Conole <[email protected]>

Quoted 36 lines · wrote:

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root. However, some distributions and applications (notably ovs 2.8+ on RHEL/Fedora) run as a non-root user.

---

  drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/nfp_nfpu.c b/drivers/net/nfp/nfp_nfpu.c index 2ed985ff4..ae2e07220 100644
--- a/drivers/net/nfp/nfp_nfpu.c
+++ b/drivers/net/nfp/nfp_nfpu.c
@@ -18,6 +18,22 @@
#define NFP_CFG_EXP_BAR 7

#define NFP_CFG_EXP_BAR_CFG_BASE 0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */ +static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t *desc) +{
+ const char *dir = "/var/lock";
+ const char *home_dir = getenv("HOME");
+
+ if (getuid() != 0 && home_dir != NULL)
+ dir = home_dir;
+
+ /* use current prefix as file path */
+ snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+ desc->nfp);
+}

Quoted 2 lines

/* There could be other NFP userspace tools using the NSP interface.
* Make sure there is no other process using it and locking the

access for

Quoted 7 lines

@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)

         struct flock lock;
         char lockname[30];

- memset(&lock, 0, sizeof(lock));
-
- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 3 lines

+ nspu_get_lockfile_path(lockname, sizeof(lockname), desc);

         /* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |

S_IWOTH */

Quoted 6 lines
         desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
 @@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
         rte_free(desc->nspu);
         close(desc->lock);

- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 6 lines

- unlink(lockname);

 +       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
         return 0;

}
--
2.14.3

#9 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

I was just wondering, if device device PCI sysfs resource files or VFIO group /dev files require to change permissions for non-root users, does it not make sense to adjust also /var/lock in the system?

Quoted 121 lines · Alejandro Lucero

I have seen that VFIO also requires explicitly to set the right permissions for non-root users to VFIO groups under /dev/vfio.

I assume then that running OVS or other DPDK apps as non-root is possible, although requiring those explicit permissions changes, and therefore this patch is necessary.

Adding stable@ and Thomas for discussing how can this be added to stable DPDK versions even if this is not going to be a patch for current DPDK version.

Quoted 103 lines · Alejandro Lucero
Quoted 10 lines · Aaron Conole
Quoted 2 lines · Alejandro Lucero

Again, this patch is correct, but because NFP PMD needs to access /sys/bus/pci/devices/$DEVICE_PCI_STRING/resource$RESOURCE_ID, and

these files have just

Quoted 1 line

read/write accesses for root, I do not know if this is really

necessary.

Quoted 2 lines

Being honest, I have not used a DPDK app with NFP PMD and not being

root. Does it work

Quoted 10 lines
Quoted 1 line

with non-root users and other PMDs with same requirements regarding

sysfs resource files?

We do run as non-root user definitely with Intel PMDs.

I'm not very sure about other vendors, but I think mlx pmd runs as non-root user (and it was modified to move off of sysfs for that reason[1]).

It is possible to not rely on sysfs resource files if device is attached to VFIO, but I think that is a must with UIO.

Quoted 72 lines

I'll continue to push for more information from the testing side to find out though.

[1]: http://dpdk.org/ml/archives/dev/2018-February/090586.html

Quoted 1 line

On Fri, Apr 13, 2018 at 12:22 AM, Aaron Conole <[email protected]>

Quoted 36 lines · wrote:

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root. However, some distributions and applications (notably ovs 2.8+ on RHEL/Fedora) run as a non-root user.

---

  drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/nfp_nfpu.c b/drivers/net/nfp/nfp_nfpu.c index 2ed985ff4..ae2e07220 100644
--- a/drivers/net/nfp/nfp_nfpu.c
+++ b/drivers/net/nfp/nfp_nfpu.c
@@ -18,6 +18,22 @@
#define NFP_CFG_EXP_BAR 7

#define NFP_CFG_EXP_BAR_CFG_BASE 0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */ +static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t *desc) +{
+ const char *dir = "/var/lock";
+ const char *home_dir = getenv("HOME");
+
+ if (getuid() != 0 && home_dir != NULL)
+ dir = home_dir;
+
+ /* use current prefix as file path */
+ snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+ desc->nfp);
+}

Quoted 2 lines

/* There could be other NFP userspace tools using the NSP interface.
* Make sure there is no other process using it and locking the

access for

Quoted 7 lines

@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)

         struct flock lock;
         char lockname[30];

- memset(&lock, 0, sizeof(lock));
-
- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 3 lines

+ nspu_get_lockfile_path(lockname, sizeof(lockname), desc);

         /* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |

S_IWOTH */

Quoted 6 lines
         desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
 @@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
         rte_free(desc->nspu);
         close(desc->lock);

- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 6 lines

- unlink(lockname);

 +       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
         return 0;

}
--
2.14.3

#10 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

Quoted 2 lines · Alejandro Lucero

I was just wondering, if device device PCI sysfs resource files or VFIO group /dev files require to change permissions for non-root users, does it not make sense to adjust also /var/lock in the system?

For the /dev, we use udev rules - so the correct individual vfio device files get assigned the correct permissions. No such mechanism exists for /var/lock as far as I can tell.

Ex. see:

https://github.com/openvswitch/ovs/blob/master/rhel/usr_lib_udev_rules.d_91-vfio.rules

Maybe something similar exists that we could use to generate the lock file automatically?

Quoted 105 lines · Alejandro Lucero

I have seen that VFIO also requires explicitly to set the right permissions for non-root users to VFIO groups under /dev/vfio.

I assume then that running OVS or other DPDK apps as non-root is possible, although requiring those explicit permissions changes, and therefore this patch is necessary.

Adding stable@ and Thomas for discussing how can this be added to stable DPDK versions even if this is not going to be a patch for current DPDK version.

On Fri, Apr 13, 2018 at 4:31 PM, Alejandro Lucero <[email protected]> wrote:

On Fri, Apr 13, 2018 at 2:31 PM, Aaron Conole <[email protected]> wrote:

Quoted 2 lines · Alejandro Lucero

Again, this patch is correct, but because NFP PMD needs to access /sys/bus/pci/devices/$DEVICE_PCI_STRING/resource$RESOURCE_ID, and these files have

just

Quoted 3 lines

read/write accesses for root, I do not know if this is really necessary.

Being honest, I have not used a DPDK app with NFP PMD and not being root. Does it

work

Quoted 1 line

with non-root users and other PMDs with same requirements regarding sysfs resource

files?

We do run as non-root user definitely with Intel PMDs.

I'm not very sure about other vendors, but I think mlx pmd runs as non-root user (and it was modified to move off of sysfs for that reason[1]).

It is possible to not rely on sysfs resource files if device is attached to VFIO, but I think that is a must with UIO.

I'll continue to push for more information from the testing side to find out though.

[1]: http://dpdk.org/ml/archives/dev/2018-February/090586.html

Quoted 61 lines · Aaron Conole

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root. However, some distributions and applications (notably ovs 2.8+ on RHEL/Fedora) run as a non-root user.

---

  drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/nfp_nfpu.c b/drivers/net/nfp/nfp_nfpu.c index 2ed985ff4..ae2e07220 100644
--- a/drivers/net/nfp/nfp_nfpu.c
+++ b/drivers/net/nfp/nfp_nfpu.c
@@ -18,6 +18,22 @@
#define NFP_CFG_EXP_BAR 7

#define NFP_CFG_EXP_BAR_CFG_BASE 0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */ +static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t *desc) +{
+ const char *dir = "/var/lock";
+ const char *home_dir = getenv("HOME");
+
+ if (getuid() != 0 && home_dir != NULL)
+ dir = home_dir;
+
+ /* use current prefix as file path */
+ snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+ desc->nfp);
+}

/* There could be other NFP userspace tools using the NSP interface.
* Make sure there is no other process using it and locking the access for
@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)

         struct flock lock;
         char lockname[30];

- memset(&lock, 0, sizeof(lock));
-
- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
+ nspu_get_lockfile_path(lockname, sizeof(lockname), desc);

         /* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH */
         desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
 @@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
         rte_free(desc->nspu);
         close(desc->lock);
 -       snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
 -       unlink(lockname);
 +       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
         return 0;

}
--
2.14.3

#11 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

Quoted 11 lines · Aaron Conole
Quoted 1 line · Alejandro Lucero

I was just wondering, if device device PCI sysfs resource files or VFIO

group /dev files require to change

Quoted 1 line

permissions for non-root users, does it not make sense to adjust also

/var/lock in the system?

For the /dev, we use udev rules - so the correct individual vfio device files get assigned the correct permissions. No such mechanism exists for /var/lock as far as I can tell.

Quoted 8 lines

Ex. see:

https://github.com/openvswitch/ovs/blob/master/
rhel/usr_lib_udev_rules.d_91-vfio.rules

Maybe something similar exists that we could use to generate the lock file automatically?

What about /sysfs/bus/pci/device/$PCI_DEV/resource file?

Is RH forcing OVS DPDK to only work if the host has IOMMU support?

Quoted 124 lines
Quoted 2 lines

On Tue, Apr 17, 2018 at 4:44 PM, Alejandro Lucero <

Quoted 2 lines · [email protected]> wrote:

I have seen that VFIO also requires explicitly to set the right

permissions for non-root users to VFIO

Quoted 3 lines

groups under /dev/vfio.

I assume then that running OVS or other DPDK apps as non-root is

possible, although requiring

Quoted 1 line

those explicit permissions changes, and therefore this patch is

necessary.

Quoted 2 lines

Adding stable@ and Thomas for discussing how can this be added to

stable DPDK versions even if

Quoted 5 lines

this is not going to be a patch for current DPDK version.

On Fri, Apr 13, 2018 at 4:31 PM, Alejandro Lucero <

Quoted 2 lines · [email protected]> wrote:

On Fri, Apr 13, 2018 at 2:31 PM, Aaron Conole <[email protected]>

Quoted 5 lines · wrote:
Quoted 2 lines · Alejandro Lucero

Again, this patch is correct, but because NFP PMD needs to access /sys/bus/pci/devices/$DEVICE_PCI_STRING/resource$RESOURCE_ID, and

these files have

Quoted 2 lines

just

Quoted 1 line

read/write accesses for root, I do not know if this is really

necessary.

Quoted 2 lines
Quoted 2 lines

Being honest, I have not used a DPDK app with NFP PMD and not being

root. Does it

Quoted 2 lines

work

Quoted 1 line

with non-root users and other PMDs with same requirements regarding

sysfs resource

Quoted 9 lines

files?

We do run as non-root user definitely with Intel PMDs.

I'm not very sure about other vendors, but I think mlx pmd runs as non-root user (and it was modified to move off of sysfs for that reason[1]).

It is possible to not rely on sysfs resource files if device is

attached to VFIO, but I think that is a

Quoted 9 lines

must with UIO.

I'll continue to push for more information from the testing side to find out though.

[1]: http://dpdk.org/ml/archives/dev/2018-February/090586.html

Quoted 1 line

On Fri, Apr 13, 2018 at 12:22 AM, Aaron Conole <[email protected]>

Quoted 36 lines · wrote:
Quoted 36 lines

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root. However, some distributions and applications (notably ovs 2.8+ on RHEL/Fedora) run as a non-root user.

---

  drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/nfp_nfpu.c b/drivers/net/nfp/nfp_nfpu.c index 2ed985ff4..ae2e07220 100644
--- a/drivers/net/nfp/nfp_nfpu.c
+++ b/drivers/net/nfp/nfp_nfpu.c
@@ -18,6 +18,22 @@
#define NFP_CFG_EXP_BAR 7

#define NFP_CFG_EXP_BAR_CFG_BASE 0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */ +static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t *desc) +{
+ const char *dir = "/var/lock";
+ const char *home_dir = getenv("HOME");
+
+ if (getuid() != 0 && home_dir != NULL)
+ dir = home_dir;
+
+ /* use current prefix as file path */
+ snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+ desc->nfp);
+}

Quoted 2 lines
Quoted 2 lines

/* There could be other NFP userspace tools using the NSP interface.
* Make sure there is no other process using it and locking the

access for

Quoted 7 lines
Quoted 7 lines

@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)

         struct flock lock;
         char lockname[30];

- memset(&lock, 0, sizeof(lock));
-
- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 3 lines
Quoted 3 lines

+ nspu_get_lockfile_path(lockname, sizeof(lockname), desc);

         /* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |

S_IWOTH */

Quoted 6 lines
Quoted 6 lines
         desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
 @@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
         rte_free(desc->nspu);
         close(desc->lock);

- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 6 lines
Quoted 6 lines

- unlink(lockname);

 +       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
         return 0;

}
--
2.14.3

#12 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

Quoted 18 lines · Alejandro Lucero

On Tue, Apr 17, 2018 at 8:19 PM, Aaron Conole <[email protected]> wrote:

Quoted 1 line · Alejandro Lucero

I was just wondering, if device device PCI sysfs resource files or VFIO group /dev files

require to change

Quoted 1 line

permissions for non-root users, does it not make sense to adjust also /var/lock in the

system?

For the /dev, we use udev rules - so the correct individual vfio device files get assigned the correct permissions. No such mechanism exists for /var/lock as far as I can tell.

Ex. see:

https://github.com/openvswitch/ovs/blob/master/rhel/usr_lib_udev_rules.d_91-vfio.rules

Quoted 6 lines

Maybe something similar exists that we could use to generate the lock file automatically?

What about /sysfs/bus/pci/device/$PCI_DEV/resource file?

Is RH forcing OVS DPDK to only work if the host has IOMMU support?

Yes.

Quoted 114 lines
Quoted 1 line

On Tue, Apr 17, 2018 at 4:44 PM, Alejandro Lucero

Quoted 2 lines · <[email protected]> wrote:

I have seen that VFIO also requires explicitly to set the right permissions for non-root

users to VFIO

Quoted 3 lines

groups under /dev/vfio.

I assume then that running OVS or other DPDK apps as non-root is possible,

although requiring

Quoted 3 lines

those explicit permissions changes, and therefore this patch is necessary.

Adding stable@ and Thomas for discussing how can this be added to stable DPDK

versions even if

Quoted 5 lines

this is not going to be a patch for current DPDK version.

On Fri, Apr 13, 2018 at 4:31 PM, Alejandro Lucero

Quoted 7 lines · <[email protected]> wrote:

On Fri, Apr 13, 2018 at 2:31 PM, Aaron Conole <[email protected]> wrote:

Quoted 2 lines · Alejandro Lucero

Again, this patch is correct, but because NFP PMD needs to access /sys/bus/pci/devices/$DEVICE_PCI_STRING/resource$RESOURCE_ID, and these files

have

Quoted 4 lines

just

Quoted 3 lines

read/write accesses for root, I do not know if this is really necessary.

Being honest, I have not used a DPDK app with NFP PMD and not being root. Does

it

Quoted 2 lines

work

Quoted 1 line

with non-root users and other PMDs with same requirements regarding sysfs

resource

Quoted 9 lines

files?

We do run as non-root user definitely with Intel PMDs.

I'm not very sure about other vendors, but I think mlx pmd runs as non-root user (and it was modified to move off of sysfs for that reason[1]).

It is possible to not rely on sysfs resource files if device is attached to VFIO, but I

think that is a

Quoted 69 lines

must with UIO.

I'll continue to push for more information from the testing side to find out though.

[1]: http://dpdk.org/ml/archives/dev/2018-February/090586.html

Quoted 61 lines · Aaron Conole

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root. However, some distributions and applications (notably ovs 2.8+ on RHEL/Fedora) run as a non-root user.

---

  drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/nfp_nfpu.c b/drivers/net/nfp/nfp_nfpu.c index 2ed985ff4..ae2e07220 100644
--- a/drivers/net/nfp/nfp_nfpu.c
+++ b/drivers/net/nfp/nfp_nfpu.c
@@ -18,6 +18,22 @@
#define NFP_CFG_EXP_BAR 7

#define NFP_CFG_EXP_BAR_CFG_BASE 0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */ +static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t *desc) +{
+ const char *dir = "/var/lock";
+ const char *home_dir = getenv("HOME");
+
+ if (getuid() != 0 && home_dir != NULL)
+ dir = home_dir;
+
+ /* use current prefix as file path */
+ snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+ desc->nfp);
+}

/* There could be other NFP userspace tools using the NSP interface.
* Make sure there is no other process using it and locking the access for
@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)

         struct flock lock;
         char lockname[30];

- memset(&lock, 0, sizeof(lock));
-
- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
+ nspu_get_lockfile_path(lockname, sizeof(lockname), desc);

         /* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH */
         desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
 @@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
         rte_free(desc->nspu);
         close(desc->lock);
 -       snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d", desc->nfp);
 -       unlink(lockname);
 +       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
         return 0;

}
--
2.14.3

#13 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

Quoted 24 lines · Aaron Conole
Quoted 1 line · Alejandro Lucero

On Tue, Apr 17, 2018 at 8:19 PM, Aaron Conole <[email protected]>

Quoted 4 lines · wrote:
Quoted 1 line · Alejandro Lucero

I was just wondering, if device device PCI sysfs resource files or

VFIO group /dev files

Quoted 2 lines

require to change

Quoted 1 line

permissions for non-root users, does it not make sense to adjust also

/var/lock in the

Quoted 9 lines

system?

For the /dev, we use udev rules - so the correct individual vfio device files get assigned the correct permissions. No such mechanism exists for /var/lock as far as I can tell.

Ex. see:

https://github.com/openvswitch/ovs/blob/master/

rhel/usr_lib_udev_rules.d_91-vfio.rules

Quoted 2 lines
Quoted 9 lines
Quoted 6 lines

Maybe something similar exists that we could use to generate the lock file automatically?

What about /sysfs/bus/pci/device/$PCI_DEV/resource file?

Is RH forcing OVS DPDK to only work if the host has IOMMU support?

Yes.

Ok then. It makes sense now to apply this patch to stable versions.

Quoted 137 lines
Quoted 5 lines
Quoted 2 lines

On Tue, Apr 17, 2018 at 4:44 PM, Alejandro Lucero

Quoted 2 lines · <[email protected]> wrote:

I have seen that VFIO also requires explicitly to set the right

permissions for non-root

Quoted 4 lines

users to VFIO

Quoted 3 lines

groups under /dev/vfio.

I assume then that running OVS or other DPDK apps as non-root is

possible,

Quoted 2 lines

although requiring

Quoted 1 line

those explicit permissions changes, and therefore this patch is

necessary.

Quoted 2 lines
Quoted 2 lines

Adding stable@ and Thomas for discussing how can this be added to

stable DPDK

Quoted 9 lines

versions even if

Quoted 5 lines

this is not going to be a patch for current DPDK version.

On Fri, Apr 13, 2018 at 4:31 PM, Alejandro Lucero

Quoted 2 lines · <[email protected]> wrote:

On Fri, Apr 13, 2018 at 2:31 PM, Aaron Conole <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 2 lines · Alejandro Lucero

Again, this patch is correct, but because NFP PMD needs to access /sys/bus/pci/devices/$DEVICE_PCI_STRING/resource$RESOURCE_ID, and

these files

Quoted 3 lines

have

Quoted 2 lines

just

Quoted 1 line

read/write accesses for root, I do not know if this is really

necessary.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Being honest, I have not used a DPDK app with NFP PMD and not

being root. Does

Quoted 3 lines

it

Quoted 2 lines

work

Quoted 1 line

with non-root users and other PMDs with same requirements

regarding sysfs

Quoted 10 lines

resource

Quoted 9 lines

files?

We do run as non-root user definitely with Intel PMDs.

I'm not very sure about other vendors, but I think mlx pmd runs as non-root user (and it was modified to move off of sysfs for that reason[1]).

It is possible to not rely on sysfs resource files if device is

attached to VFIO, but I

Quoted 5 lines

think that is a

Quoted 4 lines

must with UIO.

I'll continue to push for more information from the testing side to

find

Quoted 5 lines
Quoted 5 lines

out though.

[1]: http://dpdk.org/ml/archives/dev/2018-February/090586.html

Quoted 1 line

On Fri, Apr 13, 2018 at 12:22 AM, Aaron Conole <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines

Currently, the nfp lock files are taken from the global lock file location, which will work when the user is running as root.

However,

Quoted 1 line
Quoted 1 line
Quoted 1 line

some distributions and applications (notably ovs 2.8+ on

RHEL/Fedora)

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

run as a non-root user.

---

  drivers/net/nfp/nfp_nfpu.c | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/nfp/nfp_nfpu.c

b/drivers/net/nfp/nfp_nfpu.c

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

index 2ed985ff4..ae2e07220 100644
--- a/drivers/net/nfp/nfp_nfpu.c
+++ b/drivers/net/nfp/nfp_nfpu.c
@@ -18,6 +18,22 @@
#define NFP_CFG_EXP_BAR 7

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

#define NFP_CFG_EXP_BAR_CFG_BASE 0x30000
+#define NFP_LOCKFILE_PATH_FMT "%s/nfp%d"
+
+/* get nfp lock file path (/var/lock if root, $HOME otherwise) */ +static void
+nspu_get_lockfile_path(char *buffer, int bufsz, nfpu_desc_t

*desc)

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

+{
+ const char *dir = "/var/lock";
+ const char *home_dir = getenv("HOME");
+
+ if (getuid() != 0 && home_dir != NULL)
+ dir = home_dir;
+
+ /* use current prefix as file path */
+ snprintf(buffer, bufsz, NFP_LOCKFILE_PATH_FMT, dir,
+ desc->nfp);
+}

Quoted 1 line
Quoted 1 line
Quoted 1 line

/* There could be other NFP userspace tools using the NSP

interface.

Quoted 1 line
Quoted 1 line
Quoted 1 line

* Make sure there is no other process using it and locking the

access for

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

@@ -30,9 +46,7 @@ nspv_aquire_process_lock(nfpu_desc_t *desc)

         struct flock lock;
         char lockname[30];

- memset(&lock, 0, sizeof(lock));
-
- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

+ nspu_get_lockfile_path(lockname, sizeof(lockname), desc);

         /* Using S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH

| S_IWOTH */

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
         desc->lock = open(lockname, O_RDWR | O_CREAT, 0666);
 @@ -106,7 +120,6 @@ nfpu_close(nfpu_desc_t *desc)
         rte_free(desc->nspu);
         close(desc->lock);

- snprintf(lockname, sizeof(lockname), "/var/lock/nfp%d",

desc->nfp);

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

- unlink(lockname);

 +       nspu_get_lockfile_path(lockname, sizeof(lockname), desc);
         return 0;

}
--
2.14.3

#14 lore raw

Re: [dpdk-stable] [RFC 2/2] nfp: allow for non-root user

Quoted 31 lines · Alejandro Lucero
Quoted 29 lines · Aaron Conole
Quoted 1 line · Alejandro Lucero

On Tue, Apr 17, 2018 at 8:19 PM, Aaron Conole <[email protected]>

Quoted 4 lines · wrote:
Quoted 1 line · Alejandro Lucero

I was just wondering, if device device PCI sysfs resource files or

VFIO group /dev files

Quoted 2 lines

require to change

Quoted 1 line

permissions for non-root users, does it not make sense to adjust also

/var/lock in the

Quoted 9 lines

system?

For the /dev, we use udev rules - so the correct individual vfio device files get assigned the correct permissions. No such mechanism exists for /var/lock as far as I can tell.

Ex. see:

https://github.com/openvswitch/ovs/blob/master/

rhel/usr_lib_udev_rules.d_91-vfio.rules

Quoted 7 lines

Maybe something similar exists that we could use to generate the lock file automatically?

What about /sysfs/bus/pci/device/$PCI_DEV/resource file?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Is RH forcing OVS DPDK to only work if the host has IOMMU support?

Yes.

Ok then. It makes sense now to apply this patch to stable versions.

Since the target is the stable tree, I will drop them from patchwork as not applicable.

Can you please send v1 of the patch to the stable mail list, it can be good idea to cc stable maintainers as well.

#15 lore raw

Re: [dpdk-stable] [RFC 2/2] nfp: allow for non-root user

Quoted 39 lines · Ferruh Yigit
Quoted 38 lines · Alejandro Lucero
Quoted 24 lines · Aaron Conole
Quoted 1 line · Alejandro Lucero

On Tue, Apr 17, 2018 at 8:19 PM, Aaron Conole <[email protected]>

Quoted 4 lines · wrote:
Quoted 1 line · Alejandro Lucero

I was just wondering, if device device PCI sysfs resource files or

VFIO group /dev files

Quoted 2 lines

require to change

Quoted 1 line

permissions for non-root users, does it not make sense to adjust also

/var/lock in the

Quoted 9 lines

system?

For the /dev, we use udev rules - so the correct individual vfio device files get assigned the correct permissions. No such mechanism exists for /var/lock as far as I can tell.

Ex. see:

https://github.com/openvswitch/ovs/blob/master/

rhel/usr_lib_udev_rules.d_91-vfio.rules

Quoted 2 lines
Quoted 9 lines
Quoted 6 lines

Maybe something similar exists that we could use to generate the lock file automatically?

What about /sysfs/bus/pci/device/$PCI_DEV/resource file?

Is RH forcing OVS DPDK to only work if the host has IOMMU support?

Yes.

Ok then. It makes sense now to apply this patch to stable versions.

Quoted 7 lines
Quoted 1 line

Since the target is the stable tree, I will drop them from patchwork as not applicable.

Can you please send v1 of the patch to the stable mail list, it can be good idea to cc stable maintainers as well.

Will do. I'll spin into a proper series and submit next week.

Sorry for the extra noise, Ferruh.

#16 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

In reply to Alejandro Lucero

17/04/2018 17:44, Alejandro Lucero:

Quoted 3 lines

Adding stable@ and Thomas for discussing how can this be added to stable DPDK versions even if this is not going to be a patch for current DPDK version.

I don't understand.
This patch won't enter in 18.05?
Why do you think this patch is candidate for stable but not master?

#17 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

Quoted 11 lines · Thomas Monjalon

17/04/2018 17:44, Alejandro Lucero:

Quoted 3 lines

Adding stable@ and Thomas for discussing how can this be added to stable DPDK versions even if this is not going to be a patch for current DPDK version.

I don't understand.
This patch won't enter in 18.05?
Why do you think this patch is candidate for stable but not master?

Because all that code has been removed between 18.02 and 18.05:

http://dpdk.org/ml/archives/dev/2018-March/093655.html

I guess this had not happen yet, and stable versions only pull patches from vanilla. Am I right?

#18 lore raw

Re: [RFC 2/2] nfp: allow for non-root user

17/04/2018 18:24, Alejandro Lucero:

Quoted 12 lines
Quoted 9 lines · Thomas Monjalon

17/04/2018 17:44, Alejandro Lucero:

Quoted 3 lines

Adding stable@ and Thomas for discussing how can this be added to stable DPDK versions even if this is not going to be a patch for current DPDK version.

I don't understand.
This patch won't enter in 18.05?
Why do you think this patch is candidate for stable but not master?

Quoted 6 lines

Because all that code has been removed between 18.02 and 18.05:

http://dpdk.org/ml/archives/dev/2018-March/093655.html

I guess this had not happen yet, and stable versions only pull patches from vanilla. Am I right?

Yes patches are cherry-picked from master.
But when the backport is too much difficult, a patch can be sent directly to [email protected].

I don't know whether it already happened to fix a removed code. You need to make sure that the maintainers of stable branches will pick it. There is no special process, it's all a matter of communication :)

#19 lore raw
In reply to Aaron Conole

Hi Aaron,

Thanks for this patches.

I'm afraid these are not applicable for current NFP driver after commit

"net/nfp: add NFP CPP support
<http://dpdk.org/browse/next/dpdk-next-net/commit/?id=c21e3c53870799c379f8c2ced940e757e8820a5f>
"

which has been accepted in dpdk-net-next.

However, those could be valid for stable versions. I have comments on both patches.

Quoted 16 lines · Aaron Conole

Two fixes, one which is fairly obvious (1/2), the other which may allow support of non-root users. These patches are only compile tested which is why they are submitted as RFC. After a proper test, will resubmit them as PATCH (with any suggested / recommended changes).

Aaron Conole (2):
nfp: unlink the appropriate lock file
nfp: allow for non-root user

 drivers/net/nfp/nfp_nfpu.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

--
2.14.3

#20 lore raw
Quoted 5 lines · Alejandro Lucero

Hi Aaron,

Thanks for this patches.

I'm afraid these are not applicable for current NFP driver after commit

Okay.

Quoted 3 lines

"net/nfp: add NFP CPP support"

which has been accepted in dpdk-net-next.

I think nfp_acquire_process_lock() can be modified as I did in 2/2, but I noticed that there's some reliance on various sysfs files (and I think you point this out in your response to 2/2 as well) and that may be problematic for us with ovs2.8+. I'll do some more digging.

Thanks Alejandro!

Quoted 1 line

However, those could be valid for stable versions. I have comments on both patches.

Cool. As I noted, I haven't tested them yet, but once I get time to test them I will pull in any feedback and resubmit. I guess if I do, they should really just be for stable fixes? Not sure how that would work.

Quoted 16 lines · Aaron Conole

Two fixes, one which is fairly obvious (1/2), the other which may allow support of non-root users. These patches are only compile tested which is why they are submitted as RFC. After a proper test, will resubmit them as PATCH (with any suggested / recommended changes).

Aaron Conole (2):
nfp: unlink the appropriate lock file
nfp: allow for non-root user

  drivers/net/nfp/nfp_nfpu.c | 25 +++++++++++++++++++++----
  1 file changed, 21 insertions(+), 4 deletions(-)

--
2.14.3

#21 lore raw
Quoted 10 lines · Aaron Conole
Quoted 5 lines · Alejandro Lucero

Hi Aaron,

Thanks for this patches.

I'm afraid these are not applicable for current NFP driver after commit

Okay.

Quoted 9 lines
Quoted 3 lines

"net/nfp: add NFP CPP support"

which has been accepted in dpdk-net-next.

I think nfp_acquire_process_lock() can be modified as I did in 2/2, but I noticed that there's some reliance on various sysfs files (and I think you point this out in your response to 2/2 as well) and that may be problematic for us with ovs2.8+. I'll do some more digging.

If OVS always relies on VFIO, then it is fine and this patch makes sense.

Quoted 12 lines

Thanks Alejandro!

Quoted 1 line

However, those could be valid for stable versions. I have comments on

both patches.

Cool. As I noted, I haven't tested them yet, but once I get time to test them I will pull in any feedback and resubmit. I guess if I do, they should really just be for stable fixes? Not sure how that would work.

Not sure how this needs to be done. Stable versions pull from main branch just for bug fixing applied patches.
Maybe it is worth to discuss. Adding stable email.

Quoted 18 lines
Quoted 1 line

On Fri, Apr 13, 2018 at 12:22 AM, Aaron Conole <[email protected]>

Quoted 15 lines · wrote:

Two fixes, one which is fairly obvious (1/2), the other which may allow support of non-root users. These patches are only compile tested which is why they are submitted as RFC. After a proper test, will resubmit them as PATCH (with any suggested / recommended changes).

Aaron Conole (2):
nfp: unlink the appropriate lock file
nfp: allow for non-root user

  drivers/net/nfp/nfp_nfpu.c | 25 +++++++++++++++++++++----
  1 file changed, 21 insertions(+), 4 deletions(-)

--
2.14.3