public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	kvm@vger.kernel.org, pbonzini@redhat.com,
	"Peter Krempa" <pkrempa@redhat.com>,
	"John Ferlan" <jferlan@redhat.com>,
	libvir-list@redhat.com,
	"Christian Borntraeger" <borntraeger@de.ibm.com>
Subject: Re: [RFC] kvm: x86: export vCPU halted state to sysfs
Date: Mon, 5 Feb 2018 11:36:26 -0500	[thread overview]
Message-ID: <20180205113626.6c392936@redhat.com> (raw)
In-Reply-To: <8b691f79-1ead-8528-e00f-55624056fd7e@linux.vnet.ibm.com>

On Mon, 5 Feb 2018 17:10:18 +0100
Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> wrote:

> On 05.02.2018 16:37, Luiz Capitulino wrote:
> > On Mon, 5 Feb 2018 13:47:27 +0000
> > Daniel P. Berrangé <berrange@redhat.com> wrote:
> >   
> >> On Mon, Feb 05, 2018 at 02:43:15PM +0100, Viktor Mihajlovski wrote:  
> >>> On 02.02.2018 21:41, Eduardo Habkost wrote:    
> >>>> On Fri, Feb 02, 2018 at 03:19:45PM -0500, Luiz Capitulino wrote:    
> >>>>> On Fri, 2 Feb 2018 18:09:12 -0200
> >>>>> Eduardo Habkost <ehabkost@redhat.com> wrote:    
> >>>> [...]    
> >>>>>> Your plan above covers what will happen when using newer QEMU
> >>>>>> versions, but libvirt still needs to work sanely if running QEMU
> >>>>>> 2.11.  My suggestion is that libvirt do not run query-cpus to ask
> >>>>>> for the "halted" field on any architecture except s390.    
> >>>>>
> >>>>> My current plan is to ask libvirt to completely remove query-cpus
> >>>>> usage, independent of the arch and use the new command instead.    
> >>>>
> >>>> This would be a regression for people running QEMU 2.11 on s390.
> >>>>
> >>>> (But maybe it would be an acceptable regression?  Viktor, what do
> >>>> you think?  Are there production releases of management systems
> >>>> that already rely on vcpu.<n>.halted?)
> >>>>     
> >>> Unfortunately, there's code out there looking at vcpu.<n>.halted. I've
> >>> informed the product team about the issue.
> >>>
> >>> If we drop/deprecate vcpu.<n>.halted from the domain statistics, this
> >>> should be done for all arches, if there's a replacement mechanism (i.e.
> >>> new VCPU states). As a stop-gap measure we can make the call
> >>> arch-dependent until the new stuff is in place.    
> >>
> >> Yes, I think libvirt should just restrict this 'halted' feature reporting
> >> to s390 only, since the other archs have different semantics for this
> >> item, and the s390 semantics are the ones we want.  
> > 
> > From this whole discussion, there's only one thing that I still don't
> > understand (in a very honest way): what makes s390 halted semantics
> > different?One problem is that using the halted property to indicate that the CPU  
> has assumed the architected disabled wait state may not have been the
> wisest decision (my fault). If the CPU enters disabled wait, it will
> stay inactive until it is explicitly restarted which is different on x86.

Ah, OK. So, s390 does indeed have different semantics.

> > By quickly looking at the code, it seems to be very like the x86 one
> > when in kernel irqchip is not used: if a guest vCPU executes HLT, the
> > vCPU exits to userspace and qemu will put the vCPU thread to sleep.
> > This is the semantics I'd expect for HLT, and maybe for all archs.>
> > What makes x86 different, is when the in kernel irqchip is used (which
> > should be the default with libvirt). In this case, the vCPU thread avoids
> > exiting to user-space. So, qemu doesn't know the vCPU halted.
> > 
> > That's only one of the reasons why query-cpus forces vCPUs to user-space.
> > But there are other reasons, and that's why even on s390 query-cpus
> > will also force vCPUs to user-space, which means s390 has the same perf
> > issue but maybe this hasn't been detected yet.
> > 
> > For the immediate term, I still think we should have a query-cpus
> > replacement that doesn't cause vCPUs to go to userspace. I'll work this
> > this week.  
> FWIW: I currently exploring an extension to query-cpus to report
> s390-specific information, allowing to ditch halted in the long run.
> Further, I'm considering a new QAPI event along the lines of "CPU info
> has changed" allowing QEMU to announce low-frequency changes of CPU
> state (as is the case for s390) and finally wire up a handler in libvirt
> to update a tbd. property (!= halted).

I very much prefer adding a replacement for query-cpus, which works
for all archs and which doesn't have any performance impact.

> > 
> > However, IMHO, what we really want is to add an API to the guest agent
> > to export the CPU online bit from the guest userspace sysfs. This will
> > give the ultimate semantics and move us away from this halted mess.
> >   
> 

  reply	other threads:[~2018-02-05 16:36 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 17:54 [RFC] kvm: x86: export vCPU halted state to sysfs Luiz Capitulino
2018-02-01 20:15 ` Radim Krčmář
2018-02-01 20:26   ` Eduardo Habkost
2018-02-02 13:53     ` Viktor Mihajlovski
2018-02-02 14:14       ` Luiz Capitulino
2018-02-02 14:15       ` Eduardo Habkost
2018-02-02 14:19         ` Daniel P. Berrangé
2018-02-02 14:21           ` Luiz Capitulino
2018-02-02 14:50             ` Eduardo Habkost
2018-02-02 14:55               ` [libvirt] " Luiz Capitulino
2018-02-02 15:07               ` Daniel P. Berrangé
2018-02-02 15:25                 ` Eduardo Habkost
2018-02-02 16:23                   ` [libvirt] " Eric Blake
2018-02-02 15:19               ` Eric Blake
2018-02-02 17:23               ` [Qemu-devel] " Dr. David Alan Gilbert
2018-02-02 17:38                 ` Eduardo Habkost
2018-02-02 15:08         ` Viktor Mihajlovski
2018-02-02 15:22           ` [libvirt] " Luiz Capitulino
2018-02-02 15:51             ` Viktor Mihajlovski
2018-02-02 15:54               ` Daniel P. Berrangé
2018-02-02 16:01                 ` Luiz Capitulino
2018-02-02 16:07                   ` Luiz Capitulino
2018-02-02 16:19                   ` Viktor Mihajlovski
2018-02-02 17:42                     ` [libvirt] " Eduardo Habkost
2018-02-02 18:50                       ` Luiz Capitulino
2018-02-02 20:09                         ` Eduardo Habkost
2018-02-02 20:19                           ` [libvirt] " Luiz Capitulino
2018-02-02 20:41                             ` Eduardo Habkost
2018-02-02 21:49                               ` Luiz Capitulino
2018-02-02 21:54                                 ` Luiz Capitulino
2018-02-05 13:43                               ` Viktor Mihajlovski
2018-02-05 13:47                                 ` Daniel P. Berrangé
2018-02-05 15:37                                   ` Luiz Capitulino
2018-02-05 16:10                                     ` Viktor Mihajlovski
2018-02-05 16:36                                       ` Luiz Capitulino [this message]
2018-02-05 22:50                                     ` Eduardo Habkost
2018-02-06  2:04                                       ` Luiz Capitulino
2018-02-02 15:55               ` [libvirt] " Luiz Capitulino
2018-02-06 10:29     ` Viktor Mihajlovski
2018-02-06 14:05       ` Luiz Capitulino
2018-02-02 12:47   ` Daniel P. Berrangé
2018-02-02 13:46     ` Luiz Capitulino
2018-02-02 12:49 ` Daniel P. Berrangé
2018-02-02 13:49   ` Luiz Capitulino

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=20180205113626.6c392936@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=jferlan@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=libvir-list@redhat.com \
    --cc=mihajlov@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=pkrempa@redhat.com \
    --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