On Sun, Sep 19, 2010 at 04:07:50PM +0200, Conrad Wood wrote:
> On Sun, 2010-09-19 at 15:50 +0200, Gleb Natapov wrote:
> > On Sun, Sep 19, 2010 at 09:46:21AM -0400, Kevin O'Connor wrote:
> > > On Sun, Sep 19, 2010 at 03:40:45PM +0200, Gleb Natapov wrote:
> > > > halted state is not the way to check for whether cpu is online or
> > > > offline. cpu may be online but executing hlt instruction so
> > > > its state will be halted, but cpu itself is online. Actually with kvm
> > > > today you are not able to check that cpu is offline if it was ever
> > > > online. Query a guest for cpu status.
> > >
> > > In that regard, "info cpus" does seem to work - as it only shows me
> > > the cpus that have ever been online. Ejecting a cpu in the guest does
> > > not remove it from "info cpus", but then, I don't think kvm does
> > > remove it from being available after an eject.
> > >
> > Exactly. That what I meant by "Actually with kvm today you are not able
> > to check that cpu is offline if it was ever online". So if cpu was never
> > online it is easy to check that it is offline (it will not be reported
> > by "info cpus"). But if it was inserted and then ejected it will still
> > be present in "info cpus", but not used by a guest OS.
> >
> > --
> > Gleb.
> >
>
> 1) Thanks for clarifying "online" vs "halted" - that makes sense and is
> probably part of what confused me. I need to get the "online/offline"
> status of cpus, not if they are halted or not. I understand this is
> currently not possible with kvm. As I have no direct control over the
> guest OS, I do however need a solution on the host. Any clues how this
> could be implemented would be much appreciated.
> This is important to me.
Lets establish some terminology to understand each other better:
Lets use CPU inserted/ejected to refer to cpu being available/not
available to a guest.
Lest use CPU online/offline to refer to cpu been used by a guest OS.
CPU hot-plug works like this:
cpu is inserted (plugged into cpu socket on MB)
guest OS is notifies through ACPI
guest OS starts to use newly added CPU (makes it online)
CPU hot-unplug works like this:
guest OS is notifies through ACPI that cpu is going to be removed
guest OS stops to use cpu (makes it offline)
cpu is ejected (removed from a socket on MB) (kvm never does that part)
So which part do you want to know about from a host?
You can't really know from a host if cpu is used by guest OS (if it is
online/offline in s guest in our terminology)
inserted/ejected is management action (it can't be initiated by a
guest), so you can keep track of it by yourself. KVM doesn't do it
for you right now. More precisely it does, but doesn't have a way to
quire it.
>
> 2) In my case, the cpus are ALWAYS reported as halted, regardless of the
> current state in the guest.
This is cosmetic but. It does not affect any operation.
> After the guest booted, The "cpu infos" displays precisely the amount of
> cpus as initially set by the -smp parameter of kvm. (as halted).
> any additional cpus added later will be displayed, also as halted -
> again regardless whether or not the guest switches or had switched them
> to online. It is reported as "halted" even whilst the guest is running a
> cpu-hogger which would stop the cpu from halting.
> I don't mind so much about this cosmetic display problem ;)
>
Rightly so since even when it works information it displays is already
outdated at the moment you see it anyway. It is useful for debugging,
thus I keep fixing it when it breaks.
--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html