The GUI and the documentation of VirtualBox warn about setting virtual CPU count higher than the physical CPU count:
You should not, however, configure virtual machines to use more CPU cores than you have available physically (real cores, no hyperthreads).
However, no more details are provided. I tried to find additional information on this topic and found contradictory recommendations:
You should never assign all your cores as vCPUs in a virtual machine.
But the comments claim it to be outdated.
There is another similar question with contradictory answers: Quad Core host with hyper-threading, how many processors to configure in VirtualBox?
The accepted answer warns of errors and even BSOD, most other answers and comments don’t see any problems. Especially interesting is the link to http://envobi.com/post/virtualbox-hyper-threading-benchmark-surprise/.
The benchmarks presented at https://unix.stackexchange.com/questions/325932/virtualbox-is-it-a-bad-idea-to-assign-more-virtual-cpu-cores-than-number-of-phy show that a multi-threaded application running in a VM can profit from the additional CPUs. It looks promising for me but I still have the following questions.
What are the risks of setting CPU count in VirtualBox up to the logical CPU count of the machine? Why does VirtualBox discourage it?
I basically aim at running a multi-threaded, CPU-limited*) application in the VM at the best possible performance while the host is idle. My computer has an Intel® Core™ i7-4770 Processor.
*) I mean it can utilize the performance of all CPUs I offer to it and is not primarily limited by RAM or I/O.