linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: kvm: make hardware_disable_test less verbose
@ 2021-03-23  8:53 Vitaly Kuznetsov
  2021-03-23 10:03 ` Andrew Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Vitaly Kuznetsov @ 2021-03-23  8:53 UTC (permalink / raw)
  To: kvm, Paolo Bonzini
  Cc: Sean Christopherson, Wanpeng Li, Jim Mattson, linux-kernel

hardware_disable_test produces 512 snippets like
...
 main: [511] waiting semaphore
 run_test: [511] start vcpus
 run_test: [511] all threads launched
 main: [511] waiting 368us
 main: [511] killing child

and this doesn't have much value, let's just drop these fprintf().
Restoring them for debugging purposes shouldn't be too hard.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 tools/testing/selftests/kvm/hardware_disable_test.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/tools/testing/selftests/kvm/hardware_disable_test.c b/tools/testing/selftests/kvm/hardware_disable_test.c
index 2f2eeb8a1d86..d6d4517c4a8a 100644
--- a/tools/testing/selftests/kvm/hardware_disable_test.c
+++ b/tools/testing/selftests/kvm/hardware_disable_test.c
@@ -108,7 +108,6 @@ static void run_test(uint32_t run)
 	kvm_vm_elf_load(vm, program_invocation_name, 0, 0);
 	vm_create_irqchip(vm);
 
-	fprintf(stderr, "%s: [%d] start vcpus\n", __func__, run);
 	for (i = 0; i < VCPU_NUM; ++i) {
 		vm_vcpu_add_default(vm, i, guest_code);
 		payloads[i].vm = vm;
@@ -124,7 +123,6 @@ static void run_test(uint32_t run)
 			check_set_affinity(throw_away, &cpu_set);
 		}
 	}
-	fprintf(stderr, "%s: [%d] all threads launched\n", __func__, run);
 	sem_post(sem);
 	for (i = 0; i < VCPU_NUM; ++i)
 		check_join(threads[i], &b);
@@ -147,16 +145,13 @@ int main(int argc, char **argv)
 		if (pid == 0)
 			run_test(i); /* This function always exits */
 
-		fprintf(stderr, "%s: [%d] waiting semaphore\n", __func__, i);
 		sem_wait(sem);
 		r = (rand() % DELAY_US_MAX) + 1;
-		fprintf(stderr, "%s: [%d] waiting %dus\n", __func__, i, r);
 		usleep(r);
 		r = waitpid(pid, &s, WNOHANG);
 		TEST_ASSERT(r != pid,
 			    "%s: [%d] child exited unexpectedly status: [%d]",
 			    __func__, i, s);
-		fprintf(stderr, "%s: [%d] killing child\n", __func__, i);
 		kill(pid, SIGKILL);
 	}
 
-- 
2.30.2


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

* Re: [PATCH] selftests: kvm: make hardware_disable_test less verbose
  2021-03-23  8:53 [PATCH] selftests: kvm: make hardware_disable_test less verbose Vitaly Kuznetsov
@ 2021-03-23 10:03 ` Andrew Jones
  2021-03-23 10:42   ` Vitaly Kuznetsov
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Jones @ 2021-03-23 10:03 UTC (permalink / raw)
  To: Vitaly Kuznetsov
  Cc: kvm, Paolo Bonzini, Sean Christopherson, Wanpeng Li, Jim Mattson,
	linux-kernel

On Tue, Mar 23, 2021 at 09:53:03AM +0100, Vitaly Kuznetsov wrote:
> hardware_disable_test produces 512 snippets like
> ...
>  main: [511] waiting semaphore
>  run_test: [511] start vcpus
>  run_test: [511] all threads launched
>  main: [511] waiting 368us
>  main: [511] killing child
> 
> and this doesn't have much value, let's just drop these fprintf().
> Restoring them for debugging purposes shouldn't be too hard.

Changing them to pr_debug() allows you to keep them and restore
with -DDEBUG

Thanks,
drew

> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  tools/testing/selftests/kvm/hardware_disable_test.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/hardware_disable_test.c b/tools/testing/selftests/kvm/hardware_disable_test.c
> index 2f2eeb8a1d86..d6d4517c4a8a 100644
> --- a/tools/testing/selftests/kvm/hardware_disable_test.c
> +++ b/tools/testing/selftests/kvm/hardware_disable_test.c
> @@ -108,7 +108,6 @@ static void run_test(uint32_t run)
>  	kvm_vm_elf_load(vm, program_invocation_name, 0, 0);
>  	vm_create_irqchip(vm);
>  
> -	fprintf(stderr, "%s: [%d] start vcpus\n", __func__, run);
>  	for (i = 0; i < VCPU_NUM; ++i) {
>  		vm_vcpu_add_default(vm, i, guest_code);
>  		payloads[i].vm = vm;
> @@ -124,7 +123,6 @@ static void run_test(uint32_t run)
>  			check_set_affinity(throw_away, &cpu_set);
>  		}
>  	}
> -	fprintf(stderr, "%s: [%d] all threads launched\n", __func__, run);
>  	sem_post(sem);
>  	for (i = 0; i < VCPU_NUM; ++i)
>  		check_join(threads[i], &b);
> @@ -147,16 +145,13 @@ int main(int argc, char **argv)
>  		if (pid == 0)
>  			run_test(i); /* This function always exits */
>  
> -		fprintf(stderr, "%s: [%d] waiting semaphore\n", __func__, i);
>  		sem_wait(sem);
>  		r = (rand() % DELAY_US_MAX) + 1;
> -		fprintf(stderr, "%s: [%d] waiting %dus\n", __func__, i, r);
>  		usleep(r);
>  		r = waitpid(pid, &s, WNOHANG);
>  		TEST_ASSERT(r != pid,
>  			    "%s: [%d] child exited unexpectedly status: [%d]",
>  			    __func__, i, s);
> -		fprintf(stderr, "%s: [%d] killing child\n", __func__, i);
>  		kill(pid, SIGKILL);
>  	}
>  
> -- 
> 2.30.2
> 


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

* Re: [PATCH] selftests: kvm: make hardware_disable_test less verbose
  2021-03-23 10:03 ` Andrew Jones
@ 2021-03-23 10:42   ` Vitaly Kuznetsov
  0 siblings, 0 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2021-03-23 10:42 UTC (permalink / raw)
  To: Andrew Jones
  Cc: kvm, Paolo Bonzini, Sean Christopherson, Wanpeng Li, Jim Mattson,
	linux-kernel

Andrew Jones <drjones@redhat.com> writes:

> On Tue, Mar 23, 2021 at 09:53:03AM +0100, Vitaly Kuznetsov wrote:
>> hardware_disable_test produces 512 snippets like
>> ...
>>  main: [511] waiting semaphore
>>  run_test: [511] start vcpus
>>  run_test: [511] all threads launched
>>  main: [511] waiting 368us
>>  main: [511] killing child
>> 
>> and this doesn't have much value, let's just drop these fprintf().
>> Restoring them for debugging purposes shouldn't be too hard.
>
> Changing them to pr_debug() allows you to keep them and restore
> with -DDEBUG

Ah, missed that we have this for selftests! v2 is coming.

-- 
Vitaly


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

end of thread, other threads:[~2021-03-23 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23  8:53 [PATCH] selftests: kvm: make hardware_disable_test less verbose Vitaly Kuznetsov
2021-03-23 10:03 ` Andrew Jones
2021-03-23 10:42   ` Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).