Hi all,
I’m seeing a very regular, periodic spike in the latency from scheduling a DPC (in an ISR) to the DPC beginning to execute, on certain logical processors (other than where the ISR executes). The period of these latency spikes is about ~330ms and the worst-case latency appears to be around 15 ms. Average case latency is in the order of a microsecond.
The background is that a customer with a real-time application using our drivers experiences occasional data loss; as an experiment we tried distributing various DPCs to different logical processors in case some driver was occasionally hogging the logical processor where the ISR executes. At that point, we noticed these strange latency spikes. While KeSetTargetProcessorDpcEx is something that is best avoided most of the time, we don’t understand why using it should produce extremely poor worst-case DPC latency of ~15 ms, and why it should occur periodically.
All power management options in the BIOS and Windows are off; with those options on, we see that the latency spikes become essentially random and much more frequent. That’s to be expected I guess, but what I don’t expect is that latency spikes occur periodically even with all power management options turned off.
The OS is Windows 7 Ultimate. The processor is an Intel Core i7 920 and the motherboard is a Supermicro X8SAX.
We have gone to some effort to verify that our driver is not the source of the latency spikes (e.g. getting caught up on our own spinlocks). Driver verifier does not flag any incorrect behaviour. I guess being careless with IRQLs and spinlocks might be able to cause some kind of problem like this, but not with a regular periodicity and would probably be caught by verifier.
The period of the latency spikes does not change if we change the behaviour of our test program, e.g. less or more activity, different activity patterns etc.
I’m aware of LatencyMon and similar tools. LatencyMon in particular does not flag up anything. It reports DPC scheduling latencies as being in the order of 100 microseconds.
Any ideas on what might cause a ~15 ms latency spike every ~330 ms? Is it in fact normal behaviour in Windows 7 for certain cores of the CPU?
There is the possibility that these latency spikes are not actually real, and are an artifact of how we do measurements or are a spinlock bug in our driver, but I’m putting this question out here in case a third of a second seems like a familiar number to someone.
regards
Tomas