From: Paolo Bonzini <pbonzini@redhat.com>
To: Arthur Chunqi Li <yzt356@gmail.com>
Cc: kvm <kvm@vger.kernel.org>
Subject: Re: How to get to know vcpu status from outside
Date: Tue, 17 Dec 2013 12:21:31 +0100 [thread overview]
Message-ID: <52B033BB.6070401@redhat.com> (raw)
In-Reply-To: <CABpY8M+eq9UMtNtDDckw9gQNjiNkxcrAAZNNPM7ZfQ_9vwuk0Q@mail.gmail.com>
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
next prev parent reply other threads:[~2013-12-17 11:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 6:11 How to get to know vcpu status from outside Arthur Chunqi Li
2013-12-17 11:21 ` Paolo Bonzini [this message]
2013-12-17 11:43 ` Arthur Chunqi Li
2013-12-17 12:28 ` Paolo Bonzini
2013-12-20 8:05 ` Arthur Chunqi Li
2013-12-20 11:57 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52B033BB.6070401@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=yzt356@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox