VirtualBox

source: vbox/trunk/doc/manual/en_US/user_Technical.xml@ 98081

Last change on this file since 98081 was 97032, checked in by vboxsync, 2 years ago

doc/manual: Integrate documentation update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 34.0 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright (C) 2006-2022 Oracle and/or its affiliates.
4
5 This file is part of VirtualBox base platform packages, as
6 available from https://www.virtualbox.org.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation, in version 3 of the
11 License.
12
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <https://www.gnu.org/licenses>.
20
21 SPDX-License-Identifier: GPL-3.0-only
22-->
23<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
24"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
25<!ENTITY % all.entities SYSTEM "all-entities.ent">
26%all.entities;
27]>
28<chapter id="TechnicalBackground">
29
30 <title>Technical Background</title>
31
32 <para>
33 This chapter provides additional information for readers who are
34 familiar with computer architecture and technology and wish to find
35 out more about how &product-name; works <emphasis>under the
36 hood</emphasis>. The contents of this chapter are not required
37 reading in order to use &product-name; successfully.
38 </para>
39
40 <sect1 id="vboxconfigdata">
41
42 <title>Where &product-name; Stores its Files</title>
43
44 <para>
45 In &product-name;, a virtual machine and its settings are
46 described in a virtual machine settings file in XML format. In
47 addition, most virtual machines have one or more virtual hard
48 disks. These are typically represented by disk images, such as
49 those in VDI format. The location of these files may vary,
50 depending on the host operating system. See
51 <xref linkend="vboxconfigdata-machine-folder"/>.
52 </para>
53
54 <para>
55 Global configuration data for &product-name; is maintained in
56 another location on the host. See
57 <xref linkend="vboxconfigdata-global"/>.
58 </para>
59
60 <sect2 id="vboxconfigdata-machine-folder">
61
62 <title>The Machine Folder</title>
63
64 <para>
65 By default, each virtual machine has a directory on your host
66 computer where all the files of that machine are stored: the XML
67 settings file, with a <filename>.vbox</filename> file extension,
68 and its disk images. This is called the <emphasis>machine
69 folder</emphasis>.
70 </para>
71
72 <para>
73 By default, this machine folder is located in a common folder
74 called <filename>VirtualBox VMs</filename>, which &product-name;
75 creates in the current system user's home directory. The
76 location of this home directory depends on the conventions of
77 the host operating system, as follows:
78 </para>
79
80 <itemizedlist>
81
82 <listitem>
83 <para>
84 On Windows, this is the location returned by the
85 <literal>SHGetFolderPath</literal> function of the Windows
86 system library Shell32.dll, asking for the user profile. A
87 typical location is
88 <filename>C:\Users\<replaceable>username</replaceable></filename>.
89 </para>
90 </listitem>
91
92 <listitem>
93 <para>
94 On Linux, macOS, and Oracle Solaris, this is generally
95 taken from the environment variable
96 <filename>$HOME</filename>, except for the user
97 <literal>root</literal> where it is taken from the account
98 database. This is a workaround for the frequent trouble
99 caused by users using &product-name; in combination with the
100 tool <command>sudo</command>, which by default does not
101 reset the environment variable <filename>$HOME</filename>.
102 </para>
103
104 <para>
105 A typical location on Linux and Oracle Solaris is
106 <filename>/home/<replaceable>username</replaceable></filename>
107 and on macOS is
108 <filename>/Users/<replaceable>username</replaceable></filename>.
109 </para>
110 </listitem>
111
112 </itemizedlist>
113
114 <para>
115 For simplicity, we abbreviate the location of the home directory
116 as <filename>$HOME</filename>. Using that convention, the common
117 folder for all virtual machines is <filename>$HOME/VirtualBox
118 VMs</filename>.
119 </para>
120
121 <para>
122 As an example, when you create a virtual machine called "Example
123 VM", &product-name; creates the following:
124 </para>
125
126 <itemizedlist>
127
128 <listitem>
129 <para>
130 A machine folder: <filename>$HOME/VirtualBox VMs/Example
131 VM/</filename>
132 </para>
133 </listitem>
134
135 <listitem>
136 <para>
137 In the machine folder, a settings file: <filename>Example
138 VM.vbox</filename>
139 </para>
140 </listitem>
141
142 <listitem>
143 <para>
144 In the machine folder, a virtual disk image:
145 <filename>Example VM.vdi</filename>.
146 </para>
147 </listitem>
148
149 </itemizedlist>
150
151 <para>
152 This is the default layout if you use the
153 <emphasis role="bold">Create New Virtual Machine</emphasis>
154 wizard described in <xref linkend="create-vm-wizard" />. Once you
155 start working with the VM, additional files are added. Log files
156 are in a subfolder called <filename>Logs</filename>, and if you
157 have taken snapshots, they are in a
158 <filename>Snapshots</filename> subfolder. For each VM, you can
159 change the location of its snapshots folder in the VM settings.
160 </para>
161
162 <para>
163 You can change the default machine folder by selecting
164 <emphasis role="bold">Preferences</emphasis> from the
165 <emphasis role="bold">File</emphasis> menu in the &product-name;
166 main window. Then, in the displayed window, click on the
167 <emphasis role="bold">General</emphasis> tab. Alternatively, use
168 the <command>VBoxManage setproperty machinefolder</command>
169 command. See <xref linkend="vboxmanage-setproperty" />.
170 </para>
171
172 </sect2>
173
174 <sect2 id="vboxconfigdata-global">
175
176 <title>Global Settings</title>
177
178 <para>
179 In addition to the files for the virtual machines,
180 &product-name; maintains global configuration data in the
181 following directory:
182 </para>
183
184 <itemizedlist>
185
186 <listitem>
187 <para>
188 <emphasis role="bold">Linux and Oracle Solaris:</emphasis>
189 <filename>$HOME/.config/VirtualBox</filename>.
190 </para>
191 </listitem>
192
193 <listitem>
194 <para>
195 <emphasis role="bold">Windows:</emphasis>
196 <filename>$HOME/.VirtualBox</filename>.
197 </para>
198 </listitem>
199
200 <listitem>
201 <para>
202 <emphasis role="bold">macOS:</emphasis>
203 <filename>$HOME/Library/VirtualBox</filename>.
204 </para>
205 </listitem>
206
207 </itemizedlist>
208
209 <para>
210 &product-name; creates this configuration directory
211 automatically, if necessary. You can specify an alternate
212 configuration directory by either setting the
213 <literal>VBOX_USER_HOME</literal> environment variable, or on
214 Linux or Oracle Solaris by using the standard
215 <literal>XDG_CONFIG_HOME</literal> variable. Since the global
216 <filename>VirtualBox.xml</filename> settings file points to all
217 other configuration files, this enables switching between
218 several &product-name; configurations.
219 </para>
220
221 <para>
222 In this configuration directory, &product-name; stores its
223 global settings file, an XML file called
224 <filename>VirtualBox.xml</filename>. This file includes global
225 configuration options and a list of registered virtual machines
226 with pointers to their XML settings files.
227 </para>
228
229 </sect2>
230
231 <sect2 id="vboxconfigdata-summary-locations">
232
233 <title>Summary of Configuration Data Locations</title>
234
235 <para>
236 The following table gives a brief overview of the configuration
237 data locations on an &product-name; host.
238 </para>
239
240 <table id="table-config-summary" tabstyle="oracle-all">
241 <title>Configuration File Locations</title>
242 <tgroup cols="2">
243 <thead>
244 <row>
245 <entry><para>
246 <emphasis role="bold">Setting</emphasis>
247 </para></entry>
248 <entry><para>
249 <emphasis role="bold">Location</emphasis>
250 </para></entry>
251 </row>
252 </thead>
253 <tbody>
254 <row>
255 <entry><para>
256 Default machines folder
257 </para></entry>
258 <entry><para>
259 <filename>$HOME/VirtualBox VMs</filename>
260 </para></entry>
261 </row>
262 <row>
263 <entry><para>
264 Default disk image location
265 </para></entry>
266 <entry><para>
267 In each machine's folder
268 </para></entry>
269 </row>
270 <row>
271 <entry><para>
272 Machine settings file extension
273 </para></entry>
274 <entry><para>
275 <filename>.vbox</filename>
276 </para></entry>
277 </row>
278 <row>
279 <entry><para>
280 Media registry
281 </para></entry>
282 <entry><para>
283 Each machine settings file
284 </para>
285
286
287
288 <para>
289 Media registration is done automatically when a
290 storage medium is attached to a VM
291 </para></entry>
292 </row>
293 </tbody>
294 </tgroup>
295 </table>
296
297 </sect2>
298
299 <sect2 id="vboxconfigdata-XML-files">
300
301 <title>&product-name; XML Files</title>
302
303 <para>
304 &product-name; uses XML for both the machine settings files and
305 the global configuration file,
306 <filename>VirtualBox.xml</filename>.
307 </para>
308
309 <para>
310 All &product-name; XML files are versioned. When a new settings
311 file is created, for example because a new virtual machine is
312 created, &product-name; automatically uses the settings format
313 of the current &product-name; version. These files may not be
314 readable if you downgrade to an earlier version of
315 &product-name;. However, when &product-name; encounters a
316 settings file from an earlier version, such as after upgrading
317 &product-name;, it attempts to preserve the settings format as
318 much as possible. It will only silently upgrade the settings
319 format if the current settings cannot be expressed in the old
320 format, for example because you enabled a feature that was not
321 present in an earlier version of &product-name;.
322 </para>
323
324 <para>
325 In such cases, &product-name; backs up the old settings file in
326 the virtual machine's configuration directory. If you need to go
327 back to the earlier version of &product-name;, then you will
328 need to manually copy these backup files back.
329 </para>
330
331 <para>
332 We intentionally do not document the specifications of the
333 &product-name; XML files, as we must reserve the right to modify
334 them in the future. We therefore strongly suggest that you do
335 not edit these files manually. &product-name; provides complete
336 access to its configuration data through its the
337 <command>VBoxManage</command> command line tool, see
338 <xref linkend="vboxmanage" /> and its API, see
339 <xref linkend="VirtualBoxAPI" />.
340 </para>
341
342 </sect2>
343
344 </sect1>
345
346 <sect1 id="technical-components">
347
348 <title>&product-name; Executables and Components</title>
349
350 <para>
351 &product-name; was designed to be modular and flexible. When the
352 &product-name; graphical user interface (GUI) is opened and a VM
353 is started, at least the following three processes are running:
354 </para>
355
356 <itemizedlist>
357
358 <listitem>
359 <para>
360 <command>VBoxSVC</command>, the &product-name; service process
361 which always runs in the background. This process is started
362 automatically by the first &product-name; client process and
363 exits a short time after the last client exits. The first
364 &product-name; service can be &vbox-mgr;,
365 <command>VBoxManage</command>,
366 <command>VBoxHeadless</command>, the web service amongst
367 others. The service is responsible for bookkeeping,
368 maintaining the state of all VMs, and for providing
369 communication between &product-name; components. This
370 communication is implemented using COM/XPCOM.
371 </para>
372
373 <note>
374 <para>
375 When we refer to <emphasis>clients</emphasis> here, we mean
376 the local clients of a particular <command>VBoxSVC</command>
377 server process, not clients in a network. &product-name;
378 employs its own client/server design to allow its processes
379 to cooperate, but all these processes run under the same
380 user account on the host operating system, and this is
381 totally transparent to the user.
382 </para>
383 </note>
384 </listitem>
385
386 <listitem>
387 <para>
388 The GUI process, <command>VirtualBoxVM</command>, a client
389 application based on the cross-platform Qt library. When
390 started without the <option>--startvm</option> option, this
391 application acts as &vbox-mgr;, displaying the VMs and their
392 settings. It then communicates settings and state changes to
393 <command>VBoxSVC</command> and also reflects changes effected
394 through other means, such as the <command>VBoxManage</command>
395 command.
396 </para>
397 </listitem>
398
399 <listitem>
400 <para>
401 If the <command>VirtualBoxVM</command> client application is
402 started with the <option>--startvm</option> argument, it loads
403 the VMM library which includes the actual hypervisor and then
404 runs a virtual machine and provides the input and output for
405 the guest.
406 </para>
407 </listitem>
408
409 </itemizedlist>
410
411 <para>
412 Any &product-name; front-end, or client, will communicate with the
413 service process and can both control and reflect the current
414 state. For example, either the VM selector or the VM window or
415 VBoxManage can be used to pause the running VM, and other
416 components will always reflect the changed state.
417 </para>
418
419 <para>
420 The &product-name; GUI application, called &vbox-mgr;, is only one
421 of several available front ends, or clients. The complete list
422 shipped with &product-name; is as follows:
423 </para>
424
425 <itemizedlist>
426
427 <listitem>
428 <para>
429 <command>VirtualBoxVM</command>: The Qt front end implementing
430 &vbox-mgr; and running VMs.
431 </para>
432 </listitem>
433
434 <listitem>
435 <para>
436 <command>VBoxManage</command>: A less user-friendly but more
437 powerful alternative. See <xref linkend="vboxmanage" />.
438 </para>
439 </listitem>
440
441 <listitem>
442 <para>
443 <command>VBoxHeadless</command>: A VM front end which does not
444 directly provide any video output and keyboard or mouse input,
445 but enables redirection through the VirtualBox Remote Desktop
446 Extension. See <xref linkend="vboxheadless" />.
447 </para>
448 </listitem>
449
450 <listitem>
451 <para>
452 <command>vboxwebsrv</command>: The &product-name; web service
453 process which enables control of an &product-name; host
454 remotely. This is described in detail in the &product-name;
455 Software Development Kit (SDK) reference. See
456 <xref linkend="VirtualBoxAPI" />.
457 </para>
458 </listitem>
459
460 <listitem>
461 <para>
462 The &product-name; Python shell: A Python alternative to
463 <command>VBoxManage</command>. This is also described in the
464 SDK reference.
465 </para>
466 </listitem>
467
468 </itemizedlist>
469
470 <para>
471 Internally, &product-name; consists of many more or less separate
472 components. You may encounter these when analyzing &product-name;
473 internal error messages or log files. These include the following:
474 </para>
475
476 <itemizedlist>
477
478 <listitem>
479 <para>
480 IPRT: A portable runtime library which abstracts file access,
481 threading, and string manipulation. Whenever &product-name;
482 accesses host operating features, it does so through this
483 library for cross-platform portability.
484 </para>
485 </listitem>
486
487 <listitem>
488 <para>
489 VMM (Virtual Machine Monitor): The heart of the hypervisor.
490 </para>
491 </listitem>
492
493 <listitem>
494 <para>
495 EM (Execution Manager): Controls execution of guest code.
496 </para>
497 </listitem>
498
499 <listitem>
500 <para>
501 TRPM (Trap Manager): Intercepts and processes guest traps and
502 exceptions.
503 </para>
504 </listitem>
505
506 <listitem>
507 <para>
508 HM (Hardware Acceleration Manager): Provides support for VT-x
509 and AMD-V.
510 </para>
511 </listitem>
512
513 <listitem>
514 <para>
515 GIM (Guest Interface Manager): Provides support for various
516 paravirtualization interfaces to the guest.
517 </para>
518 </listitem>
519
520 <listitem>
521 <para>
522 PDM (Pluggable Device Manager): An abstract interface between
523 the VMM and emulated devices which separates device
524 implementations from VMM internals and makes it easy to add
525 new emulated devices. Through PDM, third-party developers can
526 add new virtual devices to &product-name; without having to
527 change &product-name; itself.
528 </para>
529 </listitem>
530
531 <listitem>
532 <para>
533 PGM (Page Manager): A component that controls guest paging.
534 </para>
535 </listitem>
536
537 <listitem>
538 <para>
539 TM (Time Manager): Handles timers and all aspects of time
540 inside guests.
541 </para>
542 </listitem>
543
544 <listitem>
545 <para>
546 CFGM (Configuration Manager): Provides a tree structure which
547 holds configuration settings for the VM and all emulated
548 devices.
549 </para>
550 </listitem>
551
552 <listitem>
553 <para>
554 SSM (Saved State Manager): Saves and loads VM state.
555 </para>
556 </listitem>
557
558 <listitem>
559 <para>
560 VUSB (Virtual USB): A USB layer which separates emulated USB
561 controllers from the controllers on the host and from USB
562 devices. This component also enables remote USB.
563 </para>
564 </listitem>
565
566 <listitem>
567 <para>
568 DBGF (Debug Facility): A built-in VM debugger.
569 </para>
570 </listitem>
571
572 <listitem>
573 <para>
574 &product-name; emulates a number of devices to provide the
575 hardware environment that various guests need. Most of these
576 are standard devices found in many PC compatible machines and
577 widely supported by guest operating systems. For network and
578 storage devices in particular, there are several options for
579 the emulated devices to access the underlying hardware. These
580 devices are managed by PDM.
581 </para>
582 </listitem>
583
584 <listitem>
585 <para>
586 Guest Additions for various guest operating systems. This is
587 code that is installed from within a virtual machine. See
588 <xref linkend="guestadditions" />.
589 </para>
590 </listitem>
591
592 <listitem>
593 <para>
594 The "Main" component is special. It ties all the above bits
595 together and is the only public API that &product-name;
596 provides. All the client processes listed above use only this
597 API and never access the hypervisor components directly. As a
598 result, third-party applications that use the &product-name;
599 Main API can rely on the fact that it is always well-tested
600 and that all capabilities of &product-name; are fully exposed.
601 It is this API that is described in the &product-name; SDK.
602 See <xref linkend="VirtualBoxAPI" />.
603 </para>
604 </listitem>
605
606 </itemizedlist>
607
608 </sect1>
609
610 <sect1 id="hwvirt">
611
612 <title>Hardware Virtualization</title>
613
614 <para>
615 &product-name; enables software in the virtual machine to run
616 directly on the processor of the host, but an array of complex
617 techniques is employed to intercept operations that would
618 interfere with your host. Whenever the guest attempts to do
619 something that could be harmful to your computer and its data,
620 &product-name; steps in and takes action. In particular, for lots
621 of hardware that the guest believes to be accessing,
622 &product-name; simulates a certain <emphasis>virtual</emphasis>
623 environment according to how you have configured a virtual
624 machine. For example, when the guest attempts to access a hard
625 disk, &product-name; redirects these requests to whatever you have
626 configured to be the virtual machine's virtual hard disk. This is
627 normally an image file on your host.
628 </para>
629
630 <para>
631 Unfortunately, the x86 platform was never designed to be
632 virtualized. Detecting situations in which &product-name; needs to
633 take control over the guest code that is executing, as described
634 above, is difficult. To achieve this, &product-name; uses
635 <emphasis>hardware virtualization</emphasis>.
636 </para>
637
638 <para>
639 Intel and AMD processors have support for hardware virtualization.
640 This means that these processors can help &product-name; to
641 intercept potentially dangerous operations that a guest operating
642 system may be attempting and also makes it easier to present
643 virtual hardware to a virtual machine.
644 </para>
645
646 <para>
647 These hardware features differ between Intel and AMD processors.
648 Intel named its technology VT-x, AMD calls theirs AMD-V. The Intel
649 and AMD support for virtualization is very different in detail,
650 but not very different in principle.
651 </para>
652
653 <note>
654 <para>
655 On many systems, the hardware virtualization features first need
656 to be enabled in the BIOS before &product-name; can use them.
657 </para>
658 </note>
659
660 <para>
661 Enabling hardware virtualization is <emphasis>required</emphasis>
662 in the following scenarios:
663 </para>
664
665 <itemizedlist>
666
667 <listitem>
668 <para>
669 Certain rare guest operating systems like OS/2 make use of
670 very esoteric processor instructions. For virtual machines
671 that are configured to use such an operating system, hardware
672 virtualization is enabled automatically.
673 </para>
674 </listitem>
675
676 <listitem>
677 <para>
678 &product-name;'s 64-bit guest and multiprocessing (SMP)
679 support both require hardware virtualization to be enabled.
680 This is not much of a limitation since the vast majority of
681 64-bit and multicore CPUs ship with hardware virtualization.
682 The exceptions to this rule are some legacy Intel and AMD
683 CPUs.
684 </para>
685 </listitem>
686
687 </itemizedlist>
688
689 <warning>
690 <para>
691 Do not run other hypervisors, either open source or commercial
692 virtualization products, together with &product-name;. While
693 several hypervisors can normally be
694 <emphasis>installed</emphasis> in parallel, do not attempt to
695 <emphasis>run</emphasis> several virtual machines from competing
696 hypervisors at the same time. &product-name; cannot track what
697 another hypervisor is currently attempting to do on the same
698 host, and especially if several products attempt to use hardware
699 virtualization features such as VT-x, this can crash the entire
700 host.
701 </para>
702 </warning>
703
704 <para>
705 See <xref linkend="hwvirt-details"/> for a technical discussion of
706 hardware virtualization.
707 </para>
708
709 </sect1>
710
711 <sect1 id="hwvirt-details">
712
713 <title>Details About Hardware Virtualization</title>
714
715 <para>
716 With Intel VT-x, there are two distinct modes of CPU operation:
717 VMX root mode and non-root mode.
718 </para>
719
720 <itemizedlist>
721
722 <listitem>
723 <para>
724 In root mode, the CPU operates much like older generations of
725 processors without VT-x support. There are four privilege
726 levels, called rings, and the same instruction set is
727 supported, with the addition of several virtualization
728 specific instruction. Root mode is what a host operating
729 system without virtualization uses, and it is also used by a
730 hypervisor when virtualization is active.
731 </para>
732 </listitem>
733
734 <listitem>
735 <para>
736 In non-root mode, CPU operation is significantly different.
737 There are still four privilege rings and the same instruction
738 set, but a new structure called VMCS (Virtual Machine Control
739 Structure) now controls the CPU operation and determines how
740 certain instructions behave. Non-root mode is where guest
741 systems run.
742 </para>
743 </listitem>
744
745 </itemizedlist>
746
747 <para>
748 Switching from root mode to non-root mode is called "VM entry",
749 the switch back is "VM exit". The VMCS includes a guest and host
750 state area which is saved/restored at VM entry and exit. Most
751 importantly, the VMCS controls which guest operations will cause
752 VM exits.
753 </para>
754
755 <para>
756 The VMCS provides fairly fine-grained control over what the guests
757 can and cannot do. For example, a hypervisor can allow a guest to
758 write certain bits in shadowed control registers, but not others.
759 This enables efficient virtualization in cases where guests can be
760 allowed to write control bits without disrupting the hypervisor,
761 while preventing them from altering control bits over which the
762 hypervisor needs to retain full control. The VMCS also provides
763 control over interrupt delivery and exceptions.
764 </para>
765
766 <para>
767 Whenever an instruction or event causes a VM exit, the VMCS
768 contains information about the exit reason, often with
769 accompanying detail. For example, if a write to the CR0 register
770 causes an exit, the offending instruction is recorded, along with
771 the fact that a write access to a control register caused the
772 exit, and information about source and destination register. Thus
773 the hypervisor can efficiently handle the condition without
774 needing advanced techniques such as CSAM and PATM described above.
775 </para>
776
777 <para>
778 VT-x inherently avoids several of the problems which software
779 virtualization faces. The guest has its own completely separate
780 address space not shared with the hypervisor, which eliminates
781 potential clashes. Additionally, guest OS kernel code runs at
782 privilege ring 0 in VMX non-root mode, obviating the problems by
783 running ring 0 code at less privileged levels. For example the
784 SYSENTER instruction can transition to ring 0 without causing
785 problems. Naturally, even at ring 0 in VMX non-root mode, any I/O
786 access by guest code still causes a VM exit, allowing for device
787 emulation.
788 </para>
789
790 <para>
791 The biggest difference between VT-x and AMD-V is that AMD-V
792 provides a more complete virtualization environment. VT-x requires
793 the VMX non-root code to run with paging enabled, which precludes
794 hardware virtualization of real-mode code and non-paged
795 protected-mode software. This typically only includes firmware and
796 OS loaders, but nevertheless complicates VT-x hypervisor
797 implementation. AMD-V does not have this restriction.
798 </para>
799
800 <para>
801 Of course hardware virtualization is not perfect. Compared to
802 software virtualization, the overhead of VM exits is relatively
803 high. This causes problems for devices whose emulation requires
804 high number of traps. One example is a VGA device in 16-color
805 mode, where not only every I/O port access but also every access
806 to the framebuffer memory must be trapped.
807 </para>
808
809 </sect1>
810
811 <sect1 id="gimproviders">
812
813 <title>Paravirtualization Providers</title>
814
815 <para>
816 &product-name; enables the exposure of a paravirtualization
817 interface, to facilitate accurate and efficient execution of
818 software within a virtual machine. These interfaces require the
819 guest operating system to recognize their presence and make use of
820 them in order to leverage the benefits of communicating with the
821 &product-name; hypervisor.
822 </para>
823
824 <para>
825 Most modern, mainstream guest operating systems, including Windows
826 and Linux, ship with support for one or more paravirtualization
827 interfaces. Hence, there is typically no need to install
828 additional software in the guest to take advantage of this
829 feature.
830 </para>
831
832 <para>
833 Exposing a paravirtualization provider to the guest operating
834 system does not rely on the choice of host platforms. For example,
835 the <emphasis>Hyper-V</emphasis> paravirtualization provider can
836 be used for VMs to run on any host platform supported by
837 &product-name; and not just Windows.
838 </para>
839
840 <para>
841 &product-name; provides the following interfaces:
842 </para>
843
844 <itemizedlist>
845
846 <listitem>
847 <para>
848 <emphasis role="bold">Minimal</emphasis>: Announces the
849 presence of a virtualized environment. Additionally, reports
850 the TSC and APIC frequency to the guest operating system. This
851 provider is mandatory for running any Mac OS X guests.
852 </para>
853 </listitem>
854
855 <listitem>
856 <para>
857 <emphasis role="bold">KVM</emphasis>: Presents a Linux KVM
858 hypervisor interface which is recognized by Linux kernels
859 version 2.6.25 or later. &product-name;'s implementation
860 currently supports paravirtualized clocks and SMP spinlocks.
861 This provider is recommended for Linux guests.
862 </para>
863 </listitem>
864
865 <listitem>
866 <para>
867 <emphasis role="bold">Hyper-V</emphasis>: Presents a Microsoft
868 Hyper-V hypervisor interface which is recognized by Windows 7
869 and newer operating systems. &product-name;'s implementation
870 currently supports paravirtualized clocks, APIC frequency
871 reporting, guest debugging, guest crash reporting and relaxed
872 timer checks. This provider is recommended for Windows guests.
873 </para>
874 </listitem>
875
876 </itemizedlist>
877
878 </sect1>
879
880 <sect1 id="nestedpaging">
881
882 <title>Nested Paging and VPIDs</title>
883
884 <para>
885 In addition to normal hardware virtualization, your processor may
886 also support the following additional sophisticated techniques:
887 </para>
888
889 <itemizedlist>
890
891 <listitem>
892 <para>
893 Nested paging implements some memory management in hardware,
894 which can greatly accelerate hardware virtualization since
895 these tasks no longer need to be performed by the
896 virtualization software.
897 </para>
898
899 <para>
900 With nested paging, the hardware provides another level of
901 indirection when translating linear to physical addresses.
902 Page tables function as before, but linear addresses are now
903 translated to "guest physical" addresses first and not
904 physical addresses directly. A new set of paging registers now
905 exists under the traditional paging mechanism and translates
906 from guest physical addresses to host physical addresses,
907 which are used to access memory.
908 </para>
909
910 <para>
911 Nested paging eliminates the overhead caused by VM exits and
912 page table accesses. In essence, with nested page tables the
913 guest can handle paging without intervention from the
914 hypervisor. Nested paging thus significantly improves
915 virtualization performance.
916 </para>
917
918 <para>
919 On AMD processors, nested paging has been available starting
920 with the Barcelona (K10) architecture. They now call it rapid
921 virtualization indexing (RVI). Intel added support for nested
922 paging, which they call extended page tables (EPT), with their
923 Core i7 (Nehalem) processors.
924 </para>
925
926 <para>
927 If nested paging is enabled, the &product-name; hypervisor can
928 also use <emphasis>large pages</emphasis> to reduce TLB usage
929 and overhead. This can yield a performance improvement of up
930 to 5%. To enable this feature for a VM, you use the
931 <command>VBoxManage modifyvm --large-pages</command> command.
932 See <xref linkend="vboxmanage-modifyvm" />.
933 </para>
934
935 <para>
936 If you have an Intel CPU with EPT, please consult
937 <xref linkend="sec-rec-cve-2018-3646" /> for security concerns
938 regarding EPT.
939 </para>
940 </listitem>
941
942 <listitem>
943 <para>
944 On Intel CPUs, a hardware feature called Virtual Processor
945 Identifiers (VPIDs) can greatly accelerate context switching
946 by reducing the need for expensive flushing of the processor's
947 Translation Lookaside Buffers (TLBs).
948 </para>
949
950 <para>
951 To enable these features for a VM, you use the
952 <command>VBoxManage modifyvm --vtx-vpid</command> and
953 <command>VBoxManage modifyvm --large-pages</command> commands.
954 See <xref linkend="vboxmanage-modifyvm" />.
955 </para>
956 </listitem>
957
958 </itemizedlist>
959
960 </sect1>
961
962</chapter>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette