diff options
author | Sean Christopherson <seanjc@google.com> | 2024-11-28 04:34:24 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2024-12-19 02:14:34 +0300 |
commit | 871ac338ef553faf8c1c2f71dc4636b35d176ef4 (patch) | |
tree | 4de0b1522e3e1fc110bb9c9413b22553a56eac33 /tools/perf/scripts/python/stackcollapse.py | |
parent | ac9d1b7591a22e63f66a8c596390eccf821885e8 (diff) | |
download | linux-871ac338ef553faf8c1c2f71dc4636b35d176ef4.tar.xz |
KVM: x86: Use only local variables (no bitmask) to init kvm_cpu_caps
Refactor the kvm_cpu_cap_init() macro magic to collect supported features
in a local variable instead of passing them to the macro as a "mask". As
pointed out by Maxim, relying on macros to "return" a value and set local
variables is surprising, as the bitwise-OR logic suggests the macros are
pure, i.e. have no side effects.
Ideally, the feature initializers would have zero side effects, e.g. would
take local variables as params, but there isn't a sane way to do so
without either sacrificing the various compile-time assertions (basically
a non-starter), or passing at least one variable, e.g. a struct, to each
macro usage (adds a lot of noise and boilerplate code).
Opportunistically force callers to emit a trailing comma by intentionally
omitting a semicolon after invoking the feature initializers. Forcing a
trailing comma isotales futures changes to a single line, i.e. doesn't
cause churn for unrelated features/lines when adding/removing/modifying a
feature.
No functional change intended.
Suggested-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20241128013424.4096668-58-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions