Well I don’t know what do you mean by “You are not attempting unsynchronized
control of the device through control registers”.
But generally you are right. I do treat the registers as a buffer. Access to
some registers should be serialized (and will be in production version of
the driver), but the hardware will not do any damage if the access is not
serialized. The hardware will issue interrupts in the future, but currently
for testing purposes is interrupt generation disabled.
When the driver is open by the application, the driver starts a thread (if
it is not already running) that in about 100ms does read and write of some
registers. Also when the driver is opened, the registers are mapped to the
user mode application memory space.
Then I can run two tests - one does reading and writing of the registers
from user mode (using the mapped memory) and I can issue some IOCTLs that
does the same in kernel mode. Both of the test do hang very often. The
access from user mode is not synchronized with the thread in kernel mode,
the IOCTLs are synchronized only with other IOCTLs, but not with the thread.
When I do not run any tests, just open the driver, the “periodic” thread
alone runs without any problem. When I disable the thread and do only the
tests, everything runs correctly. Even when I run more applications
simultaneously and run the tests, everything is ok. But only with the thread
disabled. Once the thread is enabled and I start the tests, system hangs.
The testing machine does have dual cores, if it can mean anything.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Monday, November 22, 2010 9:04 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Concurrent memory acces to PCIe device
So if I understand you correctly, you are treating the pci device
memory space simply as a buffer that for testing purposes you are
reading/writing concurrently from multiple threads. You are not
attempting unsynchronized control of the device through control
registers. For both kernel mode and user mode concurrent access
read/write testing, you are getting system hangs. In the case for
kernel mode you are using the same mapping of the pci device address
space, but separate and perhaps concurrent threads. The kernel mode
test also hangs, so the potential cache mode conflict between the user
mode mapping and the kernel mode mapping can be ruled out.
Mark Roddy
On Mon, Nov 22, 2010 at 10:57 AM, wrote:
> Well, but I have the same problem even when I am not accessing the memory
from the user mode. In that case is the mapping done (ZwMapViewOfSection is
called, but the pointers are not used), but I am accessing that memory only
in kernel mode - once from the thread that does the periodic checks and once
from IOCTL. Can the cached/non-cached problem (as you’ve described) still be
there?
>
> —
> 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
>
—
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