DRIVER_POWER_STATE_FAILURE (9f) on sleep and resume

Hi All,

I have written the WDF driver with pnp callbacks EvtDeviceSelfManagedIoInit amd EvtDeviceSelfManagedIoCleanup.

In EvtDeviceSelfManagedIoInit i am creating the systemthread using PsCreateSystemThread which wait for workitem semaphore (KeWaitForSingleObject).

My EvtIoDeviceControl puts request into workitem list_entry and set above workitem semaphore.

System thread process this request and again wait for workitem semaphore.

To exit above thread my EvtDeviceSelfManagedIoCleanup sets workitem semaphore without putting workitem in list_entry so that system thread can exit by checking empty list_entry.

When i install my driver thread is starting and IOCTL processing is happening.

But when i sleep and resume i got DRIVER_POWER_STATE_FAILURE BSOD every time.

Below is dump analyze:

DRIVER_POWER_STATE_FAILURE (9f)
A driver has failed to complete a power IRP within a specific time.
Arguments:
Arg1: 0000000000000003, A device object has been blocking an Irp for too long a time
Arg2: ffffe00001a74060, Physical Device Object of the stack
Arg3: fffff802c2fea840, nt!TRIAGE_9F_POWER on Win7 and higher, otherwise the Functional Device Object of the stack
Arg4: ffffcf8002786d80, The blocked IRP

Debugging Details:

DRVPOWERSTATE_SUBCODE: 3

IMAGE_NAME: storahci.sys

DEBUG_FLR_IMAGE_TIMESTAMP: 5215f8b7

MODULE_NAME: storahci

FAULTING_MODULE: fffff800006e8000 storahci

DEFAULT_BUCKET_ID: WIN8_DRIVER_FAULT

BUGCHECK_STR: 0x9F

PROCESS_NAME: System

CURRENT_IRQL: 2

ANALYSIS_VERSION: 6.3.9600.16384 (debuggers(dbg).130821-1623) amd64fre

DPC_STACK_BASE: FFFFF802C2FF1FB0

STACK_TEXT:
fffff802c2fea808 fffff802c160d156 : 000000000000009f 0000000000000003 ffffe00001a74060 fffff802c2fea840 : nt!KeBugCheckEx
fffff802c2fea810 fffff802c160d076 : ffffe0000406a480 0000000000000008 0000000000000004 fffff802c1497534 : nt!PopIrpWatchdogBugcheck+0xde
fffff802c2fea870 fffff802c145d404 : ffffe0000406a4b8 fffff802c2fea939 ffffe0000406a4f8 0000000000000002 : nt!PopIrpWatchdog+0x32
fffff802c2fea8c0 fffff802c145d918 : 0000000000000001 ffffe000028f4748 fffff802c1704180 fffff802c1708ee0 : nt!KiProcessExpiredTimerList+0x1d8
fffff802c2fea9a0 fffff802c1520698 : fffff802c1704180 000000000023ae87 0000000000004dd3 0000000000004deb : nt!KiExpireTimerTable+0x218
fffff802c2feaa40 fffff802c14955ec : ffffe00000000000 00001f8000000001 00000001374f1c01 0000000000000002 : nt!KiTimerExpiration+0x148
fffff802c2feaaf0 fffff802c15677ea : fffff802c1704180 fffff802c1704180 00000000001a3fe0 fffff802c175ca80 : nt!KiRetireDpcList+0x19c
fffff802c2feac60 0000000000000000 : fffff802c2feb000 fffff802c2fe5000 0000000000000000 0000000000000000 : nt!KiIdleLoop+0x5a

STACK_COMMAND: kb

FOLLOWUP_NAME: MachineOwner

FAILURE_BUCKET_ID: 0x9F_VRF_3_POWER_DOWN_PGPwded_IMAGE_storahci.sys

BUCKET_ID: 0x9F_VRF_3_POWER_DOWN_PGPwded_IMAGE_storahci.sys

ANALYSIS_SOURCE: KM

FAILURE_ID_HASH_STRING: km:0x9f_vrf_3_power_down_pgpwded_image_storahci.sys

FAILURE_ID_HASH: {c7546361-8a11-b671-9ca3-0252a6ab2438}

Followup: MachineOwner

Below is !irp ffffcf8002786d80:

Irp is active with 5 stacks 4 is current (= 0xffffcf8002786f28)
No Mdl: No System Buffer: Thread 00000000: Irp stack trace.
cmd flg cl Device File Completion-Context
[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000
[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000
[0, 0] 0 0 00000000 00000000 00000000-00000000

Args: 00000000 00000000 00000000 00000000

[16, 2] 0 e1 ffffe000025b6030 00000000 fffff802c177a054-ffffe0000406a480 Success Error Cancel pending
*** ERROR: Module load completed but symbols could not be loaded for PGPwded.sys
\Driver\PGPwded nt!PopSystemIrpCompletion
Args: 00051100 00000000 00000001 00000002
[0, 0] 0 0 00000000 00000000 00000000-ffffe0000406a480

Args: 00000000 00000000 00000000 00000000

Irp Extension present at 0xffffcf8002786fb8:

!devstack ffffe00001a74060:

!DevObj !DrvObj !DevExt ObjectName
ffffe000025b6030 \Driver\PGPwded ffffe000025b6180
ffffe00002522a40 \Driver\partmgr ffffe00002522b90
ffffe00002522060 \Driver\disk ffffe000025221b0 ??>

ffffe00001a74060 \Driver\storahci ffffe00001a741b0 00000036
!DevNode ffffe00001a75930 :
DeviceInst is “SCSI\Disk&Ven_Hitachi&Prod_HTS547550A9E384\4&2002c649&0&010000”
ServiceName is “??>”

NOTE: With only driver verifier running i got above BSOD.

I am not understanding what is blocking irp here.

Please let me know if anyone has information on above BSOD.

Regards,
Mallikarjun

Did you read:

https:

Peter
OSR
@OSRDrivers</https:>