Index: /trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 31331)
+++ /trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 31332)
@@ -269,4 +269,5 @@
         kOnMediumChanged,
         kOnCPUChanged,
+        kOnCPUPriorityChanged,
         kOnVRDPServerChanged,
         kOnRemoteDisplayInfoChanged,
@@ -3809,4 +3810,47 @@
     if (SUCCEEDED(rc))
         CONSOLE_DO_CALLBACKS2(OnCPUChanged, aCPU, aRemove);
+
+    LogFlowThisFunc(("Leaving rc=%#x\n", rc));
+    return rc;
+}
+
+/**
+ * Called by IInternalSessionControl::OnCPUPriorityChange().
+ *
+ * @note Locks this object for writing.
+ */
+HRESULT Console::onCPUPriorityChange(ULONG aCpuPriority)
+{
+    LogFlowThisFunc(("\n"));
+
+    AutoCaller autoCaller(this);
+    AssertComRCReturnRC(autoCaller.rc());
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT rc = S_OK;
+
+    /* don't trigger the CPU priority change if the VM isn't running */
+    if (mpVM)
+    {
+        /* protect mpVM */
+        AutoVMCaller autoVMCaller(this);
+        if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc();
+
+        if (   mMachineState == MachineState_Running
+            || mMachineState == MachineState_Teleporting
+            || mMachineState == MachineState_LiveSnapshotting
+            )
+        {
+            /* No need to call in the EMT thread. */
+            rc = VMR3SetCpuPriority(mpVM, aCpuPriority);
+        }
+        else
+            rc = setInvalidMachineStateError();
+    }
+
+    /* notify console callbacks on success */
+    if (SUCCEEDED(rc))
+        CONSOLE_DO_CALLBACKS1(OnCPUPriorityChanged, aCpuPriority);
 
     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
Index: /trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/MachineImpl.cpp	(revision 31331)
+++ /trunk/src/VBox/Main/MachineImpl.cpp	(revision 31332)
@@ -1299,4 +1299,6 @@
 STDMETHODIMP Machine::COMSETTER(CPUPriority)(ULONG aPriority)
 {
+    HRESULT rc = S_OK;
+
     /* check priority limits */
     if (    aPriority < 1
@@ -1312,6 +1314,7 @@
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    /* Todo: must always allow changes. */
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    alock.release();
+    rc = onCPUPriorityChange(aPriority);
+    alock.acquire();
     if (FAILED(rc)) return rc;
 
@@ -1319,4 +1322,8 @@
     mHWData.backup();
     mHWData->mCpuPriority = aPriority;
+
+    /* Save settings if online - todo why is this required?? */
+    if (Global::IsOnline(mData->mMachineState))
+        saveSettings(NULL);
 
     return S_OK;
@@ -10715,4 +10722,24 @@
 }
 
+HRESULT SessionMachine::onCPUPriorityChange(ULONG aCpuPriority)
+{
+    LogFlowThisFunc(("\n"));
+
+    AutoCaller autoCaller(this);
+    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
+
+    ComPtr<IInternalSessionControl> directControl;
+    {
+        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+        directControl = mData->mSession.mDirectControl;
+    }
+
+    /* ignore notifications sent after #OnSessionEnd() is called */
+    if (!directControl)
+        return S_OK;
+
+    return directControl->OnCPUPriorityChange(aCpuPriority);
+}
+
 /**
  *  @note Locks this object for reading.
Index: /trunk/src/VBox/Main/SessionImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/SessionImpl.cpp	(revision 31331)
+++ /trunk/src/VBox/Main/SessionImpl.cpp	(revision 31332)
@@ -594,4 +594,18 @@
 
     return mConsole->onCPUChange(aCPU, aRemove);
+}
+
+STDMETHODIMP Session::OnCPUPriorityChange(ULONG aCpuPriority)
+{
+    LogFlowThisFunc(("\n"));
+
+    AutoCaller autoCaller(this);
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
+    AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
+
+    return mConsole->onCPUPriorityChange(aCpuPriority);
 }
 
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 31331)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 31332)
@@ -12395,5 +12395,5 @@
   <interface
      name="IInternalSessionControl" extends="$unknown"
-     uuid="ab161f72-e4b3-44e6-a919-2256474bda66"
+     uuid="ef059f1d-2273-4f81-9342-c152a0d2cd40"
      internal="yes"
      wsmap="suppress"
@@ -12572,4 +12572,13 @@
       <param name="add" type="boolean" dir="in">
         <desc>Flag whether the CPU was added or removed</desc>
+      </param>
+    </method>
+
+    <method name="onCPUPriorityChange">
+      <desc>
+         Notification when the CPU priority changes.
+      </desc>
+      <param name="priority" type="unsigned long" dir="in">
+         <desc>The new CPU priority value. (1-100)</desc>
       </param>
     </method>
@@ -13776,5 +13785,5 @@
   <enum
      name="VBoxEventType"
-     uuid="7d695029-32b8-4855-86d3-75de9082923b">
+     uuid="2c76667e-6981-4122-a71a-cdfd6a6eb575">
 
     <desc>
@@ -13980,6 +13989,11 @@
       </desc>
     </const>
+    <const name="OnCPUPriorityChanged" value="63">
+      <desc>
+        <see>ICPUPriorityChangedEvent</see>
+      </desc>
+    </const>
     <!-- Last event marker -->
-    <const name="Last" value="63">
+    <const name="Last" value="64">
       <desc>
         Must be last event, used for iterations and structures relying on numerical event values.
@@ -14673,4 +14687,19 @@
 
   <interface
+    name="ICPUPriorityChangedEvent" extends="IEvent"
+    uuid="657fe2fe-a75a-4cb6-8cf9-072aa41e7d75"
+    wsmap="managed" autogen="VBoxEvent" id="OnCPUPriorityChanged"
+    >
+   <desc>
+      Notification when the CPU priority changes.
+   </desc>
+     <attribute name="priority" type="unsigned long" readonly="yes">
+       <desc>
+         The new CPU priority value. (1-100)
+       </desc>
+     </attribute>
+  </interface>
+
+   <interface
      name="IVRDPServerChangedEvent" extends="IEvent"
      uuid="726038B6-6279-4A7A-8037-D041693D1915"
Index: /trunk/src/VBox/Main/include/ConsoleImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 31331)
+++ /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 31332)
@@ -182,4 +182,5 @@
     HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
     HRESULT onCPUChange(ULONG aCPU, BOOL aRemove);
+    HRESULT onCPUPriorityChange(ULONG aCpuPriority);
     HRESULT onVRDPServerChange(BOOL aRestart);
     HRESULT onUSBControllerChange();
Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 31331)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 31332)
@@ -616,4 +616,5 @@
     virtual HRESULT onStorageControllerChange() { return S_OK; }
     virtual HRESULT onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; }
+    virtual HRESULT onCPUPriorityChange(ULONG /* aCpuPriority */) { return S_OK; }
     virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; }
     virtual HRESULT onSharedFolderChange() { return S_OK; }
@@ -944,4 +945,5 @@
     HRESULT onParallelPortChange(IParallelPort *parallelPort);
     HRESULT onCPUChange(ULONG aCPU, BOOL aRemove);
+    HRESULT onCPUPriorityChange(ULONG aCpuPriority);
     HRESULT onVRDPServerChange(BOOL aRestart);
     HRESULT onUSBControllerChange();
Index: /trunk/src/VBox/Main/include/SessionImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/SessionImpl.h	(revision 31331)
+++ /trunk/src/VBox/Main/include/SessionImpl.h	(revision 31332)
@@ -90,4 +90,5 @@
     STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment, BOOL aForce);
     STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove);
+    STDMETHOD(OnCPUPriorityChange)(ULONG aCpuPriority);
     STDMETHOD(OnVRDPServerChange)(BOOL aRestart);
     STDMETHOD(OnUSBControllerChange)();
