From 4f303785dc3001a8c952f19540e16a9b437278f2 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 27 Nov 2015 14:52:10 +0000 Subject: kvm: Shutdown KVM and disconnect performance counters on fork We can't/shouldn't use KVM after a fork since the child and parent probably point to the same VM. Knowing the exact effects of this is hard, but they are likely to be messy. We also disconnect the performance counters attached to the guest. This works around what seems to be a kernel bug where spurious SIGIOs get delivered to the forked child process. Signed-off-by: Andreas Sandberg [sascha.bischoff@arm.com: Rebased patches onto a newer gem5 version] Signed-off-by: Sascha Bischoff [andreas.sandberg@arm.com: Fatal if entering KVM in child process ] Signed-off-by: Andreas Sandberg --- src/cpu/kvm/x86_cpu.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/cpu/kvm/x86_cpu.cc') diff --git a/src/cpu/kvm/x86_cpu.cc b/src/cpu/kvm/x86_cpu.cc index f3e5edaed..c6c874dc4 100644 --- a/src/cpu/kvm/x86_cpu.cc +++ b/src/cpu/kvm/x86_cpu.cc @@ -519,7 +519,7 @@ X86KvmCPU::X86KvmCPU(X86KvmCPUParams *params) : BaseKvmCPU(params), useXSave(params->useXSave) { - Kvm &kvm(vm.kvm); + Kvm &kvm(*vm.kvm); if (!kvm.capSetTSSAddress()) panic("KVM: Missing capability (KVM_CAP_SET_TSS_ADDR)\n"); @@ -649,7 +649,7 @@ X86KvmCPU::dumpVCpuEvents() const void X86KvmCPU::dumpMSRs() const { - const Kvm::MSRIndexVector &supported_msrs(vm.kvm.getSupportedMSRs()); + const Kvm::MSRIndexVector &supported_msrs(vm.kvm->getSupportedMSRs()); std::unique_ptr msrs( newVarStruct( supported_msrs.size())); @@ -1539,7 +1539,7 @@ const Kvm::MSRIndexVector & X86KvmCPU::getMsrIntersection() const { if (cachedMsrIntersection.empty()) { - const Kvm::MSRIndexVector &kvm_msrs(vm.kvm.getSupportedMSRs()); + const Kvm::MSRIndexVector &kvm_msrs(vm.kvm->getSupportedMSRs()); DPRINTF(Kvm, "kvm-x86: Updating MSR intersection\n"); for (auto it = kvm_msrs.cbegin(); it != kvm_msrs.cend(); ++it) { -- cgit v1.2.3