Re: [PATCH v6 06/11] x86/virt/tdx: Optimize tdx_pamt_get/put()
From: Kiryl Shutsemau
Date: Thu Jun 04 2026 - 13:08:48 EST
On Tue, May 26, 2026 at 04:42:24PM +0000, Edgecombe, Rick P wrote:
> On Tue, 2026-05-26 at 16:57 +0800, Chao Gao wrote:
> > > - scoped_guard(spinlock, &pamt_lock) {
> >
> > This converts the scoped_guard() added by the previous patch to
> > explicit lock/unlock and goto. It would reduce code churn if the
> > previous patch used that form directly.
>
> Yea, it's a good point. I actually debated doing it, but decided not to because
> the scoped version is cleaner for the non-optimized version. But for
> reviewability, never doing the scoped version is probably better.
I don't see a reason why we can't keep the scoped_guard() on get side.
On put side, we cannot get atomic_get_and_lock() semantics without
dropping the scoped_guard().
Maybe we should keep it for get?
--
Kiryl Shutsemau / Kirill A. Shutemov