tools/virtio: pipe assertion in vring_test.c
PATCH 1/1 tools/virtio: pipe assertion in vring_test.c
From: Yunseong Kim <[email protected]>
The virtio_device need to fail checking when create the geust/host pipe.
--- tools/virtio/vringh_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/virtio/vringh_test.c +2 -2
@@ -161,8 +161,8 @@ static int parallel_test(u64 features, host_map =mmap (NULL , mapsize,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 ); guest_map =mmap (NULL , mapsize,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 ); -pipe (to_guest); -pipe (to_host); +assert (pipe (to_guest) ==0 ); +assert (pipe (to_host) ==0 );CPU_ZERO (&cpu_set);find_cpus (&first_cpu, &last_cpu);
Signature · 1 line
2.34.1
Michael S. Tsirkin
maintainerQuoted 3 lines · On Mon, May 27, 2024 at 04:13:31PM +0900, [email protected] wrote:
From: Yunseong Kim <[email protected]>
The
virtio_deviceneed to fail checking when create the geust/host pipe.
typo
Quoted 2 lines
Signed-off-by Yunseong Kim <[email protected]>
I guess ...
Quoted 9 lines
--- tools/virtio/vringh_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/virtio/vringh_test.c +0
-0
tools/virtio/vringh_test.c static int parallel_test(u64 features, · line 165
Quoted 7 lines
tools/virtio/vringh_test.c +2
-2@@ -161,8 +161,8 @@ static int parallel_test(u64 features, host_map =mmap (NULL , mapsize,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 ); guest_map =mmap (NULL , mapsize,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 ); -pipe (to_guest); -pipe (to_host); +assert (pipe (to_guest) ==0 ); +assert (pipe (to_host) ==0 );
I don't like == 0, prefer ! .
Also, calling pipe outside assert is preferable, since in theory assert can be compiled out.
Not an issue here but people tend to copy/paste text.
Quoted 4 lines
tools/virtio/vringh_test.c +0
-0CPU_ZERO (&cpu_set);find_cpus (&first_cpu, &last_cpu);Signature · 1 line
2.34.1
Quoted 6 lines · Michael S. Tsirkin
Quoted 3 lines · On Mon, May 27, 2024 at 04:13:31PM +0900, [email protected] wrote:
From: Yunseong Kim <[email protected]>
The
virtio_deviceneed to fail checking when create the geust/host pipe.typo
Thank you for code review Michael.
Sorry, there was a typo in my message.
I'll fix it and send you patch version 2.
Quoted 18 lines
Quoted 2 lines
Signed-off-by Yunseong Kim <[email protected]>I guess ...
Quoted 12 lines
--- tools/virtio/vringh_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/virtio/vringh_test.c +0
-0@@ -161,8 +161,8 @@ static int parallel_test(u64 features, host_map =mmap (NULL , mapsize,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 ); guest_map =mmap (NULL , mapsize,PROT_READ |PROT_WRITE ,MAP_SHARED , fd,0 );
Quoted 10 lines
tools/virtio/vringh_test.c static int parallel_test(u64 features, · line 165
Quoted 4 lines
tools/virtio/vringh_test.c +2
-2-pipe (to_guest); -pipe (to_host); +assert (pipe (to_guest) ==0 ); +assert (pipe (to_host) ==0 );I don't like == 0, prefer ! .
Also, calling pipe outside assert is preferable, since in theory assert can be compiled out.
Not an issue here but people tend to copy/paste text.
I agree, it's uncomfortable even if I did it.
I'll fix it as you suggested and send it to patch 2.
Thank you!
Warm Regards,
Yunseong Kim
Quoted 5 lines
Quoted 4 lines
tools/virtio/vringh_test.c +0
-0CPU_ZERO (&cpu_set);find_cpus (&first_cpu, &last_cpu);Signature · 1 line
2.34.1