Skip to contentSkip to conversation

What's the difference between EPT_MISCONFIG and EPT_VIOLATION?

DISCUSSION Zhang Haoyu 3 participants 5 messages Dec 3, 2014 KVM

lore
Share & tools
lore
#0 lore raw

Hi,

EXIT_REASON_EPT_VIOLATION's corresponding handle is handle_ept_violation(), and EXIT_REASON_EPT_MISCONFIG's corresponding handle is handle_ept_misconfig(), what's the difference between them?

I read the SDM-3C 28.2.3 EPT-Induced VM Exits, and found below description, "An EPT misconfiguration occurs when, in the course of translating a guest-physical address, the logical processor encounters an EPT paging-structure entry that contains an unsupported value. An EPT violation occurs when there is no EPT misconfiguration but the EPT paging-structure entries disallow an access using the guest physical address."

According to above description, EPT-MISCONFIG is from error settings , but from the its exit-handle handle_ept_misconfig(),
it seems that handle_ept_misconfig() handles mmio pagefault, I'm really confused, I think I'm missing something,
any advices?

Thanks,
Zhang Haoyu

#1 lore raw
Quoted 14 lines · Zhang Haoyu

Hi,

EXIT_REASON_EPT_VIOLATION's corresponding handle is handle_ept_violation(), and EXIT_REASON_EPT_MISCONFIG's corresponding handle is handle_ept_misconfig(), what's the difference between them?

I read the SDM-3C 28.2.3 EPT-Induced VM Exits, and found below description, "An EPT misconfiguration occurs when, in the course of translating a guest-physical address, the logical processor encounters an EPT paging-structure entry that contains an unsupported value. An EPT violation occurs when there is no EPT misconfiguration but the EPT paging-structure entries disallow an access using the guest physical address."

Quoted 6 lines

According to above description, EPT-MISCONFIG is from error settings , but from the its exit-handle handle_ept_misconfig(),
it seems that handle_ept_misconfig() handles mmio pagefault, I'm really confused, I think I'm missing something,
any advices?

EXIT_REASON_EPT_VIOLATION is similar to a "page not present" pagefault EXIT_REASON_EPT_MISCONFIG is similar to a "reserved bit set" pagefault. handle_ept_misconfig() handles mmio pagefault because KVM has an optimization that uses reserved bits to mark mmio regions.

--
Gleb.

#2 lore raw
Quoted 20 lines
Quoted 14 lines

Hi,

EXIT_REASON_EPT_VIOLATION's corresponding handle is handle_ept_violation(), and EXIT_REASON_EPT_MISCONFIG's corresponding handle is handle_ept_misconfig(), what's the difference between them?

I read the SDM-3C 28.2.3 EPT-Induced VM Exits, and found below description, "An EPT misconfiguration occurs when, in the course of translating a guest-physical address, the logical processor encounters an EPT paging-structure entry that contains an unsupported value. An EPT violation occurs when there is no EPT misconfiguration but the EPT paging-structure entries disallow an access using the guest physical address."

Quoted 6 lines

According to above description, EPT-MISCONFIG is from error settings , but from the its exit-handle handle_ept_misconfig(),
it seems that handle_ept_misconfig() handles mmio pagefault, I'm really confused, I think I'm missing something,
any advices?

Quoted 5 lines

EXIT_REASON_EPT_VIOLATION is similar to a "page not present" pagefault EXIT_REASON_EPT_MISCONFIG is similar to a "reserved bit set" pagefault. handle_ept_misconfig() handles mmio pagefault because KVM has an optimization that uses reserved bits to mark mmio regions.

Thanks, Gleb,
where does kvm use the reserved bits to mark mmio regions?

Quoted 2 lines

--
Gleb.

#3 lore raw
Quoted 20 lines · Zhang Haoyu
Quoted 20 lines
Quoted 20 lines

Hi,

EXIT_REASON_EPT_VIOLATION's corresponding handle is handle_ept_violation(), and EXIT_REASON_EPT_MISCONFIG's corresponding handle is handle_ept_misconfig(), what's the difference between them?

I read the SDM-3C 28.2.3 EPT-Induced VM Exits, and found below description, "An EPT misconfiguration occurs when, in the course of translating a guest-physical address, the logical processor encounters an EPT paging-structure entry that contains an unsupported value. An EPT violation occurs when there is no EPT misconfiguration but the EPT paging-structure entries disallow an access using the guest physical address."

According to above description, EPT-MISCONFIG is from error settings , but from the its exit-handle handle_ept_misconfig(),
it seems that handle_ept_misconfig() handles mmio pagefault, I'm really confused, I think I'm missing something,
any advices?

Quoted 8 lines
Quoted 5 lines

EXIT_REASON_EPT_VIOLATION is similar to a "page not present" pagefault EXIT_REASON_EPT_MISCONFIG is similar to a "reserved bit set" pagefault. handle_ept_misconfig() handles mmio pagefault because KVM has an optimization that uses reserved bits to mark mmio regions.

Thanks, Gleb,
where does kvm use the reserved bits to mark mmio regions?

arch/x86/kvm/mmu.c:mark_mmio_spte

--
Gleb.

maintainer
#4 lore raw
In reply to Zhang Haoyu
Quoted 7 lines · Zhang Haoyu
Quoted 5 lines
Quoted 5 lines

EXIT_REASON_EPT_VIOLATION is similar to a "page not present" pagefault EXIT_REASON_EPT_MISCONFIG is similar to a "reserved bit set" pagefault. handle_ept_misconfig() handles mmio pagefault because KVM has an optimization that uses reserved bits to mark mmio regions.

Thanks, Gleb,
where does kvm use the reserved bits to mark mmio regions?

ept_set_mmio_spte_mask is where KVM tells mmu.c how to mark MMIO regions. You can search mmu.c for shadow_mmio_mask and is_mmio_spte in order to find out more about this optimization, you'll also get to the mark_mmio_spte function that Gleb mentioned.

Paolo