Monday, June 27th 2022

Windows Defender can Significantly Impact Intel CPU Performance, We have the Fix

Kevin Glynn, aka "Uncle Webb," our associate software author behind popular utilities such as ThrottleStop and RealTemp, developed a new utility named Counter Control, which lets you monitor and log the performance counters of Intel Core processors since 2008 (Core "Nehalem"). During development for ThrottleStop, Kevin discovered a fascinating bug with Windows Defender, the built-in security software of Windows, which causes significantly higher performance impact on the processor than it should normally have. Of course a security software is bound to have some (small) performance impact during real-time protection, but this is much bigger.

The first sign that something is happening is that HWiNFO will be reporting a reduced "Effective Clock" speed when the CPU is fully loaded. A much bigger problem is that when Defender is affected by the bug, performance of your machine will be significantly reduced. For example, a Core i9-10850K running at 5.00 GHz all-core loses 1000 Cinebench points (or 6%). Such a performance loss has been reported by owners of Intel Core 8th, 9th, 10th and 11th Gen, both desktop and mobile CPUs, on both Windows 10 and Windows 11. AMD processors are not affected.

The underlying issue that costs so much performance is that Windows Defender will randomly start using all seven hardware performance counters provided by Intel Core processors, which includes three fixed function counters. Each of these counters can be programmed in one of four modes, to configure at which privilege level it counts—Disabled, OS (ring-0), User (ring>0), and All-Ring levels. Since these counters are a shared resource, it is possible that multiple programs want to access these counters at the same time.

Popular system utilities like HWiNFO, OCCT, Core Temp, and ThrottleStop, all set these counters to "mode 3" or "All-Ring Levels." Since they all set the same mode, there's no issues with multiple programs using the same counter. Windows Defender on the other hand will set these counters to "mode 2", at what looks like random intervals, for random durations of time. This can happen when a computer first boots up or it can happen at any time after that. While Windows Defender is running in the background, it can start and stop or continuously try to change these counters to mode 2 at any time. Just to clarify, the performance loss will happen even without any monitoring software running—Defender will still use excessive CPU time.

The issue is not with the Intel hardware, as setting the same timers as Windows Defender manually has no negative performance impact. Also, if these counters are manually overwritten, Defender detects that, immediately stops whatever it is doing and performance returns to normal—without any negative effect on the ability to detect viruses in real-time.
Our Counter Control software monitors and logs the "IA32_FIXED_CTR_CTRL" register of Intel Core processors, located at MSR 0x38D. This register provides access to the three fixed-function performance monitoring counters mentioned before. Counter Control will inform users if any software is using the Intel fixed-function counters, and for how long they've been in use. Typical values reported by Counter Control look like this:
  • Not Used - 0x000: The three fixed function counters are stopped. None of the counters are presently being used.
  • Defender - 0x222: All three fixed function counters are programmed to mode 2. This is the value that Windows Defender sets these counters to when it is using them.
  • Normal - 0x330: Two counters are programmed to mode 3. One counter is programmed to mode 0 and is not being used. This is normal. Most monitoring programs that use these counters will program the counter control register to this value.
  • Warning - 0x332: This is shown when two counters are being used normally by monitoring software while the third counter has been set to mode 2, likely by Windows Defender. This is a warning that two different programs might be fighting over control of the shared counters. You might see the counter control register constantly changing between 0x222 and 0x332. This is what you will see when running HWiNFO if Windows Defender is trying to use the IA32_FIXED function counters at the same time.
If your system seems affected, showing the "Defender" readout, then a quick fix is to click the "Reset Counters" button in Counter Control. By pressing the button, one timer will be reprogrammed to mode 3, which will be detected by Defender, and Defender will stop doing its thing and restore performance. Please verify with benchmarks.
There are two ways to go about mitigating this performance loss permanently. You could disable Windows Defender Real-time Monitoring, which is highly not recommended due to the security implications; or you could use the latest version 9.5 of ThrottleStop, which has a feature in the "Options" window, called "Windows Defender Boost." Ticking this ensures maximum performance and accurate Core Effective Clock monitoring in all applications whether Windows Defender real-time protection is enabled or not. To achieve that goal, ThrottleStop activates one of the programmable timers immediately. When Windows Defender detects that some user software is trying to use one of the programmable counters, it stops using all the counters and leaves them alone for as long as that counter stays enabled. This returns performance back to normal. The "Reset" button in Counter Control does the same, and gives people a way to activate only this mechanism, without having to start ThrottleStop. Just to clarify, Windows Defender will continue to work fine. It can still detect and notify users of any viruses. When started once, with the "Windows Defender Boost" option, ThrottleStop will let the timer running in mode 3, even when closed. This means you can start ThrottleStop once at bootup, close it right afterward, and your system will be protected from the Defender performance issues.

If "Windows Defender Boost" is not checked, the counter will be initially cleared. This stops the Window Defender algorithm but ThrottleStop will no longer try to keep one counter running while using ThrottleStop and it will not keep that one counter running after you exit ThrottleStop. This allows a person to use ThrottleStop without having to worry that ThrottleStop might be doing something to Windows Defender that it should not be doing. After ThrottleStop starts up, if that timer is not being used, after 10 minutes or so, Windows Defender will check that timer, see that it is not being used, and will be able to start its mysterious performance-eating algorithm again.

Let us know your experience in the comments of this article. It'll be interesting to see how widespread this issue is, we have confirmed (thread at TPU, thread at OCN) it to be happening on many systems in recent months. If we make enough noise, I'm sure Microsoft will look into why they need that many timers in Defender, why there's such a big performance hit, and fix it accordingly.

As always, let us know your thoughts and questions in the comments. Also let us know if you didn't understand certain technical details, so we can improve this writeup.

Counter Control is available as free download in our downloads section.
Add your own comment

257 Comments on Windows Defender can Significantly Impact Intel CPU Performance, We have the Fix

#251
ThrashZone
Hi,
Yeah I disable the effective clock monitoring
Also in hwinfo settings/ safety uncheck periodic poling as well.
Posted on Reply
#252
Ed_1
unclewebbThe actual clocks are consistent. The problem is that Windows Defender and HWiNFO are constantly fighting over control of the monitoring timers. HWiNFO sets the timers to mode 3 so it can accurately determine the effective clocks. Windows Defender comes along and changes the timers back to mode 2. This happens over and over again. Kind of like two people trying to share a single stop watch. This is what prevents HWiNFO from accurately measuring the effective clock speed. The clock speed has not changed. Just the ability to correctly monitor the effective clock speed has changed.

Monitoring software should be able to request exclusive access to these system timers. That would help prevent any fights like this over their use. The shared timer model that Intel uses is flawed.
Yeah, I saw the fighting happening while running HWinfo64, so the effective clock is just a reporting issue caused by defender counters.
Posted on Reply
#253
sodium
Just updating as of the date of this post the defender bug is still a problem so I guess it's never going to get fixed. optimized defaults in bios, 12700k and 4800 JEDEC DDR5. Fully updated windows 11 home 23H2, OS build 22631.3296. Latest bios/ME firmware on MSI Z690. The motherboard doesn't matter with this bug since the same CPU in an ASROCK motherboard had the same problem.

Cinebench R23.200
21382 - the bug is active, effective clock speeds in hwinfo are all throttling slightly lower than normal.
22620 - bug is fixed by simply opening and then closing Throttlestop. Effective clock speeds are now reaching advertised default boost.
Posted on Reply
#254
unclewebb
ThrottleStop & RealTemp Author
sodiumbug is fixed by simply opening and then closing ThrottleStop.
If Windows Defender Boost is checked in the ThrottleStop 9.6 Options window, you should continue to get maximum performance whether ThrottleStop is running or not. If you do a sleep resume cycle, you will need to start ThrottleStop again.

I prefer to just leave ThrottleStop running in the background with it minimized to the system tray. Being able to see the CPU temperature in the system tray helps me keep an eye on things. That makes it easier to see when some background process has gone rogue. ThrottleStop is very efficient. If you want to absolutely minimize CPU usage, press the Stop Data button. CPU usage will be close to zero with reduced data monitoring.
Posted on Reply
#255
MuAlH
This option was added back in 2022, can someone tell us if its still useful in 2024? I am using windows 11 24h2
Posted on Reply
#257
MuAlH
AusWolfNo problem. I hope something can be done to bring this to Microsoft's attention and fix this.


It starts as soon as you boot up the system. I think Intel would be under more suspicion if AMD CPUs were slowed down. Who would want to cripple Intel? Microsoft? Nah, they're best buddies for life.


How is it caused by Intel?
Yeah I checked after I posted the comment, sorry.

Anyways, it looks like it is still an issue even on 24H2, but for me there is no performance impact but the core c status is impacted slightly, I will keep it enabled.
Posted on Reply
Add your own comment
Dec 23rd, 2024 06:44 EST change timezone

New Forum Posts

Popular Reviews

Controversial News Posts