Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599853

Re: [PATCH] kvm: better MWAIT emulation for guests

From Radim Krčmář <rkrcmar@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] kvm: better MWAIT emulation for guests
Date 2017-03-13 22:50 +0100
Message-ID <tkG0O-6MV-27@gated-at.bofh.it> (permalink)
References <tjeSZ-32y-13@gated-at.bofh.it> <tkAop-2CJ-7@gated-at.bofh.it> <tkAHL-2Z7-7@gated-at.bofh.it> <tkDZ0-5cJ-17@gated-at.bofh.it> <tkEs3-5H9-55@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2017-03-13 22:03+0200, Michael S. Tsirkin:
> On Mon, Mar 13, 2017 at 08:39:11PM +0100, Radim Krčmář wrote:
> > 2017-03-13 18:08+0200, Michael S. Tsirkin:
> > > On Mon, Mar 13, 2017 at 04:46:20PM +0100, Radim Krčmář wrote:
>> >> What about keeping just the last hunk to improve OS X, for now?
>> > 
>> > IMHO if we have a new functionality we are better of creating
>> > some way for guests to discover it is there.
>> > 
>> > Do we really have to argue about a single bit in HV leaf?
>> > What harm does it do?
>> 
>> It adds code to both guest and hosts and needs documentation ...
>> The bit is acceptable.  I just see no point in having it when there
>> already is a detection mechanism for mwait.
> 
> We don't want to use that standard detection mechanism IMHO at least
> not in all cases.

Enabling mwait by default would make sense if the guest OS monitored its
steal time and disabled mwait when it detects that it is not the main
user of the CPU, because mwait then hurts the host as well as the guest.

This would warrant some kind of paravirt as we still wouldn't want to
have standard mwait by default.  My problem is that the paravirt flag
alone is not enough for a normal mwait use on Intel.

>> In any case, this patch should also remove VM exits under SVM
> 
> AMD does not have MWAIT AFAIK. In any case, I don't see
> why can't SVM be a separate patch.

AMD just doesn't have MWAIT hints. (AMD has even MWAIT in userspace and
MWAITX, but they are not supported by KVM.)

The separate patch would have to be part of the same series as we don't
want to have vendor-specific detection, so I'd just remove these two in
the same patch to simplify handling:

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index d1efe2c62b3f..18e53bc185d6 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1198,8 +1198,6 @@ static void init_vmcb(struct vcpu_svm *svm)
 	set_intercept(svm, INTERCEPT_CLGI);
 	set_intercept(svm, INTERCEPT_SKINIT);
 	set_intercept(svm, INTERCEPT_WBINVD);
-	set_intercept(svm, INTERCEPT_MONITOR);
-	set_intercept(svm, INTERCEPT_MWAIT);
 	set_intercept(svm, INTERCEPT_XSETBV);
 
 	control->iopm_base_pa = iopm_base;

Thanks.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-09 23:40 +0100
  Re: [PATCH] kvm: better MWAIT emulation for guests "Gabriel L. Somlo" <gsomlo@gmail.com> - 2017-03-10 02:00 +0100
    Re: [PATCH] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-10 02:20 +0100
      Re: [PATCH] kvm: better MWAIT emulation for guests Wanpeng Li <kernellwp@gmail.com> - 2017-03-13 08:50 +0100
  Re: [PATCH] kvm: better MWAIT emulation for guests Jim Mattson <jmattson@google.com> - 2017-03-11 00:50 +0100
    Re: [PATCH] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-12 01:10 +0100
      Re: [PATCH] kvm: better MWAIT emulation for guests "Gabriel L. Somlo" <gsomlo@gmail.com> - 2017-03-12 22:20 +0100
  Re: [PATCH] kvm: better MWAIT emulation for guests Radim Krčmář <rkrcmar@redhat.com> - 2017-03-13 16:50 +0100
    Re: [PATCH] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-13 17:10 +0100
      Re: [PATCH] kvm: better MWAIT emulation for guests Radim Krčmář <rkrcmar@redhat.com> - 2017-03-13 20:40 +0100
        Re: [PATCH] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-13 21:10 +0100
          Re: [PATCH] kvm: better MWAIT emulation for guests Radim Krčmář <rkrcmar@redhat.com> - 2017-03-13 22:50 +0100
            Re: [PATCH] kvm: better MWAIT emulation for guests "Gabriel L. Somlo" <gsomlo@gmail.com> - 2017-03-15 19:20 +0100
              Re: [PATCH] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-15 19:40 +0100
                Re: [PATCH] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-15 20:10 +0100
                Re: [PATCH] kvm: better MWAIT emulation for guests "Gabriel L. Somlo" <gsomlo@gmail.com> - 2017-03-15 20:10 +0100
                Re: [PATCH] kvm: better MWAIT emulation for guests "Gabriel L. Somlo" <gsomlo@gmail.com> - 2017-03-15 20:50 +0100
                Re: [PATCH] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-15 21:20 +0100
                Re: [PATCH] kvm: better MWAIT emulation for guests "Michael S. Tsirkin" <mst@redhat.com> - 2017-03-15 20:50 +0100

csiph-web