Our driver is mapping PCI bar addresss into UserMode for an application and we're experiencing access errors after approximately 6 hours of runtime of application.
We found out that only if we are mapping certain areas of the BARs to UserMode we are getting those access errors.
Through investigation, we discovered also that a sequential 8-byte read across our PCI BARs, from first to last BAR, is responsible for the access errors.
Our driver maps PCI BAR addresses to UserMode the following:
- MmMapIoSpace (with MmNonCached) for physical to virtual mapping
- mapping virtual addresses to UserMode
This is our relevant code for mapping the virtual addresses to UserMode:
pMemUmOut->uMdl.pPtr = (void*) IoAllocateMdl( (void*) pVirtualAdrIn,
lSizeMemIn,
FALSE,
FALSE,
NULL);
if (pMemUmOut->uMdl.pPtr == NULL)
{
// set ErrorString
...
}
else
{
MmBuildMdlForNonPagedPool((PMDL) pMemUmOut->uMdl.pPtr);
try
{
// maps the physical pages that are described by an MDL
pMemUmOut->uAdrUser.pPtr = MmMapLockedPagesSpecifyCache((PMDL) pMemUmOut->uMdl.pPtr,
UserMode,
MmNonCached,
NULL,
FALSE,
NormalPagePriority);
}
except(EXCEPTION_EXECUTE_HANDLER)
{
...
}
}
We are wondering who/what is performing these sequential reads?
The MmProbeAndLockPages routine should not be called because the pages are already locked (NonPagedPool)...
Any idea? Also how we could figure it out? We tried to set data breakpoint on the start of the first PCI BAR with windbg but unfortunately the breakpoint haven't triggered yet...
We would be very happy any help!