From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v2 4/5] KVM: nVMX: Allow to disable VM_{ENTRY_LOAD,EXIT_SAVE}_DEBUG_CONTROLS Date: Tue, 17 Jun 2014 07:18:43 +0200 Message-ID: <539FCFB3.8030304@redhat.com> References: <1d6af71531e07c1f765c116d88c94993b6cedbe3.1402919981.git.jan.kiszka@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm To: Bandan Das , Jan Kiszka Return-path: Received: from mail-wg0-f41.google.com ([74.125.82.41]:35193 "EHLO mail-wg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755420AbaFQFSs (ORCPT ); Tue, 17 Jun 2014 01:18:48 -0400 Received: by mail-wg0-f41.google.com with SMTP id a1so6565257wgh.12 for ; Mon, 16 Jun 2014 22:18:47 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Il 16/06/2014 19:02, Bandan Das ha scritto: > > - vmcs_write64(GUEST_IA32_DEBUGCTL, vmcs12->guest_ia32_debugctl); > > + if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS) { > > + kvm_set_dr(vcpu, 7, vmcs12->guest_dr7); > > + vmcs_write64(GUEST_IA32_DEBUGCTL, vmcs12->guest_ia32_debugctl); > > + } else { > > + kvm_set_dr(vcpu, 7, vcpu->arch.dr7); > > + vmcs_write64(GUEST_IA32_DEBUGCTL, vmx->nested.vmcs01_debugctl); > > + } > > (I guess I don't understand DEBUGCTLS enough) vmcs01_debugctl is used by > L0 to run L1, and if L1 hasn't set VM_ENTRY_LOAD_DEBUG_CONTROLS for L2, > why do we need the GUEST_IA32_DEBUGCTL vmwrite in the "else" case ? Beause we always set VM_ENTRY_LOAD_DEBUG_CONTROLS in the VMCS02, so we must always fill in GUEST_IA32_DEBUGCTL of the VMCS02. Depending on the VMCS12's VM_ENTRY_LOAD_DEBUG_CONTROLS, the field comes from either VMCS01 or VMCS12. Paolo