Linux Device Driver Report I/O Request Flow in WDF Kernel- Mode Drivers.

Slides:



Advertisements
Similar presentations
Generalized Requests. The current definition They are defined in MPI 2 under the hood of the chapter 8 (External Interfaces) Page 166 line 16 The objective.
Advertisements

Device Virtualization Architecture
purpose Search : automation methods for device driver development in IP-based embedded systems in order to achieve high reliability, productivity, reusability.
WDM 드라이버의 기본 구조 What is WDM?
请点击以下链接下载WinHEC的演讲材料
Introduction to Plug and Play and Power Management in the Windows Driver Foundation 陳怡碩.
Chapter 7 Protocol Software On A Conventional Processor.
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
IO Request Flow in WDF Kernel-Mode Drivers
I/O Request Flow in WDF Kernel‑Mode Drivers
I/O Request Flaw in WDF Kernel-Mode Driver
Process Concept An operating system executes a variety of programs
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Using the Windows Driver Framework to build better drivers
计算机系 信息处理实验室 Lecture 12 I/O System
Chapter 4: Threads Adapted to COP4610 by Robert van Engelen.
Kumar Rajeev SDET Microsoft Corporation. KMDF does not support HID minidrivers natively due to conflicting KMDF and HID architecture requirements HID.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
NetSim ZigBee Simulation Code Walkthrough in 10 steps
Chapter 4: Threads. 4.2CSCI 380 Operating Systems Chapter 4: Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
© Microsoft Corporation1 Windows Kernel Internals I/O Architecture *David B. Probert, Ph.D. Windows Kernel Development Microsoft Corporation.
FINAL MPX DELIVERABLE Due when you schedule your interview and presentation.
ATA Miniport Nuts and Bolts
Xen I/O Overview. Xen is a popular open-source x86 virtual machine monitor – full-virtualization – para-virtualization para-virtualization as a more efficient.
A Revolutionary Programming Pattern that Will Clean up your Code : Coroutines in C++ David Sackstein ACCU 2015.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
A Comparative Study of the Linux and Windows Device Driver Architectures with a focus on IEEE1394 (high speed serial bus) drivers Melekam Tsegaye
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
NT Kernel CS Spring Overview Interrupts and Exceptions: Trap Handler Interrupt Request Levels and IRT DPC’s, and APC’s System Service Dispatching.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 4: Threads.
A Critical Analysis of the Windows mLAN Driver
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
OS2014 PROJECT 2 Supplemental Information. Outline Sequence Diagram of Project 2 Kernel Modules Kernel Sockets Work Queues Synchronization.
WHDC PowerPoint Template Notes & Handouts
CSC 2720 Building Web Applications Frameworks for Building Web Applications.
Bluetooth on CE. Mid - Presentation Roman Zoltsman & Oren Haggai Group /2001 Instructor: Nir Borenshtein HSDSL Lab. Technion.
© 2004 Microsoft Corporation. All rights reserved. 1 Minifilter Generated IO’s.
How to Develop a KMDF Driver. Outline WDF Object model DDI Organization Object context memory Object lifetime WDF Request Flow Through the Driver Request.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
4P13 Week 12 Talking Points Device Drivers 1.Auto-configuration and initialization routines 2.Routines for servicing I/O requests (the top half)
CSC 360, Instructor: Kui Wu Thread & PThread. CSC 360, Instructor: Kui Wu Agenda 1.What is thread? 2.User vs kernel threads 3.Thread models 4.Thread issues.
Customer and Partner Connections Design and Develop Assess and Certify.
 Program Abstractions  Concepts  ACE Structure.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS3: Concurrency 3.3. Advanced Windows Synchronization.
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
Other Thread Synchronization Functions 井民全製作. Introduction.
UDI Technology Benefits Slide 1 Uniform Driver Interface UDI Technology Benefits.
1 Lecture 19: Unix signals and Terminal management n what is a signal n signal handling u kernel u user n signal generation n signal example usage n terminal.
© 2004 Microsoft Corporation. All rights reserved. 1 Processing IO Operations.
Lecture 8 Task Utilization. Theoretical Analysis.
OPERATING SYSTEM CONCEPT AND PRACTISE
Process concept.
Oracle Subledger Accounting
Protection of System Resources
CSE451 I/O Systems and the Full I/O Path Autumn 2002
I/O Manager, 64-bit Porting, and New Driver Models
Chapter 3: Windows7 Part 2.
Introduction to writing device drivers for Windows
Quiz
Chapter 3: Windows7 Part 2.
I/O Procedures.
Threads Chapter 4.
Threads Chapter 5 2/17/2019 B.Ramamurthy.
Threads Chapter 5 2/23/2019 B.Ramamurthy.
Galen C. Hunt Microsoft Research and the University of Rochester
Interrupts and System Calls
Mr. M. D. Jamadar Assistant Professor
DPACC API Guidelines 2019/10/12.
Presentation transcript:

Linux Device Driver Report I/O Request Flow in WDF Kernel- Mode Drivers

Outline Flow of an I/O Request Throught the System –Application I/O Requests –I/O Request Path from Application to Driver –KMDF Driver Processing of I/O Requests Flow of an I/O Request Within a KMDF Driver –Framework Receives a Request and Inserts It on a WDFQUEUE –Framework Invokes the Driver’s I/O Event Processing Callback –Driver’s I/O Event Processing Callback Executes

Application I/O Requests Application I/O Requests 的種類 –Create Requests CreateFile –Close Requests Close –Read and Write Requests ReadFile WriteFile –Device Control Requests DeviceControl

Application I/O Requests 同步、非同步 –Synchronous –Control 會等到 request 完成後,才會回到 application 。 –Asynchronous –Control 會立刻回到 application 。 –Application 必須自己檢查 Request 是否完成。

I/O Request Path from Application to Driver

1.When an application issues an I/O request, Windows issues a system service call to the system service dispatcher. 2.The system service dispatcher calls the corresponding I/O processing function of the Windows I/O Manager. 3.The I/O Manager builds an I/O request packet (IRP) that describes the I/O request issued by the application and sends it to the framework (the KMDF library, Wdfdynam.sys). The framework sorts incoming requests by major function code and, in the case of a read, write, or device control request, sends it to the framework's I/O package for processing. The I/O package validates the request parameters and processes the request according to its type and the driver's configuration of its WDFQUEUE(s). 4.If the KMDF driver is a filter driver and has configured its WDFQUEUE(s) to forward requests of this type to the next-lower driver on the underlying driver stack, the framework forwards the request to the next-lower driver. Otherwise, it forwards the request to the KMDF driver. 5.If the KMDF driver receives the request, it processes the request and, if necessary, forwards it to the next-lower driver on the underlying stack. 6.That driver processes the request and, in turn, forwards the request to the next- lower driver and so on down the driver stack, as needed to satisfy the request.

I/O Request Path from Application to Driver I/O Request Path from Application to the Framework Windows Issues a System Service Call for an Application I/O Request The System Service Dispatcher Calls the I/O Manager The I/O Manager Builds an IRP and Sends It to the Framework –Validating request parameters –Building the IRP –Sending the IRP to the framework.

I/O Request Path from Application to Driver I/O Request Path from Framework to Driver

KMDF Driver Processing of I/O Requests Processing a Request Internally Processing a Request by Sending It to Another Driver Requests Marked Pending During Processing

KMDF Driver Processing of I/O Requests I/O Completion Path from Driver to Application.

KMDF Driver Processing of I/O Requests Driver Completion of a Request –I/O status. –Completion information. –Requested data. I/O Completion Path from Framework to I/O Manager I/O Manager Completion of a Request –Stage 1: Completion Processing in Arbitrary Context –Stage 2: Completion Processing in the Requestor’s Context

Framework Receives a Request and Inserts It on a WDFQUEUE WDFQUEUE Insertion Logic –If the device has previously been defined as a filter device object (by calling WdfFdoInitSetFilter) –The framework determines the correct WDFQUEUE into which to place the arriving WDFREQUEST –The framework then checks the dispatch type for the chosen WDFQUEUE Driver Queue Implementation

Framework Receives a Request and Inserts It on a WDFQUEUE Consider the following queue structure provided by the WDFDIO driver: WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioCallbac ks, WdfIoQueueDispatchSequential); ioCallbacks.EvtIoDeviceControl = DioEvtDeviceControl; status = WdfIoQueueCreate(device, &ioCallbacks, WDF_NO_OBJECT_ATTRIBUTES, NULL); // optional pointer for queue handle

Framework Invokes the Driver's I/O Event Processing Callback Dispatch Type of the Queue Dispatch Types –WdfIoQueueDispatchParallel –WdfIoQueueDispatchSequential Impact of Dispatch Type on Driver Design Synchronization Scope for WDFDEVICEs and WDFQUEUEs Specifying Synchronization Scope

Framework Invokes the Driver's I/O Event Processing Callback How Synchronization Scope Works Queue State Is the Callback Called?

Driver's I/O Event Processing Callback Executes Validating the Arriving Request Processing the Arriving Request Satisfying the Request within the I/O Event Processing Callback Initiating a Request on the Device Sending a Request to Another Driver for Processing

Driver's I/O Completion Routine Executes I/O Completion Routine Example –VOID –EvtRequestReadCompletionRoutine( – IN WDFREQUEST Request, – IN WDFIOTARGET Target, – PWDF_REQUEST_COMPLETION_PARAMS CompletionParams, – IN WDFCONTEXT Context – ) –{ – NTSTATUS status; – size_t bytesRead = 0; – PWDF_USB_REQUEST_COMPLETION_PARAMS usbCompletionParams; – UNREFERENCED_PARAMETER(Target); – UNREFERENCED_PARAMETER(Context); – status = CompletionParams->IoStatus.Status; – – usbCompletionParams = – CompletionParams->Parameters.Usb.Completion; – – bytesRead = usbCompletionParams->Parameters.PipeRead.Length; – – WdfRequestCompleteWithInformation(Request, status, bytesRead); – return; –}