Re: cpu hotplug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2010-09-19 at 12:04 -0400, Kevin O'Connor wrote:
> On Sun, Sep 19, 2010 at 05:53:47PM +0200, Gleb Natapov wrote:
> > On Sun, Sep 19, 2010 at 05:44:00PM +0200, Conrad Wood wrote:
> > > 
> > > > > However after step 7 the guest can turn the cpu online again by issuing 
> > > > > echo 1 >/sys/devices/.../cpuX/online
> > > > There will be no /sys/devices/.../cpuX/online in guest after step 7.
> > > 
> > > Well then at least in my version there's a bug, because it still is
> > > there and never goes away. (kvm 0.12.5)
> > > And changing it to online works as well.
> > Can you provide exact steps you are using? After doing cpu_set x offline
> > cpu x should disappear from a guest. Otherwise cpu eject didn't work.
> 
> I'm confused.  The "cpu_set x offline" doesn't appear to do anything
> for me.  It does not disable the cpu, nor does it inform the guest to
> disable the cpu.


I second that - same here.


a script with my exact steps is below. Result is reproducible.


When run on my system it will output:


"Known CPUs" are defined as cpus with an entry
in /sys/devices/system/cpu on the guest
"Inserted CPUs" are defined as cpus listed by info cpus in qemu monitor
"online CPUs" are defined as cpus listed in /proc/cpuinfo on the guest

Inserted CPUs: 4, CPUs known to the guest: 4, ONLINE in guest: 4
Inserting CPU #4
Inserted CPUs: 5, CPUs known to the guest: 5, ONLINE in guest: 4
Ejecting CPU #4
Inserted CPUs: 5, CPUs known to the guest: 5, ONLINE in guest: 4
Setting all available cpus to online...
bash: line 0: echo: write error: Invalid argument
bash: line 0: echo: write error: Invalid argument
bash: line 0: echo: write error: Invalid argument
Inserted CPUs: 5, CPUs known to the guest: 5, ONLINE in guest: 5
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
after cpu_set 4 offline this should not come online again!!




---------------------------------------------------
#!/bin/bash
VM=192.168.2.35
MONITORHOST=localhost
MONITORPORT=9401

# count how many cpus are in /proc/cpuinfo on the guest
countOnline() {
 ONLINECPUS=`ssh -lroot ${VM} "grep processor /proc/cpuinfo | wc -l"`
}

# count how many cpus are in /sys/devices/...
countCPUsKnown() {
 KNOWNCPUS=`ssh -lroot ${VM} "find /sys/devices/system/cpu/ -name
'cpu?'| wc -l"`
}

# count how many cpus does kvm list
countInserted() {
 INSERTEDCPUS=`echo "info cpus" | nc  ${MONITORHOST} ${MONITORPORT} |
grep -av '(qemu)'|grep -va 'for more inform'|wc -l`
}

printInfo() {
countOnline
countCPUsKnown
countInserted
echo "Inserted CPUs: ${INSERTEDCPUS}, CPUs known to the guest:
${KNOWNCPUS}, ONLINE in guest: ${ONLINECPUS}"
}


echo "\"Known CPUs\" are defined as cpus with an entry
in /sys/devices/system/cpu on the guest"
echo "\"Inserted CPUs\" are defined as cpus listed by info cpus in qemu
monitor"
echo "\"online CPUs\" are defined as cpus listed in /proc/cpuinfo on the
guest"
echo

printInfo

echo "Inserting CPU #4"
echo "cpu_set 4 online" | nc ${MONITORHOST} ${MONITORPORT} >/dev/null

printInfo

echo "Ejecting CPU #4"
echo "cpu_set 4 offline" | nc ${MONITORHOST} ${MONITORPORT} >/dev/null

printInfo

echo "Setting all available cpus to online..."
ssh -lroot ${VM} "find /sys/devices/system/cpu/ -type f -path
'*/cpu?/online' -exec bash -c \"echo 1 >{}\" \;"


printInfo


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux