Re: [PATCH v7 13/20] x86/virt/tdx: Allocate and set up PAMTs for TDMRs
From: Dave Hansen
Date: Mon Nov 28 2022 - 17:56:34 EST
On 11/28/22 14:48, Huang, Kai wrote:
>> Maybe even a little ASCII diagram about the different tmb configurations
>> that this can find:
>>
>>> TDMR1 | TDMR2 |
>> |---tmb---|
>> |tmb|
>> |------tmb-------| <- case 3)
>> |------tmb-------| <- case 4
> Thanks for the diagram!
>
> But IIUC it seems the above case 3) and 4) are actually not possible, since when
> one TDMR is created, it's end is always rounded up to the end of TMB it tries to
> cover (the rounded-up end may cover the entire or only partial of other TMBs,
> though).
OK, but at the same time, we shouldn't *STRICTLY* specialize every
single little chunk of this code to be aware of every other tiny little
implementation detail.
Let's say tomorrow's code has lots of TDMRs left, but fills up one
TDMR's reserved areas and has to "split" it. Want to bet on whether the
person that adds that patch will be able to find this code and fix it up?
Or, say that the TDMR creation algorithm changes and they're not done in
order of ascending physical address.
This code actually gets easier and more obvious if you ignore the other
details.