Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177883503
D61939.1795509976.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61939.1795509976.diff
View Options
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -3359,6 +3359,21 @@
}
}
+/*
+ * Invalidate a mapping of which only the accessed flag has been cleared. For
+ * an EPT pmap this is counted in pm_eptgen_ad as well as in pm_eptgen, so that
+ * a hypervisor that keeps copies of the pmap's mappings, such as the EPT of a
+ * nested guest, knows that they are still right.
+ */
+static void
+pmap_invalidate_page_accessed(pmap_t pmap, vm_offset_t va)
+{
+
+ if (pmap->pm_type == PT_EPT)
+ atomic_add_long(&pmap->pm_eptgen_ad, 1);
+ pmap_invalidate_page(pmap, va);
+}
+
void
pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
{
@@ -9026,7 +9041,8 @@
(oldpde & PG_W) == 0) {
if (safe_to_clear_referenced(pmap, oldpde)) {
atomic_clear_long(pde, PG_A);
- pmap_invalidate_page(pmap, pv->pv_va);
+ pmap_invalidate_page_accessed(pmap,
+ pv->pv_va);
demoted = false;
} else if (pmap_demote_pde_locked(pmap, pde,
pv->pv_va, &lock)) {
@@ -9107,7 +9123,7 @@
if ((*pte & PG_A) != 0) {
if (safe_to_clear_referenced(pmap, *pte)) {
atomic_clear_long(pte, PG_A);
- pmap_invalidate_page(pmap, pv->pv_va);
+ pmap_invalidate_page_accessed(pmap, pv->pv_va);
cleared++;
} else if ((*pte & PG_W) == 0) {
/*
diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
--- a/sys/amd64/include/pmap.h
+++ b/sys/amd64/include/pmap.h
@@ -335,6 +335,7 @@
int pm_flags;
struct pmap_pcid *pm_pcidp;
struct rangeset pm_pkru;
+ long pm_eptgen_ad; /* of pm_eptgen: only PG_A cleared */
};
/* flags */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 24, 8:46 AM (22 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41951100
Default Alt Text
D61939.1795509976.diff (1 KB)
Attached To
Mode
D61939: amd64: Count the EPT invalidations that only clear the accessed flag
Attached
Detach File
Event Timeline