Driver Problems? Questions? Issues?
Put OSR's experience to work for you! Contact us for assistance with:
  • Creating the right design for your requirements
  • Reviewing your existing driver code
  • Analyzing driver reliability/performance issues
  • Custom training mixed with consulting and focused directly on your specific areas of interest/concern.
Check us out. OSR, the Windows driver experts.

Upcoming OSR Seminars:

Writing WDF Drivers I: Core Concepts, Nashua, NH 15-19 May, 2017
Writing WDF Drivers II: Advanced Implementation Tech., Nashua, NH 23-26 May, 2017
Kernel Debugging and Crash Analysis, Dulles, VA 26-30 June, 2017
Windows Internals & Software Driver Development, Nashua, NH 24-28 July, 2017


Go Back   OSR Online Lists > ntdev
Welcome, Guest
You must login to post to this list
  Message 1 of 20  
04 Jan 17 06:43
Pavel A
xxxxxx@fastmail.fm
Join Date: 21 Jul 2008
Posts To This List: 2392
Performance estimation of Usermode drivers?

Could anybody share data on performance of UMDF driver vs. similar kernel driver? For a future project, I'm considering a usermode driver, but the customer has doubts about performance impact. The device itself is quite trivial, it is (PCI) memory-mapped array of various digital sensors, A/D converters etc. These should be polled at unknown rate by unknown number of client apps. Lots of small-size requests. We can 'do the math' on the device accesses, but have difficulty to estimate effect of thread switches, caches and other such things. Expected target machines are at least 4 cores i5-class cpu, with enough RAM. Regards, -- pa
  Message 2 of 20  
04 Jan 17 11:08
Alex Grig
xxxxxx@broadcom.com
Join Date: 14 Apr 2008
Posts To This List: 3210
Performance estimation of Usermode drivers?

I don't think an UMDF driver is allowed to access BARs.
  Message 3 of 20  
04 Jan 17 12:17
Tim Roberts
xxxxxx@probo.com
Join Date: 28 Jan 2005
Posts To This List: 11564
Performance estimation of Usermode drivers?

xxxxx@fastmail.fm wrote: > Could anybody share data on performance of UMDF driver vs. similar kernel driver? > > For a future project, I'm considering a usermode driver, but the customer has doubts about performance impact. The device itself is quite trivial, it is (PCI) memory-mapped array of various digital sensors, A/D converters etc. These should be polled at unknown rate by unknown number of client apps. Lots of small-size requests. We can 'do the math' on the device accesses, but have difficulty to estimate effect of thread switches, caches and other such things. Microsoft reps on this list have quoted a 10% penalty over an all-kernel driver. For most applications, that would be undetectable. That's especially true for sensors, because the bandwidth is usually quite low. Most sensors are queried dozens of times per second, not hundreds of thousands. That's why the sensor driver model has been user-mode from the start. -- Tim Roberts, xxxxx@probo.com Providenza & Boekelheide, Inc.
  Message 4 of 20  
04 Jan 17 12:20
Tim Roberts
xxxxxx@probo.com
Join Date: 28 Jan 2005
Posts To This List: 11564
Performance estimation of Usermode drivers?

xxxxx@broadcom.com wrote: > I don't think an UMDF driver is allowed to access BARs. Actually, they can. WdfDeviceMapIoSpace creates a user-mode mapping to BAR space: https://msdn.microsoft.com/en-us/windows/hardware/drivers/wdf/reading-and-writing -to-device-registers -- Tim Roberts, xxxxx@probo.com Providenza & Boekelheide, Inc.
  Message 5 of 20  
04 Jan 17 14:27
Peter Viscarola (OSR)
xxxxxx@osr.com
Join Date:
Posts To This List: 5916
List Moderator
Performance estimation of Usermode drivers?

<quote> Actually, they can. WdfDeviceMapIoSpace creates a user-mode mapping to BAR space: </quote> OR via a system call. The mapping is just one of two options. Peter OSR @OSRDrivers
  Message 6 of 20  
04 Jan 17 14:31
Peter Viscarola (OSR)
xxxxxx@osr.com
Join Date:
Posts To This List: 5916
List Moderator
Performance estimation of Usermode drivers?

<quote> For a future project, I'm considering a usermode driver, but the customer has doubts about performance impact. </quote> As of UMDF 2, both KMDF and UMDF are sufficiently similar that you can TRY it in user-mode and then TRY it in kernel-mode to see which you like best. For most drivers, the conversion process is just a few hours, and once you've got the code written that lets your driver work in either mode, you can switch back and forth at will. Now... let me hasten to add: I've never done this for a real "commercial" project, but I *have* done it multiple times for play time projects... and it's proved pretty easy. Peter OSR @OSRDrivers
  Message 7 of 20  
04 Jan 17 21:02
Chris Aseltine
xxxxxx@gmail.com
Join Date: 23 Sep 2006
Posts To This List: 1220
Performance estimation of Usermode drivers?

Tim Roberts wrote: > Microsoft reps on this list have quoted a 10% penalty over an > all-kernel driver. I thought what was quoted was a 10% penalty of KMDF versus WDM, not UMDF versus KMDF.
  Message 8 of 20  
04 Jan 17 22:02
Peter Viscarola (OSR)
xxxxxx@osr.com
Join Date:
Posts To This List: 5916
List Moderator
Performance estimation of Usermode drivers?

<quote> I thought what was quoted was a 10% penalty of KMDF versus WDM, not UMDF versus KMDF. </quote> I don't Know what an unnamed "Microsoft rep" might have said, but I can't agree with a 10% penalty between WDM and KMDF. The perf difference really can't be accurately measured for the general case. A lot of what's done in KMDF by the Framework is stuff that you'd need to do in your driver in WDM. Like, oh, IRP queuing for example. This makes it really difficult to compare the two, absent a specific design or implementation. The UMDF perf hit relative to KMDF will be very highly related to the number of requests processed. More small requests will suffer a bigger pentalty than fewer large requests. Once you're in the driver, I can't imagine the perf is too much different... I guess depending on how you access your data. But that's hardly news... Peter OSR @OSRDrivers
  Message 9 of 20  
05 Jan 17 13:00
Tim Roberts
xxxxxx@probo.com
Join Date: 28 Jan 2005
Posts To This List: 11564
Performance estimation of Usermode drivers?

xxxxx@osr.com wrote: > <quote> > I thought what was quoted was a 10% penalty of KMDF versus WDM, not UMDF versus > KMDF. > </quote> > > I don't Know what an unnamed "Microsoft rep" might have said, but I can't agree with a 10% penalty between WDM and KMDF. The perf difference really can't be accurately measured for the general case. I remember a plainly stated quote from a list luminary, but I can't find it now. The search terms are just too common. However, there was a discussion of this topic in 2008 which asserted that a UMDF driver using small transfers sees a 10% to 20% penalty over KMDF, but for a driver using larger transfers (64k), the difference is negligible. I agree that the KMDF to WDM difference is insignificant. -- Tim Roberts, xxxxx@probo.com Providenza & Boekelheide, Inc.
  Message 10 of 20  
06 Jan 17 10:42
Chris Aseltine
xxxxxx@gmail.com
Join Date: 23 Sep 2006
Posts To This List: 1220
Performance estimation of Usermode drivers?

Tim Roberts wrote: > I remember a plainly stated quote from a list luminary, but I can't > find it now. The search terms are just too common. > > However, there was a discussion of this topic in 2008 which asserted > that a UMDF driver using small transfers sees a 10% to 20% penalty > over KMDF, but for a driver using larger transfers (64k), the difference > is negligible. Here's the post I was referring to, look at message 4 of 7, where a "list luminary" gives a certain "figure"....which the assorted members will have to decide whether is "insignificant": http://www.osronline.com/showThread.cfm?link=99794
  Message 11 of 20  
06 Jan 17 11:25
Doron Holan
xxxxxx@microsoft.com
Join Date: 08 Sep 2005
Posts To This List: 10065
Performance estimation of Usermode drivers?

Btw we fixed the fwd progress guarantee problem for storage since that post :) Bent from my phone ________________________________ From: xxxxx@lists.osr.com <xxxxx@lists.osr.com> on behalf of xxxxx@gmail.com <xxxxx@gmail.com> Sent: Friday, January 6, 2017 7:40:14 AM To: Windows System Software Devs Interest List Subject: RE:[ntdev] Performance estimation of Usermode drivers? Tim Roberts wrote: > I remember a plainly stated quote from a list luminary, but I can't > find it now. The search terms are just too common. > > However, there was a discussion of this topic in 2008 which asserted > that a UMDF driver using small transfers sees a 10% to 20% penalty > over KMDF, but for a driver using larger transfers (64k), the difference > is negligible. Here's the post I was referring to, look at message 4 of 7, where a "list luminary" gives a certain "figure"....which the assorted members will have to decide whether is "insignificant": http://www.osronline.com/showThread.cfm?link=99794 --- NTDEV is sponsored by OSR Visit the list online at: <http://www.osronline.com/showlists.cfm?list=ntdev> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at <http://www.osr.com/seminars> To unsubscribe, visit the List Server section of OSR Online at <http://www.osronline.com/page.cfm?name=ListServer> --
  Message 12 of 20  
06 Jan 17 12:02
Peter Viscarola (OSR)
xxxxxx@osr.com
Join Date:
Posts To This List: 5916
List Moderator
Performance estimation of Usermode drivers?

Thank you Mr. Aseltine, for using your Google-fu to find the original quote you were thinking of. Much appreciated. It's a BIT more nuanced than "there a 10% perf penalty for using KMDF" -- The quote from Mr. Holan (almost TEN years ago) is the following: <quote> we have measured around a 10% CPU increase with KMDF. you can still fully saturate the bus (pci, usb, etc), but with slightly higher CPU usage... </quote> Wait for it... </quote> and if you are already doing sync of pnp/power state while processing i/o under a lock, the increase is smaller since KMDF is doing the same thing you were doing beforehand. </quote> But, it depends on your specific case... it's hard to generalize, and Mr. Holan goes on to say: <quote> in the end, you need to measure. </quote> Indeed you do. MY net takeaway from all this is "The perf difference really can't be accurately stated for the general case... but in most cases the perf delta between KMDF and WDM is insignificant. If you want to know the differences for a specific case, you'd have to measure." Others may take something else from Mr. Holan's statements. Peter OSR @OSRDrivers
  Message 13 of 20  
06 Jan 17 12:14
Chris Aseltine
xxxxxx@gmail.com
Join Date: 23 Sep 2006
Posts To This List: 1220
Performance estimation of Usermode drivers?

Peter Viscarola (OSR) wrote: > Thank you Mr. Aseltine, for using your Google-fu to find the original > quote you were thinking of. Much appreciated. FWIW, I used the OSR search tool, not Google, to find it. > The perf difference really can't be accurately stated for the general > case... but in most cases the perf delta between KMDF and WDM is > insignificant. If you want to know the differences for a specific case, > you'd have to measure. But what does that mean in practice? If you want to know how much perf you're losing in KMDF, you have to implement your driver a second time in WDM, and "measure", to really know? If that's the case, then what's the point?
  Message 14 of 20  
06 Jan 17 12:31
Peter Viscarola (OSR)
xxxxxx@osr.com
Join Date:
Posts To This List: 5916
List Moderator
Performance estimation of Usermode drivers?

<quote> FWIW, I used the OSR search tool, not Google, to find it. </quote> Webinator rocks. <quote> But what does that mean in practice? If you want to know how much perf you're losing in KMDF, you have to implement your driver a second time in WDM, and "measure", to really know? </quote> Yes. <quote> If that's the case, then what's the point? </quote> PRECISELY! Just don't worry about it, and use KMDF. Peter OSR @OSRDrivers
  Message 15 of 20  
06 Jan 17 13:03
Peter Wieland
xxxxxx@microsoft.com
Join Date: 16 Jul 2009
Posts To This List: 303
Performance estimation of Usermode drivers?

I think it means implement your driver in KMDF, and then measure it and see= if the performance meets your needs.=20 If not you can look at falling back to WDM for the paths you need to optimi= ze. -p Q: Which is faster, a Porsche 911 or a Toyota Sienna? A: Does it matter if you have to drive 6 people someplace? -----Original Message----- From: xxxxx@lists.osr.com [mailto:bounce-623061-43642@lists.o= sr.com] On Behalf Of xxxxx@gmail.com Sent: Friday, January 6, 2017 9:13 AM To: Windows System Software Devs Interest List <xxxxx@lists.osr.com> Subject: RE:[ntdev] Performance estimation of Usermode drivers? Peter Viscarola (OSR) wrote: > Thank you Mr. Aseltine, for using your Google-fu to find the original=20 > quote you were thinking of. Much appreciated. FWIW, I used the OSR search tool, not Google, to find it. > The perf difference really can't be accurately stated for the general=20 > case... but in most cases the perf delta between KMDF and WDM is=20 > insignificant. If you want to know the differences for a specific=20 > case, you'd have to measure. But what does that mean in practice? If you want to know how much perf you= 're losing in KMDF, you have to implement your driver a second time in WDM,= and "measure", to really know? If that's the case, then what's the point?= =20 --- NTDEV is sponsored by OSR Visit the list online at: <http://www.osronline.com/showlists.cfm?list=3Dnt= dev> MONTHLY seminars on crash dump analysis, WDF, Windows internals and softwar= e drivers! Details at <http://www.osr.com/seminars> To unsubscribe, visit the List Server section of OSR Online at <http://www.= osronline.com/page.cfm?name=3DListServer>
  Message 16 of 20  
06 Jan 17 16:33
Peter Viscarola (OSR)
xxxxxx@osr.com
Join Date:
Posts To This List: 5916
List Moderator
Performance estimation of Usermode drivers?

<quote> I think it means implement your driver in KMDF, and then measure it and see if the performance meets your needs. If not you can look at falling back to WDM for the paths you need to optimize. </quote> I was going to differ, but after I wrote my reply I decided we were actually in violent agreement ;-) If you don't get the perf you need, it's not like you're going to start again and re-conceptualize your driver in WDM. That's neither going to wise, nor productive, nor even necessary. Rather, if you don't get the perf you need, you look at streamlining your KMDF design... which MAY include various types of optimizations and restructuring that include falling back to WDM (within the KMDF overall structure) for some specific handling. Classic case: You write your driver to have a parallel Queue that receives all/most of your Requests, and then -- based on the type of Request or something -- forwards those Requests to other specific Queues. This is a nice design. I've used it myself. You aren't getting the throughput you need, or your Request to Request latency is too large. OK, maybe you change things around a bit and do the dispatching yourself using an EvtDeviceWdmIrpDispatch Event Processing Callback, thereby delivering IRPs/Requests directly to the proper Queue in the first place. Peter OSR @OSRDrivers
  Message 17 of 20  
09 Jan 17 09:12
Pavel A
xxxxxx@fastmail.fm
Join Date: 21 Jul 2008
Posts To This List: 2392
Performance estimation of Usermode drivers?

Thanks to everyone who answered. So, the bottom line is the perf impact is not _expected_ to be large - but to verify it, the customer is going to get two drivers - a KMDF one and UMDF one :) But the main reason for me to consider UMDF is robustness against crashes. The customer may want later to do complicated processing in the driver (filtering, triggers ...) using floating point math, maybe even a small "scripting language" like JS. This can decrease chattiness between apps and the driver and compensate performance loss. Has anyone tried this in UMDF driver? Thanks, - Pavel
  Message 18 of 20  
09 Jan 17 09:36
Pavel A
xxxxxx@fastmail.fm
Join Date: 21 Jul 2008
Posts To This List: 2392
Performance estimation of Usermode drivers?

Peter Viscarola wrote: > If you don't get the perf you need, it's not like you're going to start again > and re-conceptualize your driver in WDM. That's neither going to wise, nor > productive, nor even necessary. > Rather, if you don't get the perf you need, you look at streamlining your KMDF > design... which MAY include various types of optimizations and restructuring In this case unfortunately I don't know upfront enough on the app behavior to plan such optimization. All I have now is the requirement to serve lots of small requests... Thanks again, -- pa
  Message 19 of 20  
09 Jan 17 10:09
Doron Holan
xxxxxx@microsoft.com
Join Date: 08 Sep 2005
Posts To This List: 10065
Performance estimation of Usermode drivers?

If invoking the scripting language is through a dll import and the closure of all of its dependencies are imports, it should work. When you start getting into com activation for interfaces, it is unclear. Bent from my phone ________________________________ From: xxxxx@lists.osr.com <xxxxx@lists.osr.com> on behalf of xxxxx@fastmail.fm <xxxxx@fastmail.fm> Sent: Monday, January 9, 2017 6:10:56 AM To: Windows System Software Devs Interest List Subject: RE:[ntdev] Performance estimation of Usermode drivers? Thanks to everyone who answered. So, the bottom line is the perf impact is not _expected_ to be large - but to verify it, the customer is going to get two drivers - a KMDF one and UMDF one :) But the main reason for me to consider UMDF is robustness against crashes. The customer may want later to do complicated processing in the driver (filtering, triggers ...) using floating point math, maybe even a small "scripting language" like JS. This can decrease chattiness between apps and the driver and compensate performance loss. Has anyone tried this in UMDF driver? Thanks, - Pavel --- NTDEV is sponsored by OSR Visit the list online at: <http://www.osronline.com/showlists.cfm?list=ntdev> MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at <http://www.osr.com/seminars> To unsubscribe, visit the List Server section of OSR Online at <http://www.osronline.com/page.cfm?name=ListServer> --
  Message 20 of 20  
12 Jan 17 12:55
Pavel A
xxxxxx@fastmail.fm
Join Date: 21 Jul 2008
Posts To This List: 2392
Performance estimation of Usermode drivers?

Doron wrote > If invoking the scripting language is through a dll import and the closure of all of its dependencies are imports, it should work. Great. All I need is to load DLLs, no COM involved. Thank you. -- pa
Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You must login to OSR Online AND be a member of the ntdev list to be able to post.

All times are GMT -5. The time now is 09:51.


Copyright ©2015, OSR Open Systems Resources, Inc.
Based on vBulletin Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Modified under license