On Sun, Aug 14, 2022 at 08:43:09PM -0700, Linus Torvalds wrote: > On Sun, Aug 14, 2022 at 3:59 PM Linus Torvalds > <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > > > If TDX has problems with it, then TDX needs to be fixed. And it's > > simple enough - just make sure you have a guard page between any > > kernel RAM mapping and whatever odd crazy page. > > .. thinking about this more, I thought we had already done that in the > memory initialization code - ie make sure that we always leave a gap > between any page we mark and any IO memory after it. > > But it's possible that I'm confused with the IO window allocation > code, which does the reverse (ie actively try to avoid starting > allocations close to the end-of-RAM because there is often > undocumented stolen memory there) > > I'd much rather lose one page from the page allocator at the end of a > RAM region than lose the ability to do string word operations. > > Of course, it's also entirely possible that even if my memory about us > already trying to do that is right (which it might not be), we might > also have lost that whole thing over time, since we've had a lot of > updates to the bootmem/memblock setup. We don't create gaps in the memory initialization code, everything that's E820_TYPE_RAM goes in the end to the page allocator with exception of partial pages. And this didn't change in the last few years. > Linus -- Sincerely yours, Mike.