[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 2/2] x86: Add Support for Paging-Write Feature
On Thu, Dec 19, 2024 at 1:17 PM Petr Beneš <w1benny@xxxxxxxxx> wrote: > > From: Petr Beneš <w1benny@xxxxxxxxx> > > This patch introduces a new XENMEM_access_r_pw permission. Functionally, it > is similar to XENMEM_access_r, but for processors with > TERTIARY_EXEC_EPT_PAGING_WRITE support (Intel 12th Gen/Alder Lake and later), > it also permits the CPU to write to the page during guest page-table walks > (e.g., updating A/D bits) without triggering an EPT violation. > > This behavior works by both enabling the EPT paging-write feature and setting > the EPT paging-write flag in the EPT leaf entry. > > This feature provides a significant performance boost for introspection tools > that monitor guest page-table updates. Previously, every page-table > modification by the guest—including routine updates like setting A/D > bits—triggered an EPT violation, adding unnecessary overhead. The new > XENMEM_access_r_pw permission allows these "uninteresting" updates to occur > without EPT violations, improving efficiency. > > Additionally, this feature simplifies the handling of race conditions in > scenarios where an introspection tool: > > - Sets an "invisible breakpoint" in the altp2m view for a function F > - Monitors guest page-table updates to track whether the page containing F is > paged out > - Encounters a cleared Access (A) bit on the page containing F while the > guest is about to execute the breakpoint > > In the current implementation: > > - If xc_monitor_inguest_pagefault() is enabled, the introspection tool must > emulate both the breakpoint and the setting of the Access bit. > - If xc_monitor_inguest_pagefault() is disabled, Xen handles the EPT > violation without notifying the introspection tool, setting the Access bit > and emulating the instruction. However, Xen fetches the instruction from the > default view instead of the altp2m view, potentially causing the breakpoint > to be missed. I'm glad to see this mystery resolved! \o/ > diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c > index 21728397f9..5ad78ae4b5 100644 > --- a/xen/arch/x86/mm/p2m-ept.c > +++ b/xen/arch/x86/mm/p2m-ept.c > @@ -176,6 +176,10 @@ static void ept_p2m_type_to_flags(const struct > p2m_domain *p2m, > break; > case p2m_access_rwx: > break; > + case p2m_access_r_pw: > + entry->w = entry->x = 0; > + entry->pw = !!cpu_has_vmx_ept_paging_write; I don't see ept_entry_t having a pw field. What's the deal there? Tamas
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |