[d/azure][PATCH 1/2] UBUNTU: SAUCE: Don't wait in hvnd_query_gid after interface is already bound to ND

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[d/azure][PATCH 1/2] UBUNTU: SAUCE: Don't wait in hvnd_query_gid after interface is already bound to ND

Marcelo Henrique Cerri
From: Long Li <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1839673

The user mode may call hvnd_query_gid multiple times, and from multiple user
contexts at the same time. If it's already bound, return GID and not wait.

Signed-off-by: Long Li <[hidden email]>
Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 .../hw/vmbus-rdma/vmbus-rdma-144.0/provider.c          | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
index 8e15522707b9..3ad27e9d6a5d 100644
--- a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
+++ b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
@@ -604,9 +604,11 @@ static int hvnd_query_gid(struct ib_device *ibdev, u8 port, int index,
 
  debug_check(__func__, __LINE__);
 
- ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
- if (!ret)
- return -ETIMEDOUT;
+ if (!nd_dev->bind_complete) {
+ ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
+ if (!ret && !nd_dev->bind_complete)
+ return -ETIMEDOUT;
+ }
 
  memset(&(gid->raw[0]), 0, sizeof(gid->raw));
  memcpy(&(gid->raw[0]), nd_dev->mac_addr, 6);
@@ -2752,8 +2754,8 @@ static int hvnd_try_bind_nic(unsigned char *mac, __be32 ip)
  /* if we reach here, this means bind_nic is a success */
  hvnd_error("successfully bound to IP %pI4 MAC %pM\n",
    nd_dev->ip_addr, nd_dev->mac_addr);
- complete(&nd_dev->addr_set);
  nd_dev->bind_complete = 1;
+ complete_all(&nd_dev->addr_set);
  mutex_unlock(&nd_dev->bind_mutex);
 
  ret = hvnd_register_device(nd_dev, nd_dev->ip_addr, nd_dev->mac_addr);
--
2.20.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[d/azure][PATCH 2/2] UBUNTU: SAUCE: Expose extended attributes for user IB verbs QUERY_DEVICE, CREATE_CQ and CREATE_QP

Marcelo Henrique Cerri
From: Long Li <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1839673

The user-mode driver may call this IB verbs to get extended data. The RDMA layer
checks if those data are available in lower layer, and copy those data back to user
mode. There is no need to change lower layer driver as those data have already been
returned in RDMA-lower driver interfaces.

Signed-off-by: Long Li <[hidden email]>
Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
index 3ad27e9d6a5d..1877cf60853b 100644
--- a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
+++ b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
@@ -2669,6 +2669,11 @@ int hvnd_register_device(struct hvnd_dev *dev, char *ip_addr, char *mac_addr)
 
  dev->ibdev.ops.get_port_immutable = hvnd_get_port_immutable;
 
+ dev->ibdev.uverbs_ex_cmd_mask |=
+                (1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE) |
+                (1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ) |
+                (1ull << IB_USER_VERBS_EX_CMD_CREATE_QP);
+
  //DMA ops for mapping all possible addresses
  dev->ibdev.dev.parent = &(dev->hvdev->device);
  dev->ibdev.dev.dma_ops = &vmbus_dma_ops;
--
2.20.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [d/azure][PATCH 1/2] UBUNTU: SAUCE: Don't wait in hvnd_query_gid after interface is already bound to ND

Sultan Alsawaf
In reply to this post by Marcelo Henrique Cerri
On Wed, Aug 14, 2019 at 03:08:03PM -0300, Marcelo Henrique Cerri wrote:

> From: Long Li <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1839673
>
> The user mode may call hvnd_query_gid multiple times, and from multiple user
> contexts at the same time. If it's already bound, return GID and not wait.
>
> Signed-off-by: Long Li <[hidden email]>
> Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
> ---
>  .../hw/vmbus-rdma/vmbus-rdma-144.0/provider.c          | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> index 8e15522707b9..3ad27e9d6a5d 100644
> --- a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> +++ b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> @@ -604,9 +604,11 @@ static int hvnd_query_gid(struct ib_device *ibdev, u8 port, int index,
>  
>   debug_check(__func__, __LINE__);
>  
> - ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
> - if (!ret)
> - return -ETIMEDOUT;
> + if (!nd_dev->bind_complete) {
> + ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
> + if (!ret && !nd_dev->bind_complete)
> + return -ETIMEDOUT;
> + }
>  
>   memset(&(gid->raw[0]), 0, sizeof(gid->raw));
>   memcpy(&(gid->raw[0]), nd_dev->mac_addr, 6);
> @@ -2752,8 +2754,8 @@ static int hvnd_try_bind_nic(unsigned char *mac, __be32 ip)
>   /* if we reach here, this means bind_nic is a success */
>   hvnd_error("successfully bound to IP %pI4 MAC %pM\n",
>     nd_dev->ip_addr, nd_dev->mac_addr);
> - complete(&nd_dev->addr_set);
>   nd_dev->bind_complete = 1;
> + complete_all(&nd_dev->addr_set);
>   mutex_unlock(&nd_dev->bind_mutex);
>  
>   ret = hvnd_register_device(nd_dev, nd_dev->ip_addr, nd_dev->mac_addr);
> --
> 2.20.1
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Acked-by: Sultan Alsawaf <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [d/azure][PATCH 2/2] UBUNTU: SAUCE: Expose extended attributes for user IB verbs QUERY_DEVICE, CREATE_CQ and CREATE_QP

Sultan Alsawaf
In reply to this post by Marcelo Henrique Cerri
On Wed, Aug 14, 2019 at 03:08:04PM -0300, Marcelo Henrique Cerri wrote:

> From: Long Li <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1839673
>
> The user-mode driver may call this IB verbs to get extended data. The RDMA layer
> checks if those data are available in lower layer, and copy those data back to user
> mode. There is no need to change lower layer driver as those data have already been
> returned in RDMA-lower driver interfaces.
>
> Signed-off-by: Long Li <[hidden email]>
> Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
> ---
>  drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> index 3ad27e9d6a5d..1877cf60853b 100644
> --- a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> +++ b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> @@ -2669,6 +2669,11 @@ int hvnd_register_device(struct hvnd_dev *dev, char *ip_addr, char *mac_addr)
>  
>   dev->ibdev.ops.get_port_immutable = hvnd_get_port_immutable;
>  
> + dev->ibdev.uverbs_ex_cmd_mask |=
> +                (1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE) |
> +                (1ull << IB_USER_VERBS_EX_CMD_CREATE_CQ) |
> +                (1ull << IB_USER_VERBS_EX_CMD_CREATE_QP);
> +
>   //DMA ops for mapping all possible addresses
>   dev->ibdev.dev.parent = &(dev->hvdev->device);
>   dev->ibdev.dev.dma_ops = &vmbus_dma_ops;
> --
> 2.20.1
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Acked-by: Sultan Alsawaf <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [d/azure][PATCH 1/2] UBUNTU: SAUCE: Don't wait in hvnd_query_gid after interface is already bound to ND

Connor Kuehl
In reply to this post by Marcelo Henrique Cerri
On 8/14/19 11:08 AM, Marcelo Henrique Cerri wrote:

> From: Long Li <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1839673
>
> The user mode may call hvnd_query_gid multiple times, and from multiple user
> contexts at the same time. If it's already bound, return GID and not wait.
>
> Signed-off-by: Long Li <[hidden email]>
> Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
> ---
>   .../hw/vmbus-rdma/vmbus-rdma-144.0/provider.c          | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> index 8e15522707b9..3ad27e9d6a5d 100644
> --- a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> +++ b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> @@ -604,9 +604,11 @@ static int hvnd_query_gid(struct ib_device *ibdev, u8 port, int index,
>  
>   debug_check(__func__, __LINE__);
>  
> - ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
> - if (!ret)
> - return -ETIMEDOUT;
> + if (!nd_dev->bind_complete) {
> + ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
> + if (!ret && !nd_dev->bind_complete)
> + return -ETIMEDOUT;
> + }
>  
>   memset(&(gid->raw[0]), 0, sizeof(gid->raw));
>   memcpy(&(gid->raw[0]), nd_dev->mac_addr, 6);
> @@ -2752,8 +2754,8 @@ static int hvnd_try_bind_nic(unsigned char *mac, __be32 ip)
>   /* if we reach here, this means bind_nic is a success */
>   hvnd_error("successfully bound to IP %pI4 MAC %pM\n",
>     nd_dev->ip_addr, nd_dev->mac_addr);
> - complete(&nd_dev->addr_set);
>   nd_dev->bind_complete = 1;
> + complete_all(&nd_dev->addr_set);
>   mutex_unlock(&nd_dev->bind_mutex);
>  
>   ret = hvnd_register_device(nd_dev, nd_dev->ip_addr, nd_dev->mac_addr);
>

For both patches:

Acked-by: Connor Kuehl <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [d/azure][PATCH 1/2] UBUNTU: SAUCE: Don't wait in hvnd_query_gid after interface is already bound to ND

Khaled Elmously
In reply to this post by Marcelo Henrique Cerri
On 2019-08-14 15:08:03 , Marcelo Henrique Cerri wrote:

> From: Long Li <[hidden email]>
>
> BugLink: https://bugs.launchpad.net/bugs/1839673
>
> The user mode may call hvnd_query_gid multiple times, and from multiple user
> contexts at the same time. If it's already bound, return GID and not wait.
>
> Signed-off-by: Long Li <[hidden email]>
> Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
> ---
>  .../hw/vmbus-rdma/vmbus-rdma-144.0/provider.c          | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> index 8e15522707b9..3ad27e9d6a5d 100644
> --- a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> +++ b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-144.0/provider.c
> @@ -604,9 +604,11 @@ static int hvnd_query_gid(struct ib_device *ibdev, u8 port, int index,
>  
>   debug_check(__func__, __LINE__);
>  
> - ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
> - if (!ret)
> - return -ETIMEDOUT;
> + if (!nd_dev->bind_complete) {
> + ret = wait_for_completion_timeout(&nd_dev->addr_set, 60*HZ);
> + if (!ret && !nd_dev->bind_complete)
> + return -ETIMEDOUT;
> + }
>  
>   memset(&(gid->raw[0]), 0, sizeof(gid->raw));
>   memcpy(&(gid->raw[0]), nd_dev->mac_addr, 6);
> @@ -2752,8 +2754,8 @@ static int hvnd_try_bind_nic(unsigned char *mac, __be32 ip)
>   /* if we reach here, this means bind_nic is a success */
>   hvnd_error("successfully bound to IP %pI4 MAC %pM\n",
>     nd_dev->ip_addr, nd_dev->mac_addr);
> - complete(&nd_dev->addr_set);
>   nd_dev->bind_complete = 1;
> + complete_all(&nd_dev->addr_set);
>   mutex_unlock(&nd_dev->bind_mutex);
>  
>   ret = hvnd_register_device(nd_dev, nd_dev->ip_addr, nd_dev->mac_addr);
> --

Acked-by: Khalid Elmously <[hidden email]>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED: [d/azure][PATCH 1/2] UBUNTU: SAUCE: Don't wait in hvnd_query_gid after interface is already bound to ND

Marcelo Henrique Cerri
In reply to this post by Marcelo Henrique Cerri
--
Regards,
Marcelo


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (499 bytes) Download Attachment