diff options
| author | Sean Christopherson <seanjc@google.com> | 2025-10-30 13:09:37 -0700 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2025-11-05 11:05:52 -0800 |
| commit | af96d5452e5e88019bed9c081d4be1c489d7c081 (patch) | |
| tree | f64af395dc174ca09e5f4d061349c1d349231386 /tools/lib/python/kdoc/kdoc_output.py | |
| parent | 24adff39705223f06607926f2717e6f8dec12d28 (diff) | |
KVM: TDX: Use atomic64_dec_return() instead of a poor equivalent
Use atomic64_dec_return() when decrementing the number of "pre-mapped"
S-EPT pages to ensure that the count can't go negative without KVM
noticing. In theory, checking for '0' and then decrementing in a separate
operation could miss a 0=>-1 transition. In practice, such a condition is
impossible because nr_premapped is protected by slots_lock, i.e. doesn't
actually need to be an atomic (that wart will be addressed shortly).
Don't bother trying to keep the count non-negative, as the KVM_BUG_ON()
ensures the VM is dead, i.e. there's no point in trying to limp along.
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Yan Zhao <yan.y.zhao@intel.com>
Tested-by: Yan Zhao <yan.y.zhao@intel.com>
Tested-by: Kai Huang <kai.huang@intel.com>
Link: https://patch.msgid.link/20251030200951.3402865-15-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/lib/python/kdoc/kdoc_output.py')
0 files changed, 0 insertions, 0 deletions
