Hi,everyone I try to intercept every memory access to the kernel space of Guest OS on a host using EPT. So I change __direct_map(). wp_mask is only effective when __direct_map cone across a kernel space gfn. I record the gfn. And then emulating write access when kvm_mmu_page_fault is caused by writing to the gfn in kernel space. About emulating, I just use the x86_emulate_instruction in the kvm_mmu_page_fault. if (iterator.level == level) { unsigned pte_access = ACC_ALL & wp_mask; /* remove write access from all of this ,ept does not have prefetch*/ mmu_set_spte(vcpu, iterator.sptep, ACC_ALL, pte_access, 0, write, &emulate, level, gfn, pfn, prefault, map_writable); direct_pte_prefetch(vcpu, iterator.sptep); ++vcpu->stat.pf_fixed; break; } However I got the error message as following. KVM: entry failed, hardware error 0x80000021 If you're running a guest on an Intel machine without unrestricted mode support, the failure can be most likely due to the guest entering an invalid state for Intel VT. For example, the guest maybe running in big real mode which is not supported on less recent Intel processors. EAX=f7fd6544 EBX=f7fe2000 ECX=c18f6e40 EDX=00000286 ESI=00000000 EDI=c18f6e40 EBP=c18ecf14 ESP=f7fd2fb0 EIP=c0620b3b EFL=00000086 [--S--P-] CPL=0 II=0 A20=1 SMM=0 HLT=0 ES =007b 00000000 ffffffff 00c0f300 DPL=3 DS [-WA] CS =0060 00000000 ffffffff 00c09b00 DPL=0 CS32 [-RA] SS =0068 00000000 ffffffff 00c09300 DPL=0 DS [-WA] DS =007b 00000000 ffffffff 00c0f300 DPL=3 DS [-WA] FS =0000 00000000 ffffffff 00000000 GS =0000 00000000 ffffffff 00000000 LDT=0088 c074a020 00000027 00008200 DPL=0 LDT TR =0080 c1803980 00002073 00008b00 DPL=0 TSS32-busy GDT= c180b000 000000ff IDT= c06fa000 000007ff CR0=8005003b CR2=ffc46000 CR3=00746000 CR4=000006d0 DR0=0000000000000000 DR1=0000000000000000 DR2=0000000700000000 DR3=0000000000000000 DR6=00000000ffff0ff0 DR7=0000000000000400 EFER=0000000000000000 Code=e9 f4 98 e0 ff b2 01 86 10 8b 04 24 e9 e8 98 e0 ff 9c 5a fa <90> fe 08 79 1c f7 c2 00 02 00 00 74 0b fb f3 90 80 38 00 7e f9 fa eb e8 f3 90 80 38 00 7f By the way, I got the error code of the page fault is 0x2, which means that page fault is only caused by write access and page not present. Is this caused by the emulating process? Can anybody give me a clue what is wrong? Thanks for answering. R -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html