[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110714131228.GD24072@8bytes.org>
Date: Thu, 14 Jul 2011 15:12:28 +0200
From: Joerg Roedel <joro@...tes.org>
To: Avi Kivity <avi@...hat.com>
Cc: Joerg Roedel <joerg.roedel@....com>,
Marcelo Tosatti <mtosatti@...hat.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/7] KVM: SVM: Use seperate VMCB for L2 guests
On Thu, Jul 14, 2011 at 02:38:39PM +0300, Avi Kivity wrote:
> On 07/13/2011 06:32 PM, Joerg Roedel wrote:
>> +static bool init_nested_vmcb(struct vcpu_svm *svm)
>> +{
>> + struct vmcb_control_area *hc, *nc;
>> +
>> + svm->nested.n_vmcb = (void *)get_zeroed_page(GFP_KERNEL);
>> + if (svm->nested.n_vmcb == NULL)
>> + return false;
>> +
>> + nc =&svm->nested.n_vmcb->control;
>> + hc =&svm->host_vmcb->control;
>> +
>> + nc->iopm_base_pa = hc->iopm_base_pa;
>> + nc->msrpm_base_pa = hc->msrpm_base_pa;
>> + nc->nested_ctl = hc->nested_ctl;
>> + nc->pause_filter_count = hc->pause_filter_count;
>> + svm->nested.n_vmcb->save.g_pat = svm->host_vmcb->save.g_pat;
>> +
>> + return true;
>> +}
>> +
>
> Instead of initializing the non-nested vmcb and then copying it,
> separate out the bits you're copying here into a separate function (i.e.
> init_vmcb_host_state()) and call it for both vmcbs.
>
> I had practically the same comment for nvmx (see
> vmx_set_constant_host_state()).
Makes sense. I'll probably remove the lazy allocation and initialize
both VMCBs at vcpu-creation time. The memory foodprint is the same as
before because the hsave area was also allocated at the beginning.
Joerg
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists