From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, Chris Wright <chrisw@sous-sol.org>,
kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH] qemu-kvm: introduce cpu_start/cpu_stop commands
Date: Tue, 23 Nov 2010 08:24:21 -0600 [thread overview]
Message-ID: <4CEBCE95.2050400@codemonkey.ws> (raw)
In-Reply-To: <4CEBC915.2010006@redhat.com>
On 11/23/2010 08:00 AM, Avi Kivity wrote:
>>>
>>> If we could catch SIGSTOP, then it would be easy to unblock it only
>>> while running in guest context. It would then stop on exit to
>>> userspace.
>>
>> Yeah, that's not a bad idea.
>
> Except we can't.
Yeah, I s:SIGSTOP:SIGUSR1:g.
>>
>>> Using monitor commands is fairly heavyweight for something as high
>>> frequency as this. What control period do you see people using?
>>> Maybe we should define USR1 for vcpu start/stop.
>>>
>>> What happens if one vcpu is stopped while another is running? Spin
>>> loops, synchronous IPIs will take forever. Maybe we need to stop
>>> the entire process.
>>
>> It's the same problem if a VCPU is descheduled while another is running.
>
> We can fix that with directed yield or lock holder preemption
> prevention. But if a vcpu is stopped by qemu, we suddenly can't.
That only works for spin locks.
Here's the scenario:
1) VCPU 0 drops to userspace and acquires qemu_mutex
2) VCPU 0 gets descheduled
3) VCPU 1 needs to drop to userspace and acquire qemu_mutex, gets
blocked and yields
4) If we're lucky, VCPU 0 gets scheduled but it depends on how busy the
system is
With CFS hard limits, once (2) happens, we're boned for (3) because (4)
cannot happen. By having QEMU know about (2), it can choose to run just
a little bit longer in order to drop qemu_mutex such that (3) never happens.
>
>> The problem with stopping the entire process is that a big motivation
>> for this is to ensure that benchmarks have consistent results
>> regardless of CPU capacity. If you just monitor the full process,
>> then one VCPU may dominate the entitlement resulting in very erratic
>> benchmarking.
>
> What's the desired behaviour? Give each vcpu 300M cycles per second,
> or give a 2vcpu guest 600M cycles per second?
Each vcpu gets 300M cycles per second.
> You could monitor threads separately but stop the entire process.
> Stopping individual threads will break apart as soon as they start
> taking locks.
I don't think so.. PLE should work as expected. It's no different than
a normally contended system.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2010-11-23 14:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-22 23:00 [PATCH] qemu-kvm: introduce cpu_start/cpu_stop commands Anthony Liguori
2010-11-22 23:03 ` Anthony Liguori
2010-11-22 23:04 ` Chris Wright
2010-11-22 23:44 ` Anthony Liguori
2010-11-22 23:56 ` Chris Wright
2010-11-23 0:24 ` Anthony Liguori
2010-11-23 6:35 ` [Qemu-devel] " Avi Kivity
2010-11-23 6:41 ` [Qemu-devel] " Avi Kivity
2010-11-23 8:16 ` Dor Laor
2010-11-23 13:57 ` Anthony Liguori
2010-11-23 13:51 ` Anthony Liguori
2010-11-23 14:00 ` Avi Kivity
2010-11-23 14:24 ` Anthony Liguori [this message]
2010-11-23 14:35 ` Avi Kivity
2010-11-23 7:29 ` Gleb Natapov
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=4CEBCE95.2050400@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox