the userspace process vapp mmap filed // [PULL 13/37] vhost-user: fix regions provied with VHOST_USER_SET_MEM_TABLE message
Quoted 7 lines · Michael S. Tsirkin
Quoted 1 line · linhafieng
I run the user process vapp to test the
VHOST_USER_SET_MEM_TABLEmessage found that the user sapce failed to mmap.Why off-list?
pls copy qemu mailing list and [email protected]
I wrote a patch for the vapp to test the patch of broken mem regions.The vapp can receive data from VM but there is a mmap failed error.
i have some qeusions about the patch and vhost-user:
1.can i mmap all the fd of the mem regions? why some region failed?Have any impact on it? 2.the vapp why not update with the path of broken mem regions?
3.is the test program of vhost user test vring mem more meaningful?
4.the port of switch how to find the vhost-user device?by the socket path? 5.should the process of vhost-user manage all vhost-user backend socket fd? or any better advise?
my patch is for vapp is :
/vhost_server.c 2014-09-09 11:36:50.000000000 +0000 renamed from vhost_server.c 2014-08-30 09:39:20.000000000 +0000 +8 -4
@@ -147,18 +147,22 @@ for (idx = 0; idx < msg->msg.memory.nregions; idx++) { if (msg->fds[idx] > 0) { + size_t size; + uint64_t *guest_mem; VhostServerMemoryRegion *region = &vhost_server->memory.regions[idx]; region->guest_phys_addr = msg->msg.memory.regions[idx].guest_phys_addr; region->memory_size = msg->msg.memory.regions[idx].memory_size; region->userspace_addr = msg->msg.memory.regions[idx].userspace_addr; - + region->mmap_offset = msg->msg.memory.regions[idx].mmap_offset; + assert(idx < msg->fd_num); assert(msg->fds[idx] > 0); - region->mmap_addr = - (uintptr_t) init_shm_from_fd(msg->fds[idx], region->memory_size); - + size = region->memory_size + region->mmap_offset; + guest_mem = init_shm_from_fd(msg->fds[idx], size); + guest_mem += (region->mmap_offset / sizeof(*guest_mem)); + region->mmap_addr = (uint64_t)guest_mem; vhost_server->memory.nregions++; } }
/vhost_server.h 2014-09-05 01:41:27.000000000 +0000 renamed from vhost_server.h 2014-08-30 09:39:20.000000000 +0000 +2 -0
@@ -13,7 +13,9 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; uint64_t mmap_addr; + } VhostServerMemoryRegion; typedef struct VhostServerMemory {
/vhost_user.h 2014-09-05 01:40:20.000000000 +0000 renamed from vhost_user.h 2014-08-30 09:39:20.000000000 +0000 +1 -0
@@ -13,6 +13,7 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; } VhostUserMemoryRegion; typedef struct VhostUserMemory {
the result of the vapp with my patch :
................................................................................
Processing message: VHOST_USER_SET_OWNER_set_owner
Cmd: VHOST_USER_GET_FEATURES (0x1)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_GET_FEATURES_get_features
Cmd: VHOST_USER_SET_VRING_CALL (0xd)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd 0x5
Cmd: VHOST_USER_SET_VRING_CALL (0xd)
Flags: 0x1
u64: 0x1
................................................................................
Processing message: VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd 0x6
Cmd: VHOST_USER_SET_FEATURES (0x2)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_SET_FEATURES_set_features
Cmd: VHOST_USER_SET_MEM_TABLE (0x5)
Flags: 0x1
nregions: 2
region:
gpa = 0x0
size = 655360
ua = 0x7f76c0000000 [0]
region:
gpa = 0xC0000
size = 2146697216
ua = 0x7f76c00c0000 [1]................................................................................
Processing message: VHOST_USER_SET_MEM_TABLE_set_mem_table
mmap: Invalid argument //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ region 0 mmap failed! Got memory.nregions 2
Cmd: VHOST_USER_SET_VRING_NUM (0x8)
Flags: 0x1
state: 0 256
................................................................................
Processing message: VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd: VHOST_USER_SET_VRING_BASE (0xa)
Flags: 0x1
state: 0 0
................................................................................
Processing message: VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd: VHOST_USER_SET_VRING_ADDR (0x9)
Flags: 0x1
addr:
idx = 0
flags = 0x0
dua = 0x7f76f7f54000
uua = 0x7f76f7f56000
aua = 0x7f76f7f55000
lga = 0x37f56000................................................................................
Processing message: VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd: VHOST_USER_SET_VRING_KICK (0xc)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd 0x9
Cmd: VHOST_USER_SET_VRING_NUM (0x8)
Flags: 0x1
state: 1 256
................................................................................
Processing message: VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd: VHOST_USER_SET_VRING_BASE (0xa)
Flags: 0x1
state: 1 0
................................................................................
Processing message: VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd: VHOST_USER_SET_VRING_ADDR (0x9)
Flags: 0x1
addr:
idx = 1
flags = 0x0
dua = 0x7f7739834000
uua = 0x7f7739836000
aua = 0x7f7739835000
lga = 0x79836000................................................................................
Processing message: VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd: VHOST_USER_SET_VRING_KICK (0xc)
Flags: 0x1
u64: 0x1
................................................................................
Processing message: VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd 0xa
Listening for kicks on 0xa
Cmd: VHOST_USER_SET_VRING_CALL (0xd)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd 0xb
Cmd: VHOST_USER_SET_VRING_CALL (0xd)
Flags: 0x1
u64: 0x1
................................................................................
Processing message: VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd 0xc
chunks: 10 90
................................................................................
33 33 00 00 00 16 52 54 00 12 34 56 86 dd 60 00
00 00 00 24 00 01 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 16 3a 00 05 02 00 00 01 00 8f 00
3b 22 00 00 00 01 04 00 00 00 ff 02 00 00 00 00
00 00 00 00 00 01 ff 12 34 56
chunks: 10 78
................................................................................
33 33 ff 12 34 56 52 54 00 12 34 56 86 dd 60 00
00 00 00 18 3a ff 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 01 ff 12 34 56 87 00 c4 02 00 00 00 00 fe 80
00 00 00 00 00 00 50 54 00 ff fe 12 34 56
chunks: 10 70
................................................................................
33 33 00 00 00 02 52 54 00 12 34 56 86 dd 60 00
00 00 00 10 3a ff fe 80 00 00 00 00 00 00 50 54
00 ff fe 12 34 56 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 02 85 00 71 b5 00 00 00 00 01 01
52 54 00 12 34 56
chunks: 10 90
................................................................................
-------- Forwarded Message --------
Subject: Re: the userspace process vapp mmap filed //[Qemu-devel] [PULL 13/37] vhost-user: fix regions provied with VHOST_USER_SET_MEM_TABLE message
Date: Tue, 09 Sep 2014 19:45:08 +0800
From: linhafieng <[email protected]>
To: Michael S. Tsirkin <[email protected]>
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Quoted 7 lines · Michael S. Tsirkin
Quoted 1 line · linhafieng
I run the user process vapp to test the
VHOST_USER_SET_MEM_TABLEmessage found that the user sapce failed to mmap.Why off-list?
pls copy qemu mailing list and [email protected]
I wrote a patch for the vapp to test the patch of broken mem regions.The vapp can receive data from VM but there is a mmap failed error.
i have some qeusions about the patch and vhost-user:
1.can i mmap all the fd of the mem regions? why some region failed?Have any impact on it? 2.the vapp why not update with the path of broken mem regions?
3.is the test program of vhost user test vring mem more meaningful?
4.the port of switch how to find the vhost-user device?by the socket path? 5.should the process of vhost-user manage all vhost-user backend socket fd? or any better advise?
my patch is for vapp is :
/vhost_server.c 2014-09-09 11:36:50.000000000 +0000 renamed from vhost_server.c 2014-08-30 09:39:20.000000000 +0000 +8 -4
@@ -147,18 +147,22 @@ for (idx = 0; idx < msg->msg.memory.nregions; idx++) { if (msg->fds[idx] > 0) { + size_t size; + uint64_t *guest_mem; VhostServerMemoryRegion *region = &vhost_server->memory.regions[idx]; region->guest_phys_addr = msg->msg.memory.regions[idx].guest_phys_addr; region->memory_size = msg->msg.memory.regions[idx].memory_size; region->userspace_addr = msg->msg.memory.regions[idx].userspace_addr; - + region->mmap_offset = msg->msg.memory.regions[idx].mmap_offset; + assert(idx < msg->fd_num); assert(msg->fds[idx] > 0); - region->mmap_addr = - (uintptr_t) init_shm_from_fd(msg->fds[idx], region->memory_size); - + size = region->memory_size + region->mmap_offset; + guest_mem = init_shm_from_fd(msg->fds[idx], size); + guest_mem += (region->mmap_offset / sizeof(*guest_mem)); + region->mmap_addr = (uint64_t)guest_mem; vhost_server->memory.nregions++; } }
/vhost_server.h 2014-09-05 01:41:27.000000000 +0000 renamed from vhost_server.h 2014-08-30 09:39:20.000000000 +0000 +2 -0
@@ -13,7 +13,9 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; uint64_t mmap_addr; + } VhostServerMemoryRegion; typedef struct VhostServerMemory {
/vhost_user.h 2014-09-05 01:40:20.000000000 +0000 renamed from vhost_user.h 2014-08-30 09:39:20.000000000 +0000 +1 -0
@@ -13,6 +13,7 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; } VhostUserMemoryRegion; typedef struct VhostUserMemory {
the result of the vapp with my patch :
................................................................................
Processing message: VHOST_USER_SET_OWNER_set_owner
Cmd: VHOST_USER_GET_FEATURES (0x1)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_GET_FEATURES_get_features
Cmd: VHOST_USER_SET_VRING_CALL (0xd)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd 0x5
Cmd: VHOST_USER_SET_VRING_CALL (0xd)
Flags: 0x1
u64: 0x1
................................................................................
Processing message: VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd 0x6
Cmd: VHOST_USER_SET_FEATURES (0x2)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_SET_FEATURES_set_features
Cmd: VHOST_USER_SET_MEM_TABLE (0x5)
Flags: 0x1
nregions: 2
region:
gpa = 0x0
size = 655360
ua = 0x7f76c0000000 [0]
region:
gpa = 0xC0000
size = 2146697216
ua = 0x7f76c00c0000 [1]................................................................................
Processing message: VHOST_USER_SET_MEM_TABLE_set_mem_table
mmap: Invalid argument //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ region 0 mmap failed! Got memory.nregions 2
Cmd: VHOST_USER_SET_VRING_NUM (0x8)
Flags: 0x1
state: 0 256
................................................................................
Processing message: VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd: VHOST_USER_SET_VRING_BASE (0xa)
Flags: 0x1
state: 0 0
................................................................................
Processing message: VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd: VHOST_USER_SET_VRING_ADDR (0x9)
Flags: 0x1
addr:
idx = 0
flags = 0x0
dua = 0x7f76f7f54000
uua = 0x7f76f7f56000
aua = 0x7f76f7f55000
lga = 0x37f56000................................................................................
Processing message: VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd: VHOST_USER_SET_VRING_KICK (0xc)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd 0x9
Cmd: VHOST_USER_SET_VRING_NUM (0x8)
Flags: 0x1
state: 1 256
................................................................................
Processing message: VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd: VHOST_USER_SET_VRING_BASE (0xa)
Flags: 0x1
state: 1 0
................................................................................
Processing message: VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd: VHOST_USER_SET_VRING_ADDR (0x9)
Flags: 0x1
addr:
idx = 1
flags = 0x0
dua = 0x7f7739834000
uua = 0x7f7739836000
aua = 0x7f7739835000
lga = 0x79836000................................................................................
Processing message: VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd: VHOST_USER_SET_VRING_KICK (0xc)
Flags: 0x1
u64: 0x1
................................................................................
Processing message: VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd 0xa
Listening for kicks on 0xa
Cmd: VHOST_USER_SET_VRING_CALL (0xd)
Flags: 0x1
u64: 0x0
................................................................................
Processing message: VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd 0xb
Cmd: VHOST_USER_SET_VRING_CALL (0xd)
Flags: 0x1
u64: 0x1
................................................................................
Processing message: VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd 0xc
chunks: 10 90
................................................................................
33 33 00 00 00 16 52 54 00 12 34 56 86 dd 60 00
00 00 00 24 00 01 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 16 3a 00 05 02 00 00 01 00 8f 00
3b 22 00 00 00 01 04 00 00 00 ff 02 00 00 00 00
00 00 00 00 00 01 ff 12 34 56
chunks: 10 78
................................................................................
33 33 ff 12 34 56 52 54 00 12 34 56 86 dd 60 00
00 00 00 18 3a ff 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 01 ff 12 34 56 87 00 c4 02 00 00 00 00 fe 80
00 00 00 00 00 00 50 54 00 ff fe 12 34 56
chunks: 10 70
................................................................................
33 33 00 00 00 02 52 54 00 12 34 56 86 dd 60 00
00 00 00 10 3a ff fe 80 00 00 00 00 00 00 50 54
00 ff fe 12 34 56 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 02 85 00 71 b5 00 00 00 00 01 01
52 54 00 12 34 56
chunks: 10 90
................................................................................
Hello,
Vapp is a VOSYS application, currently not meant to be part of QEMU; as such your proposed patch might not be meaningful if pushed towards QEMU devel list. As the current Vapp implementation is not updated since last March, custom support and any related potential design need for a software switch implementation can be discussed at a custom commercial level.
regards,
Nikolay Nikolaev
Virtual Open Systems
Quoted 240 lines · linhafieng
-------- Forwarded Message --------
Subject: Re: the userspace process vapp mmap filed //[Qemu-devel] [PULL 13/37] vhost-user: fix regions provied withVHOST_USER_SET_MEM_TABLEmessage
Date: Tue, 09 Sep 2014 19:45:08 +0800
From: linhafieng <[email protected]>
To: Michael S. Tsirkin <[email protected]>
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]Quoted 7 lines · Michael S. Tsirkin
Quoted 1 line · linhafieng
I run the user process vapp to test the
VHOST_USER_SET_MEM_TABLEmessage found that the user sapce failed to mmap.Why off-list?
pls copy qemu mailing list and [email protected]I wrote a patch for the vapp to test the patch of broken mem regions.The vapp can receive data from VM but there is a mmap failed error.
i have some qeusions about the patch and vhost-user:
1.can i mmap all the fd of the mem regions? why some region failed?Have any impact on it? 2.the vapp why not update with the path of broken mem regions?
3.is the test program of vhost user test vring mem more meaningful?
4.the port of switch how to find the vhost-user device?by the socket path? 5.should the process of vhost-user manage all vhost-user backend socket fd? or any better advise?my patch is for vapp is :
diff -uNr
vapp/vhost_server.cvapp-for-broken-mem-region//vhost_server.c/vhost_server.c 2014-09-09 11:36:50.000000000 +0000 renamed from vhost_server.c 2014-08-30 09:39:20.000000000 +0000 +8
-4@@ -147,18 +147,22 @@ for (idx = 0; idx < msg->msg.memory.nregions; idx++) { if (msg->fds[idx] > 0) { + size_t size; + uint64_t *guest_mem; VhostServerMemoryRegion *region = &vhost_server->memory.regions[idx]; region->guest_phys_addr = msg->msg.memory.regions[idx].guest_phys_addr; region->memory_size = msg->msg.memory.regions[idx].memory_size; region->userspace_addr = msg->msg.memory.regions[idx].userspace_addr; - + region->mmap_offset = msg->msg.memory.regions[idx].mmap_offset; + assert(idx < msg->fd_num); assert(msg->fds[idx] > 0); - region->mmap_addr = - (uintptr_t) init_shm_from_fd(msg->fds[idx], region->memory_size); - + size = region->memory_size + region->mmap_offset; + guest_mem = init_shm_from_fd(msg->fds[idx], size); + guest_mem += (region->mmap_offset / sizeof(*guest_mem)); + region->mmap_addr = (uint64_t)guest_mem; vhost_server->memory.nregions++; } }diff -uNr
vapp/vhost_server.hvapp-for-broken-mem-region//vhost_server.h/vhost_server.h 2014-09-05 01:41:27.000000000 +0000 renamed from vhost_server.h 2014-08-30 09:39:20.000000000 +0000 +2
-0@@ -13,7 +13,9 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; uint64_t mmap_addr; + } VhostServerMemoryRegion; typedef struct VhostServerMemory {diff -uNr
vapp/vhost_user.hvapp-for-broken-mem-region//vhost_user.h/vhost_user.h 2014-09-05 01:40:20.000000000 +0000 renamed from vhost_user.h 2014-08-30 09:39:20.000000000 +0000 +1
-0@@ -13,6 +13,7 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; } VhostUserMemoryRegion; typedef struct VhostUserMemory {the result of the vapp with my patch :
................................................................................
Processing message:VHOST_USER_SET_OWNER_set_owner
Cmd:VHOST_USER_GET_FEATURES(0x1)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_GET_FEATURES_get_features
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0x5
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x1
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0x6
Cmd:VHOST_USER_SET_FEATURES(0x2)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_FEATURES_set_features
Cmd:VHOST_USER_SET_MEM_TABLE(0x5)
Flags:0x1
nregions: 2
region:gpa = 0x0 size = 655360 ua = 0x7f76c0000000 [0] region: gpa = 0xC0000 size = 2146697216 ua = 0x7f76c00c0000 [1]................................................................................
Processing message:VHOST_USER_SET_MEM_TABLE_set_mem_table
mmap: Invalid argument //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ region 0 mmap failed! Got memory.nregions 2
Cmd:VHOST_USER_SET_VRING_NUM(0x8)
Flags:0x1
state: 0 256
................................................................................
Processing message:VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd:VHOST_USER_SET_VRING_BASE(0xa)
Flags:0x1
state: 0 0
................................................................................
Processing message:VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd:VHOST_USER_SET_VRING_ADDR(0x9)
Flags:0x1
addr:idx = 0 flags = 0x0 dua = 0x7f76f7f54000 uua = 0x7f76f7f56000 aua = 0x7f76f7f55000 lga = 0x37f56000................................................................................
Processing message:VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd:VHOST_USER_SET_VRING_KICK(0xc)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd0x9
Cmd:VHOST_USER_SET_VRING_NUM(0x8)
Flags:0x1
state: 1 256
................................................................................
Processing message:VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd:VHOST_USER_SET_VRING_BASE(0xa)
Flags:0x1
state: 1 0
................................................................................
Processing message:VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd:VHOST_USER_SET_VRING_ADDR(0x9)
Flags:0x1
addr:idx = 1 flags = 0x0 dua = 0x7f7739834000 uua = 0x7f7739836000 aua = 0x7f7739835000 lga = 0x79836000................................................................................
Processing message:VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd:VHOST_USER_SET_VRING_KICK(0xc)
Flags:0x1
u64:0x1
................................................................................
Processing message:VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd0xa
Listening for kicks on0xa
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0xb
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x1
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0xc
chunks: 10 90
................................................................................
33 33 00 00 00 16 52 54 00 12 34 56 86 dd 60 00
00 00 00 24 00 01 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 16 3a 00 05 02 00 00 01 00 8f 00
3b 22 00 00 00 01 04 00 00 00 ff 02 00 00 00 00
00 00 00 00 00 01 ff 12 34 56
chunks: 10 78
................................................................................
33 33 ff 12 34 56 52 54 00 12 34 56 86 dd 60 00
00 00 00 18 3a ff 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 01 ff 12 34 56 87 00 c4 02 00 00 00 00 fe 80
00 00 00 00 00 00 50 54 00 ff fe 12 34 56
chunks: 10 70
................................................................................
33 33 00 00 00 02 52 54 00 12 34 56 86 dd 60 00
00 00 00 10 3a ff fe 80 00 00 00 00 00 00 50 54
00 ff fe 12 34 56 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 02 85 00 71 b5 00 00 00 00 01 01
52 54 00 12 34 56
chunks: 10 90
................................................................................
Quoted 10 lines · Nikolay Nikolaev
Hello,
Vapp is a VOSYS application, currently not meant to be part of QEMU; as such your proposed patch might not be meaningful if pushed towards QEMU devel list.
As the current Vapp implementation is not updated
since last March, custom support and any related potential design need for a software switch implementation can be discussed at a custom commercial level.
Quoted 3 lines
regards,
Nikolay Nikolaev
Virtual Open Systems
I'm not familiar enough with the software itself to comment on the patch.
But I don't think yours is a valid answer, and I was the one who asked that the question is sent to the list.
I merged the vhost-user protocol so we can support multiple backends. Someone wants to work on another backend, more power to them, Way I read it the question is whether there's a bug in vhost in qemu, and how to use vhost-user, and this seems relevant on our list.
Signature · 1 line
MST
Hi,
Thank you for your answer.I think the problem is not how to publish the patch the problem is there is no standard vhost-user module.
I just use the vapp to test the new backend vhost-user. I found that the kernel have a module names vhost-net for the vhost backend but there is no vhost-user module for the vhost-user backend.who will supply a standard vhost-user lib for the user process?if everybody implement it self I think it's hard to maintenance qemu.so I think there are some question must be answered:
1.who supply the standard vhost-user module to use the backend of qemu?kernel have maintenance the vhost-net there must be a organization to maintenance the vhost-user module. 2.the vhost-user module should be in common use.I think it maybe a share library have interface like open、close、send、recv and the user process will easy to use not just supply a test program. 3.qemu support multi net device the vhost-user module should support multi net device too.
-----Original Message-----
From: Nikolay Nikolaev [mailto:[email protected]]
Sent: Wednesday, September 10, 2014 1:54 AM
To: Linhaifeng; Daniel Raho
Cc: qemu-devel; [email protected] >> Michael S. Tsirkin; Lilijun (Jerry); Paolo Bonzini; Damjan Marion; VirtualOpenSystems Technical Team
Subject: Re: Re: the userspace process vapp mmap filed //[Qemu-devel] [PULL 13/37] vhost-user: fix regions provied with VHOST_USER_SET_MEM_TABLE message
Hello,
Vapp is a VOSYS application, currently not meant to be part of QEMU; as such your proposed patch might not be meaningful if pushed towards QEMU devel list. As the current Vapp implementation is not updated since last March, custom support and any related potential design need for a software switch implementation can be discussed at a custom commercial level.
regards,
Nikolay Nikolaev
Virtual Open Systems
Quoted 240 lines · linhafieng
-------- Forwarded Message --------
Subject: Re: the userspace process vapp mmap filed //[Qemu-devel] [PULL 13/37] vhost-user: fix regions provied withVHOST_USER_SET_MEM_TABLEmessage
Date: Tue, 09 Sep 2014 19:45:08 +0800
From: linhafieng <[email protected]>
To: Michael S. Tsirkin <[email protected]>
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]Quoted 7 lines · Michael S. Tsirkin
Quoted 1 line · linhafieng
I run the user process vapp to test the
VHOST_USER_SET_MEM_TABLEmessage found that the user sapce failed to mmap.Why off-list?
pls copy qemu mailing list and [email protected]I wrote a patch for the vapp to test the patch of broken mem regions.The vapp can receive data from VM but there is a mmap failed error.
i have some qeusions about the patch and vhost-user:
1.can i mmap all the fd of the mem regions? why some region failed?Have any impact on it? 2.the vapp why not update with the path of broken mem regions?
3.is the test program of vhost user test vring mem more meaningful?
4.the port of switch how to find the vhost-user device?by the socket path? 5.should the process of vhost-user manage all vhost-user backend socket fd? or any better advise?my patch is for vapp is :
diff -uNr
vapp/vhost_server.cvapp-for-broken-mem-region//vhost_server.c/vhost_server.c 2014-09-09 11:36:50.000000000 +0000 renamed from vhost_server.c 2014-08-30 09:39:20.000000000 +0000 +8
-4@@ -147,18 +147,22 @@ for (idx = 0; idx < msg->msg.memory.nregions; idx++) { if (msg->fds[idx] > 0) { + size_t size; + uint64_t *guest_mem; VhostServerMemoryRegion *region = &vhost_server->memory.regions[idx]; region->guest_phys_addr = msg->msg.memory.regions[idx].guest_phys_addr; region->memory_size = msg->msg.memory.regions[idx].memory_size; region->userspace_addr = msg->msg.memory.regions[idx].userspace_addr; - + region->mmap_offset = msg->msg.memory.regions[idx].mmap_offset; + assert(idx < msg->fd_num); assert(msg->fds[idx] > 0); - region->mmap_addr = - (uintptr_t) init_shm_from_fd(msg->fds[idx], region->memory_size); - + size = region->memory_size + region->mmap_offset; + guest_mem = init_shm_from_fd(msg->fds[idx], size); + guest_mem += (region->mmap_offset / sizeof(*guest_mem)); + region->mmap_addr = (uint64_t)guest_mem; vhost_server->memory.nregions++; } }diff -uNr
vapp/vhost_server.hvapp-for-broken-mem-region//vhost_server.h/vhost_server.h 2014-09-05 01:41:27.000000000 +0000 renamed from vhost_server.h 2014-08-30 09:39:20.000000000 +0000 +2
-0@@ -13,7 +13,9 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; uint64_t mmap_addr; + } VhostServerMemoryRegion; typedef struct VhostServerMemory {diff -uNr
vapp/vhost_user.hvapp-for-broken-mem-region//vhost_user.h/vhost_user.h 2014-09-05 01:40:20.000000000 +0000 renamed from vhost_user.h 2014-08-30 09:39:20.000000000 +0000 +1
-0@@ -13,6 +13,7 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; } VhostUserMemoryRegion; typedef struct VhostUserMemory {the result of the vapp with my patch :
................................................................................
Processing message:VHOST_USER_SET_OWNER_set_owner
Cmd:VHOST_USER_GET_FEATURES(0x1)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_GET_FEATURES_get_features
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0x5
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x1
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0x6
Cmd:VHOST_USER_SET_FEATURES(0x2)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_FEATURES_set_features
Cmd:VHOST_USER_SET_MEM_TABLE(0x5)
Flags:0x1
nregions: 2
region:gpa = 0x0 size = 655360 ua = 0x7f76c0000000 [0] region: gpa = 0xC0000 size = 2146697216 ua = 0x7f76c00c0000 [1]................................................................................
Processing message:VHOST_USER_SET_MEM_TABLE_set_mem_table
mmap: Invalid argument //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ region 0 mmap failed! Got memory.nregions 2
Cmd:VHOST_USER_SET_VRING_NUM(0x8)
Flags:0x1
state: 0 256
................................................................................
Processing message:VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd:VHOST_USER_SET_VRING_BASE(0xa)
Flags:0x1
state: 0 0
................................................................................
Processing message:VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd:VHOST_USER_SET_VRING_ADDR(0x9)
Flags:0x1
addr:idx = 0 flags = 0x0 dua = 0x7f76f7f54000 uua = 0x7f76f7f56000 aua = 0x7f76f7f55000 lga = 0x37f56000................................................................................
Processing message:VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd:VHOST_USER_SET_VRING_KICK(0xc)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd0x9
Cmd:VHOST_USER_SET_VRING_NUM(0x8)
Flags:0x1
state: 1 256
................................................................................
Processing message:VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd:VHOST_USER_SET_VRING_BASE(0xa)
Flags:0x1
state: 1 0
................................................................................
Processing message:VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd:VHOST_USER_SET_VRING_ADDR(0x9)
Flags:0x1
addr:idx = 1 flags = 0x0 dua = 0x7f7739834000 uua = 0x7f7739836000 aua = 0x7f7739835000 lga = 0x79836000................................................................................
Processing message:VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd:VHOST_USER_SET_VRING_KICK(0xc)
Flags:0x1
u64:0x1
................................................................................
Processing message:VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd0xa
Listening for kicks on0xa
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0xb
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x1
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0xc
chunks: 10 90
................................................................................
33 33 00 00 00 16 52 54 00 12 34 56 86 dd 60 00
00 00 00 24 00 01 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 16 3a 00 05 02 00 00 01 00 8f 00
3b 22 00 00 00 01 04 00 00 00 ff 02 00 00 00 00
00 00 00 00 00 01 ff 12 34 56
chunks: 10 78
................................................................................
33 33 ff 12 34 56 52 54 00 12 34 56 86 dd 60 00
00 00 00 18 3a ff 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 01 ff 12 34 56 87 00 c4 02 00 00 00 00 fe 80
00 00 00 00 00 00 50 54 00 ff fe 12 34 56
chunks: 10 70
................................................................................
33 33 00 00 00 02 52 54 00 12 34 56 86 dd 60 00
00 00 00 10 3a ff fe 80 00 00 00 00 00 00 50 54
00 ff fe 12 34 56 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 02 85 00 71 b5 00 00 00 00 01 01
52 54 00 12 34 56
chunks: 10 90
................................................................................
Hello,
see my answer inline:
Quoted 7 lines · Linhaifeng
Hi,
Thank you for your answer.I think the problem is not how to publish the patch the problem is there is no standard vhost-user module.
I just use the vapp to test the new backend vhost-user. I found that the kernel have a module names vhost-net for the vhost backend but there is no vhost-user module for the vhost-user backend.who will supply a standard vhost-user lib for the user process?if everybody implement it self I think it's hard to maintenance qemu.so I think there are some question must be answered:
1.who supply the standard vhost-user module to use the backend of qemu?kernel have maintenance the vhost-net there must be a organization to maintenance the vhost-user module.
AFAIK there is no such module. vhost-user is a protocol. It is described in the relevant document in the QEMU tree. If a project wants to use it, it will implement the protocol.
The way we use vhost-user in snabbswitch (http://snabb.co) is we implemented the slave side of the protocol in Lua.
Quoted 1 line
2.the vhost-user module should be in common use.I think it maybe a share library have interface like open、close、send、recv and the user process will easy to use not just supply a test program.
We have discussed this possibility internally, however our current resource prioritization does not allow us to give a fixed implementation plan.
Quoted 1 line
3.qemu support multi net device the vhost-user module should support multi net device too.
I am not sure what multi net is? if you mean multiple vhost-user backed NICs I think this should be working.
Is there a bug in vhost-user implementation in QEMU related to shared memory? We don't see such. We're working on commercial deployment of qemu/vhost-user/snabbswitch and it works well with our tests.
regards,
Nikolay Nikolaev
Virtual Open Systems
Quoted 262 lines
-----Original Message-----
From: Nikolay Nikolaev [mailto:[email protected]]
Sent: Wednesday, September 10, 2014 1:54 AM
To: Linhaifeng; Daniel Raho
Cc: qemu-devel; [email protected] >> Michael S. Tsirkin; Lilijun (Jerry); Paolo Bonzini; Damjan Marion; VirtualOpenSystems Technical Team
Subject: Re: Re: the userspace process vapp mmap filed //[Qemu-devel] [PULL 13/37] vhost-user: fix regions provied withVHOST_USER_SET_MEM_TABLEmessageHello,
Vapp is a VOSYS application, currently not meant to be part of QEMU; as such your proposed patch might not be meaningful if pushed towards QEMU devel list. As the current Vapp implementation is not updated since last March, custom support and any related potential design need for a software switch implementation can be discussed at a custom commercial level.
regards,
Nikolay Nikolaev
Virtual Open SystemsQuoted 240 lines · linhafieng
-------- Forwarded Message --------
Subject: Re: the userspace process vapp mmap filed //[Qemu-devel] [PULL 13/37] vhost-user: fix regions provied withVHOST_USER_SET_MEM_TABLEmessage
Date: Tue, 09 Sep 2014 19:45:08 +0800
From: linhafieng <[email protected]>
To: Michael S. Tsirkin <[email protected]>
CC: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]Quoted 7 lines · Michael S. Tsirkin
Quoted 1 line · linhafieng
I run the user process vapp to test the
VHOST_USER_SET_MEM_TABLEmessage found that the user sapce failed to mmap.Why off-list?
pls copy qemu mailing list and [email protected]I wrote a patch for the vapp to test the patch of broken mem regions.The vapp can receive data from VM but there is a mmap failed error.
i have some qeusions about the patch and vhost-user:
1.can i mmap all the fd of the mem regions? why some region failed?Have any impact on it? 2.the vapp why not update with the path of broken mem regions?
3.is the test program of vhost user test vring mem more meaningful?
4.the port of switch how to find the vhost-user device?by the socket path? 5.should the process of vhost-user manage all vhost-user backend socket fd? or any better advise?my patch is for vapp is :
diff -uNr
vapp/vhost_server.cvapp-for-broken-mem-region//vhost_server.c/vhost_server.c 2014-09-09 11:36:50.000000000 +0000 renamed from vhost_server.c 2014-08-30 09:39:20.000000000 +0000 +8
-4@@ -147,18 +147,22 @@ for (idx = 0; idx < msg->msg.memory.nregions; idx++) { if (msg->fds[idx] > 0) { + size_t size; + uint64_t *guest_mem; VhostServerMemoryRegion *region = &vhost_server->memory.regions[idx]; region->guest_phys_addr = msg->msg.memory.regions[idx].guest_phys_addr; region->memory_size = msg->msg.memory.regions[idx].memory_size; region->userspace_addr = msg->msg.memory.regions[idx].userspace_addr; - + region->mmap_offset = msg->msg.memory.regions[idx].mmap_offset; + assert(idx < msg->fd_num); assert(msg->fds[idx] > 0); - region->mmap_addr = - (uintptr_t) init_shm_from_fd(msg->fds[idx], region->memory_size); - + size = region->memory_size + region->mmap_offset; + guest_mem = init_shm_from_fd(msg->fds[idx], size); + guest_mem += (region->mmap_offset / sizeof(*guest_mem)); + region->mmap_addr = (uint64_t)guest_mem; vhost_server->memory.nregions++; } }diff -uNr
vapp/vhost_server.hvapp-for-broken-mem-region//vhost_server.h/vhost_server.h 2014-09-05 01:41:27.000000000 +0000 renamed from vhost_server.h 2014-08-30 09:39:20.000000000 +0000 +2
-0@@ -13,7 +13,9 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; uint64_t mmap_addr; + } VhostServerMemoryRegion; typedef struct VhostServerMemory {diff -uNr
vapp/vhost_user.hvapp-for-broken-mem-region//vhost_user.h/vhost_user.h 2014-09-05 01:40:20.000000000 +0000 renamed from vhost_user.h 2014-08-30 09:39:20.000000000 +0000 +1
-0@@ -13,6 +13,7 @@ uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; + uint64_t mmap_offset; } VhostUserMemoryRegion; typedef struct VhostUserMemory {the result of the vapp with my patch :
................................................................................
Processing message:VHOST_USER_SET_OWNER_set_owner
Cmd:VHOST_USER_GET_FEATURES(0x1)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_GET_FEATURES_get_features
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0x5
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x1
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0x6
Cmd:VHOST_USER_SET_FEATURES(0x2)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_FEATURES_set_features
Cmd:VHOST_USER_SET_MEM_TABLE(0x5)
Flags:0x1
nregions: 2
region:gpa = 0x0 size = 655360 ua = 0x7f76c0000000 [0] region: gpa = 0xC0000 size = 2146697216 ua = 0x7f76c00c0000 [1]................................................................................
Processing message:VHOST_USER_SET_MEM_TABLE_set_mem_table
mmap: Invalid argument //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ region 0 mmap failed! Got memory.nregions 2
Cmd:VHOST_USER_SET_VRING_NUM(0x8)
Flags:0x1
state: 0 256
................................................................................
Processing message:VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd:VHOST_USER_SET_VRING_BASE(0xa)
Flags:0x1
state: 0 0
................................................................................
Processing message:VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd:VHOST_USER_SET_VRING_ADDR(0x9)
Flags:0x1
addr:idx = 0 flags = 0x0 dua = 0x7f76f7f54000 uua = 0x7f76f7f56000 aua = 0x7f76f7f55000 lga = 0x37f56000................................................................................
Processing message:VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd:VHOST_USER_SET_VRING_KICK(0xc)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd0x9
Cmd:VHOST_USER_SET_VRING_NUM(0x8)
Flags:0x1
state: 1 256
................................................................................
Processing message:VHOST_USER_SET_VRING_NUM_set_vring_num
Cmd:VHOST_USER_SET_VRING_BASE(0xa)
Flags:0x1
state: 1 0
................................................................................
Processing message:VHOST_USER_SET_VRING_BASE_set_vring_base
Cmd:VHOST_USER_SET_VRING_ADDR(0x9)
Flags:0x1
addr:idx = 1 flags = 0x0 dua = 0x7f7739834000 uua = 0x7f7739836000 aua = 0x7f7739835000 lga = 0x79836000................................................................................
Processing message:VHOST_USER_SET_VRING_ADDR_set_vring_addr
Cmd:VHOST_USER_SET_VRING_KICK(0xc)
Flags:0x1
u64:0x1
................................................................................
Processing message:VHOST_USER_SET_VRING_KICK_set_vring_kick
Got kickfd0xa
Listening for kicks on0xa
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x0
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0xb
Cmd:VHOST_USER_SET_VRING_CALL(0xd)
Flags:0x1
u64:0x1
................................................................................
Processing message:VHOST_USER_SET_VRING_CALL_set_vring_call
Got callfd0xc
chunks: 10 90
................................................................................
33 33 00 00 00 16 52 54 00 12 34 56 86 dd 60 00
00 00 00 24 00 01 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 16 3a 00 05 02 00 00 01 00 8f 00
3b 22 00 00 00 01 04 00 00 00 ff 02 00 00 00 00
00 00 00 00 00 01 ff 12 34 56
chunks: 10 78
................................................................................
33 33 ff 12 34 56 52 54 00 12 34 56 86 dd 60 00
00 00 00 18 3a ff 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 ff 02 00 00 00 00 00 00 00 00
00 01 ff 12 34 56 87 00 c4 02 00 00 00 00 fe 80
00 00 00 00 00 00 50 54 00 ff fe 12 34 56
chunks: 10 70
................................................................................
33 33 00 00 00 02 52 54 00 12 34 56 86 dd 60 00
00 00 00 10 3a ff fe 80 00 00 00 00 00 00 50 54
00 ff fe 12 34 56 ff 02 00 00 00 00 00 00 00 00
00 00 00 00 00 02 85 00 71 b5 00 00 00 00 01 01
52 54 00 12 34 56
chunks: 10 90
................................................................................