I’ve a Windows 2000 virtual disk driver which redirects SCSI reads and writes to Zw[Read|Write]File().
Attaching the image file as a disk in the Windows 7 installation environment works. I can begin to install Windows 7 to the image file. But part of the way through the installation, the virtual disk’s I/O hangs. The IRPs have all been queued to the virtual disk’s own thread. Here’s where it’s blocked:
When I look at the queue, there are a few IRPs in there, so the installation process(es) might have an asynchronous aspect.
I am unsure as to why the driver is blocking, but my guess would be that the filter manager has already locked a lock once for the virtual disc I/O, then the lock is still locked when this driver is attempting the “inner” I/O to the image file.
Does anyone have an experience, suggestions, or wisdom that might help the driver to prevent this blocking? The driver is intended to support >= Windows 2000.
You have a collided page fault, so this thread is waiting for the in page
operation to happen in another thread. The question then is why the thread
servicing the page fault is it not making forward progress. Have you found
the other thread yet? !stacks 2 can help.
-scott
–
Scott Noone
Consulting Associate and Chief System Problem Analyst
OSR Open Systems Resources, Inc. http://www.osronline.com
wrote in message news:xxxxx@ntdev…
Good day to All,
I’ve a Windows 2000 virtual disk driver which redirects SCSI reads and
writes to Zw[Read|Write]File().
Attaching the image file as a disk in the Windows 7 installation environment
works. I can begin to install Windows 7 to the image file. But part of the
way through the installation, the virtual disk’s I/O hangs. The IRPs have
all been queued to the virtual disk’s own thread. Here’s where it’s
blocked:
When I look at the queue, there are a few IRPs in there, so the installation
process(es) might have an asynchronous aspect.
I am unsure as to why the driver is blocking, but my guess would be that the
filter manager has already locked a lock once for the virtual disc I/O, then
the lock is still locked when this driver is attempting the “inner” I/O to
the image file.
Does anyone have an experience, suggestions, or wisdom that might help the
driver to prevent this blocking? The driver is intended to support >=
Windows 2000.
What is the preferred method for facilitating paging where the page I/O will pass through Zw[ReadWrite]File() ? Is there one? Since ZwXxxFile() could be serviced by any number of drivers, and any driver might have pageable sections, it doesn’t seem at all likely that there’s a way to instruct Windows not to page particular drivers’ memory out to a device which… Depends on those drivers.
This has me wondering if the native .VHD support in Windows 7 builds a map of sectors for the .VHD file and uses those, instead of file I/O (which might pass through non-disk drivers which pageable sections).
Would anyone care to share how they have addressed this paging predicament in their own virtual disk drivers? If so, then I’d certainly appreciate it.
Well first paging I/O doesn’t pass through the Zw[ReadWrite]File()
calls. Second drivers have to indicate they are in the paging path and
then the system will not page them. Take a look at the disk filter
example in the WDK to see what needs to be done.
“xxxxx@YRDSB.Edu.On.Ca” wrote in message news:xxxxx@ntdev:
> What is the preferred method for facilitating paging where the page I/O will pass through Zw[ReadWrite]File() ? Is there one? Since ZwXxxFile() could be serviced by any number of drivers, and any driver might have pageable sections, it doesn’t seem at all likely that there’s a way to instruct Windows not to page particular drivers’ memory out to a device which… Depends on those drivers. > > This has me wondering if the native .VHD support in Windows 7 builds a map of sectors for the .VHD file and uses those, instead of file I/O (which might pass through non-disk drivers which pageable sections). > > Would anyone care to share how they have addressed this paging predicament in their own virtual disk drivers? If so, then I’d certainly appreciate it.
I apologize. What I meant was that the paging I/O to my virtual disk would have to eventually be serviced by Zw[Read|Write]File(), so I’m wondering if anyone has a similar situation that they’ve dealt with “properly” or at least successfully.
Virtual disk depends on Zw[Read|Write]File()
Zw[Read|Write]File() depends on FS drivers, filters, etc.
One of these has a piece that gets paged out
A time comes when that piece needs to be paged back in… From the virtual disk
I’ll have a look at the sample you’ve recommended.
It’s not very typical to have a paging file on the disk in this type of
driver. And by not having a paging file on your virtual disk you break the
circular dependency (i.e. you trigger a paging I/O to a different disk). I
don’t have much experience with them, but according to this article even
native boot VHDs don’t support having a paging file on them:
If you do want to support this for some reason, you have two issues:
Determining if a particular I/O is paging I/O or not at the volume/disk
layer. You’ll either need a file system filter assist on this or you’ll need
to keep track of the sectors that make up the paging file
Sending paging I/Os to the FSD to deal with the paging operations (i.e.
IRP_MJ_READ requests with the IRP_PAGING_IO bit set). You can’t do this with
the Zw APIs and paging I/O has some special rules that you’ll need to figure
out and obey.
If I were you I’d spend some time researching to see if I could avoid
getting the paging file on the virtual disk. If it’s possible to hook into
whatever support they’re using for native boot you’ll be much happier.
-scott
–
Scott Noone
Consulting Associate and Chief System Problem Analyst
OSR Open Systems Resources, Inc. http://www.osronline.com
wrote in message news:xxxxx@ntdev…
Thanks, Don.
I apologize. What I meant was that the paging I/O to my virtual disk would
have to eventually be serviced by Zw[Read|Write]File(), so I’m wondering if
anyone has a similar situation that they’ve dealt with “properly” or at
least successfully.
Virtual disk depends on Zw[Read|Write]File()
Zw[Read|Write]File() depends on FS drivers, filters, etc.
One of these has a piece that gets paged out
A time comes when that piece needs to be paged back in… From the virtual
disk
I’ll have a look at the sample you’ve recommended.
That was a fantastic response, Scott, and I truly appreciate it. For now, the driver can live with the same limitations as you point out in Microsoft’s article for .VHDs. A paging feature can wait for later, if it’s even possible.
For your #1, keeping track of the sectors that make up the paging file seems like it could be [at least a bit of] a memory burden. For your #2, I’m not 100% sure what I’d use instead of Zw[Read|Write]File(), so that’d take some thinking. Back-burner, then!
>For your #1, keeping track of the sectors that make up the paging file seems >like it could be [at least a bit of] a memory burden. For your #2, I’m not >100% sure what I’d use instead of Zw[Read|Write]File(), so that’d take some >thinking.
In general, your design is not good. Virtual disk works in the storage stack and should perform disk block, not file system, I/Os. Otherwise, the driver may get recursive operations which happened to you.
Even admitting what you pointed out, I’m not sure how else to provide a virtual disk for an image file located on a network filesystem. Microsoft appears to support .VHDs over SMB; this is a similar feature, in my opinion.
But alas, even by preventing page-files on the virtual disk, the driver still gets stuck:
You again stuck on file system level.
Usually the lower level interface of virtual disks connected directly to drivers which serves hardware. For example, I worked on a project which designed a virtual disk. The virtual disk keeps all data on network server. All communication done by using UDP. The lower edge of the virtual disk was connected to a NDIS Protocol driver, which was part of the project.
You probably could develop some stuff for network file system, which is already represented by a virtual disk. But it could be done either on user mode or the file system filters. You are trying to develop another virtual disk which is resizing below the file system on which you want to communicate. It is not good design.
>In general, your design is not good. Virtual disk works in the storage
stack and should perform disk block, not file system, I/Os. Otherwise, >the
driver may get recursive operations which happened to you.
This is a file backed disk, I’d say it’s a bad design to NOT go through the
file system. Doing block I/O would means that you would bypass the file
system and all file system filters, which means that you lose the ability to
do things like encrypt/compress the disk. Try playing with the VHD support
in Windows, it is effectively the same thing that the OP is trying to
accomplish (and it does in fact use the FSD to perform I/O on its disk
file).
You’re trying to do a cached I/O but the cache is full so you block. Imagine
the scenario, the cache is full so the Cache Manager sends a non-cached I/O
to the disk with data from the cache to make some room. Your driver turns
this into a cached I/O, which blocks waiting for room in the cache.
The solution is that you need to use non-cached I/O when you write to the
file backing your disk.
Hope to see you at the next OSR kernel debugging class February 14th in
Columbia, MD!
wrote in message news:xxxxx@ntdev…
Thanks for the feed-back, Igor.
Even admitting what you pointed out, I’m not sure how else to provide a
virtual disk for an image file located on a network filesystem. Microsoft
appears to support .VHDs over SMB; this is a similar feature, in my opinion.
But alas, even by preventing page-files on the virtual disk, the driver
still gets stuck:
>This is a file backed disk, I’d say it’s a bad design to NOT go through the file >system. Doing block I/O would means that you would bypass the file system >and all file system filters, which means that you lose the ability to do things >like encrypt/compress the disk. Try playing with the VHD support in Windows, >it is effectively the same thing that the OP is trying to accomplish (and it does >in fact use the FSD to perform I/O on its disk file).
I was confused with OP design where he implemented virtual disk. I thought he implemented a virtual disk in storage stack because in beginning of the post he mentioned
"I’ve a Windows 2000 virtual disk driver which redirects SCSI reads and writes to Zw[Read|Write]File(). "
It means means that his virtual disk performs block I/O. And doing file operations from storage stack is not good things.
I was mention the project, I worked, which supports also Windows 2000. And VHD is not available in Win2000.
The driver I was having troubles with is part of a [very] small suite of drivers. One of the drivers is an AoE driver and the other provides read-only virtual disks over HTTP. I agree with you that there are some good ways to have virtual disks over the network besides an image file on a share. I thank you for sharing your relevant experiences.
As an aside and in regards to “VHD is not available in Win2000,” that’s a goal for this driver. Flat .VHDs (a sector-by-sector image with a footer) should currently be supported by this driver. It’s difficult to avoid the block I/O -> file I/O in this scenario, but I certainly welcome suggestions, such as the already-mentioned sector map for the file (though it’d have to be a fixed size and’d have to have a fixed position and’d have to be determined as being on a non-network FS).
Scott:
Thank you (and OSR)[1] once more for your x-ray vision; FILE_NO_INTERMEDIATE_BUFFERING certainly does the trick. In retrospect, it seems silly that it was previously missing.