从软件的角度来看,内存页面弄脏的指令与内核页面条目(PTE)中核心实际标记页面脏的时间之间的延迟是多少?
换句话说,如果一条指令弄脏了一个页面,那么下一条指令是否可以读取PTE并看到脏位设置?
我不关心实际经过的周期,只有当软件可见窗口中尚未设置脏位时.我似乎无法在参考手册中找到任何保证.
从AMD的手册(大约2005年),第2卷:系统编程:
5.4页面翻译表输入字段
...
Dirty (D) Bit. Bit 6.
This bit is only present in the lowest level of the page-translation hierarchy. It indicates whether the pagetranslation table or physical page to which this entry points has been written. The D bit is set to 1 by the processor the first time there is a write to the physical page.
英特尔同上(大约2006年),卷3-A:系统编程指南,第1部分:
3.7.6页面目录和页表条目
...
Dirty (D) flag, bit 6
Indicates whether a page has been written to when set. (This flag is not used in page-directory entries that point to page tables.) Memory management software typically clears this flag when a page is initially loaded into physical memory. The processor then sets this flag the first time a page is accessed for a write operation.
更新:
从最新的intel手册(第3A卷,系统编程指南):
8.1.2.1 Automatic Locking
The operations on which the processor automatically follows the LOCK semantics are as follows:
...
When updating page-directory and page-table entries —
When updating page-directory and page-table entries, the processor uses locked cycles to set the accessed and dirty flag in the page-directory and page-table entries.
从8.1和8.2节中的其余部分开始,一旦CPU使用锁定操作设置脏位,其他CPU应该开始看到更新的值.
当然,您可能遇到竞争条件,因为您首先在一个CPU(或其中一个线程)中将脏位读为0,然后另一个CPU(或同一CPU上的另一个线程)将此位设置为1,但这并不罕见.
AMD64架构程序员手册第2卷:系统编程(修订版3.22,2012年9月)
通常,脏位更新是针对其他加载和存储而排序的,尽管不一定是关于对WC存储器的访问; 特别是,它们可能不会导致WC缓冲区被刷新.但是,为确保与未来处理器的兼容性,应在读取D位之前插入串行化操作.
(强调我的.)