Re: [PATCHv2 1/7] mm: Add support for unaccepted memory

From: Mike Rapoport
Date: Thu Jan 13 2022 - 02:42:20 EST


On Wed, Jan 12, 2022 at 10:40:53AM -0800, Dave Hansen wrote:
> On 1/12/22 10:30, Kirill A. Shutemov wrote:
> > On Tue, Jan 11, 2022 at 11:46:37AM -0800, Dave Hansen wrote:
> > > > diff --git a/mm/memblock.c b/mm/memblock.c
> > > > index 1018e50566f3..6dfa594192de 100644
> > > > --- a/mm/memblock.c
> > > > +++ b/mm/memblock.c
> > > > @@ -1400,6 +1400,7 @@ phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size,
> > > > */
> > > > kmemleak_alloc_phys(found, size, 0, 0);
> > > > + accept_memory(found, found + size);
> > > > return found;
> > > > }
> > >
> > > This could use a comment.
> >
> > How about this:
> >
> > /*
> > * Some Virtual Machine platforms, such as Intel TDX or AMD SEV-SNP,
> > * requiring memory to be accepted before it can be used by the
> > * guest.
> > *
> > * Accept the memory of the allocated buffer.
> > */
>
> I think a one-liner that might cue the reader to go look at accept_memory()
> itself would be fine. Maybe:
>
> /* Make the memblock usable when running in picky VM guests: */

I'd s/memblock/found range/ or something like that, memblock is too vague
IMO

> That implies that the memory isn't usable without doing this and also points
> out that it's related to running in a guest.

--
Sincerely yours,
Mike.