Re: [PATCH 08/31] nVMX: Fix local_vcpus_link handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/17/2011 04:19 PM, Marcelo Tosatti wrote:
>  +/*
>  + * Maintain the vcpus_on_cpu and saved_vmcss_on_cpu lists of vcpus and
>  + * inactive saved_vmcss on nested entry (L1->L2) or nested exit (L2->L1).
>  + *
>  + * nested_maintain_per_cpu_lists should be called after the VMCS was switched
>  + * to the new one, with parameters giving both the new on (after the entry
>  + * or exit) and the old one, in that order.
>  + */
>  +static void nested_maintain_per_cpu_lists(struct vcpu_vmx *vmx,
>  +		struct saved_vmcs *new_vmcs,
>  +		struct saved_vmcs *old_vmcs)
>  +{
>  +	/*
>  +	 * When a vcpus's old vmcs is saved, we need to drop it from
>  +	 * vcpus_on_cpu and put it on saved_vmcss_on_cpu.
>  +	 */
>  +	if (old_vmcs->cpu != -1) {
>  +		list_del(&vmx->local_vcpus_link);
>  +		list_add(&old_vmcs->local_saved_vmcss_link,
>  +			&per_cpu(saved_vmcss_on_cpu, old_vmcs->cpu));
>  +	}

This new handling of vmcs could be simplified (local_vcpus_link must be
manipulated with interrupts disabled, BTW).

What about having a per-CPU VMCS list instead of per-CPU vcpu list?
"local_vmcs_link" list node could be in "struct saved_vmcs" (and
a current_saved_vmcs pointer in "struct vcpu_vmx").

vmx_vcpu_load would then add to this list at

         if (per_cpu(current_vmcs, cpu) != vmx->vmcs) {
                 per_cpu(current_vmcs, cpu) = vmx->vmcs;
                 vmcs_load(vmx->vmcs);
         }

Right, that's the easiest thing to do.

Perhaps even easier (avoids duplication):

struct raw_vmcs {
    u32 revision_id;
    u32 abort;
    char data[0];
};

struct vmcs {
    struct raw_vmcs *raw_vmcs;
    struct list_head local_vmcs_link;
};

struct vcpu_vmx {
    ...
    struct vmcs *vmcs;  /* often points at l1_vmcs */
    struct vmcs l1_vmcs;
    ...
};

static DEFINE_PER_CPU(struct list_head, vmcss_on_cpu);

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux