public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: "Longpeng (Mike)" <longpeng2@huawei.com>,
	kvm <kvm@vger.kernel.org>, Gonglei <arei.gonglei@huawei.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Question] About the behavior of HLT in VMX guest mode
Date: Tue, 11 Jul 2017 17:04:09 +0200	[thread overview]
Message-ID: <20170711150408.GC3326@potion> (raw)
In-Reply-To: <CANRm+Cwjjn1BAAW8yamOrpOdcGLX4dw1TGFv+wbAn=CD0W2XAw@mail.gmail.com>

2017-07-11 18:41+0800, Wanpeng Li:
> 2017-07-11 1:08 GMT+08:00 Radim Krčmář <rkrcmar@redhat.com>:
> > 2017-07-04 12:24+0800, Wanpeng Li:
> >> I observed that the hang during the boot of guest since pvspinlock
> >> depends on trapping the halt as mentioned in this patch:
> >> http://lkml.iu.edu/hypermail/linux/kernel/1202.0/03309.html,the hang
> >> disappears when I remove the KVM_FEATURE_PV_UNHALT CPUID flag in order
> >> to disable the pvspinlock in guest from kvm. So if disable the
> >> pvspinlock in the low latency scenario(idle=poll in guest) w/ vCPU and
> >> pCPU 1:1 pin can be acceptable?
> >
> > I think the hang happened because one VCPU did a halt with disabled
> > interrupts and then ignored KVM_HC_KICK_CPU from another VCPU.
> > The target VCPU does a VM exit, so handling the PV unhalt should be a
> > simple setting of GUEST_ACTIVITY_ACTIVE upon arch.pv.pv_unhalted.
> >
> > If it turns out to be complicated, then forbidding the userspace to
> > configure both is acceptable, (like you said, it currently doesn't make
> > much sense to combine them)
> 
> kvm_spinlock_init() just check KVM_FEATURE_PV_UNHALT once to determine
> whether to enable pvspinlock, however, there is no easy way to check
> per-VM halt-exiting flag in the function __do_cpuid_ent().

Right, but we do not need to eliminate the flag from __do_cpuid_ent().

The documentation could say that if you enable per-VM halt-exiting, then
you cannot set KVM_FEATURE_PV_UNHALT for VCPUs in that VM.  And KVM can
check when userspace sets the CPUID.  (And at least forbid enablement of
halt-exiting if there already are created VCPUs.)

It's nothing pretty, so I hope that supporting the combination will
work. :)

      reply	other threads:[~2017-07-11 15:04 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)
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ář [this message]

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=20170711150408.GC3326@potion \
    --to=rkrcmar@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=longpeng2@huawei.com \
    --cc=pbonzini@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