Skip to contentSkip to conversation

vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests

PATCH In review 项文成 3 participants 7 messages Jun 13, 2024 – Jul 2, 2024

lore
Share & tools
lore

项文成

author
#0 lore raw

PATCH 1/1 vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests

From: BillXiang <[email protected]>

The VHOST_USER_SET_LOG_BASE requests should be categorized into
non-vring specific messages, and should be sent only once.
If send more than once, dpdk will munmap old log_addr which may has been used and cause segmentation fault.

---
 hw/virtio/vhost-user.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/vhost-user.c +1 -0
index cdf9af4a4b..41e34edd49 100644
@@ -371,6 +371,7 @@ static bool vhost_user_per_device_request(VhostUserRequest request)
     case VHOST_USER_RESET_DEVICE:
     case VHOST_USER_ADD_MEM_REG:
     case VHOST_USER_REM_MEM_REG:
+    case VHOST_USER_SET_LOG_BASE:
         return true;
     default:
         return false;
Signature · 1 line
2.30.0
author
#1 lore raw
Quoted 23 lines

From: "项文成"<[email protected]>
Date:  Thu, Jun 13, 2024, 14:51
Subject:  [PATCH] vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests
To: <[email protected]>
Cc: <[email protected]>, "BillXiang"<[email protected]>
From: BillXiang <[email protected]>

The VHOST_USER_SET_LOG_BASE requests should be categorized into
non-vring specific messages, and should be sent only once.
If send more than once, dpdk will munmap old log_addr which may has been used and cause segmentation fault.

---
  hw/virtio/vhost-user.c | 1 +

  1 file changed, 1 insertion(+)

hw/virtio/vhost-user.c +0 -0
index cdf9af4a4b..41e34edd49 100644
@@ -371,6 +371,7 @@ static bool vhost_user_per_device_request(VhostUserRequest request)

     case VHOST_USER_RESET_DEVICE:

Quoted 8 lines

     case VHOST_USER_ADD_MEM_REG:
     case VHOST_USER_REM_MEM_REG:
+    case VHOST_USER_SET_LOG_BASE:
         return true;
     default:
         return false;
--
2.30.0

ping

#2 lore raw
In reply to 项文成
Quoted 6 lines · 项文成

From: BillXiang <[email protected]>

The VHOST_USER_SET_LOG_BASE requests should be categorized into non-vring specific messages, and should be sent only once. If send more than once, dpdk will munmap old log_addr which may has been used and cause segmentation fault.

This looks fine to me but looking at the vhost-user.rst we don't seem to make any explicit statements about how many times given messages should be sent.

Quoted 18 lines
---
 hw/virtio/vhost-user.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/vhost-user.c +1 -0
index cdf9af4a4b..41e34edd49 100644
@@ -371,6 +371,7 @@ static bool vhost_user_per_device_request(VhostUserRequest request)
     case VHOST_USER_RESET_DEVICE:
     case VHOST_USER_ADD_MEM_REG:
     case VHOST_USER_REM_MEM_REG:
+    case VHOST_USER_SET_LOG_BASE:
         return true;
     default:
         return false;
Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
author
#3 lore raw
Quoted 14 lines

From: "Alex Bennée"<[email protected]>
Date:  Mon, Jul 1, 2024, 16:49
Subject:  Re: [PATCH] vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests
To: "项文成"<[email protected]>
Cc: <[email protected]>, <[email protected]>
项文成 <[email protected]> writes:

Quoted 6 lines

From: BillXiang <[email protected]>

The VHOST_USER_SET_LOG_BASE requests should be categorized into non-vring specific messages, and should be sent only once. If send more than once, dpdk will munmap old log_addr which may has been used and cause segmentation fault.

Quoted 5 lines


This looks fine to me but looking at the vhost-user.rst we don't seem to make any explicit statements about how many times given messages should be sent.

There is indeed no explicit statements about how many times given messages should be sent in vhost-user.rst but already have some discussions such as
https://lore.kernel.org/qemu-devel/[email protected]/.

Quoted 22 lines
Quoted 11 lines

---
  hw/virtio/vhost-user.c | 1 +

  1 file changed, 1 insertion(+)
hw/virtio/vhost-user.c +0 -0
index cdf9af4a4b..41e34edd49 100644
@@ -371,6 +371,7 @@ static bool vhost_user_per_device_request(VhostUserRequest request)
Quoted 7 lines

     case VHOST_USER_RESET_DEVICE:
     case VHOST_USER_ADD_MEM_REG:
     case VHOST_USER_REM_MEM_REG:
+    case VHOST_USER_SET_LOG_BASE:
         return true;
     default:
         return false;


--
Alex Bennée
Virtualisation Tech Lead @ Linaro

#4 lore raw
Quoted 13 lines · BillXiang
Quoted 13 lines

From: "Alex Bennée"<[email protected]>
Date:  Mon, Jul 1, 2024, 16:49
Subject:  Re: [PATCH] vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests
To: "项文成"<[email protected]>
Cc: <[email protected]>, <[email protected]>
项文成 <[email protected]> writes:

Quoted 6 lines

From: BillXiang <[email protected]>

The VHOST_USER_SET_LOG_BASE requests should be categorized into non-vring specific messages, and should be sent only once. If send more than once, dpdk will munmap old log_addr which may has been used and cause segmentation fault.

Quoted 8 lines
Quoted 5 lines


This looks fine to me but looking at the vhost-user.rst we don't seem to make any explicit statements about how many times given messages should be sent.

There is indeed no explicit statements about how many times given messages should be sent in vhost-user.rst but already have some discussions such as
https://lore.kernel.org/qemu-devel/[email protected]/.

Right, but I think we should then update the specification if this is the way we want things to work. Otherwise we are putting a backend specific hack that another backend might be able to tolerate.

Quoted 22 lines
Quoted 22 lines
Quoted 11 lines

---
  hw/virtio/vhost-user.c | 1 +

  1 file changed, 1 insertion(+)
hw/virtio/vhost-user.c +0 -0
index cdf9af4a4b..41e34edd49 100644
@@ -371,6 +371,7 @@ static bool vhost_user_per_device_request(VhostUserRequest request)
Quoted 7 lines

     case VHOST_USER_RESET_DEVICE:
     case VHOST_USER_ADD_MEM_REG:
     case VHOST_USER_REM_MEM_REG:
+    case VHOST_USER_SET_LOG_BASE:
         return true;
     default:
         return false;


--
Alex Bennée
Virtualisation Tech Lead @ Linaro

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#5 lore raw
Quoted 20 lines · Alex Bennée
Quoted 18 lines · BillXiang
Quoted 18 lines

From: "Alex Bennée"<[email protected]>
Date:  Mon, Jul 1, 2024, 16:49
Subject:  Re: [PATCH] vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests
To: "项文成"<[email protected]>
Cc: <[email protected]>, <[email protected]>
项文成 <[email protected]> writes:

Quoted 6 lines

From: BillXiang <[email protected]>

The VHOST_USER_SET_LOG_BASE requests should be categorized into non-vring specific messages, and should be sent only once. If send more than once, dpdk will munmap old log_addr which may has been used and cause segmentation fault.


This looks fine to me but looking at the vhost-user.rst we don't seem to make any explicit statements about how many times given messages should be sent.

Quoted 7 lines
Quoted 3 lines

There is indeed no explicit statements about how many times given messages should be sent in vhost-user.rst but already have some discussions such as
https://lore.kernel.org/qemu-devel/[email protected]/.

Right, but I think we should then update the specification if this is the way we want things to work. Otherwise we are putting a backend specific hack that another backend might be able to tolerate.

I think it's a dpdk bug, we *allow* resending same message many times. However, less messages is better, I don't see a reason to repeat the same message many times.

Quoted 26 lines
Quoted 22 lines
Quoted 22 lines
Quoted 11 lines

---
  hw/virtio/vhost-user.c | 1 +

  1 file changed, 1 insertion(+)
hw/virtio/vhost-user.c +0 -0
index cdf9af4a4b..41e34edd49 100644
@@ -371,6 +371,7 @@ static bool vhost_user_per_device_request(VhostUserRequest request)
Quoted 7 lines

     case VHOST_USER_RESET_DEVICE:
     case VHOST_USER_ADD_MEM_REG:
     case VHOST_USER_REM_MEM_REG:
+    case VHOST_USER_SET_LOG_BASE:
         return true;
     default:
         return false;


--
Alex Bennée
Virtualisation Tech Lead @ Linaro

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
author
#6 lore raw
Quoted 34 lines

From: "Michael S. Tsirkin"<[email protected]>
Date:  Mon, Jul 1, 2024, 23:17
Subject:  Re: [PATCH] vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests
To: "Alex Bennée"<[email protected]>
Cc: "BillXiang"<[email protected]>, <[email protected]>

Quoted 27 lines · Alex Bennée

"BillXiang" <[email protected]> writes:

Quoted 13 lines
Quoted 13 lines

From: "Alex Bennée"<[email protected]>
Date:  Mon, Jul 1, 2024, 16:49
Subject:  Re: [PATCH] vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests
To: "项文成"<[email protected]>
Cc: <[email protected]>, <[email protected]>
项文成 <[email protected]> writes:

Quoted 6 lines

From: BillXiang <[email protected]>

The VHOST_USER_SET_LOG_BASE requests should be categorized into non-vring specific messages, and should be sent only once. If send more than once, dpdk will munmap old log_addr which may has been used and cause segmentation fault.

Quoted 8 lines
Quoted 5 lines


This looks fine to me but looking at the vhost-user.rst we don't seem to make any explicit statements about how many times given messages should be sent.

There is indeed no explicit statements about how many times given messages should be sent in vhost-user.rst but already have some discussions such as
https://lore.kernel.org/qemu-devel/[email protected]/.


Right, but I think we should then update the specification if this is the way we want things to work. Otherwise we are putting a backend specific hack that another backend might be able to tolerate.

I agree with you that we should then update the specification and maybe for vhost_user_per_device_request.

Quoted 5 lines


I think it's a dpdk bug, we *allow* resending same message many times. However, less messages is better, I don't see a reason to repeat the same message many times.

Of course these repeated VHOST_USER_SET_LOG_BASE can be handled by dpdk
and it's what I did now. When live migration started, I have some extra-code to wait for the final log_base but I think it's ugly.
AFAIK it's better to resolve this by vhost_user_per_device_request and it's what "per_device" really mean.

Quoted 26 lines
Quoted 26 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

---
  hw/virtio/vhost-user.c | 1 +

  1 file changed, 1 insertion(+)
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
hw/virtio/vhost-user.c +0 -0
index cdf9af4a4b..41e34edd49 100644
@@ -371,6 +371,7 @@ static bool vhost_user_per_device_request(VhostUserRequest request)

     case VHOST_USER_RESET_DEVICE:
     case VHOST_USER_ADD_MEM_REG:
     case VHOST_USER_REM_MEM_REG:

Quoted 8 lines
Quoted 4 lines

+    case VHOST_USER_SET_LOG_BASE:
         return true;
     default:
         return false;


--
Alex Bennée
Virtualisation Tech Lead @ Linaro


--
Alex Bennée
Virtualisation Tech Lead @ Linaro