On Tue, Apr 16, 2024 at 07:45:18PM +0000, Edgecombe, Rick P wrote: > On Wed, 2024-04-10 at 15:49 +0300, Kirill A. Shutemov wrote: > > On Fri, Mar 15, 2024 at 09:33:20AM -0700, Sean Christopherson wrote: > > > So my feedback is to not worry about the exports, and instead focus on > > > figuring > > > out a way to make the generated code less bloated and easier to read/debug. > > > > I think it was mistake trying to centralize TDCALL/SEAMCALL calls into > > few megawrappers. I think we can get better results by shifting leaf > > function wrappers into assembly. > > > > We are going to have more assembly, but it should produce better result. > > Adding macros can help to write such wrapper and minimizer boilerplate. > > > > Below is an example of how it can look like. It's not complete. I only > > converted TDCALLs, but TDVMCALLs or SEAMCALLs. TDVMCALLs are going to be > > more complex. > > > > Any opinions? Is it something worth investing more time? > > We discussed offline how implementing these for each TDVM/SEAMCALL increases the > chances of a bug in just one TDVM/SEAMCALL. Which could making debugging > problems more challenging. Kirill raised the possibility of some code generating > solution like cpufeatures.h, that could take a spec and generate correct calls. > > So far no big wins have presented themselves. Kirill, do we think the path to > move the messy part out-of-line will not work? I converted all TDCALL and TDVMCALL leafs to direct assembly wrappers. Here's WIP branch: https://github.com/intel/tdx/commits/guest-tdx-asm/ I still need to clean it up and write commit messages and comments for all wrappers. Now I think it worth the shot. Any feedback? -- Kiryl Shutsemau / Kirill A. Shutemov