From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
Chris Wright <chrisw@sous-sol.org>
Subject: Re: [PATCH] qemu-kvm: response to SIGUSR1 to start/stop a VCPU (v2)
Date: Wed, 24 Nov 2010 10:18:01 +0200 [thread overview]
Message-ID: <4CECCA39.4060702@redhat.com> (raw)
In-Reply-To: <1290530963-3448-1-git-send-email-aliguori@us.ibm.com>
On 11/23/2010 06:49 PM, Anthony Liguori wrote:
> qemu-kvm vcpu threads don't response to SIGSTOP/SIGCONT. Instead of teaching
> them to respond to these signals (which cannot be trapped), use SIGUSR1 to
> approximate the behavior of SIGSTOP/SIGCONT.
>
> The purpose of this is to implement CPU hard limits using an external tool that
> watches the CPU consumption and stops the VCPU as appropriate.
>
> This provides a more elegant solution in that it allows the VCPU thread to
> release qemu_mutex before going to sleep.
>
> This current implementation uses a single signal. I think this is too racey
> in the long term so I think we should introduce a second signal. If two signals
> get coalesced into one, it could confuse the monitoring tool into giving the
> VCPU the inverse of it's entitlement.
You can use sigqueue() to send an accompanying value.
> It might be better to simply move this logic entirely into QEMU to make this
> more robust--the question is whether we think this is a good long term feature
> to carry in QEMU?
>
I'm more concerned about lock holder preemption, and interaction of this
mechanism with any kernel solution for LHP.
> +static __thread int sigusr1_wfd;
> +
> +static void on_sigusr1(int signo)
> +{
> + char ch = 0;
> + if (write(sigusr1_wfd,&ch, 1)< 0) {
> + /* who cares */
> + }
> +}
We do have signalfd().
> +
> +static void sigusr1_read(void *opaque)
> +{
> + CPUState *env = opaque;
> + ssize_t len;
> + int caught_signal = 0;
> +
> + do {
> + char buffer[256];
> + len = read(env->sigusr1_fd, buffer, sizeof(buffer));
> + caught_signal = 1;
> + } while (len> 0);
> +
> + if (caught_signal) {
> + if (env->stopped) {
env->stopped is multiplexed among multiple users, so this interferes
with vm_stop().
We need to make ->stopped a reference count instead.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2010-11-24 8:18 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 16:49 [PATCH] qemu-kvm: response to SIGUSR1 to start/stop a VCPU (v2) Anthony Liguori
2010-11-23 19:35 ` [Qemu-devel] " Blue Swirl
2010-11-23 21:46 ` Anthony Liguori
2010-11-23 23:43 ` Paolo Bonzini
2010-11-24 1:15 ` Anthony Liguori
2010-11-24 2:08 ` Paolo Bonzini
2010-11-24 8:18 ` Avi Kivity [this message]
2010-11-24 13:58 ` Anthony Liguori
2010-11-24 14:23 ` Avi Kivity
2010-12-01 12:37 ` Srivatsa Vaddagiri
2010-12-01 12:56 ` Avi Kivity
2010-12-01 16:12 ` Srivatsa Vaddagiri
2010-12-01 16:25 ` Peter Zijlstra
2010-12-01 17:17 ` Chris Wright
2010-12-01 17:22 ` Peter Zijlstra
2010-12-01 17:26 ` Rik van Riel
2010-12-01 19:07 ` Peter Zijlstra
2010-12-01 19:24 ` Rik van Riel
2010-12-01 19:35 ` Peter Zijlstra
2010-12-01 19:42 ` Rik van Riel
2010-12-01 19:47 ` Peter Zijlstra
2010-12-02 9:07 ` Avi Kivity
2010-12-01 17:46 ` Chris Wright
2010-12-01 17:29 ` Srivatsa Vaddagiri
2010-12-01 17:45 ` Peter Zijlstra
2010-12-01 18:00 ` Srivatsa Vaddagiri
2010-12-01 19:09 ` Peter Zijlstra
2010-12-02 9:17 ` Avi Kivity
2010-12-02 11:47 ` Srivatsa Vaddagiri
2010-12-02 12:22 ` Srivatsa Vaddagiri
2010-12-02 12:41 ` Avi Kivity
2010-12-02 13:13 ` Srivatsa Vaddagiri
2010-12-02 13:49 ` Avi Kivity
2010-12-02 15:27 ` Srivatsa Vaddagiri
2010-12-02 15:28 ` Srivatsa Vaddagiri
2010-12-02 15:33 ` Avi Kivity
2010-12-02 15:44 ` Srivatsa Vaddagiri
2010-12-02 12:19 ` Srivatsa Vaddagiri
2010-12-02 12:42 ` Avi Kivity
2010-12-02 9:14 ` Avi Kivity
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=4CECCA39.4060702@redhat.com \
--to=avi@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=chrisw@sous-sol.org \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.