Hi Paolo,

Thanks very much. And...(see below)

On Tue, Dec 17, 2013 at 7:21 PM, Paolo Bonzini <pbonz...@redhat.com> wrote:
> Il 17/12/2013 07:11, Arthur Chunqi Li ha scritto:
>> Hi Paolo,
>>
>> Since VCPU is managed the same as a process in kernel, how can I know
>> the status (running, sleeping etc.) of a vcpu in kernel? Is there a
>> variant in struct kvm_vcpu or something else indicate this?
>
> waitqueue_active(&vcpu->wq) means that the VCPU is sleeping in the
> kernel (i.e. in a halted state).
>
> vcpu->mode == IN_GUEST_MODE means that the VCPU is running.
>
> Anything else means that the host is running some kind of "glue" code
> (either kernel or userspace).

Another question about scheduler. When I have 4 vcpus and the workload
of VM is low, and I noticed that it tends to activate only 1 or 2
vcpus. Does this mean the other 2 vcpus are scheduled out or into
sleeping status?

>
>> Besides, if vcpu1 is running on pcpu1, and a kernel thread running on
>> pcpu0. Can the kernel thread send a message to force vcpu1 trap to
>> VMM? How can I do this?
>
> Yes, with kvm_vcpu_kick.  KVM tracks internally which pcpu will run the
> vcpu in vcpu->cpu, and kvm_vcpu_kick sends either a wakeup (if the vcpu
> is sleeping) or an IPI (if it is running).

What is vcpu's action if kvm_vcpu_kick(vcpu)? What is the exit_reason
of the kicked vcpu?

>
> Paolo
>

Besides, can I pin a vcpu to a pcpu? That is to say, I assigned a pcpu
only for a vcpu and pcpu can only run this vcpu?


Thanks,
Arthur

-- 
Arthur Chunqi Li
Department of Computer Science
School of EECS
Peking University
Beijing, China
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to