tunables: Simplify TUNABLE_SET interface
commit61117bfa1b08ca048e6512c0652c568300fedf6a
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Fri, 5 Feb 2021 07:48:58 +0000 (5 13:18 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Wed, 10 Feb 2021 13:38:33 +0000 (10 19:08 +0530)
treed752f7a8eec0c3a174c42f73f1e7927616d6d073
parente604a5e4bb61267c58e6b6179209efe74ab5f675
tunables: Simplify TUNABLE_SET interface

The TUNABLE_SET interface took a primitive C type argument, which
resulted in inconsistent type conversions internally due to incorrect
dereferencing of types, especialy on 32-bit architectures.  This
change simplifies the TUNABLE setting logic along with the interfaces.

Now all numeric tunable values are stored as signed numbers in
tunable_num_t, which is intmax_t.  All calls to set tunables cast the
input value to its primitive type and then to tunable_num_t for
storage.  This relies on gcc-specific (although I suspect other
compilers woul also do the same) unsigned to signed integer conversion
semantics, i.e. the bit pattern is conserved.  The reverse conversion
is guaranteed by the standard.
elf/dl-tunable-types.h
elf/dl-tunables.c
elf/dl-tunables.h
manual/README.tunables
sysdeps/unix/sysv/linux/aarch64/cpu-features.c
sysdeps/x86/dl-cacheinfo.h