On Tue, May 10, 2022 at 08:32:23PM +0200, Borislav Petkov wrote: > On Fri, May 06, 2022 at 07:13:59PM +0300, Kirill A. Shutemov wrote: > > Failure to accept the memory is fatal. Why pretend it is not? > > > > For TDX it will result in a crash on the first access. Prolonging the > > suffering just make it harder to understand what happened. > > Ok then. Does that panic message contain enough info so that the > acceptance failure can be debugged? > > Just "Cannot accept memory" doesn't seem very helpful to me... Okay. Fair enough. I will change it to panic("Cannot accept memory: unknown platform."); > > > That's true. Note also that the check is inherently racy. Other CPU can > > get the range or subrange accepted just after spin_unlock(). > > > > The check indicates that accept_memory() has to be called on the range > > before first access. > > > > Do you have problem with a name? Maybe has_unaccepted_memory()? > > I have a problem with the definition of this function, what it is > supposed to do and how it is supposed to be used. > > Right now, it looks weird and strange: is it supposed to check for *all* > in-between (start, end)? It doesn't, atm, so what's the meaning of > @start and @end then at all? It checks if the range of memory requires accept_memory() call before it can be accessed. If any part of the range is not accepted, the call is required. accept_memory() knows what exactly has to be done. Note that accept_memory() call is harmless for any valid memory range. It can be called on already accepted memory. -- Kirill A. Shutemov