* [PATCH] selftests/kvm: Fix bug in how demand_paging_test calculates paging rate
@ 2023-02-16 20:02 Anish Moorthy
2023-02-16 20:13 ` Oliver Upton
0 siblings, 1 reply; 5+ messages in thread
From: Anish Moorthy @ 2023-02-16 20:02 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: jthoughton, seanjc, oliver.upton, Anish Moorthy
The current denominator is 1E8, not 1E9 as it should be.
Reported-by: James Houghton <jthoughton@google.com>
Signed-off-by: Anish Moorthy <amoorthy@google.com>
---
tools/testing/selftests/kvm/demand_paging_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c
index b0e1fc4de9e29..2439c4043fed6 100644
--- a/tools/testing/selftests/kvm/demand_paging_test.c
+++ b/tools/testing/selftests/kvm/demand_paging_test.c
@@ -194,7 +194,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
ts_diff.tv_sec, ts_diff.tv_nsec);
pr_info("Overall demand paging rate: %f pgs/sec\n",
memstress_args.vcpu_args[0].pages * nr_vcpus /
- ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0));
+ ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / NSEC_PER_SEC));
memstress_destroy_vm(vm);
--
2.39.2.637.g21b0678d19-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests/kvm: Fix bug in how demand_paging_test calculates paging rate
2023-02-16 20:02 [PATCH] selftests/kvm: Fix bug in how demand_paging_test calculates paging rate Anish Moorthy
@ 2023-02-16 20:13 ` Oliver Upton
2023-02-16 20:17 ` Sean Christopherson
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Upton @ 2023-02-16 20:13 UTC (permalink / raw)
To: Anish Moorthy; +Cc: pbonzini, kvm, jthoughton, seanjc
The shortlog doesn't give any hint as to what the bug actually is.
Maybe:
KVM: selftests: Fix nsec to sec conversion in demand_paging_test
On Thu, Feb 16, 2023 at 08:02:18PM +0000, Anish Moorthy wrote:
> The current denominator is 1E8, not 1E9 as it should be.
demand_paging_test uses 1E8 as the denominator to convert nanoseconds
to seconds, which is wrong. Use NSEC_PER_SEC instead to fix the issue
and make the conversion obvious.
> Reported-by: James Houghton <jthoughton@google.com>
> Signed-off-by: Anish Moorthy <amoorthy@google.com>
Bikeshedding aside:
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
> ---
> tools/testing/selftests/kvm/demand_paging_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c
> index b0e1fc4de9e29..2439c4043fed6 100644
> --- a/tools/testing/selftests/kvm/demand_paging_test.c
> +++ b/tools/testing/selftests/kvm/demand_paging_test.c
> @@ -194,7 +194,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
> ts_diff.tv_sec, ts_diff.tv_nsec);
> pr_info("Overall demand paging rate: %f pgs/sec\n",
> memstress_args.vcpu_args[0].pages * nr_vcpus /
> - ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0));
> + ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / NSEC_PER_SEC));
>
> memstress_destroy_vm(vm);
>
> --
> 2.39.2.637.g21b0678d19-goog
>
--
Thanks,
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests/kvm: Fix bug in how demand_paging_test calculates paging rate
2023-02-16 20:13 ` Oliver Upton
@ 2023-02-16 20:17 ` Sean Christopherson
2023-02-16 20:24 ` [PATCH] selftests/kvm: Fix nsec to sec conversion in demand_paging_test Anish Moorthy
0 siblings, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2023-02-16 20:17 UTC (permalink / raw)
To: Oliver Upton; +Cc: Anish Moorthy, pbonzini, kvm, jthoughton
On Thu, Feb 16, 2023, Oliver Upton wrote:
> The shortlog doesn't give any hint as to what the bug actually is.
> Maybe:
>
> KVM: selftests: Fix nsec to sec conversion in demand_paging_test
+1
> On Thu, Feb 16, 2023 at 08:02:18PM +0000, Anish Moorthy wrote:
> > The current denominator is 1E8, not 1E9 as it should be.
>
> demand_paging_test uses 1E8 as the denominator to convert nanoseconds
> to seconds, which is wrong. Use NSEC_PER_SEC instead to fix the issue
> and make the conversion obvious.
>
> > Reported-by: James Houghton <jthoughton@google.com>
> > Signed-off-by: Anish Moorthy <amoorthy@google.com>
>
> Bikeshedding aside:
>
> Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
With Oliver's shortlog (I'm indifferent on the changelog),
Reviewed-by: Sean Christopherson <seanjc@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] selftests/kvm: Fix nsec to sec conversion in demand_paging_test.
2023-02-16 20:17 ` Sean Christopherson
@ 2023-02-16 20:24 ` Anish Moorthy
2023-02-16 20:33 ` Sean Christopherson
0 siblings, 1 reply; 5+ messages in thread
From: Anish Moorthy @ 2023-02-16 20:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: jthoughton, seanjc, oliver.upton, Anish Moorthy
demand_paging_test uses 1E8 as the denominator to convert nanoseconds to
seconds, which is wrong. Use NSEC_PER_SEC instead to fix the issue and
make the conversion obvious.
Reported-by: James Houghton <jthoughton@google.com>
Signed-off-by: Anish Moorthy <amoorthy@google.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Reviewed-by: Sean Christopherson <seanjc@google.com>
---
tools/testing/selftests/kvm/demand_paging_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c
index b0e1fc4de9e29..2439c4043fed6 100644
--- a/tools/testing/selftests/kvm/demand_paging_test.c
+++ b/tools/testing/selftests/kvm/demand_paging_test.c
@@ -194,7 +194,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
ts_diff.tv_sec, ts_diff.tv_nsec);
pr_info("Overall demand paging rate: %f pgs/sec\n",
memstress_args.vcpu_args[0].pages * nr_vcpus /
- ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0));
+ ((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / NSEC_PER_SEC));
memstress_destroy_vm(vm);
--
2.39.2.637.g21b0678d19-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests/kvm: Fix nsec to sec conversion in demand_paging_test.
2023-02-16 20:24 ` [PATCH] selftests/kvm: Fix nsec to sec conversion in demand_paging_test Anish Moorthy
@ 2023-02-16 20:33 ` Sean Christopherson
0 siblings, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2023-02-16 20:33 UTC (permalink / raw)
To: Anish Moorthy; +Cc: pbonzini, kvm, jthoughton, oliver.upton
"KVM: selftests:" please.
And when sending a new version, bump the version number, i.e. the subject should
read "[PATCH v2] ..."
On Thu, Feb 16, 2023, Anish Moorthy wrote:
> demand_paging_test uses 1E8 as the denominator to convert nanoseconds to
> seconds, which is wrong. Use NSEC_PER_SEC instead to fix the issue and
> make the conversion obvious.
>
> Reported-by: James Houghton <jthoughton@google.com>
> Signed-off-by: Anish Moorthy <amoorthy@google.com>
> Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
> Reviewed-by: Sean Christopherson <seanjc@google.com>
> ---
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-16 20:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-16 20:02 [PATCH] selftests/kvm: Fix bug in how demand_paging_test calculates paging rate Anish Moorthy
2023-02-16 20:13 ` Oliver Upton
2023-02-16 20:17 ` Sean Christopherson
2023-02-16 20:24 ` [PATCH] selftests/kvm: Fix nsec to sec conversion in demand_paging_test Anish Moorthy
2023-02-16 20:33 ` Sean Christopherson
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).