Re: [PATCH v5 3/7] x86/virt/tdx: Mark memory cache state incoherent when making SEAMCALL
From: Huang, Kai
Date: Mon Aug 11 2025 - 21:32:37 EST
On Tue, 2025-08-12 at 00:51 +0000, Edgecombe, Rick P wrote:
> On Tue, 2025-07-29 at 00:28 +1200, Kai Huang wrote:
> > +static __always_inline u64 do_seamcall(sc_func_t func, u64 fn,
> > + struct tdx_module_args *args)
> > +{
> > + lockdep_assert_preemption_disabled();
> > +
> > + /*
> > + * SEAMCALLs are made to the TDX module and can generate dirty
> > + * cachelines of TDX private memory. Mark cache state incoherent
> > + * so that the cache can be flushed during kexec.
> > + *
> > + * This needs to be done before actually making the SEAMCALL,
> > + * because kexec-ing CPU could send NMI to stop remote CPUs,
> > + * in which case even disabling IRQ won't help here.
> > + */
> > + this_cpu_write(cache_state_incoherent, true);
> > +
> > + return func(fn, args);
> > +}
> > +
>
>
> Functionally it looks good now, but I still think the chain of names is not
> acceptable:
>
> seamcall()
> sc_retry()
> do_seamcall()
> __seamcall()
>
> sc_retry() is the only one with a hint of what is different about it, but it
> randomly uses sc abbreviation instead of seamcall. That is an existing thing.
> But the additional one should be named with something about the cache part that
> it does, like seamcall_dirty_cache() or something. "do_seamcall()" tells the
> reader nothing.
OK. I'll change do_seamcall() to seamcall_dirty_cache().
Is there anything else I can improve? Otherwise I plan to send out v6
soon.