public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH] tools/virtio: pipe assertion in vring_test.c
@ 2024-05-27  7:13 yskelg
  2024-05-27  7:52 ` Michael S. Tsirkin
  0 siblings, 1 reply; 3+ messages in thread
From: yskelg @ 2024-05-27  7:13 UTC (permalink / raw)
  To: Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez
  Cc: skhan, Austin Kim, shjy180909, virtualization, linux-kernel,
	linux-kernel-mentees, Yunseong Kim

From: Yunseong Kim <yskelg@gmail.com>

The virtio_device need to fail checking when create the geust/host pipe.

Signed-off-by: Yunseong Kim <yskelg@gmail.com>
---
 tools/virtio/vringh_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c
index 98ff808d6f0c..b1af8807c02a 100644
--- a/tools/virtio/vringh_test.c
+++ b/tools/virtio/vringh_test.c
@@ -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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/virtio: pipe assertion in vring_test.c
  2024-05-27  7:13 [PATCH] tools/virtio: pipe assertion in vring_test.c yskelg
@ 2024-05-27  7:52 ` Michael S. Tsirkin
  2024-05-27  8:40   ` Yunseong Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2024-05-27  7:52 UTC (permalink / raw)
  To: yskelg
  Cc: Jason Wang, Xuan Zhuo, Eugenio Pérez, skhan, Austin Kim,
	shjy180909, virtualization, linux-kernel, linux-kernel-mentees

On Mon, May 27, 2024 at 04:13:31PM +0900, yskelg@gmail.com wrote:
> From: Yunseong Kim <yskelg@gmail.com>
> 
> The virtio_device need to fail checking when create the geust/host pipe.

typo

> 
> Signed-off-by: Yunseong Kim <yskelg@gmail.com>


I guess ... 

> ---
>  tools/virtio/vringh_test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c
> index 98ff808d6f0c..b1af8807c02a 100644
> --- a/tools/virtio/vringh_test.c
> +++ b/tools/virtio/vringh_test.c
> @@ -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.

>  	CPU_ZERO(&cpu_set);
>  	find_cpus(&first_cpu, &last_cpu);
> -- 
> 2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/virtio: pipe assertion in vring_test.c
  2024-05-27  7:52 ` Michael S. Tsirkin
@ 2024-05-27  8:40   ` Yunseong Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Yunseong Kim @ 2024-05-27  8:40 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Jason Wang, Xuan Zhuo, Eugenio Pérez, skhan, Austin Kim,
	shjy180909, virtualization, linux-kernel, linux-kernel-mentees



On 5/27/24 4:52 오후, Michael S. Tsirkin wrote:
> On Mon, May 27, 2024 at 04:13:31PM +0900, yskelg@gmail.com wrote:
>> From: Yunseong Kim <yskelg@gmail.com>
>>
>> The virtio_device need 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.

>>
>> Signed-off-by: Yunseong Kim <yskelg@gmail.com>
> 
> 
> I guess ... 
> 
>> ---
>>  tools/virtio/vringh_test.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c
>> index 98ff808d6f0c..b1af8807c02a 100644
>> --- a/tools/virtio/vringh_test.c
>> +++ b/tools/virtio/vringh_test.c
>> @@ -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.

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


>>  	CPU_ZERO(&cpu_set);
>>  	find_cpus(&first_cpu, &last_cpu);
>> -- 
>> 2.34.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-27  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27  7:13 [PATCH] tools/virtio: pipe assertion in vring_test.c yskelg
2024-05-27  7:52 ` Michael S. Tsirkin
2024-05-27  8:40   ` Yunseong Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox