* [PATCH v3] KVM: selftests: Fix nsec to sec conversion in demand_paging_test.
@ 2023-02-23 0:18 Anish Moorthy
2023-03-24 20:58 ` Sean Christopherson
0 siblings, 1 reply; 2+ messages in thread
From: Anish Moorthy @ 2023-02-23 0:18 UTC (permalink / raw)
To: kvm; +Cc: seanjc, amoorthy, oliver.upton, James Houghton
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>
---
v3:
- Add version number to patch
- Correct "KVM: selftests" tag in shortlog
v2: https://lore.kernel.org/all/20230216200218.1028943-1-amoorthy@google.com/
- Change to Oliver's log message
v1: https://lore.kernel.org/all/20230216200218.1028943-1-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] 2+ messages in thread
* Re: [PATCH v3] KVM: selftests: Fix nsec to sec conversion in demand_paging_test.
2023-02-23 0:18 [PATCH v3] KVM: selftests: Fix nsec to sec conversion in demand_paging_test Anish Moorthy
@ 2023-03-24 20:58 ` Sean Christopherson
0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2023-03-24 20:58 UTC (permalink / raw)
To: Sean Christopherson, kvm, Anish Moorthy; +Cc: oliver.upton, James Houghton
On Thu, 23 Feb 2023 00:18:05 +0000, 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.
>
>
Applied to kvm-x86 selftests, thanks!
[1/1] KVM: selftests: Fix nsec to sec conversion in demand_paging_test.
https://github.com/kvm-x86/linux/commit/f6baabdcadd1
--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-24 20:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23 0:18 [PATCH v3] KVM: selftests: Fix nsec to sec conversion in demand_paging_test Anish Moorthy
2023-03-24 20:58 ` Sean Christopherson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.