[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68b06fbaa32ad_2114829458@iweiny-mobl.notmuch>
Date: Thu, 28 Aug 2025 10:03:22 -0500
From: Ira Weiny <ira.weiny@...el.com>
To: Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini
<pbonzini@...hat.com>
CC: <kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Michael Roth
<michael.roth@....com>, Yan Zhao <yan.y.zhao@...el.com>, Ira Weiny
<ira.weiny@...el.com>, Vishal Annapurve <vannapurve@...gle.com>, "Rick
Edgecombe" <rick.p.edgecombe@...el.com>
Subject: Re: [RFC PATCH 08/12] KVM: TDX: Use atomic64_dec_return() instead of
a poor equivalent
Sean Christopherson wrote:
> 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.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Reviewed-by: Ira Weiny <ira.weiny@...el.com>
[snip]
Powered by blists - more mailing lists