The DPC time is relevant only if you have a sustained burst of interrupts.
In this case, if Tp, the total time required in the DPC, is >= Tiar, the
inter-arrival time of elements in the DPC queue, then queue size will grow
to infinite, as will latencies. If the Tiar is larger than Tp, however,
the problem does not exist. It gets really interesting for multimodal
Tiar, or “bursty data”. In this case, we can usually establish an upper
bound on queue size, and an upper bound on total latency.
But for a device that has a very small Tiar, even if the Tp is less than
Tiar, the limiting factor is how fast the ISR can process the data. This
would be expressed as Til + Tip, the base interrupt latency time plus the
interrupt processing time. That may impact the feasibility more than Tp,
at least for bursty data (good grief! I haven’t worried about this stuff
since I passed the Operations Research qualifier back in 1971!).
Ultimately, it means that for some devices you can separate the Tp
concerns (read: DPC latency) from the Til+Tip concerns (read: latency,
interrupt-to-ISR + ISR-to-IRET time). The interrupt-to-IRET time can, in
some cases, dominate the whole problem, because this places an upper bound
on the interrupt frequency, so knowing interrupt-to-ISR time may be only
half the problem if Til+Tip+Tiret ~ Tiar, even if Til+Tip < Tiar. (Oh,
for the ability to use subscripts) and Tiar is multimodal.
However, at this remove, I doubt if I could come up with the necessary
math to demonstrate expected values given the expected multimodal
distributions. 42 years ago, I could do better than be able to identify
an integral sign correctly two times out of three (and these days, only on
clear days, with a tailwind. And like a dog chasing a car, I’m not sure
what I’d do with one after I caught it)
joe
In your posting you said “I did the test only on Linux now”.
It seems like the number Windows driver developers (and maybe Linux driver
developers too) likely care most about is the time from interrupt signal
(which I suppose in MSI-X terms means the memory write to the interrupt
controller), to when the DPC can process the interrupt. Windows ISR’s
generally don’t do much work in the ISR, all the real work happens in the
DPC. For example, a NIC driver will get the interrupt, but packets
typically are not pulled off the completion status ring until the DPC
where they can be indicated up to the transport.
If it’s about a uSec from interrupt to ISR, I could easily imagine it’s
2-4 uSec from interrupt to DPC (and a LOT of variation up to double and
triple digit uSecs due to DPCs ahead of you). It would be interesting to
see real measured numbers, maybe queuing and running a DPC is a fraction
of a uSec, but maybe not. I suppose the DPC queuing/dequeuing part is easy
to measure, but there also is the post ISR processing which I could
imagine is similar to the pre ISR processing. Knowing typical
distributions of the latency would also be interesting.
I did do a test a year or so ago while writing some driver private worker
thread code, that as I remember said I could queue and dequeue a work item
in about 0.2 uSec (around 5 million work requests/sec, on a single core,
that did not cause the thread to suspend). The test was basically queue a
work item that queued a work item, and seeing how fast the loop spins.
I also did some measurement of ETW trace events, and concluded you could
do about a million ETW events/sec (as I remember on 1 core, if you didn’t
mind using 100% of that core). These were basically back-to-back ETW event
writes, and the trace timestamps showed about a uSec between each event.
I know it used to be that if you had more than about 75K interrupts/sec
the checked OS decided your device was broken and bugchecked. I’m curious
what the value is today, on W2K12r2. I also know there is an API call to
query the DPC watchdog about percentage of the DPC time limit it left, so
you can tune things like how many requests you process in each DPC
invocation.
It would be great to have some table of a how long many operations take,
on typical processors, for those of us who like doing back of envelope
performance estimates.
Jan
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@besi.com
Sent: Tuesday, November 5, 2013 9:22 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Windows Interrupt Latency Measurements… Anybody?
Hi Peter,
>3us-4us is a *lot* longer than I expected.
this is an interesting feedback from you. It was just a short test
today… Till now I always thought of “about 4us” so I didn’t question the
result but it seems that I am wrong here. It seems that my DM647-side
timestamp calculation is part of the long time, also polling this register
was done in too long intervals.
I did the test again and directly used DM647 timer registers instead of a
higher level function to calculate a timestamp and also reduced the
polling interval. It seems that the time is shorter. I used a DM647 timer
running at about 117MHz now - so about 117increments per us. I see that
it usually takes about 80-110 increments till the register gets reset - so
a bit less than 1us. A few interrupts took longer, about 800 increments or
about 7us. Another thing is that reading the timer registers twice
directly show 28 increments. Since I read the timer before setting the ISR
and again after detecting the acknowledge the real result will be even
shorter… I did the test only on Linux now, it will be similar on
Windows. again it was just a short test and most likely the values are
again wrong 
bye,
Thomas
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer