Received: from eggs.gnu.org ([2001:4830:134:3::10]:38804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFvTf-0000Lr-3f for qemu-devel@nongnu.org; Mon, 26 Jan 2015 21:02:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFvTb-0002bY-KR for qemu-devel@nongnu.org; Mon, 26 Jan 2015 21:02:03 -0500 Received: from [59.151.112.132] (port=19575 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFvTa-0002aF-QF for qemu-devel@nongnu.org; Mon, 26 Jan 2015 21:01:59 -0500 Message-ID: <1422324042.3793.9.camel@G08FNSTD140041> From: Zhu Guihua Date: Tue, 27 Jan 2015 10:00:42 +0800 In-Reply-To: <1444566229.5202465.1422271669259.JavaMail.zimbra@oxygem.tv> References: <884906902.4955995.1422008657285.JavaMail.zimbra@oxygem.tv> <1422237708.23881.5.camel@G08FNSTD140041> <1405516216.5166135.1422242392438.JavaMail.zimbra@oxygem.tv> <1422244033.23881.14.camel@G08FNSTD140041> <1444566229.5202465.1422271669259.JavaMail.zimbra@oxygem.tv> Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 00/11] cpu: add i386 cpu hot remove support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexandre DERUMIER Cc: qemu-devel , tangchen@cn.fujitsu.com, chen fan fnst , isimatu yasuaki , Igor Mammedov , guz fnst , Anshul Makkar , afaerber On Mon, 2015-01-26 at 12:27 +0100, Alexandre DERUMIER wrote: > >>About this, I can do it successfully on my qemu.=20 > >>So can you tell us more information about your operation?=20 > simply start with >=20 > -smp 2,sockets=3D2,cores=3D2,maxcpus=3D4 -device kvm64-x86_64-cpu,apic-id= =3D2,id=3Dcpu2 >=20 > then >=20 > #device_del cpu2 >=20 > Guest return > [ 324.195024] Unregister pv shared memory for cpu 2 > [ 324.250579] smpboot: CPU 2 is now offline >=20 > but cpu is not remove in qemu. >=20 > I had also try to eject manualy from guest > echo 1 > /sys/bus/acpi/devices/LNXCPU\:02/eject >=20 > But I have this error message > ACPI: \_SB_.CP02: Eject incomplete - status 0xf >=20 > (maybe is it normal ? or maybe is it a guest bug (kernel 3.16 from debian= wheezy backports) ?) >=20 According to your description, the guest has invoked _EJ0 method, but the method was executed unsuccessfully. Thus, only hot-unplug request was invoked in qemu, but hot-unplug was not so that cpu was still in qemu. Did you test any other kernel version? I will try kernel 3.16 to investigate this problem later. Regards, Zhu >=20 > >>And I found the patchset you applied is the last version in your last=20 > >>email. I think you'd better apply the latest version.=20 >=20 > I have applied on top of git theses patches series >=20 > https://www.mail-archive.com/qemu-devel%40nongnu.org/msg272745.html > [Qemu-devel] [RESEND PATCH v1 0/5] Common unplug and unplug request cb fo= r memory and CPU hot-unplug. > https://lists.nongnu.org/archive/html/qemu-devel/2015-01/msg01552.html > [Qemu-devel] [PATCH v3 0/7] cpu: add device_add foo-x86_64-cpu support > https://www.mail-archive.com/qemu-devel@nongnu.org/msg273870.html > [Qemu-devel] [PATCH v2 00/11] cpu: add i386 cpu hot remove support >=20 > ----- Mail original ----- > De: "Zhu Guihua" > =C3=80: "aderumier" > Cc: "qemu-devel" , tangchen@cn.fujitsu.com, "guz f= nst" , "isimatu yasuaki" , "Anshul Makkar" , "chen fan fnst" = , "Igor Mammedov" , "afa= erber" > Envoy=C3=A9: Lundi 26 Janvier 2015 04:47:13 > Objet: Re: [Qemu-devel] [PATCH v2 00/11] cpu: add i386 cpu hot remove sup= port >=20 > On Mon, 2015-01-26 at 04:19 +0100, Alexandre DERUMIER wrote:=20 > > Thanks for your reply.=20 > >=20 > > 2 others things:=20 > >=20 > > 1)=20 > > on cpu unplug, I see that the cpu is correctly removed from my linux gu= est but not from qemu=20 > >=20 >=20 > About this, I can do it successfully on my qemu.=20 > So can you tell us more information about your operation?=20 >=20 > And I found the patchset you applied is the last version in your last=20 > email. I think you'd better apply the latest version.=20 >=20 > Regards,=20 > Zhu=20 >=20 > > starting with a guest with 3cpus:=20 > >=20 > > guest: #ls -lah /sys/devices/system/ |grep cpu=20 > > drwxr-xr-x 6 root root 0 Jan 25 22:16 cpu0=20 > > drwxr-xr-x 6 root root 0 Jan 25 22:16 cpu1=20 > > drwxr-xr-x 6 root root 0 Jan 25 22:16 cpu2=20 > >=20 > > hmp: # info cpus=20 > > * CPU #0: pc=3D0xffffffff81057022 (halted) thread_id=3D24972=20 > > CPU #1: pc=3D0xffffffff81057022 (halted) thread_id=3D24973=20 > > CPU #2: pc=3D0xffffffff81048bc1 (halted) thread_id=3D25102=20 > >=20 > >=20 > > then unplug cpu2=20 > > hmp : device_del cpu2=20 > >=20 > > guest:=20 > >=20 > > dmesg:=20 > > [ 176.219754] Unregister pv shared memory for cpu 2=20 > > [ 176.278881] smpboot: CPU 2 is now offline=20 > >=20 > > #ls -lah /sys/devices/system/ |grep cpu=20 > > drwxr-xr-x 6 root root 0 Jan 25 22:16 cpu0=20 > > drwxr-xr-x 6 root root 0 Jan 25 22:16 cpu1=20 > >=20 > > hmp: # info cpus=20 > > * CPU #0: pc=3D0xffffffff81057022 (halted) thread_id=3D24972=20 > > CPU #1: pc=3D0xffffffff81057022 (halted) thread_id=3D24973=20 > > CPU #2: pc=3D0xffffffff81048bc1 (halted) thread_id=3D25102=20 > >=20 > >=20 > >=20 > >=20 > > 2)when numa is used, the hotplugged cpu is always on numa node 0=20 > > (cpu_add or device_add cpu)=20 > >=20 > >=20 > > starting a guest, with 2 sockets,1 cores=20 > >=20 > > -smp 2,sockets=3D2,cores=3D1,maxcpus=3D2=20 > > -object memory-backend-ram,size=3D256M,id=3Dram-node0 -numa node,nodeid= =3D0,cpus=3D0,memdev=3Dram-node0=20 > > -object memory-backend-ram,size=3D256M,id=3Dram-node1 -numa node,nodeid= =3D1,cpus=3D1,memdev=3Dram-node1=20 > >=20 > > hmp:=20 > > # info numa=20 > > 2 nodes=20 > > node 0 cpus: 0=20 > > node 0 size: 256 MB=20 > > node 1 cpus: 1=20 > > node 1 size: 256 MB=20 > >=20 > > ok=20 > >=20 > > now=20 > >=20 > > starting with same topology, but with 1cpu at start=20 > > -smp 2,sockets=3D2,cores=3D1,maxcpus=3D2=20 > > -object memory-backend-ram,size=3D256M,id=3Dram-node0 -numa node,nodeid= =3D0,cpus=3D0,memdev=3Dram-node0=20 > > -object memory-backend-ram,size=3D256M,id=3Dram-node1 -numa node,nodeid= =3D1,cpus=3D1,memdev=3Dram-node1=20 > >=20 > > # info numa=20 > > 2 nodes=20 > > node 0 cpus: 0=20 > > node 0 size: 256 MB=20 > > node 1 cpus:=20 > > node 1 size: 256 MB=20 > >=20 > > hotpluging a cpu=20 > > # device_add kvm64-x86_64-cpu,apic-id=3D1,id=3Dcpu1=20 > >=20 > > # info numa=20 > > 2 nodes=20 > > node 0 cpus: 0 1=20 > > node 0 size: 256 MB=20 > > node 1 cpus:=20 > > node 1 size: 256 MB=20 > >=20 > > cpu1 should be on node1, not node0.=20 > >=20 > >=20 > > Regards,=20 > >=20 > > Alexandre=20 > >=20 > > ----- Mail original -----=20 > > De: "Zhu Guihua" =20 > > =C3=80: "aderumier" =20 > > Cc: "qemu-devel" , tangchen@cn.fujitsu.com, "guz= fnst" , "isimatu yasuaki" , "Anshul Makkar" , "chen fan fnst= " , "Igor Mammedov" , "a= faerber" =20 > > Envoy=C3=A9: Lundi 26 Janvier 2015 03:01:48=20 > > Objet: Re: [Qemu-devel] [PATCH v2 00/11] cpu: add i386 cpu hot remove s= upport=20 > >=20 > > On Fri, 2015-01-23 at 11:24 +0100, Alexandre DERUMIER wrote:=20 > > > Hello,=20 > > >=20 > > > I'm currently testing the new cpu unplug features,=20 > > > Works fine here with debian guests and kernel 3.14.=20 > > >=20 > >=20 > > Thanks for your test.=20 > >=20 > > > But I have notice some small potential bugs, but I'm not sure I'm doi= ng it right.=20 > > >=20 > > > 1)first, to unplug cpu, we need an id for cpu=20 > > >=20 > >=20 > > Yes, if you want to unplug cpu, you must have an id for cpu.=20 > >=20 > > > The problem is that the current qemu command line=20 > > > -smp 1,sockets=3D2,cores=3D1,maxcpus=3D2=20 > > >=20 > > > for example, will create 1 cpu on apic-id 0 without any id, so we can= 't unplug it.=20 > > >=20 > > >=20 > > > So, I have tried with=20 > > >=20 > > > -smp 1,sockets=3D2,cores=3D1,maxcpus=3D2 -device kvm64-x86_64-cpu,api= c-id=3D0,id=3Dcpu0=20 > > >=20 > > > But this give me an error:=20 > > > "-device kvm64-x86_64-cpu,apic-id=3D0,id=3Dcpu0: CPU with APIC ID 0 e= xists"=20 > > >=20 > >=20 > > APIC ID 0 was used by the cpu of '-smp 1'.=20 > > So you should use apic-id=3D1=20 > >=20 > > > (also try to set -smp 0, but it's not working).=20 > > >=20 > > >=20 > > >=20 > > > 2) second problem, if I start with=20 > > > -smp 1,sockets=3D2,cores=3D1,maxcpus=3D2=20 > > >=20 > > > then hmp:=20 > > > device_add kvm64-x86_64-cpu,apic-id=3D1,id=3Dcpu1=20 > > >=20 > > > then hmp : device_del cpu1=20 > > >=20 > > > Got an error:"=20 > > > This is the last cpu, should not be removed!"=20 > > >=20 > > >=20 > >=20 > > Oh, it's our problem, thanks for your pointing out.=20 > > I will fix it in next version.=20 > >=20 > > Regards,=20 > > Zhu=20 > >=20 > > >=20 > > > This is coming from=20 > > > [PATCH 06/12] pc: add cpu hot unplug request callback support=20 > > > + if (smp_cpus =3D=3D 1) {=20 > > > + error_setg(&local_err,=20 > > > + "This is the last cpu, should not be removed!");=20 > > > + goto out;=20 > > > + }=20 > > >=20 > > >=20 > > >=20 > > > So, the only way unplug is working for me, is to start with -smp 2 mi= nimum=20 > > > -smp 2,sockets=3D2,cores=3D1,maxcpus=3D4=20 > > >=20 > > > Then I can hotplug|unplug cpuid >=3D 2=20 > > >=20 > > >=20 > > >=20 > > > Regards,=20 > > >=20 > > > Alexandre Derumier=20 > > [...]=20