From: "Longpeng (Mike)" <longpeng2@huawei.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: kvm <kvm@vger.kernel.org>, Wanpeng Li <kernellwp@gmail.com>,
Gonglei <arei.gonglei@huawei.com>
Subject: Re: [Question] About the behavior of HLT in VMX guest mode
Date: Tue, 21 Mar 2017 09:47:41 +0800 [thread overview]
Message-ID: <58D0863D.4080001@huawei.com> (raw)
In-Reply-To: <20170320151815.GA25540@potion>
Hi Radim,
On 2017/3/20 23:18, Radim Krčmář wrote:
> 2017-03-17 13:22+0800, Longpeng (Mike):
>> Hi Radim,
...
>> In my humble opinion:
>>
>> 1) As "Intel sdm vol3 ch25.3" says, MWAIT operates normally (I think includes
>> entering deeper sleep) under certain conditions.
>> Some deeper sleep modes(such as C4E/C6/C7) will clear the L1/L2/L3 cache.
>> This is insecurity if we don't take other protective measures(such as limit the
>> guest's max-cstate, it's fortunately that power subsystem isn't supported by
>> QEMU, but we should be careful for some special-purpose in case). While HLT in
>> guest mode can't cause hardware into sleep.
>
> Good point. I'm not aware of any VMX capabilities to prevent deeper
> C-states, so we'd always hope that guests obey provided information.
>
I'll do some tests this weekend.
I plan to use MWAIT to enter deeper C-states in a testcase of kvm-unit-tests,
and start a memory-sensitive workload on another hyper-thread, then use
intel-pcm or perf to observe the count of cache miss on that core.
>> 2) According to the "Intel sdm vol3 ch26.3.3 & ch27.5.6", I think MONITOR in
>> guest mode can't work as perfect as in host sometimes.
>> For example, a vcpu MONITOR a address and then MWAIT, if a external-intr(suppose
>> this intr won't cause to inject any virtual events ) cause VMEXIT, the monitor
>> address will be cleaned, so the MWAIT won't be waken up by a store operation to
>> the monitored address any more.
>
> It's not as perfect, but should not cause a bug (well, there is a
> discussion with suspicious MWAIT behavior :]).
> MWAIT on all Intels I tested would just behave as a nop if exit happened
> between MONITOR and MWAIT, like it does if you skip the MONITOR (MWAIT
> instruction desciption):
>
> If the preceding MONITOR instruction did not successfully arm an
> address range or if the MONITOR instruction has not been executed
> prior to executing MWAIT, then the processor will not enter the
> implementation-dependent-optimized state. Execution will resume at the
> instruction following the MWAIT.
>
OK. :)
>> But I'm glad to do some tests if time permits, thanks :)
>>
>> Radim, how about to make HLT-exiting configurable again in upstream ? If you
>> like it, there is a problem should be resolved, asynpf is conflict with
>> "HLT-exiting = 0" in certain situations.
>
> Go ahead. KVM should provide access to hardware features and
> no-HLT-exiting is reasonable as a per-VM (even per-VCPU if you make a
> good case) capability. I'm interested in the asyncpf conflict.
>
I had did some offline discussion with Wanpeng Li, he's interesting to write a
path for this feature. :)
> Thanks.
>
> .
>
--
Regards,
Longpeng(Mike)
next prev parent reply other threads:[~2017-03-21 1:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 7:12 [Question] About the behavior of HLT in VMX guest mode Longpeng (Mike)
2017-03-15 17:32 ` Radim Krčmář
2017-03-16 2:08 ` Longpeng (Mike)
2017-03-16 2:48 ` Longpeng (Mike)
2017-03-16 8:51 ` Wanpeng Li
2017-03-16 9:19 ` Longpeng (Mike)
2017-03-16 14:23 ` Radim Krčmář
2017-03-17 5:22 ` Longpeng (Mike)
2017-03-20 15:18 ` Radim Krčmář
2017-03-21 1:47 ` Longpeng (Mike) [this message]
2017-03-21 6:21 ` Wanpeng Li
2017-03-21 16:45 ` Radim Krčmář
2017-07-04 4:24 ` Wanpeng Li
2017-07-10 17:08 ` Radim Krčmář
2017-07-11 10:41 ` Wanpeng Li
2017-07-11 15:04 ` Radim Krčmář
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=58D0863D.4080001@huawei.com \
--to=longpeng2@huawei.com \
--cc=arei.gonglei@huawei.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=rkrcmar@redhat.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;
as well as URLs for NNTP newsgroup(s).