Re: [PATCHv4 3/8] efi/x86: Implement support for unaccepted memory

Borislav Petkov
2022-04-14T16:23:01Z

On Fri, Apr 08, 2022 at 10:26:14AM -0700, Dave Hansen wrote:
> > + /*
> > + * Accept small regions that might not be able to be represented
> > + * in the bitmap:
> > + */
> > + if (end - start < 2 * PMD_SIZE) {
> > + __accept_memory(start, end);
> > + return;
> > + }
>
> This is not my first time looking at this code and I still had to think
> about this a bit. That's not good. That pathological case here is
> actually something like this:
>
> | 4k | 2044k + 2044k | 4k |
> ^ 0x0 ^ 2MB ^ 4MB
>
> Where we have a 2MB-aligned 4k accepted area, a 4088k unaccepted area,
> then another 4k accepted area. That will not result in any bits being
> set in the accepted memory bitmap because no 2MB region is fully accepted.

I could use that ascii art very well in a comment above it instead of
having to paint it in my mind each time.

Thx.

--
Regards/Gruss,
Boris.