[vbox-dev] VBoxServiceCpuHotPlug.cpp: sysdev -> physical_node

Petar Bogdanovic petar at smokva.net
Fri Jan 24 19:05:10 GMT 2014


Hi,

[1]this commit removes the "sysdev" symlink from the cpu device-subtree
of sysfs.  The files that were found in "sysdev" are now located in
"physical_node" which is also a symlink.

VBoxServiceCpuHotPlug.cpp relies on the former symlink:

	279 /* Get the sysdev */
	280 uint32_t idCore    = RTLinuxSysFsReadIntFile(10, "%s/sysdev/topology/core_id",
	281                                              pszPathCurr);
	282 uint32_t idPackage = RTLinuxSysFsReadIntFile(10, "%s/sysdev/topology/physical_package_id",
	283                                              pszPathCurr);

and since VBoxService now can't match a cpu, it dies whenever there is an
attempt to "unplugcpu" by the host:

	# VBoxService -fvvv --disable-automount
	VBoxService 4.3.6 r91406 (verbosity: 3) linux.x86 (Dec 18 2013 16:44:16) release log
	(...)
	00:00:00.001981 main     OS Release: 3.12.6-1-ARCH
	(...)
	00:00:03.617740 cpuhotplug CpuHotPlug: Event happened idCpuCore=1 idCpuPackage=0 enmEventType=3
	00:00:03.618315 cpuhotplug Final path after probing /sys/devices/LNXSYSTM:00/device:00/ACPI0004:00/LNXCPU:00 rc=VINF_SUCCESS
	00:00:03.618347 cpuhotplug Going deeper (iLvlCurr=1)
	00:00:03.618358 cpuhotplug New path /sys/devices/LNXSYSTM:00/device:*
	00:00:03.618391 cpuhotplug Going deeper (iLvlCurr=2)
	00:00:03.618402 cpuhotplug New path /sys/devices/LNXSYSTM:00/device:00/ACPI0004:*
	00:00:03.618472 cpuhotplug Going deeper (iLvlCurr=3)
	00:00:03.618483 cpuhotplug New path /sys/devices/LNXSYSTM:00/device:00/ACPI0004:00/LNXCPU:*
	00:00:03.618609 cpuhotplug CPU doesn't match, next directory
	00:00:03.618624 cpuhotplug Directory not found, going back (iLvlCurr=2)
	00:00:03.618642 cpuhotplug Going deeper (iLvlCurr=3)
	00:00:03.618652 cpuhotplug New path /sys/devices/LNXSYSTM:00/device:00/ACPI0004:01/LNXCPU:*
	00:00:03.618693 cpuhotplug CPU doesn't match, next directory
	00:00:03.618707 cpuhotplug Directory not found, going back (iLvlCurr=2)
	00:00:03.618719 cpuhotplug Directory not found, going back (iLvlCurr=1)
	00:00:03.618731 cpuhotplug Going deeper (iLvlCurr=2)
	00:00:03.618741 cpuhotplug New path /sys/devices/LNXSYSTM:00/device:02/ACPI0004:*
	00:00:03.618772 cpuhotplug Directory not found, going back (iLvlCurr=1)
	00:00:03.618788 cpuhotplug Directory not found, going back (iLvlCurr=0)
	00:00:03.618801 cpuhotplug Directory not found, going back (iLvlCurr=4294967295)
	00:00:03.618811 cpuhotplug Directory not found, going back (iLvlCurr=4294967294)
	00:00:03.618822 cpuhotplug Directory not found, going back (iLvlCurr=4294967293)
	*** glibc detected *** VBoxService: free(): invalid pointer: 0x08056640 ***
	======= Backtrace: =========
	/lib/libc.so.6(+0x6e822)[0xb7553822]
	/lib/libc.so.6(+0x6f4c2)[0xb75544c2]
	/lib/libc.so.6(cfree+0x6d)[0xb75575ad]
	VBoxService[0x8058e0a]
	VBoxService[0x8059040]
	VBoxService[0x80591bf]
	VBoxService[0x804becc]
	VBoxService[0x8071a72]
	VBoxService[0x805adc0]
	/lib/libpthread.so.0(+0x6cf7)[0xb769bcf7]
	/lib/libc.so.6(clone+0x5e)[0xb75b786e]
	(...)

The issuer of unplugcpu gets this in return:

	$ VBoxManage controlvm pintail unplugcpu 1
	VBoxManage: error: Hot-Remove was aborted because the CPU may still be used by the guest
	VBoxManage: error: Details: code VBOX_E_VM_ERROR (0x80bb0003), component Console, interface IConsole, callee nsISupports
	VBoxManage: error: Context: "HotUnplugCPU(n)" at line 135 of file VBoxManageControlVM.cpp


Not sure how to fix this properly since the change needs to be backward
compatible and I'm not very familiar with the source yet.

		Petar Bogdanovic

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/acpi/processor_driver.c?id=ac212b6980d8d5eda705864fc5a8ecddc6d6eacc




More information about the vbox-dev mailing list