Re: [PATCH Part2 RFC v2 08/37] x86/sev: Split the physmap when adding the page in RMP table
From: Peter Zijlstra
Date: Mon May 03 2021 - 11:07:39 EST
On Fri, Apr 30, 2021 at 07:37:53AM -0500, Brijesh Singh wrote:
> This poses a challenge in the Linux memory model. The Linux kernel
> creates a direct mapping of all the physical memory -- referred to as
> the physmap. The physmap may contain a valid mapping of guest owned pages.
> During the page table walk, the host access may get into the situation where
> one of the pages within the large page is owned by the guest (i.e assigned
> bit is set in RMP). A write to a non-guest within the large page will
> raise an RMP violation. To workaround it, call set_memory_4k() to split
> the physmap before adding the page in the RMP table. This ensures that the
> pages added in the RMP table are used as 4K in the physmap.
What's an RMP violation and why are they a problem?
> The spliting of the physmap is a temporary solution until the kernel page
> fault handler is improved to split the kernel address on demand.
How is that an improvement? Fracturing the physmap sucks whichever way
around.
> One of the
> disadvtange of splitting is that eventually, it will end up breaking down
> the entire physmap unless its coalesce back to a large page. I am open to
> the suggestation on various approaches we could take to address this problem.
Have the hardware fracture the TLB entry internally?