GithubHelp home page GithubHelp logo

Comments (3)

ams-tschoening avatar ams-tschoening commented on July 18, 2024 1

The question is, how sure are you, that descriptions of individual CPU cores can't be different? If it's only "often" or "most likely" you might run into the same issue like currently, where it was assumed that a loop is sufficient and no gaps in the core IDs exist. But why shouldn't the description of cores be something like "Intel blabla Core XY"?

OTOH, the current interface isn't able to show different descriptions anyway, but only uses that of core 0:

return d['cpus'][0] + ' (' + d['cpus'].length +')';

https://github.com/phpvirtualbox/phpvirtualbox/blob/develop/js/phpvirtualbox.js#L48

It's a design decision in the end. The cleanest approach would be to ask VirtualBox for all available CPU IDs, iterate those to get their description and even show all descriptions individually in the web UI. But from what I see, VirtualBox doesn't seem to provide an interface to get all CPU IDs. Have a look a t chapter 5.71 "IHost" in the following PDF:

http://download.virtualbox.org/virtualbox/SDKRef.pdf

from phpvirtualbox.

ams-tschoening avatar ams-tschoening commented on July 18, 2024

I had the same problem an it is related to how Intel assigns CPU IDs to their processor cores, with/without hyperthreading etc. Those IDs might have gaps, but phpVirtualBox expects them to be continuously incremental and simply uses a loop over the number of reported processors by the OS. For each of those generated IDs it forwards a call to get the processor description to VirtualBox and that fails, because a given CPU ID might simply not exist. The problematic code is the following:

	/*
	 * Processors
	 */
	for($i = 0; $i < $host->processorCount; $i++) {
		$response['cpus'][$i] = $host->getProcessorDescription($i);
	}

https://github.com/phpvirtualbox/phpvirtualbox/blob/develop/endpoints/lib/vboxconnector.php#L3394

phpVirtualBox is not the only one with this problem, I reported it against vboxmanage list hostinfo as well. You can find a more detailed description of the problem there as well. In short, look at the IDs of your NUMA nodes in e.g. lscpu and you will easily spot the gaps. Those depends on the number of cores, if hyperthreading is enabled etc.

The easiest fix for now is NOT to comment line 4880, this way you won't get any processor description, but instead to change the above code to e.g. always query index 0:

		$response['cpus'][$i] = $host->getProcessorDescription(0);

Don't remove the loop, as only this way all the data phpVirtualBox expects is still available.

Additionally, it would be great if one could change the title of this issue to something more strictly related to the issue, maybe mentioning that it's the processor description which is read or stuff like that.

from phpvirtualbox.

takiyon avatar takiyon commented on July 18, 2024

Solved my problem. I have changed the commented line out and added that 0 in the loop. Still why would there be a loop there anyway unless you are listing all available physical cpus. Other than than the descriptions should not change since the cpus should be the same for each socket. Why not just look for the first cpu and use that description? As stated, a query will most likely succeed.

from phpvirtualbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.