KVM: selftests: Use getcpu() instead of sched_getcpu() in rseq_test
authorGavin Shan <gshan@redhat.com>
Wed, 10 Aug 2022 10:41:14 +0000 (18:41 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 Aug 2022 19:08:29 +0000 (15:08 -0400)
commit0fcc102923dee97bf33bd199d5b26a6735e16097
tree6f9cf6a0fe9b4ae3d34663f50f96b60b10ad6b62
parent66d42ac73fc680dbd7a1402f8b44967426522d0f
KVM: selftests: Use getcpu() instead of sched_getcpu() in rseq_test

sched_getcpu() is glibc dependent and it can simply return the CPU
ID from the registered rseq information, as Florian Weimer pointed.
In this case, it's pointless to compare the return value from
sched_getcpu() and that fetched from the registered rseq information.

Fix the issue by replacing sched_getcpu() with getcpu(), as Florian
suggested. The comments are modified accordingly by replacing
"sched_getcpu()" with "getcpu()".

Reported-by: Yihuang Yu <yihyu@redhat.com>
Suggested-by: Florian Weimer <fweimer@redhat.com>
Suggested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Gavin Shan <gshan@redhat.com>
Message-Id: <20220810104114.6838-3-gshan@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/rseq_test.c