Skip to contentSkip to conversation

vhost-user: Silence unsupported VHOST_USER_PROTOCOL_F_RARP error

PATCH In review Laurent Vivier 6 participants 16 messages Jan 21, 2025 – Feb 21, 2025 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost-user: Silence unsupported VHOST_USER_PROTOCOL_F_RARP error

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
 hw/net/vhost_net-stub.c | 2 +-
 net/vhost-user.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +1 -1
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask)
 
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
-    return -1;
+    return -ENOTSUP;
 }
 
 VHostNetState *get_vhost_net(NetClientState *nc)
net/vhost-user.c +1 -1
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
 
         r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
             fprintf(stderr,
                     "Vhost user backend fails to broadcast fake RARP\n");
             fflush(stderr);
Signature · 1 line
2.47.1
#1 lore raw
Quoted 49 lines · Laurent Vivier

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
hw/net/vhost_net-stub.c | 2 +-
net/vhost-user.c | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +1 -1
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask)
 
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
-    return -1;
+    return -ENOTSUP;
 }
 
 VHostNetState *get_vhost_net(NetClientState *nc)
net/vhost-user.c +1 -1
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
 
        r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
            fprintf(stderr,
                    "Vhost user backend fails to broadcast fake RARP\n");
            fflush(stderr);
Signature · 1 line
2.47.1

IIUC the message was there since the introduction about 10 years ago from commit 3e866365e1 ("vhost user: add rarp sending after live migration for legacy guest"). IIUC -ENOTSUP is returned when both F_RARP and F_GUEST_ANNOUNCE are not negotiated.

That said, I honestly don't know what F_RARP or F_GUEST_ANNOUNCE is for, but my understanding is that the message was to notify that the migration was finished (reading that commit).

If neither feature is supported, could this be a problem for the user and that's why we were printing the message?

Thanks,
Stefano

#2 lore raw
Quoted 56 lines · Stefano Garzarella
Quoted 49 lines · Laurent Vivier

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
hw/net/vhost_net-stub.c | 2 +-
net/vhost-user.c | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +1 -1
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask)
 
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
-    return -1;
+    return -ENOTSUP;
 }
 
 VHostNetState *get_vhost_net(NetClientState *nc)
net/vhost-user.c +1 -1
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
 
        r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
            fprintf(stderr,
                    "Vhost user backend fails to broadcast fake RARP\n");
            fflush(stderr);
Signature · 1 line
2.47.1

IIUC the message was there since the introduction about 10 years ago from commit 3e866365e1 ("vhost user: add rarp sending after live migration for legacy guest"). IIUC -ENOTSUP is returned when both F_RARP and F_GUEST_ANNOUNCE are not negotiated.

Quoted 1 line

That said, I honestly don't know what F_RARP or F_GUEST_ANNOUNCE is for,

rarp is to have destination host broadcast a message with VM address to update the network. Guest announce is when it will instead ask the guest to do this.

Quoted 8 lines

but my understanding is that the message was to notify that the migration was finished (reading that commit).

If neither feature is supported, could this be a problem for the user and that's why we were printing the message?

Thanks,
Stefano

#3 lore raw
Quoted 57 lines · Michael S. Tsirkin
Quoted 56 lines · Stefano Garzarella
Quoted 47 lines · Laurent Vivier

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
hw/net/vhost_net-stub.c | 2 +-
net/vhost-user.c | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +1 -1
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask)
 
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
-    return -1;
+    return -ENOTSUP;
 }
 
 VHostNetState *get_vhost_net(NetClientState *nc)
net/vhost-user.c +1 -2
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
 
        r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
            fprintf(stderr,
                    "Vhost user backend fails to broadcast fake RARP\n");
            fflush(stderr);
--
Quoted 2 lines

2.47.1

IIUC the message was there since the introduction about 10 years ago from commit 3e866365e1 ("vhost user: add rarp sending after live migration for legacy guest"). IIUC -ENOTSUP is returned when both F_RARP and F_GUEST_ANNOUNCE are not negotiated.

Quoted 5 lines
Quoted 1 line

That said, I honestly don't know what F_RARP or F_GUEST_ANNOUNCE is for,

rarp is to have destination host broadcast a message with VM address to update the network. Guest announce is when it will instead ask the guest to do this.

Okay, thanks for explaining to me.
So if both features are not negotiated, no one is going to broadcast the message, right?

Could that be a valid reason to print an error message in QEMU?

To me it might be reasonable because the user might experience some network problems, but I'm not a network guy :-)

Thanks,
Stefano

Quoted 11 lines
Quoted 10 lines

but my understanding is that the message was to notify that the migration was finished (reading that commit).

If neither feature is supported, could this be a problem for the user and that's why we were printing the message?

Thanks,
Stefano

#4 lore raw
Quoted 68 lines · Stefano Garzarella
Quoted 57 lines · Michael S. Tsirkin
Quoted 56 lines · Stefano Garzarella
Quoted 47 lines · Laurent Vivier

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
hw/net/vhost_net-stub.c | 2 +-
net/vhost-user.c | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +1 -1
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, bool mask)
 
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
-    return -1;
+    return -ENOTSUP;
 }
 
 VHostNetState *get_vhost_net(NetClientState *nc)
net/vhost-user.c +1 -2
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, const uint8_t *buf,
 
        r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
            fprintf(stderr,
                    "Vhost user backend fails to broadcast fake RARP\n");
            fflush(stderr);
--
Quoted 2 lines

2.47.1

IIUC the message was there since the introduction about 10 years ago from commit 3e866365e1 ("vhost user: add rarp sending after live migration for legacy guest"). IIUC -ENOTSUP is returned when both F_RARP and F_GUEST_ANNOUNCE are not negotiated.

Quoted 5 lines
Quoted 1 line

That said, I honestly don't know what F_RARP or F_GUEST_ANNOUNCE is for,

rarp is to have destination host broadcast a message with VM address to update the network. Guest announce is when it will instead ask the guest to do this.

Okay, thanks for explaining to me.
So if both features are not negotiated, no one is going to broadcast the message, right?

Quoted 7 lines

Could that be a valid reason to print an error message in QEMU?

To me it might be reasonable because the user might experience some network problems, but I'm not a network guy :-)

Thanks,
Stefano

reasonable, yes.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

but my understanding is that the message was to notify that the migration was finished (reading that commit).

If neither feature is supported, could this be a problem for the user and that's why we were printing the message?

Thanks,
Stefano

#5 lore raw
In reply to Stefano Garzarella
Quoted 66 lines · Stefano Garzarella
Quoted 59 lines · Michael S. Tsirkin
Quoted 58 lines · Stefano Garzarella

hw/net/vhost_net-stub.c void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev,

Quoted 25 lines · Laurent Vivier

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

  Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
hw/net/vhost_net-stub.c | 2 +-
net/vhost-user.c        | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +0 -0
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void vhost_net_config_mask(VHostNetState *net, VirtIODevice *dev, 

bool mask)

net/vhost-user.c static ssize_t vhost_user_receive(NetClientState *nc, const

Quoted 13 lines
hw/net/vhost_net-stub.c +1 -1
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
-    return -1;
+    return -ENOTSUP;
 }
 
 VHostNetState *get_vhost_net(NetClientState *nc)
net/vhost-user.c +0 -0
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t vhost_user_receive(NetClientState *nc, const 

uint8_t *buf,

Quoted 11 lines
net/vhost-user.c +1 -2
          r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
              fprintf(stderr,
                      "Vhost user backend fails to broadcast fake RARP\n");
              fflush(stderr);
--

2.47.1

IIUC the message was there since the introduction about 10 years ago from commit 3e866365e1 ("vhost user: add rarp sending after live migration for legacy guest"). IIUC -ENOTSUP is returned when both F_RARP and F_GUEST_ANNOUNCE are not negotiated.

Quoted 5 lines
Quoted 1 line

That said, I honestly don't know what F_RARP or F_GUEST_ANNOUNCE is for,

rarp is to have destination host broadcast a message with VM address to update the network. Guest announce is when it will instead ask the guest to do this.

Quoted 8 lines

Okay, thanks for explaining to me.
So if both features are not negotiated, no one is going to broadcast the message, right?

Could that be a valid reason to print an error message in QEMU?

To me it might be reasonable because the user might experience some network problems, but I'm not a network guy :-)

I'm working on adding vhost-user to passt[1], and in this case we don't need to broadcast any message.

So I don't implement VHOST_USER_SEND_RARP and I don't want the error message to spoil my console.

-ENOTSUP is an error message for developer not for user.

Thanks,
Laurent
[1] https://passt.top/passt/

#6 lore raw
Quoted 71 lines · Laurent Vivier
Quoted 70 lines · Stefano Garzarella
Quoted 59 lines · Michael S. Tsirkin
Quoted 58 lines · Stefano Garzarella

hw/net/vhost_net-stub.c void vhost_net_config_mask(VHostNetState

Quoted 25 lines · Laurent Vivier

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

  Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
hw/net/vhost_net-stub.c | 2 +-
net/vhost-user.c        | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +0 -0
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void vhost_net_config_mask(VHostNetState 

*net, VirtIODevice *dev, bool mask)

net/vhost-user.c static ssize_t

Quoted 13 lines
hw/net/vhost_net-stub.c +1 -1
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
-    return -1;
+    return -ENOTSUP;
 }
 
 VHostNetState *get_vhost_net(NetClientState *nc)
net/vhost-user.c +0 -0
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t 

vhost_user_receive(NetClientState *nc, const uint8_t *buf,

Quoted 11 lines
net/vhost-user.c +1 -2
          r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
              fprintf(stderr,
                      "Vhost user backend fails to broadcast fake RARP\n");
              fflush(stderr);
--

2.47.1

IIUC the message was there since the introduction about 10 years ago from commit 3e866365e1 ("vhost user: add rarp sending after live migration for legacy guest"). IIUC -ENOTSUP is returned when both F_RARP and F_GUEST_ANNOUNCE are not negotiated.

Quoted 5 lines
Quoted 1 line

That said, I honestly don't know what F_RARP or F_GUEST_ANNOUNCE is for,

rarp is to have destination host broadcast a message with VM address to update the network. Guest announce is when it will instead ask the guest to do this.

Okay, thanks for explaining to me.
So if both features are not negotiated, no one is going to broadcast the message, right?

Quoted 6 lines
Quoted 4 lines

Could that be a valid reason to print an error message in QEMU?

To me it might be reasonable because the user might experience some network problems, but I'm not a network guy :-)

I'm working on adding vhost-user to passt[1], and in this case we don't need to broadcast any message.

Okay, so please can you add that to the commit description and also explaining why you don't need that?

Quoted 2 lines

So I don't implement VHOST_USER_SEND_RARP and I don't want the error message to spoil my console.

Fair enough, but at that point, if it's valid to have both feature not negotiated, IMHO is better to return 0 in vhost_user_migration_done(). Maybe adding also a comment to explain that in your scenario you don't need to do nothing (like if guest supports GUEST_ANNOUNCE).

Quoted 2 lines

-ENOTSUP is an error message for developer not for user.

I was referring to the "Vhost user backend fails to broadcast fake RARP" error message we are skipping here.

Thanks,
Stefano

#7 lore raw
Quoted 83 lines · Stefano Garzarella
Quoted 71 lines · Laurent Vivier
Quoted 70 lines · Stefano Garzarella
Quoted 59 lines · Michael S. Tsirkin
Quoted 58 lines · Stefano Garzarella

hw/net/vhost_net-stub.c void vhost_net_config_mask(VHostNetState

Quoted 25 lines · Laurent Vivier

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

  Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
hw/net/vhost_net-stub.c | 2 +-
net/vhost-user.c        | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +0 -0
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void vhost_net_config_mask(VHostNetState 

*net, VirtIODevice *dev, bool mask)

net/vhost-user.c static ssize_t

Quoted 13 lines
hw/net/vhost_net-stub.c +1 -1
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
-    return -1;
+    return -ENOTSUP;
 }
 
 VHostNetState *get_vhost_net(NetClientState *nc)
net/vhost-user.c +0 -0
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t 

vhost_user_receive(NetClientState *nc, const uint8_t *buf,

Quoted 11 lines
net/vhost-user.c +1 -1
          r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
              fprintf(stderr,
                      "Vhost user backend fails to broadcast fake RARP\n");
              fflush(stderr);
Signature · 1 line
2.47.1

IIUC the message was there since the introduction about 10 years ago from commit 3e866365e1 ("vhost user: add rarp sending after live migration for legacy guest"). IIUC -ENOTSUP is returned when both F_RARP and F_GUEST_ANNOUNCE are not negotiated.

Quoted 5 lines
Quoted 1 line

That said, I honestly don't know what F_RARP or F_GUEST_ANNOUNCE is for,

rarp is to have destination host broadcast a message with VM address to update the network. Guest announce is when it will instead ask the guest to do this.

Okay, thanks for explaining to me.
So if both features are not negotiated, no one is going to broadcast the message, right?

Quoted 6 lines
Quoted 4 lines

Could that be a valid reason to print an error message in QEMU?

To me it might be reasonable because the user might experience some network problems, but I'm not a network guy :-)

I'm working on adding vhost-user to passt[1], and in this case we don't need to broadcast any message.

Okay, so please can you add that to the commit description and also explaining why you don't need that?

Quoted 1 line
Quoted 6 lines
Quoted 1 line

So I don't implement VHOST_USER_SEND_RARP and I don't want the error message to spoil my console.

Fair enough, but at that point, if it's valid to have both feature not negotiated, IMHO is better to return 0 in vhost_user_migration_done(). Maybe adding also a comment to explain that in your scenario you don't need to do nothing (like if guest supports GUEST_ANNOUNCE).

I agree.

Quoted 6 lines
Quoted 3 lines

-ENOTSUP is an error message for developer not for user.

I was referring to the "Vhost user backend fails to broadcast fake RARP" error message we are skipping here.

So in the end my real question at this point is:

is it better to suppress the error message in QEMU (1) or implement an empty VHOST_USER_SEND_RARP in Passt (2)?

As this discussion is going on I'm no longer sure that (1) is the right one.

Thanks,
Laurent

#8 lore raw
Quoted 100 lines · Laurent Vivier
Quoted 85 lines · Stefano Garzarella
Quoted 72 lines · Laurent Vivier
Quoted 71 lines · Stefano Garzarella
Quoted 60 lines · Michael S. Tsirkin
Quoted 59 lines · Stefano Garzarella
Quoted 25 lines · Laurent Vivier

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

  Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
hw/net/vhost_net-stub.c | 2 +-
net/vhost-user.c        | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +0 -0
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void
Quoted 1 line

vhost_net_config_mask(VHostNetState

*net, VirtIODevice *dev, bool mask)

net/vhost-user.c static ssize_t

Quoted 13 lines

int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr) {
-    return -1;
+    return -ENOTSUP;
}

VHostNetState *get_vhost_net(NetClientState *nc)

net/vhost-user.c +0 -0
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t

vhost_user_receive(NetClientState *nc, const uint8_t *buf,

Quoted 11 lines
net/vhost-user.c +1 -1
          r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
              fprintf(stderr,
                      "Vhost user backend fails to broadcast fake RARP\n");
              fflush(stderr);
Signature · 1 line
2.47.1

IIUC the message was there since the introduction about 10 years ago from commit 3e866365e1 ("vhost user: add rarp sending after live migration for legacy guest"). IIUC -ENOTSUP is returned when both F_RARP and F_GUEST_ANNOUNCE are not negotiated.

Quoted 5 lines
Quoted 1 line

That said, I honestly don't know what F_RARP or F_GUEST_ANNOUNCE is for,

rarp is to have destination host broadcast a message with VM address to update the network. Guest announce is when it will instead ask the guest to do this.

Okay, thanks for explaining to me.
So if both features are not negotiated, no one is going to broadcast the message, right?

Quoted 7 lines
Quoted 4 lines

Could that be a valid reason to print an error message in QEMU?

To me it might be reasonable because the user might experience some network problems, but I'm not a network guy :-)

I'm working on adding vhost-user to passt[1], and in this case we don't need to broadcast any message.

Okay, so please can you add that to the commit description and also explaining why you don't need that?

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

So I don't implement VHOST_USER_SEND_RARP and I don't want the error message to spoil my console.

Fair enough, but at that point, if it's valid to have both feature not negotiated, IMHO is better to return 0 in vhost_user_migration_done(). Maybe adding also a comment to explain that in your scenario you don't need to do nothing (like if guest supports GUEST_ANNOUNCE).

I agree.

Quoted 4 lines
Quoted 3 lines

-ENOTSUP is an error message for developer not for user.

Quoted 7 lines
Quoted 2 lines

I was referring to the "Vhost user backend fails to broadcast fake RARP" error message we are skipping here.

So in the end my real question at this point is:

is it better to suppress the error message in QEMU (1) or implement an empty VHOST_USER_SEND_RARP in Passt (2)?

If it is valid to interpret "VHOST_USER_SEND_RARP" to mean the service is "capable of sending a RARP where appropriate" rather than "will always unconditionally send an RARP", then it would be reasonable for Passt to have an empty VHOST_USER_SEND_RARP impl.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#9 lore raw
In reply to Stefano Garzarella

[Cc'ed Thibaut as author of 3e866365e1eb ("vhost user: add rarp sending after live migration for legacy guest")]

Quoted 74 lines · On Wed, 22 Jan 2025 17:51:07 +0100 Stefano Garzarella <[email protected]>…
Quoted 73 lines · Laurent Vivier
Quoted 72 lines · Stefano Garzarella
Quoted 59 lines · Michael S. Tsirkin
Quoted 58 lines · Stefano Garzarella

hw/net/vhost_net-stub.c void vhost_net_config_mask(VHostNetState

Quoted 25 lines · Laurent Vivier

In vhost_user_receive() if vhost_net_notify_migration_done() reports an error we display on the console:

  Vhost user backend fails to broadcast fake RARP

This message can be useful if there is a problem to execute VHOST_USER_SEND_RARP but it is useless if the backend doesn't support VHOST_USER_PROTOCOL_F_RARP.

Don't report the error if vhost_net_notify_migration_done() returns -ENOTSUP (from vhost_user_migration_done())

Update vhost_net-stub.c to return -ENOTSUP too.

---
hw/net/vhost_net-stub.c | 2 +-
net/vhost-user.c        | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/net/vhost_net-stub.c +0 -0
index 72df6d757e4d..875cd6c2b9c8 100644
@@ -93,7 +93,7 @@ void vhost_net_config_mask(VHostNetState   

*net, VirtIODevice *dev, bool mask)

net/vhost-user.c static ssize_t

Quoted 13 lines
hw/net/vhost_net-stub.c +1 -1
 int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr)
 {
-    return -1;
+    return -ENOTSUP;
 }
 
 VHostNetState *get_vhost_net(NetClientState *nc)
net/vhost-user.c +0 -0
index 12555518e838..636fff8a84a2 100644
@@ -146,7 +146,7 @@ static ssize_t   

vhost_user_receive(NetClientState *nc, const uint8_t *buf,

Quoted 11 lines
net/vhost-user.c +1 -2
          r = vhost_net_notify_migration_done(s->vhost_net, mac_addr);
 
-        if ((r != 0) && (display_rarp_failure)) {
+        if ((r != 0) && (r != -ENOTSUP) && (display_rarp_failure)) {
              fprintf(stderr,
                      "Vhost user backend fails to broadcast fake RARP\n");
              fflush(stderr);
--

2.47.1

IIUC the message was there since the introduction about 10 years ago from commit 3e866365e1 ("vhost user: add rarp sending after live migration for legacy guest"). IIUC -ENOTSUP is returned when both F_RARP and F_GUEST_ANNOUNCE are not negotiated.

Quoted 5 lines
Quoted 1 line

That said, I honestly don't know what F_RARP or F_GUEST_ANNOUNCE is for,

rarp is to have destination host broadcast a message with VM address to update the network. Guest announce is when it will instead ask the guest to do this.

Okay, thanks for explaining to me.
So if both features are not negotiated, no one is going to broadcast the message, right?

Could that be a valid reason to print an error message in QEMU?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

To me it might be reasonable because the user might experience some network problems, but I'm not a network guy :-)

I'm working on adding vhost-user to passt[1], and in this case we don't need to broadcast any message.

Okay, so please can you add that to the commit description and also explaining why you don't need that?

By the way, we don't need that in passt because we don't need to update any ARP table. Even if the guest changes its MAC address, with passt, nobody is going to notice.

Quoted 8 lines
Quoted 2 lines

So I don't implement VHOST_USER_SEND_RARP and I don't want the error message to spoil my console.

Fair enough, but at that point, if it's valid to have both feature not negotiated, IMHO is better to return 0 in vhost_user_migration_done(). Maybe adding also a comment to explain that in your scenario you don't need to do nothing (like if guest supports GUEST_ANNOUNCE).

Quoted 4 lines
Quoted 1 line

-ENOTSUP is an error message for developer not for user.

I was referring to the "Vhost user backend fails to broadcast fake RARP" error message we are skipping here.

By the way, I think that that message is inaccurate on a number of other levels:

- if the back-end doesn't even try, it can't fail, and "fails" indicates... failure?

- RARP is an obsolete protocol, but there's no such thing as a fake protocol. It's not even a fake message, it's a simple RARP broadcast message, with the correct MAC address. It's "dummy", at most

- I read the whole thread but still I can't understand why we have a capability then: what does it (or its absence) mean?

Regardless of that, sure, let's go ahead and add the fake (that one *is* fake) callback in passt, which Laurent just sent a patch for. We need it anyway as a workaround for compatibility with current/older versions of QEMU.

But I don't understand why we're leaving this as it is.

Signature · 1 line
Stefano
#10 lore raw
Quoted 1 line · Stefano Brivio

But I don't understand why we're leaving this as it is.

So that people notice if there's some backend problem and announcements are not going out. should help debug migration issues. which we had, so we added this :)

#11 lore raw
Quoted 6 lines · On Thu, 20 Feb 2025 10:28:20 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 1 line · Stefano Brivio

But I don't understand why we're leaving this as it is.

So that people notice if there's some backend problem and announcements are not going out. should help debug migration issues. which we had, so we added this :)

The message mentions that the back-end fails to do something it didn't and can't even do, that's (one reason) why it's wrong (and confusing) and this patch is obviously correct.

Perhaps the commit title isn't entirely accurate (it should say "when unsupported", I guess) but it's somewhat expected to sacrifice detail in the name of brevity, there. A glimpse at the message is enough.

Laurent now added a workaround in passt to pretend that we support VHOST_USER_PROTOCOL_F_RARP by doing nothing in the callback, report success, and silence the warning:

https://passt.top/passt/commit/?id=dd6a6854c73a09c4091c1776ee7f349d1e1f966c

but having to do this kind of stuff is a bit unexpected while interacting with another opensource project.

Signature · 1 line
Stefano
#12 lore raw
Quoted 18 lines · Stefano Brivio
Quoted 6 lines · On Thu, 20 Feb 2025 10:28:20 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 1 line · Stefano Brivio

But I don't understand why we're leaving this as it is.

So that people notice if there's some backend problem and announcements are not going out. should help debug migration issues. which we had, so we added this :)

The message mentions that the back-end fails to do something it didn't and can't even do, that's (one reason) why it's wrong (and confusing) and this patch is obviously correct.

Perhaps the commit title isn't entirely accurate (it should say "when unsupported", I guess) but it's somewhat expected to sacrifice detail in the name of brevity, there. A glimpse at the message is enough.

Quoted 11 lines

Laurent now added a workaround in passt to pretend that we support VHOST_USER_PROTOCOL_F_RARP by doing nothing in the callback, report success, and silence the warning:

https://passt.top/passt/commit/?id=dd6a6854c73a09c4091c1776ee7f349d1e1f966c

but having to do this kind of stuff is a bit unexpected while interacting with another opensource project.

Signature · 1 line
Stefano

let me explain. historically backends did not support migration. then migration was added. as it was assumed RARP is required, we did not add a feature flag for "supports migration" and instead just assumed that VHOST_USER_PROTOCOL_F_RARP is that.

If you silence the warning you silence it for old backends with no migration support.
If you want a new flag "migration with no RARP", be my guest and add it.
Or if you want to add documentation explaining the meaning better and clarifying the message.

Signature · 1 line
MST
#13 lore raw
Quoted 32 lines · On Thu, 20 Feb 2025 13:21:33 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 18 lines · Stefano Brivio
Quoted 6 lines · On Thu, 20 Feb 2025 10:28:20 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 1 line · Stefano Brivio

But I don't understand why we're leaving this as it is.

So that people notice if there's some backend problem and announcements are not going out. should help debug migration issues. which we had, so we added this :)

The message mentions that the back-end fails to do something it didn't and can't even do, that's (one reason) why it's wrong (and confusing) and this patch is obviously correct.

Perhaps the commit title isn't entirely accurate (it should say "when unsupported", I guess) but it's somewhat expected to sacrifice detail in the name of brevity, there. A glimpse at the message is enough.

Quoted 11 lines

Laurent now added a workaround in passt to pretend that we support VHOST_USER_PROTOCOL_F_RARP by doing nothing in the callback, report success, and silence the warning:

https://passt.top/passt/commit/?id=dd6a6854c73a09c4091c1776ee7f349d1e1f966c

but having to do this kind of stuff is a bit unexpected while interacting with another opensource project.

Signature · 1 line
Stefano  
Quoted 7 lines

let me explain. historically backends did not support migration. then migration was added. as it was assumed RARP is required, we did not add a feature flag for "supports migration" and instead just assumed that VHOST_USER_PROTOCOL_F_RARP is that.

If you silence the warning you silence it for old backends with no migration support.

Thanks for the explanation. I'm struggling to grasp this. So if a back-end doesn't support migration, because VHOST_USER_PROTOCOL_F_RARP is not present in the features flag, migration is done anyway, but then this is printed:

Vhost user backend fails to broadcast fake RARP

with the meaning of:

We did migration even if the back-end doesn't support it, whoops

?

Note that the message is printed *after* the migration and the flag is *not* checked before.

Quoted 2 lines

If you want a new flag "migration with no RARP", be my guest and add it.

That would actually make more sense than the existing situation I think. VHOST_USER_PROTOCOL_F_NO_RARP?

I didn't understand, yet, what the exact meaning would be, though.

Quoted 2 lines

Or if you want to add documentation explaining the meaning better and clarifying the message.

I'm still in the phase where I'm trying to understand the role of the message :) ...I have to say this is fairly different now from what was mentioned on the thread so far.

Signature · 1 line
Stefano
#14 lore raw
Quoted 65 lines · Stefano Brivio
Quoted 32 lines · On Thu, 20 Feb 2025 13:21:33 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 18 lines · Stefano Brivio
Quoted 6 lines · On Thu, 20 Feb 2025 10:28:20 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 1 line · Stefano Brivio

But I don't understand why we're leaving this as it is.

So that people notice if there's some backend problem and announcements are not going out. should help debug migration issues. which we had, so we added this :)

The message mentions that the back-end fails to do something it didn't and can't even do, that's (one reason) why it's wrong (and confusing) and this patch is obviously correct.

Perhaps the commit title isn't entirely accurate (it should say "when unsupported", I guess) but it's somewhat expected to sacrifice detail in the name of brevity, there. A glimpse at the message is enough.

Quoted 11 lines

Laurent now added a workaround in passt to pretend that we support VHOST_USER_PROTOCOL_F_RARP by doing nothing in the callback, report success, and silence the warning:

https://passt.top/passt/commit/?id=dd6a6854c73a09c4091c1776ee7f349d1e1f966c

but having to do this kind of stuff is a bit unexpected while interacting with another opensource project.

Signature · 1 line
Stefano  
Quoted 7 lines

let me explain. historically backends did not support migration. then migration was added. as it was assumed RARP is required, we did not add a feature flag for "supports migration" and instead just assumed that VHOST_USER_PROTOCOL_F_RARP is that.

If you silence the warning you silence it for old backends with no migration support.

Thanks for the explanation. I'm struggling to grasp this. So if a back-end doesn't support migration, because VHOST_USER_PROTOCOL_F_RARP is not present in the features flag, migration is done anyway, but then this is printed:

Vhost user backend fails to broadcast fake RARP

with the meaning of:

We did migration even if the back-end doesn't support it, whoops

?

Note that the message is printed *after* the migration and the flag is *not* checked before.

Quoted 2 lines

If you want a new flag "migration with no RARP", be my guest and add it.

That would actually make more sense than the existing situation I think. VHOST_USER_PROTOCOL_F_NO_RARP?

Quoted 8 lines

I didn't understand, yet, what the exact meaning would be, though.

Quoted 2 lines

Or if you want to add documentation explaining the meaning better and clarifying the message.

I'm still in the phase where I'm trying to understand the role of the message :) ...I have to say this is fairly different now from what was mentioned on the thread so far.

I'm going by memory. We made it a warning on the assumption that hey, maybe someone has a way to migrate without a RARP, let them work. Exactly what happened, we just did not think it through completely :)

Signature · 1 line
MST
#15 lore raw
Quoted 72 lines · Michael S. Tsirkin
Quoted 70 lines · Stefano Brivio
Quoted 32 lines · On Thu, 20 Feb 2025 13:21:33 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 22 lines · Stefano Brivio
Quoted 6 lines · On Thu, 20 Feb 2025 10:28:20 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 1 line · Stefano Brivio

But I don't understand why we're leaving this as it is.

So that people notice if there's some backend problem and announcements are not going out. should help debug migration issues. which we had, so we added this :)

The message mentions that the back-end fails to do something it didn't and can't even do, that's (one reason) why it's wrong (and confusing) and this patch is obviously correct.

Perhaps the commit title isn't entirely accurate (it should say "when unsupported", I guess) but it's somewhat expected to sacrifice detail in the name of brevity, there. A glimpse at the message is enough.

Laurent now added a workaround in passt to pretend that we support VHOST_USER_PROTOCOL_F_RARP by doing nothing in the callback, report success, and silence the warning:

Quoted 7 lines

https://passt.top/passt/commit/?id=dd6a6854c73a09c4091c1776ee7f349d1e1f966c

but having to do this kind of stuff is a bit unexpected while interacting with another opensource project.

--
Stefano

Quoted 7 lines

let me explain. historically backends did not support migration. then migration was added. as it was assumed RARP is required, we did not add a feature flag for "supports migration" and instead just assumed that VHOST_USER_PROTOCOL_F_RARP is that.

If you silence the warning you silence it for old backends with no migration support.

Thanks for the explanation. I'm struggling to grasp this. So if a back-end doesn't support migration, because VHOST_USER_PROTOCOL_F_RARP is not present in the features flag, migration is done anyway, but then this is printed:

Vhost user backend fails to broadcast fake RARP

with the meaning of:

We did migration even if the back-end doesn't support it, whoops

?

Note that the message is printed *after* the migration and the flag is *not* checked before.

Quoted 2 lines

If you want a new flag "migration with no RARP", be my guest and add it.

That would actually make more sense than the existing situation I think. VHOST_USER_PROTOCOL_F_NO_RARP?

I didn't understand, yet, what the exact meaning would be, though.

Quoted 2 lines

Or if you want to add documentation explaining the meaning better and clarifying the message.

Quoted 6 lines
Quoted 3 lines

I'm still in the phase where I'm trying to understand the role of the message :) ...I have to say this is fairly different now from what was mentioned on the thread so far.

I'm going by memory. We made it a warning on the assumption that hey, maybe someone has a way to migrate without a RARP, let them work.

Migration still works, it might just increase the time spent on recovering the networking topology by switching if the guest doesn't send anything.

Or I've heard from the upper layer team that the control/management plane may be in charge of the network recovery after migration so RARP is not a must.

Quoted 1 line

Exactly what happened, we just did not think it through completely :)

Thanks

Quoted 5 lines

--
MST