Re: KeWaitForMultipleObjects

From: Alexander Grigoriev (alegr_at_earthlink.net)
Date: 04/14/04


Date: Wed, 14 Apr 2004 07:44:20 -0700

It's not obvious from the DDK docs. Actually I don't understand reason why
objects' array should be accessed while the thread is waiting. Addresses of
the objects are copied into the thread's array (or WaitBlockArray) of
KWAIT_BLOCK's, and there's no need to read the array again (unless an APC is
delivered?).

"Don Burn" <burn@stopspam.acm.org> wrote in message
news:107qgvo86aif371@corp.supernews.com...
> You are correct you must allocate the WaitArray from NonPagedPool.
>
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
> "OttoVonRix" <OttoVonRix@iname.com> wrote in message
> news:8D324B36-9E8D-456C-A8DC-3C0B5DEDC2B8@microsoft.com...
> > In my driver, a call to KeWaitForMultipleObjects is bugchecking:
> >
> > if( KeWaitForMultipleObjects( NumObjs, pQuitObjects,
> > WaitAny, Executive,
KernelMode,
> > FALSE,
> (PLARGE_INTEGER)&TimeOut, NULL ) != STATUS_TIMEOUT)
> >
> > NumObjs in this case is 2. pQuitObjects is a dynamically allocated
array,
> allocated with ExAllocPool, from the paged pool (an event and a thread).
the
> TimeOut is Zero
> >
> > This code has been running for ages on many, many systems without
> problems. However, an MP Win2k machine has started bugcjecking. Here's
what
> I get:
> >
> > IRQL_NOT_LESS_OR_EQUAL (a)
> > An attempt was made to access a pageable (or completely invalid) address
> at an
> > interrupt request level (IRQL) that is too high. This is usually
> > caused by drivers using improper addresses.
> > If a kernel debugger is available get the stack backtrace.
> > Arguments:
> > Arg1: e27cb588, memory referenced
> > Arg2: 0000001c, IRQL
> > Arg3: 00000000, value 0 = read operation, 1 = write operation
> > Arg4: 8042becf, address which referenced memory
> >
> > Debugging Details:
> > ------------------
> >
> >
> > READ_ADDRESS: e27cb588 Paged pool
> >
> > CURRENT_IRQL: 1c
> >
> > FAULTING_IP:
> > nt!KeWaitForMultipleObjects+99
> > 8042becf 8b38 mov edi,[eax]
> >
> > This is on a Windows 2000 MP Kernel.
> >
> > In the crash dump file, the read address (e27cb588) appears valid. This
is
> the address of the array of wait objects passed in to the function
> (allocated from the paged pool).
> >
> > So, I guess I'm going to answer my own question: Is this problem caused
by
> allocating the array of wait objects (i.e. an array of pointers to
non-paged
> kernel objects) from the paged pool?
> > The documentation doesn't explicitly state that this would be a problem?
> >
> > With some overhead, I could change over to an on-stack array. With a
> KernelMode wait, would this be safe?
> >
> > Thanks in advance!
> >
> > Otto
> >
>
>



Relevant Pages

  • Re: Cons cell archaic!?
    ... from s-expression or XML or other syntax you keep the bloated array ... For using vectors to emulate lists that ... Allocate 2, move 1 element: ... What do you think of that algorithm? ...
    (comp.lang.lisp)
  • Re: efficiency of allocatable array into derived type
    ... I have made a simple comparison between three different derived types: 1) with static array, 2) with allocatable array, 3) pointer array. ... implicit none ... allocate, sb, sc) ... static and pointer array into derived type are at least one order slower than the static version; ...
    (comp.lang.fortran)
  • Storing/Retrieving TYPEs with ALLOCATABLE components (TR) (long)
    ... tBrd, including array descriptor of tEn )). ... Without previous DEALLOCATE, the allocate line fails at run time with message ... the fact that I'm loading an invalid descriptor tBrd%tEn from the file... ... status (which is not possible according to Standard, but then BINARY files ...
    (comp.lang.fortran)
  • Re: global array allocation
    ... some space will be set aside for the array. ... lifetime of the kernel at a fixed address in memory. ... I don't think that you can set a definite limit, as e.g. already installed modules will reduce the amount of available memory. ... Also, you might render your system unusable if you allocate all of the available memory to a static array, leaving nothing for other purposes, e.g. dynamically allocated data structures. ...
    (comp.os.linux.development.system)
  • Re: Storing the size of an array in the structure itself
    ... >> I think every C programmer can relate to the frustrations that malloc ... >> the size of an array must be stored separately to be a nightmare. ... is anything more than just that - a chunk of memory. ... > Otherwise you couldn't tell it how much to allocate. ...
    (comp.lang.c)