Driver StartType = 0 vs SQL Server 2005 start time

I have a question concerning the order of operations with my device
driver. I have a custom storage driver which is supposed to start
during OS boot time. My goal is to have SQL Server use my custom
storage device for the tempdb file.

From my driver INI file:

[MyInstall.NT.Services]
Addservice = mydrive, 0x00000002, MyAddService, MyAddEventLog

[MyAddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 0 ; SERVICE_BOOT_START
ErrorControl = 1 ; SERVICE_ERROR_CRITICAL
LoadOrderGroup = System Bus Extender
ServiceBinary = %12%\mydrive.sys
AddReg = MyService_AddReg

The problem I have is that it seems that SQL Server loads before my
driver is loaded and the custom storage device is ready. Here is a
same System Log:

2012-05-27T04:00:23.000000000Z - INFO - EventLog -
6.01. 7601 Service Pack 1 Multiprocessor Free 17514
2012-05-27T04:00:29.122798200Z - INFO - Service Control Manager -
SQL Server VSS Writer running
2012-05-27T04:00:29.135799000Z - INFO - Service Control Manager -
Distributed Link Tracking Client running
2012-05-27T04:00:29.153800000Z - INFO - Service Control Manager -
Windows Management Instrumentation running
2012-05-27T04:00:29.178801400Z - INFO - Service Control Manager -
IP Helper running
2012-05-27T04:00:29.271806700Z - INFO - Service Control Manager -
SQL Server Browser running
2012-05-27T04:00:29.350811300Z - INFO - Service Control Manager -
SQL Server Integration Services running
2012-05-27T04:00:29.827838500Z - INFO - Service Control Manager -
SQL Server (MSSQLSERVER) running
2012-05-27T04:00:29.997848300Z - INFO - Service Control Manager -
SQL Server Agent (MSSQLSERVER) running
2012-05-27T04:00:30.397871200Z - INFO - Service Control Manager -
SQL Server Analysis Services (MSSQLSERVER) running
2012-05-27T04:01:02.997735800Z - INFO - MyEventDriver -
My Device Driver v 1.1.1.111 Built on Jan 11 2011 11:11:11
2012-05-27T04:01:11.678232300Z - INFO - MyEventDriver -
MyDrive was successfully loaded and attached to the system.

In the above system log entries, I see that SQL Server loads before my
custom storage driver.

I have a couple of questions:

  1. Is there a way for my driver to load before SQL Server?

  2. If not, how does SQL Server behave? For example, does it load and
    then wait for storage devices to come on-line. If so, what is the
    timeout period before SQL Server decides that storage devices have had
    enough time before it fails.

Thanks,

((&->

QuasiCodo wrote:

I have a question concerning the order of operations with my device
driver. I have a custom storage driver which is supposed to start
during OS boot time. My goal is to have SQL Server use my custom
storage device for the tempdb file.

Is this a PnP driver or a legacy driver? If it is PnP, then StartType
and LoadOrderGroup are not relevant. Your driver will be loaded when
the device it drives appears.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

On 6/11/2012 2:07 PM, Tim Roberts wrote:

QuasiCodo wrote:
> I have a question concerning the order of operations with my device
> driver. I have a custom storage driver which is supposed to start
> during OS boot time. My goal is to have SQL Server use my custom
> storage device for the tempdb file.

Is this a PnP driver or a legacy driver? If it is PnP, then StartType
and LoadOrderGroup are not relevant. Your driver will be loaded when
the device it drives appears.

It is a PnP WDF driver.

Your driver will be loaded when the device it drives appears.

Interesting. The drive is able to support the Windows paging file,
which seems to imply to me that the device is loaded very early during
boot. But what you are saying is that this is not early enough to
support SQL Server 2005’s tempdb, right?

thx,

((&->

Is it a root-enumerated device or a real physical (PCIe) device?

Tim,

For a PNP driver with start type 0 (boot start) LoadBootOrder is relevant, if there are other boot drivers that depend on it. For example, the physical bus enumerators (pci.sys) need to be loaded before drivers that use them.
The downside of out-of-order loading of a PNP driver is just that a dummy root-enumerated devnode will be created for it, which only messes up WHQL/WHCK tests.

But a miniport needs to have a specific load order, to make sure it only loads after its port (storport/scsiport/NDIS) is initialized.

>But a miniport needs to have a specific load order, to make sure it only loads
after its port (storport/scsiport/NDIS) is initialized.

This may not be true, though, if the driver loader that resolves the exports will force-call the KM DLL DriverEntry before the miniport. This is the case for non-boot drivers, and must be for boot-drivers, too.

On 6/11/2012 3:25 PM, xxxxx@broadcom.com wrote:

Is it a root-enumerated device or a real physical (PCIe) device?

It is a physical PCIe device.

((&->

When does it have all the targets/LUNs ready? Is it immediately after HwStorInitialize (or the passive init routine) returns?

On 6/11/2012 4:43 PM, xxxxx@broadcom.com wrote:

When does it have all the targets/LUNs ready? Is it immediately after HwStorInitialize (or the passive init routine) returns?

The devices are on-line before leaving EvtDeviceAdd().

((&->

Maybe from your driver’s perspective, but from the OS perspective, you need to complete the start irp (evtpreparehw and power up and friends) before they are viewed as on line

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of QuasiCodo
Sent: Tuesday, June 12, 2012 11:37 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Driver StartType = 0 vs SQL Server 2005 start time

On 6/11/2012 4:43 PM, xxxxx@broadcom.com wrote:

When does it have all the targets/LUNs ready? Is it immediately after HwStorInitialize (or the passive init routine) returns?

The devices are on-line before leaving EvtDeviceAdd().

((&->


NTDEV is sponsored by OSR

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

Thanks all for your help. I was able to get our drives initialized
before SQL Server simply by going into Services and changing the SQL
Server services from “Automatic” to “Automatic (Delayed Start)”. Now
our drives come up 3 minutes before SQL Server starts.

((&->