Work Item Problem.

Hi ,

in a dpc routine (read callback from a serial device), i need to do some job
at lower irq , so i make a work item .
everything runs fine when loading my driver .
then on windows startup , after rebooting the computer , if i let computer
load till the end , then use my serial device , i got no problem .
but if use my device while windows is still loading the system hangs ( the
driver is still working as i still got output in my windbg session ) and the
work item callback isnt called by the system , and after 5 minutes ( always
5 mins ) the system resumes after the work item callback is finally called .

anyone would have any idea why i got such a behavior ?

work item init :

PSOME_EXTENSION bpx = (PSOME_EXTENSION) ExAllocatePool(PagedPool,
sizeof(SOME_EXTENSION));
if (!bpx)
{
KdPrint((DRIVERNAME " - ExAllocatePool failed to allocate %d bytes for
SOME_EXTENSION structure\n", sizeof(SOME_EXTENSION)));
return STATUS_INSUFFICIENT_RESOURCES;
}

bpx->DeviceExtension = pdx;
bpx->somevalue = somevalue

PIO_WORKITEM item = IoAllocateWorkItem(pdx->DeviceObject);
if (!item)
{
ExFreePool(bpx);
KdPrint((DRIVERNAME " - IoAllocateWorkItem failed\n"));
return STATUS_INSUFFICIENT_RESOURCES;
}

bpx->item = item;

IoQueueWorkItem(item, (PIO_WORKITEM_ROUTINE) WorkItemCallback,
DelayedWorkQueue, bpx);
KdPrint((DRIVERNAME " - Work item queued\n"));

The five minute timer is typically an IRP that has been cancelled but that
has no cancel routine, or the cancel routine doesn’t do what it is supposed
to do, being timed out by the OS.

Other than that I have no idea what your problem is.

=====================
Mark Roddy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ronan Launay
Sent: Tuesday, March 08, 2005 11:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Work Item Problem.

Hi ,

in a dpc routine (read callback from a serial device), i need to do some job
at lower irq , so i make a work item .
everything runs fine when loading my driver .
then on windows startup , after rebooting the computer , if i let computer
load till the end , then use my serial device , i got no problem .
but if use my device while windows is still loading the system hangs ( the
driver is still working as i still got output in my windbg session ) and the
work item callback isnt called by the system , and after 5 minutes ( always
5 mins ) the system resumes after the work item callback is finally called .

anyone would have any idea why i got such a behavior ?

work item init :

PSOME_EXTENSION bpx = (PSOME_EXTENSION) ExAllocatePool(PagedPool,
sizeof(SOME_EXTENSION)); if (!bpx)
{
KdPrint((DRIVERNAME " - ExAllocatePool failed to allocate %d bytes for
SOME_EXTENSION structure\n", sizeof(SOME_EXTENSION)));
return STATUS_INSUFFICIENT_RESOURCES;
}

bpx->DeviceExtension = pdx;
bpx->somevalue = somevalue

PIO_WORKITEM item = IoAllocateWorkItem(pdx->DeviceObject);
if (!item)
{
ExFreePool(bpx);
KdPrint((DRIVERNAME " - IoAllocateWorkItem failed\n"));
return STATUS_INSUFFICIENT_RESOURCES;
}

bpx->item = item;

IoQueueWorkItem(item, (PIO_WORKITEM_ROUTINE) WorkItemCallback,
DelayedWorkQueue, bpx); KdPrint((DRIVERNAME " - Work item queued\n"));


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Worker threads are a very scarce resource. I don’t know how many you have in
your system,
but it will be a low number. Imagine there is only one and it is the thing
that is waiting
for your driver to finish.

You can’t complete the request until you get a worker thread and the worker
thread won’t be available
until you complete the request - or the IRP times out.

Resource deadlocks similar to this have happened to me in the past (when I
was writing a
driver that was in the Storage stack). These days, I create my own thread
pool.

I’m not sure if this is your problem, just thought I’d throw in my 2
penn’orth (or is that cents?)

Don Ward

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roddy, Mark
Sent: 08 March 2005 16:34
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Work Item Problem.

The five minute timer is typically an IRP that has been
cancelled but that has no cancel routine, or the cancel
routine doesn’t do what it is supposed to do, being timed out
by the OS.

Other than that I have no idea what your problem is.

=====================
Mark Roddy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ronan Launay
Sent: Tuesday, March 08, 2005 11:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Work Item Problem.

Hi ,

in a dpc routine (read callback from a serial device), i need
to do some job at lower irq , so i make a work item .
everything runs fine when loading my driver . then on windows
startup , after rebooting the computer , if i let computer
load till the end , then use my serial device , i got no
problem . but if use my device while windows is still loading
the system hangs ( the driver is still working as i still got
output in my windbg session ) and the work item callback isnt
called by the system , and after 5 minutes ( always 5 mins )
the system resumes after the work item callback is finally called .

anyone would have any idea why i got such a behavior ?

You cannot allocate PagedPool at IRQL > PASSIVE_LEVEL. Your
PSOME_EXTENSION should be from NP pool if you are allocating it from a
DPC routine. While the machine is stuck, you should break in and run
!stacks 1 and looks at the waiting threads. That might give you an
indication as to what has stopped the machine from making fwd progress.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ronan Launay
Sent: Tuesday, March 08, 2005 8:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Work Item Problem.

Hi ,

in a dpc routine (read callback from a serial device), i need to do some
job
at lower irq , so i make a work item .
everything runs fine when loading my driver .
then on windows startup , after rebooting the computer , if i let
computer
load till the end , then use my serial device , i got no problem .
but if use my device while windows is still loading the system hangs (
the
driver is still working as i still got output in my windbg session ) and
the
work item callback isnt called by the system , and after 5 minutes (
always
5 mins ) the system resumes after the work item callback is finally
called .

anyone would have any idea why i got such a behavior ?

work item init :

PSOME_EXTENSION bpx = (PSOME_EXTENSION) ExAllocatePool(PagedPool,
sizeof(SOME_EXTENSION));
if (!bpx)
{
KdPrint((DRIVERNAME " - ExAllocatePool failed to allocate %d bytes for
SOME_EXTENSION structure\n", sizeof(SOME_EXTENSION)));
return STATUS_INSUFFICIENT_RESOURCES;
}

bpx->DeviceExtension = pdx;
bpx->somevalue = somevalue

PIO_WORKITEM item = IoAllocateWorkItem(pdx->DeviceObject);
if (!item)
{
ExFreePool(bpx);
KdPrint((DRIVERNAME " - IoAllocateWorkItem failed\n"));
return STATUS_INSUFFICIENT_RESOURCES;
}

bpx->item = item;

IoQueueWorkItem(item, (PIO_WORKITEM_ROUTINE) WorkItemCallback,
DelayedWorkQueue, bpx);
KdPrint((DRIVERNAME " - Work item queued\n"));


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks !

that was it .
i was focused on the worker thread and didnt see about the paged pool
problem .

“Doron Holan” a écrit dans le message de
news:xxxxx@ntdev…
You cannot allocate PagedPool at IRQL > PASSIVE_LEVEL. Your
PSOME_EXTENSION should be from NP pool if you are allocating it from a
DPC routine. While the machine is stuck, you should break in and run
!stacks 1 and looks at the waiting threads. That might give you an
indication as to what has stopped the machine from making fwd progress.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ronan Launay
Sent: Tuesday, March 08, 2005 8:29 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Work Item Problem.

Hi ,

in a dpc routine (read callback from a serial device), i need to do some
job
at lower irq , so i make a work item .
everything runs fine when loading my driver .
then on windows startup , after rebooting the computer , if i let
computer
load till the end , then use my serial device , i got no problem .
but if use my device while windows is still loading the system hangs (
the
driver is still working as i still got output in my windbg session ) and
the
work item callback isnt called by the system , and after 5 minutes (
always
5 mins ) the system resumes after the work item callback is finally
called .

anyone would have any idea why i got such a behavior ?

work item init :

PSOME_EXTENSION bpx = (PSOME_EXTENSION) ExAllocatePool(PagedPool,
sizeof(SOME_EXTENSION));
if (!bpx)
{
KdPrint((DRIVERNAME " - ExAllocatePool failed to allocate %d bytes for
SOME_EXTENSION structure\n", sizeof(SOME_EXTENSION)));
return STATUS_INSUFFICIENT_RESOURCES;
}

bpx->DeviceExtension = pdx;
bpx->somevalue = somevalue

PIO_WORKITEM item = IoAllocateWorkItem(pdx->DeviceObject);
if (!item)
{
ExFreePool(bpx);
KdPrint((DRIVERNAME " - IoAllocateWorkItem failed\n"));
return STATUS_INSUFFICIENT_RESOURCES;
}

bpx->item = item;

IoQueueWorkItem(item, (PIO_WORKITEM_ROUTINE) WorkItemCallback,
DelayedWorkQueue, bpx);
KdPrint((DRIVERNAME " - Work item queued\n"));



Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com