VirtualBox

Changeset 47991 in vbox


Ignore:
Timestamp:
Aug 22, 2013 2:31:52 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
88315
Message:

Main: Made the exclusive HW virtualization use setting global rather than per-VM.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/user_VBoxManage.xml

    r47859 r47991  
    326326Time offset:     0 ms
    327327Hardw. virt.ext: on
    328 Hardw. virt.ext exclusive: on
    329328Nested Paging:   on
    330329VT-x VPID:       off
     
    581580            (Intel VT-x or AMD-V) in the processor of your host system; see
    582581            <xref linkend="hwvirt" />.</para>
    583           </listitem>
    584 
    585           <listitem>
    586             <para><computeroutput>--hwvirtexexcl on|off</computeroutput>: This
    587             specifies whether VirtualBox will make exclusive use of the
    588             hardware virtualization extensions (Intel VT-x or AMD-V) in the
    589             processor of your host system; see <xref linkend="hwvirt" />. If
    590             you wish to simultaneously share these extensions with other
    591             hypervisors, then you must disable this setting. Doing so has
    592             negative performance implications.</para>
    593582          </listitem>
    594583
     
    24862475
    24872476        <glossentry>
     2477          <glossterm><computeroutput>hwvirtexclusive</computeroutput></glossterm>
     2478          <para>This specifies whether VirtualBox will make exclusive use of
     2479          the hardware virtualization extensions (Intel VT-x or AMD-V) of the
     2480          host system's processor; see <xref linkend="hwvirt" />. If you wish to
     2481          share these extensions with other hypervisors running at the same time,
     2482          you must disable this setting. Doing so has negative performance implications.
     2483          </para>
     2484        </glossentry>
     2485
     2486
     2487        <glossentry>
    24882488          <glossterm><computeroutput>vrdeauthlibrary</computeroutput></glossterm>
    24892489
  • trunk/include/VBox/settings.h

    r47503 r47991  
    277277    com::Utf8Str            strLoggingLevel;
    278278    uint32_t                ulLogHistoryCount;
     279    bool                    fExclusiveHwVirt;
    279280};
    280281
     
    841842
    842843    bool                fHardwareVirt,
    843                         fHardwareVirtExclusive,
    844844                        fNestedPaging,
    845845                        fLargePages,
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r47918 r47991  
    179179                     "                            [--hpet on|off]\n"
    180180                     "                            [--hwvirtex on|off]\n"
    181                      "                            [--hwvirtexexcl on|off]\n"
    182181                     "                            [--nestedpaging on|off]\n"
    183182                     "                            [--largepages on|off]\n"
     
    635634        RTStrmPrintf(pStrm,
    636635                           "%s setproperty %s     machinefolder default|<folder> |\n"
     636                     "                            hwvirtexclusive on|off |\n"
    637637                     "                            vrdeauthlibrary default|<library> |\n"
    638638                     "                            websrvauthlibrary default|null|<library> |\n"
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r47908 r47991  
    672672    SHOW_BOOLEAN_PROP_EX(machine,   RTCUseUTC,                  "rtcuseutc",            "RTC",          "UTC", "local time");
    673673    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_Enabled,   &f),   "hwvirtex",     "Hardw. virt.ext");
    674     SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_Exclusive, &f),   "hwvirtexexcl", "Hardw. virt.ext exclusive");
    675674    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &f),"nestedpaging", "Nested Paging");
    676675    SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_LargePages, &f),  "largepages",   "Large Pages");
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r47908 r47991  
    525525    ULONG ulValue;
    526526    LONG64 i64Value;
     527    BOOL fValue;
    527528
    528529    pVirtualBox->COMGETTER(APIVersion)(str.asOutParam());
     
    607608    systemProperties->COMGETTER(DefaultMachineFolder)(str.asOutParam());
    608609    RTPrintf("Default machine folder:          %ls\n", str.raw());
     610    systemProperties->COMGETTER(ExclusiveHwVirt)(&fValue);
     611    RTPrintf("Exclusive HW virtualization use: %ls\n", fValue ? L"on" : L"off");
    609612    systemProperties->COMGETTER(DefaultHardDiskFormat)(str.asOutParam());
    610613    RTPrintf("Default hard disk format:        %ls\n", str.raw());
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r47908 r47991  
    824824            CHECK_ERROR(systemProperties, COMSETTER(DefaultMachineFolder)(Bstr(a->argv[1]).raw()));
    825825    }
     826    else if (!strcmp(a->argv[0], "hwvirtexclusive"))
     827    {
     828        bool   fHwVirtExclusive;
     829
     830        if (!strcmp(a->argv[1], "on"))
     831            fHwVirtExclusive = true;
     832        else if (!strcmp(a->argv[1], "off"))
     833            fHwVirtExclusive = false;
     834        else
     835            return errorArgument("Invalid hwvirtexclusive argument '%s'", a->argv[1]);
     836        CHECK_ERROR(systemProperties, COMSETTER(ExclusiveHwVirt)(fHwVirtExclusive));
     837    }
    826838    else if (   !strcmp(a->argv[0], "vrdeauthlibrary")
    827839             || !strcmp(a->argv[0], "vrdpauthlibrary"))
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r47934 r47991  
    6262    MODIFYVM_SYNTHCPU,
    6363    MODIFYVM_HWVIRTEX,
    64     MODIFYVM_HWVIRTEXEXCLUSIVE,
    6564    MODIFYVM_NESTEDPAGING,
    6665    MODIFYVM_LARGEPAGES,
     
    224223    { "--synthcpu",                 MODIFYVM_SYNTHCPU,                  RTGETOPT_REQ_BOOL_ONOFF },
    225224    { "--hwvirtex",                 MODIFYVM_HWVIRTEX,                  RTGETOPT_REQ_BOOL_ONOFF },
    226     { "--hwvirtexexcl",             MODIFYVM_HWVIRTEXEXCLUSIVE,         RTGETOPT_REQ_BOOL_ONOFF },
    227225    { "--nestedpaging",             MODIFYVM_NESTEDPAGING,              RTGETOPT_REQ_BOOL_ONOFF },
    228226    { "--largepages",               MODIFYVM_LARGEPAGES,                RTGETOPT_REQ_BOOL_ONOFF },
     
    632630            }
    633631
    634             case MODIFYVM_HWVIRTEXEXCLUSIVE:
    635             {
    636                 CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Exclusive, ValueUnion.f));
    637                 break;
    638             }
    639 
    640632            case MODIFYVM_SETCPUID:
    641633            {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r47922 r47991  
    954954  <enum
    955955    name="HWVirtExPropertyType"
    956     uuid="39463ecd-b4b8-401f-b168-76cfa87e11f0"
     956    uuid="411ad0ea-aeeb-44cb-9d03-1624d0d025ac"
    957957    >
    958958    <desc>
     
    970970      </desc>
    971971    </const>
    972     <const name="Exclusive"             value="2">
    973       <desc>
    974         Whether hardware virtualization is used exclusively by VirtualBox. When enabled,
    975         VirtualBox assumes it can acquire full and exclusive access to the VT-x or AMD-V
    976         feature of the host. To share these with other hypervisors, you must disable this property.
    977       </desc>
    978     </const>
    979     <const name="VPID"                  value="3">
     972    <const name="VPID"                  value="2">
    980973      <desc>
    981974        Whether VT-x VPID is enabled. If this extension is not available, it will not be used.
    982975      </desc>
    983976    </const>
    984     <const name="NestedPaging"          value="4">
     977    <const name="NestedPaging"          value="3">
    985978      <desc>
    986979        Whether Nested Paging is enabled. If this extension is not available, it will not be used.
    987980      </desc>
    988981    </const>
    989     <const name="UnrestrictedExecution" value="5">
     982    <const name="UnrestrictedExecution" value="4">
    990983      <desc>
    991984        Whether VT-x unrestricted execution is enabled. If this feature is not available, it will not be used.
    992985      </desc>
    993986    </const>
    994     <const name="LargePages"            value="6">
     987    <const name="LargePages"            value="5">
    995988      <desc>
    996989        Whether large page allocation is enabled; requires nested paging and a 64-bit host.
    997990      </desc>
    998991    </const>
    999     <const name="Force"                 value="7">
     992    <const name="Force"                 value="6">
    1000993      <desc>
    1001994        Whether the VM should fail to start if hardware virtualization (VT-x/AMD-V) cannot be used. If
     
    87288721    name="ISystemProperties"
    87298722    extends="$unknown"
    8730     uuid="856be1bc-0525-46b1-a27a-fe17d9a4939f"
     8723    uuid="1254a96a-ae57-4484-946a-22d86c1f98af"
    87318724    wsmap="managed"
    87328725    >
     
    87938786        possible to include all possible devices to the boot list.
    87948787        <see><link to="IMachine::setBootOrder"/></see>
     8788      </desc>
     8789    </attribute>
     8790
     8791    <attribute name="exclusiveHwVirt" type="boolean">
     8792      <desc>
     8793        Exclusive use of hardware virtualization by VirtualBox. When enabled,
     8794        VirtualBox assumes it can obtain full and exclusive access to the VT-x
     8795        or AMD-V feature of the host. To share hardware virtualization with
     8796        other hypervisors, this property must be disabled.
    87958797      </desc>
    87968798    </attribute>
  • trunk/src/VBox/Main/include/MachineImpl.h

    r47561 r47991  
    270270        ULONG               mMonitorCount;
    271271        BOOL                mHWVirtExEnabled;
    272         BOOL                mHWVirtExExclusive;
    273272        BOOL                mHWVirtExNestedPagingEnabled;
    274273        BOOL                mHWVirtExLargePagesEnabled;
  • trunk/src/VBox/Main/include/SystemPropertiesImpl.h

    r47401 r47991  
    7070    STDMETHOD(COMGETTER(ParallelPortCount))(ULONG *count);
    7171    STDMETHOD(COMGETTER(MaxBootPosition))(ULONG *aMaxBootPosition);
     72    STDMETHOD(COMGETTER(ExclusiveHwVirt))(BOOL *aExclusiveHwVirt);
     73    STDMETHOD(COMSETTER(ExclusiveHwVirt))(BOOL aExclusiveHwVirt);
    7274    STDMETHOD(COMGETTER(LoggingLevel))(BSTR *aLoggingLevel);
    7375    STDMETHOD(COMSETTER(LoggingLevel))(IN_BSTR aLoggingLevel);
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r47841 r47991  
    988988        /* HWVirtEx exclusive mode */
    989989        BOOL fHMExclusive = true;
    990         hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Exclusive, &fHMExclusive); H();
     990        hrc = systemProperties->COMGETTER(ExclusiveHwVirt)(&fHMExclusive);                  H();
    991991        InsertConfigInteger(pHM, "Exclusive", fHMExclusive);
    992992
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r47916 r47991  
    181181    mHWVirtExUXEnabled = true;
    182182    mHWVirtExForceEnabled = false;
    183 #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS)
    184     mHWVirtExExclusive = false;
    185 #else
    186     mHWVirtExExclusive = true;
    187 #endif
    188183#if HC_ARCH_BITS == 64 || defined(RT_OS_WINDOWS) || defined(RT_OS_DARWIN)
    189184    mPAEEnabled = true;
     
    25402535            break;
    25412536
    2542         case HWVirtExPropertyType_Exclusive:
    2543             *aVal = mHWData->mHWVirtExExclusive;
    2544             break;
    2545 
    25462537        case HWVirtExPropertyType_VPID:
    25472538            *aVal = mHWData->mHWVirtExVPIDEnabled;
     
    25892580            mHWData.backup();
    25902581            mHWData->mHWVirtExEnabled = !!aVal;
    2591             break;
    2592 
    2593         case HWVirtExPropertyType_Exclusive:
    2594             setModified(IsModified_MachineData);
    2595             mHWData.backup();
    2596             mHWData->mHWVirtExExclusive = !!aVal;
    25972582            break;
    25982583
     
    91599144
    91609145        mHWData->mHWVirtExEnabled             = data.fHardwareVirt;
    9161         mHWData->mHWVirtExExclusive           = data.fHardwareVirtExclusive;
    91629146        mHWData->mHWVirtExNestedPagingEnabled = data.fNestedPaging;
    91639147        mHWData->mHWVirtExLargePagesEnabled   = data.fLargePages;
     
    1048410468        // CPU
    1048510469        data.fHardwareVirt          = !!mHWData->mHWVirtExEnabled;
    10486         data.fHardwareVirtExclusive = !!mHWData->mHWVirtExExclusive;
    1048710470        data.fNestedPaging          = !!mHWData->mHWVirtExNestedPagingEnabled;
    1048810471        data.fLargePages            = !!mHWData->mHWVirtExLargePagesEnabled;
  • trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp

    r47593 r47991  
    9898
    9999    m->ulLogHistoryCount = 3;
     100
     101
     102    /* On Windows and OS X, HW virtualization use isn't exclusive by
     103     * default so that VT-x or AMD-V can be shared with other
     104     * hypervisors without requiring user intervention.
     105     */
     106#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS)
     107    m->fExclusiveHwVirt = false;
     108#else
     109    m->fExclusiveHwVirt = true;
     110#endif
    100111
    101112    HRESULT rc = S_OK;
     
    314325}
    315326
     327
     328STDMETHODIMP SystemProperties::COMGETTER(ExclusiveHwVirt)(BOOL *aExclusiveHwVirt)
     329{
     330    CheckComArgOutPointerValid(aExclusiveHwVirt);
     331
     332    AutoCaller autoCaller(this);
     333    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     334
     335    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     336
     337    *aExclusiveHwVirt = m->fExclusiveHwVirt;
     338
     339    return S_OK;
     340}
     341
     342STDMETHODIMP SystemProperties::COMSETTER(ExclusiveHwVirt)(BOOL aExclusiveHwVirt)
     343{
     344    AutoCaller autoCaller(this);
     345    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     346
     347    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     348    m->fExclusiveHwVirt = !!aExclusiveHwVirt;
     349    alock.release();
     350
     351    // VirtualBox::saveSettings() needs vbox write lock
     352    AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
     353    HRESULT rc = mParent->saveSettings();
     354
     355    return rc;
     356}
    316357
    317358STDMETHODIMP SystemProperties::GetMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *count)
     
    11261167
    11271168    m->ulLogHistoryCount = data.ulLogHistoryCount;
     1169    m->fExclusiveHwVirt  = data.fExclusiveHwVirt;
    11281170
    11291171    rc = setAutostartDatabasePath(data.strAutostartDatabasePath);
  • trunk/src/VBox/Main/xml/Settings.cpp

    r47917 r47991  
    14401440                        pelmGlobalChild->getAttributeValue("autostartDatabasePath", systemProperties.strAutostartDatabasePath);
    14411441                        pelmGlobalChild->getAttributeValue("defaultFrontend", systemProperties.strDefaultFrontend);
     1442                        pelmGlobalChild->getAttributeValue("exclusiveHwVirt", systemProperties.fExclusiveHwVirt);
    14421443                    }
    14431444                    else if (pelmGlobalChild->nameEquals("ExtraData"))
     
    15071508}
    15081509
     1510
    15091511/**
    15101512 * Called from the IVirtualBox interface to write out VirtualBox.xml. This
     
    16541656    if (systemProperties.strDefaultFrontend.length())
    16551657        pelmSysProps->setAttribute("defaultFrontend", systemProperties.strDefaultFrontend);
     1658    pelmSysProps->setAttribute("exclusiveHwVirt", systemProperties.fExclusiveHwVirt);
    16561659
    16571660    buildUSBDeviceFilters(*pelmGlobal->createChild("USBDeviceFilters"),
     
    18401843}
    18411844
    1842 // use a define for the platform-dependent default value of
    1843 // hwvirt exclusivity, since we'll need to check that value
    1844 // in bumpSettingsVersionIfNeeded()
    1845 #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS)
    1846     #define HWVIRTEXCLUSIVEDEFAULT false
    1847 #else
    1848     #define HWVIRTEXCLUSIVEDEFAULT true
    1849 #endif
    1850 
    18511845Hardware::Hardware()
    18521846        : strVersion("1"),
    18531847          fHardwareVirt(true),
    1854           fHardwareVirtExclusive(HWVIRTEXCLUSIVEDEFAULT),
    18551848          fNestedPaging(true),
    18561849          fVPID(true),
     
    19231916                  && (uuid                      == h.uuid)
    19241917                  && (fHardwareVirt             == h.fHardwareVirt)
    1925                   && (fHardwareVirtExclusive    == h.fHardwareVirtExclusive)
    19261918                  && (fNestedPaging             == h.fNestedPaging)
    19271919                  && (fLargePages               == h.fLargePages)
     
    26532645            {
    26542646                pelmCPUChild->getAttributeValue("enabled", hw.fHardwareVirt);
    2655                 pelmCPUChild->getAttributeValue("exclusive", hw.fHardwareVirtExclusive);        // settings version 1.9
    26562647            }
    26572648            if ((pelmCPUChild = pelmHwChild->findChildElement("HardwareVirtExNestedPaging")))
     
    39253916    xml::ElementNode *pelmHwVirtEx = pelmCPU->createChild("HardwareVirtEx");
    39263917    pelmHwVirtEx->setAttribute("enabled", hw.fHardwareVirt);
    3927     if (m->sv >= SettingsVersion_v1_9)
    3928         pelmHwVirtEx->setAttribute("exclusive", hw.fHardwareVirtExclusive);
    39293918
    39303919    pelmCPU->createChild("HardwareVirtExNestedPaging")->setAttribute("enabled", hw.fNestedPaging);
     
    56765665    if (    (m->sv < SettingsVersion_v1_9)
    56775666         && (    (hardwareMachine.firmwareType >= FirmwareType_EFI)
    5678               || (hardwareMachine.fHardwareVirtExclusive != HWVIRTEXCLUSIVEDEFAULT)
    56795667              || machineUserData.fTeleporterEnabled
    56805668              || machineUserData.uTeleporterPort
Note: See TracChangeset for help on using the changeset viewer.

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