linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] kvm: selftests: cleanup PTE definitions
@ 2022-04-21 16:28 Paolo Bonzini
  2022-04-21 16:28 ` [PATCH 1/2] kvm: selftests: do not use bitfields larger than 32-bits for PTEs Paolo Bonzini
  2022-04-21 16:28 ` [PATCH 2/2] kvm: selftests: introduce and use more page size-related constants Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Bonzini @ 2022-04-21 16:28 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: peterx, seanjc

The width of operations on bit fields greater than 32-bit is
implementation defined, and differs between GCC (which uses the bitfield
precision) and clang (which uses 64-bit arithmetic), so this is a
minefield that is already causing bugs (see patch 1).  Remove the bit
fields and using manual masking instead.

Mostly the same as yesterday's patch, but with constants moved to
processor.h and extended to include common idioms such as PAGE_MASK
and PAGE_SIZE.

Paolo

Supersedes: <20220420103624.1143824-1-pbonzini@redhat.com>

Paolo Bonzini (2):
  kvm: selftests: do not use bitfields larger than 32-bits for PTEs
  kvm: selftests: introduce and use more page size-related constants

 .../selftests/kvm/include/x86_64/processor.h  |  17 ++
 .../selftests/kvm/lib/x86_64/processor.c      | 202 +++++++-----------
 tools/testing/selftests/kvm/x86_64/amx_test.c |   1 -
 .../kvm/x86_64/emulator_error_test.c          |   1 -
 tools/testing/selftests/kvm/x86_64/smm_test.c |   2 -
 .../kvm/x86_64/vmx_tsc_adjust_test.c          |   1 -
 .../selftests/kvm/x86_64/xen_shinfo_test.c    |   1 -
 .../selftests/kvm/x86_64/xen_vmcall_test.c    |   1 -
 8 files changed, 99 insertions(+), 127 deletions(-)

-- 
2.31.1


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

end of thread, other threads:[~2022-04-21 19:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 16:28 [PATCH 0/2] kvm: selftests: cleanup PTE definitions Paolo Bonzini
2022-04-21 16:28 ` [PATCH 1/2] kvm: selftests: do not use bitfields larger than 32-bits for PTEs Paolo Bonzini
2022-04-21 16:28 ` [PATCH 2/2] kvm: selftests: introduce and use more page size-related constants Paolo Bonzini
2022-04-21 19:38   ` Peter Xu

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).