Advertisement
cakemaker

short quantums win 24H2

Feb 17th, 2025 (edited)
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | Fixit | 0 0
  1. ## How to revert short short quantums win 24H2 settings to what it was on win11 22H2/23H2
  2.  
  3. You'll need 2 boxes.
  4. PC1 is the Target Box (you'll need to configure it via bcdedit).
  5. PC2 is the Debugger Box (you'll need to install WinDbg on it, and also note its IP).
  6.  
  7.  
  8. ### First, set things up on the Debugger Box.
  9.  
  10. 1. Download and install Windbg: https://aka.ms/windbg/download.
  11. You can extract url from the downloaded package and then extract files from the archive using 7-zip if you don't want to do "real" installation.
  12.  
  13. 2. Configure symbols. Just run this command as admin:
  14. setx /M _NT_SYMBOL_PATH C:\stuff\symbols\local;srv*c:\stuff\symbols\ms*https://msdl.microsoft.com/download/symbols
  15.  
  16. And run this as regular user:
  17. mkdir C:\stuff\symbols\ms
  18.  
  19. 3. Launch WinDbg.
  20. File / Start debugging / Attach to Kernel (Ctrl+K).
  21. Use "Net" tab. You can leave port 50000 as is. Set [encryption] key to e.g. "j.e.f.f", w/o quotes.
  22. Leave Target IP empty. Set flag "Break on connection". Press "Ok".
  23.  
  24. 4. Run ipconfig and note IP of this box.
  25.  
  26.  
  27. ### Second, configure the Target Box.
  28.  
  29. From admin cmd configure old black boot menu (for simplicity):
  30. bcdedit /set {bootloadersettings} bootmenupolicy legacy
  31. bcdedit /set {resumeloadersettings} bootmenupolicy legacy
  32. bcdedit /set {current} bootmenupolicy legacy
  33.  
  34. Now make copy of current item to enable timeout:
  35. bcdedit /copy {current} /d "backup entry"
  36. bcdedit /timeout 7
  37.  
  38. Now configure debugger:
  39. :: /debug on might not work, but you can ignore that, see below
  40. bcdedit /debug on
  41. :: enter IP of the debug box instead of 192.168.555.777
  42. bcdedit /dbgsettings net hostip:192.168.555.777 port:50000 key:j.e.f.f
  43.  
  44. :: [RARE] If you have multiple network cards on the target box and debugger doesn't connect:
  45. :: find "bus.device.function" (e.g. 0.9.0) in the devmgmt.msc under "Location Information" for the netcard you use, enter it:
  46. ::bcdedit /set {dbgsettings} busparams 0.9.0
  47.  
  48. :: [RARE] Windows might not support your target box network card for kernel debugging.
  49. :: It won't give you any warning or anything, kernel debugger just won't connect.
  50. :: To check if netcard is supported, check VerifiedNicList.xml, or see
  51. :: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/supported-ethernet-nics-for-network-kernel-debugging-in-windows-11
  52. :: Having unsupported adapter would suck; sure there are other ways to do kernel debug, but your first fallback
  53. :: would be to use separate PCI-E network adapter ($5 to $10).
  54.  
  55.  
  56. ### All done.
  57. Now just reboot the Target Box.
  58. You'll see boot menu with 7 seconds timeout. If entry has "[debug]" suffix, just press enter. Otherwise, just select debug mode manually for this boot session only: press F8, down-down-down, select "Debugging Mode".
  59.  
  60. Now Target Box should stop and you can examine its state on the Debugger Box.
  61. Move to the Debugger Box and enter commands:
  62. ba w4 nt!KiVelocityFlags "ed nt!KiVelocityFlags (dwo(nt!KiVelocityFlags) & ~40000)"
  63. g
  64.  
  65. That'll set breakpoint on writing to KiVelocityFlags var, and force debugger to clear ShortThreadQuantum bit.
  66. Debugger might stop with spurious "Break instruction exception", just press F5 to continue.
  67.  
  68. Now target should be running and once it boots you can do experiments.
  69.  
  70. You can press Ctrl+Break in debugger to stop the target at any moment.
  71. You can remove your breakpoints with "bc *" command, although that shouldn't affect things.
  72.  
  73. You can display current velocity variable or "quantum end timer increment":
  74. dd nt!KiVelocityFlags L1
  75. dd nt!KeQuantumEndTimerIncrement L1
  76.  
  77. If VelocityFlags were edited correctly, KeQuantumEndTimerIncrement shall contain value 0n156250. On vanilla 24H2 system value would be 0n17400.
  78. Anyway, that might or might not "adjust back" some performance to the way it was on win11 22H2/23H2. After all, it's just one of the many changes in that kernel.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement