Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Doing direct DMA transfer through a disk filter driver?

craniumratcraniumrat Member Posts: 17

Hi,

I am trying to speed up a cross-platform Software Raid (RAID5) driver in WDM.

Currently, my method is to split the incoming IO into stripe sized chunks, allocate a parity buffer, compute the parity, and write stripe sized data to the individual disks. This unfortunately results in a large number of IO if the incoming buffer is large.

I was looking into scatter/gather lists and want to see if this approach is possible?

  1. Call IoGetDmaAdapter for the member disks. Currently, I am calling this from the completion routine of an IOCTL_GET_DRIVE_LAYOUT_EX call.
  2. Construct the MDL for scatter/gather lists using the incoming IO MDL and my parity MDL spliced together.
  3. Execute the transaction.

I tried calling IoGetDmaAdapter using the PDO I get in my disk filter driver, but I don't get a _DMA_ADAPTER pointer even after trying several options for DEVICE_DESCRIPTION as mentioned in earlier OSR posts or in Windows samples. I always end up with a nullptr.

My PDO has !devobj output:

: kd> !devobj 0xffffa70a`c5c73050
Device object (ffffa70ac5c73050) is for:
 00000048 \Driver\storvsc DriverObject ffffa70ac1c6fa10
Current Irp 00000000 RefCount 0 Type 00000007 Flags 00001050
SecurityDescriptor ffffdf80e7e1d8e0 DevExt ffffa70ac5c731a0 DevObjExt ffffa70ac5c74120 DevNode ffffa70ac8608650 
ExtensionFlags (0000000000)  
Characteristics (0x00000180)  FILE_AUTOGENERATED_DEVICE_NAME, FILE_DEVICE_SECURE_OPEN
AttachedDevice (Upper) ffffa70ac610e060 \Driver\disk
Device queue is not busy.

Is my approach feasible? If not, is there another way to execute DMA scatter/gather from my disk filter driver?

Comments

  • MBond2MBond2 Member Posts: 708

    Filter drivers don't directly access hardware. As the name implies, they filter IRPs that other drivers then work with.

    you don't really know if the disk you are speaking with is connected via USB, SAS, NVMe, FC or something else not yet invented

  • Dejan_MaksimovicDejan_Maksimovic Member - All Emails Posts: 636
    via Email
    Why does the split need to be in stripe sized chunks?
    I mean it can be in buffer_size / num_disks + 1_for_parity sized chunks?
  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,754

    Typically in windows a custom raid implementation is implemented as a component of a third-party storage adapter. Software raid is more or less already implemented by the built in storage spaces.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 20-24 May 2024 Live, Online