Question regarding nested_svm_inject_npf_exit()
Hello Paolo,
I encountered an issue while running some svm tests. Apparently, the tests “npt_rw_pfwalk” and “npt_rsv_pfwalk” expect the present bit to be clear.
KVM indeed clears this bit in nested_svm_inject_npf_exit():
/*
* The present bit is always zero for page structure faults on real
* hardware.
*/
if (svm->vmcb->control.exit_info_1 & (2ULL << 32))
svm->vmcb->control.exit_info_1 &= ~1;I could not find documentation of this behavior. Unfortunately, I do not have a bare-metal AMD machine to test the behavior (and some enabling of kvm-unit-tests/svm is required, e.g. this test does not run with more than 4GB of memory).
Are you sure that this is the way AMD machines behave?
Thanks,
Nadav
Paolo Bonzini
maintainerQuoted 15 lines · Nadav Amit
Hello Paolo,
I encountered an issue while running some svm tests. Apparently, the tests “npt_rw_pfwalk” and “npt_rsv_pfwalk” expect the present bit to be clear.
KVM indeed clears this bit in
nested_svm_inject_npf_exit():/* * The present bit is always zero for page structure faults on real * hardware. */ if (svm->vmcb->control.exit_info_1 & (2ULL << 32)) svm->vmcb->control.exit_info_1 &= ~1;
Quoted 6 lines
I could not find documentation of this behavior. Unfortunately, I do not have a bare-metal AMD machine to test the behavior (and some enabling of kvm-unit-tests/svm is required, e.g. this test does not run with more than 4GB of memory).
Are you sure that this is the way AMD machines behave?
No, I'm not. The code was added when NPF was changed to synthesize EXITINFO1, instead of simply propagating L0's EXITINFO1 into L1 (see commit 5e3525195196, "KVM: nSVM: propagate the NPF EXITINFO to the guest", 2014-09-03). With six more years of understanding of KVM, the lack of a present bit might well have been a consequence of how the MMU works.
One of these days I'd like to run the SVM tests under QEMU without KVM.
It would probably find bugs in both.
Paolo
Quoted 23 lines · Paolo Bonzini
Quoted 20 lines · Nadav Amit
Hello Paolo,
I encountered an issue while running some svm tests. Apparently, the tests “npt_rw_pfwalk” and “npt_rsv_pfwalk” expect the present bit to be clear.
KVM indeed clears this bit in
nested_svm_inject_npf_exit():/* * The present bit is always zero for page structure faults on real * hardware. */ if (svm->vmcb->control.exit_info_1 & (2ULL << 32)) svm->vmcb->control.exit_info_1 &= ~1;I could not find documentation of this behavior. Unfortunately, I do not have a bare-metal AMD machine to test the behavior (and some enabling of kvm-unit-tests/svm is required, e.g. this test does not run with more than 4GB of memory).
Quoted 8 lines
Quoted 1 line
Are you sure that this is the way AMD machines behave?
No, I'm not. The code was added when NPF was changed to synthesize EXITINFO1, instead of simply propagating L0's EXITINFO1 into L1 (see commit
5e3525195196, "KVM: nSVM: propagate the NPF EXITINFO to the guest", 2014-09-03). With six more years of understanding of KVM, the lack of a present bit might well have been a consequence of how the MMU works.
Thanks. I ran ‘git blame’ before asking you, and that is the reason I assumed you would know best... ;-)
Quoted 2 lines
One of these days I'd like to run the SVM tests under QEMU without KVM. It would probably find bugs in both.
Well, I think we can agree that bare-metal is a better reference than another emulator for the matter. Even without running the tests on bare-metal, it is easy to dump EXITINFO1 on the nested page-fault. I will try to find a bare-metal machine.
Anyhow, I would appreciate if anyone from AMD would tell whether any result should be considered architectural.
Quoted 39 lines · Nadav Amit
Quoted 24 lines · Paolo Bonzini
Quoted 20 lines · Nadav Amit
Hello Paolo,
I encountered an issue while running some svm tests. Apparently, the tests “npt_rw_pfwalk” and “npt_rsv_pfwalk” expect the present bit to be clear.
KVM indeed clears this bit in
nested_svm_inject_npf_exit():/* * The present bit is always zero for page structure faults on real * hardware. */ if (svm->vmcb->control.exit_info_1 & (2ULL << 32)) svm->vmcb->control.exit_info_1 &= ~1;I could not find documentation of this behavior. Unfortunately, I do not have a bare-metal AMD machine to test the behavior (and some enabling of kvm-unit-tests/svm is required, e.g. this test does not run with more than 4GB of memory).
Quoted 8 lines
Quoted 1 line
Are you sure that this is the way AMD machines behave?
No, I'm not. The code was added when NPF was changed to synthesize EXITINFO1, instead of simply propagating L0's EXITINFO1 into L1 (see commit
5e3525195196, "KVM: nSVM: propagate the NPF EXITINFO to the guest", 2014-09-03). With six more years of understanding of KVM, the lack of a present bit might well have been a consequence of how the MMU works.Thanks. I ran ‘git blame’ before asking you, and that is the reason I assumed you would know best... ;-)
Quoted 2 lines
One of these days I'd like to run the SVM tests under QEMU without KVM. It would probably find bugs in both.
Quoted 7 lines
Well, I think we can agree that bare-metal is a better reference than another emulator for the matter. Even without running the tests on bare-metal, it is easy to dump EXITINFO1 on the nested page-fault. I will try to find a bare-metal machine.
Anyhow, I would appreciate if anyone from AMD would tell whether any result should be considered architectural.
I'd be happy to test on bare metal, but I'm still waiting for instructions that a script kiddie (with read-only console access) can follow.
Paolo Bonzini
maintainerQuoted 11 lines · Jim Mattson
Quoted 7 lines
Well, I think we can agree that bare-metal is a better reference than another emulator for the matter. Even without running the tests on bare-metal, it is easy to dump EXITINFO1 on the nested page-fault. I will try to find a bare-metal machine.
Anyhow, I would appreciate if anyone from AMD would tell whether any result should be considered architectural.
I'd be happy to test on bare metal, but I'm still waiting for instructions that a script kiddie (with read-only console access) can follow.
I'll try to test myself and prepare some instructions.
Paolo
Quoted 8 lines · Paolo Bonzini
Quoted 5 lines · Jim Mattson
Quoted 5 lines
Well, I think we can agree that bare-metal is a better reference than another emulator for the matter. Even without running the tests on bare-metal, it is easy to dump EXITINFO1 on the nested page-fault. I will try to find a bare-metal machine.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Anyhow, I would appreciate if anyone from AMD would tell whether any result should be considered architectural.
I'd be happy to test on bare metal, but I'm still waiting for instructions that a script kiddie (with read-only console access) can follow.
I'll try to test myself and prepare some instructions.
Sorry for the late response (divorce, it turns out, is very time consuming).
I will try to send you scripts later on, but I did not automate things through the iDRAC.
I managed to get an AMD machine, but unfortunately non of the tests run on that machine. I am still trying to figure it out. I will update you once I make progress.