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 kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html