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).

> 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).

Paolo

--
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

Reply via email to