Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1622246
| From | Jim Mattson <jmattson@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v6] kvm: better MWAIT emulation for guests |
| Date | 2017-04-12 17:30 +0200 |
| Message-ID | <tvsnw-680-27@gated-at.bofh.it> (permalink) |
| References | <tv2t3-6q3-7@gated-at.bofh.it> <tv7Cp-1vq-17@gated-at.bofh.it> <tv8I9-2bb-5@gated-at.bofh.it> <tvrB8-5Bn-3@gated-at.bofh.it> <tvrUu-5IE-33@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Apr 12, 2017 at 7:54 AM, Alexander Graf <agraf@suse.de> wrote:
>
>
> On 12.04.17 16:34, Jim Mattson wrote:
>>
>> Actually, we have rejected commit 87c00572ba05aa8c ("kvm: x86: emulate
>> monitor and mwait instructions as nop"), so when we intercept
>> MONITOR/MWAIT, we synthesize #UD. Perhaps it is this difference from
>> vanilla kvm that motivates the following idea...
>
>
> So you're not running upstream kvm? In that case, you can just not take this
> patch either :).
This patch should be harmless. :-)
>
>> Since we're still not going to report MONITOR support in CPUID, the
>> only guests of consequence are paravirtual guests. What if a
>
>
> Only if someone actually implemented something for PV guests, yes.
>
> The real motivation is to allow user space to force set the MONITOR CPUID
> flag. That way an admin can - if he really wants to - dedicate pCPUs to the
> VM.
>
> I agree that we don't need the kvm pv flag for that. I'd be happy to drop
> that if everyone agrees.
>
>> paravirtual guest was aware of the fact that sometimes MONITOR/MWAIT
>> would work as architected, and sometimes they would raise #UD (or do
>> something else that's guest-visible, to indicate that the hypevisor is
>> intercepting the instructions). Such a guest could first try a
>> MONITOR/MWAIT-based idle loop and then fall back on a HLT-based idle
>> loop if the hypervisor rejected its use of MONITOR/MWAIT.
>
>
> How would that work? That guest would have to atomically notify all other
> vCPUs that wakeup notifications now go via IPIs instead of cache line
> dirtying.
>
> That's probably as much work to get right as it would be to just emulate
> MWAIT inside kvm ;).
True. I don't have an easy solution to that problem.
>
>> We already have the loose concept of "this pCPU has other things to
>> do," which is encoded in the variable-sized PLE window. With
>> MONITOR/MWAIT, the choice is binary, but a simple implementation could
>> tie the two together, by allowing the guest to use MONITOR/MWAIT
>> whenever the PLE window exceeds a certain threshold. Or the decision
>> could be left to the userspace agent.
>
>
> I agree, and that's basically the idea I mentioned earlier with MWAIT
> emulation. We could (for well behaved guests) switch between emulating MWAIT
> and running native MWAIT.
Yes, that would probably be the preferred solution.
>
>
>
> Alex
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v6] kvm: better MWAIT emulation for guests Alexander Graf <agraf@suse.de> - 2017-04-11 13:50 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests Alexander Graf <agraf@suse.de> - 2017-04-11 14:50 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests "Gabriel L. Somlo" <gsomlo@gmail.com> - 2017-04-11 14:50 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests "Gabriel L. Somlo" <gsomlo@gmail.com> - 2017-04-11 14:50 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests Jim Mattson <jmattson@google.com> - 2017-04-11 19:20 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests Alexander Graf <agraf@suse.de> - 2017-04-11 20:30 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests Jim Mattson <jmattson@google.com> - 2017-04-12 16:40 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests Alexander Graf <agraf@suse.de> - 2017-04-12 17:00 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests Jim Mattson <jmattson@google.com> - 2017-04-12 17:30 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-04-12 18:30 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests Alexander Graf <agraf@suse.de> - 2017-04-21 12:10 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests Paolo Bonzini <pbonzini@redhat.com> - 2017-04-21 12:10 +0200
Re: [PATCH v6] kvm: better MWAIT emulation for guests Paolo Bonzini <pbonzini@redhat.com> - 2017-04-21 12:10 +0200
csiph-web