I/O Request Flow in WDF Kernel‑Mode Drivers

Slides:



Advertisements
Similar presentations
Introduction to Plug and Play and Power Management in the Windows Driver Foundation 陳怡碩.
Advertisements

布林代數的應用--- 全及項(最小項)和全或項(最大項)展開式
建立使用案例敘述 --Use Case Narrative
Web Service 實作簡介 張啟中. Outline Introduction to Web Service Demo (An Example) Demo (Building a Web Service with.Net) Demo (Consuming a Web Service with.Net)
PowerPoint2010 李燕秋 版面配置 版面配置指的是每一個頁面的內容配置 方式,不同的版面配置會有對應的母片。
Forum 2004 Building and Plaza Herzog & de Meuron Barcelona, Spain Pic 1.
無名哇哇哇 ?. 封包 header & 內文 Form 位置 找到發送 POST 的封包 找到密碼位置.
教案課程片頭介紹 教案課程片頭是以圖片透過 Powerpoint 之動畫設 計功能轉變而成的動畫形式所呈現出來的影片, 目的是要讓老師們的課程顯得更加活潑、生動、 有趣,以往傳統的做法大部分都是以文字或投影 片的方式呈現,後來加以改良成為動畫呈現方式, 使得學生在複習課程方面能更加淺顯易懂、激發 出更多學習的興趣與樂趣。
指導教授:黃仁暐 教 授 專題生:羅允志 陳冠宏 1.  分組討論時 …  多人同時討論的平台 … 2.
指導教授:陳淑媛 學生:李宗叡 李卿輔.  利用下列三種方法 (Edge Detection 、 Local Binary Pattern 、 Structured Local Edge Pattern) 來判斷是否為場景變換,以方便使用者來 找出所要的片段。
SIP Mobiity TA: 洪敏書
在 Ad-hoc 網路中實現點對 點發送訊息與廣播訊息. 檔案下載  範例程式可在下列網址取得  DEMO 程式可在下列網址取得
Linux Device Driver Report I/O Request Flow in WDF Kernel- Mode Drivers.
全球化環境下的組織管理 本章內容 全球化的趨勢 國際化的階段 國際企業母公司對分支機構的管理取向 國際企業組織的結構設計 Chapter 6
Review of Chapter 3 - 已學過的 rules( 回顧 )- 朝陽科技大學 資訊管理系 李麗華 教授.
1 實驗二 : SIP User Mobility 實驗目的 藉由 Registra 和 Redirect Server 的設計,深入瞭解 SIP 的運 作及訊息格式。 實作部分 ( 1 )實作一個 Registrar 來接收 SIP REGISTER ,而且 要將 REGISTER 中 Contact.
多媒體概論 mm11.ppt 1 分散式資料處理 多媒體資訊的處理與管理 多用戶系統間的協調 網路教學.
1.1 電腦的特性 電腦能夠快速處理資料:電腦可在一秒內處理數百萬個 基本運算,這是人腦所不能做到的。原本人腦一天的工 作量,交給電腦可能僅需幾分鐘的時間就處理完畢。 電腦能夠快速處理資料:電腦可在一秒內處理數百萬個 基本運算,這是人腦所不能做到的。原本人腦一天的工 作量,交給電腦可能僅需幾分鐘的時間就處理完畢。
STAT0_sampling Random Sampling  母體: Finite population & Infinity population  由一大小為 N 的有限母體中抽出一樣本數為 n 的樣 本,若每一樣本被抽出的機率是一樣的,這樣本稱 為隨機樣本 (random sample)
第一章 計算機系統的主要架構.
1. 假設以下的敘述為一未提供 “ 捷徑計算 ” 能力的程式段,試用程 式設計的技巧,使此敘述經此改 寫的動作後,具有與 “ 捷徑計算 ” 之 處理方法相同之處理模式。 if and then E1 else E2 endif.
各種線上電子資源的特異功能 STICnet 的 SDI 專題訂閱服務 2003/4/28 修改. 無論校內外皆可使用。連線至
JVM versus.NET. .NET vs. Java Runtime environment.NET  CLR Java  JVM Intermediate Code.NET  MSIL Java  Java Byte Code Support.NET  Multiple Languages,
1 網路同步學習 如何使用中山大學管理學院知識管理平台 愷中 製作. 2 如何登入中山大學網路學習平台 1. 首先, 請輸入 2. 點選申請帳號, 依照螢幕所示, 輸入個人資訊.
Department of Air-conditioning and Refrigeration Engineering/ National Taipei University of Technology 模糊控制設計使用 MATLAB 李達生.
Intelligent Systems Mu-Chun Su Department of Computer Science & Information Engineering National Central University.
Wireless Protocol Bluetooth
IO Request Flow in WDF Kernel-Mode Drivers
最新計算機概論 第 5 章 系統程式. 5-1 系統程式的類型 作業系統 (OS) : 介於電腦硬體與 應用軟體之間的 程式,除了提供 執行應用軟體的 環境,還負責分 配系統資源。
Department of Air-conditioning and Refrigeration Engineering/ National Taipei University of Technology MATLAB 操作與 系統動態模擬 SIMULINK 李達生.
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 參 資料蒐集的方法.
第三章 自動再裝載運用篇 使用時機:裝載計劃完成時,尚有剩餘空 間的情形,維持已固定計劃而繼續做裝載 最佳化。以支持次日裝載計劃而提前調整 作業模式。 裝載物品設定和裝載容器設定如前兩章介 紹,於此不再重複此動作,直接從裝載計 劃設定開始,直接從系統內定的物品和容 器選取所需.
緒論 統計的範圍 敘述統計 推論統計 有母數統計 無母數統計 實驗設計 統計的本質 大量 數字 客觀.
Fugacity Coefficient and Fugacity
計算機概論 第 5 章 作業系統 主講人:沈宗南 世新大學多媒體中心
1 第六章 Blog 網誌 網誌已是 Web2.0 的最新指標. 2 教學目標  了解 Blog 的意義  了解 Blog 的功用  了解 RSS  能註冊 Blog 並加以使用.
生產系統導論 生產系統簡介 績效衡量 現代工廠之特徵 管理機能.
教材名稱:網際網路安全之技術及其應用 (編號: 41 ) 計畫主持人:胡毓忠 副教授 聯絡電話: 教材網址: 執行單位: 政治大學資訊科學系.
: Problem G e-Coins ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10306: Problem G e-Coins 解題者:陳瀅文 解題日期: 2006 年 5 月 2 日 題意:給定一個正整數 S (0
第 9 章 TSR 程式基本教練. 本章提要 TSR 程式 以熱鍵 (Hot key) 叫用 TSR 程式 Clock 中斷 int 08h 、 int 1ch DOS reentrant 的問題 有用的 TSR 程式.
Image Interpolation Use SSE 指導教授 : 楊士萱 學 生 : 楊宗峰 日 期 :
演算法 8-1 最大數及最小數找法 8-2 排序 8-3 二元搜尋法.
人力資源管理 1 教 師:林昌榮 人力資源管理 2 何謂工作分析  界定職位之工作內容及工作方式  決定擔任此職位的人所具備的能 力及條件  為人力資源管理活動的磐石.
第十二章 供應鏈管理之決策支援系統 Decision-Support Systems for Supply Chain Management
作業系統 Operating System 游宗翰. 大綱 什麼是作業系統 作業系統的功能 載入作業系統 MS-DOS 、 Windows 的歷史 Linux 簡介.
概念性產品企劃書 呂學儒 李政翰.
Probability Distribution 機率分配 汪群超 12/12. 目的:產生具均等分配的數值 (Data) ,並以 『直方圖』的功能計算出數值在不同範圍內出現 的頻率,及繪製數值的分配圖,以反應出該 機率分配的特性。
無線通訊網路 Mac 層 TDM 通訊模式的操作與效能研究 專題生 : 林書弘、蔡逸祥、毛建翔、王政 華 指導教授 : 黃依賢.
UPnP Architecture Reporter: shi-han wang DCN LAB.
I/O Request Flaw in WDF Kernel-Mode Driver
FSMs and Synchronization
Lab 1 Introduction to Promodel 4.2 By C. L. Hsieh Department of Industrial Management Aletheia University.
Outlook 教學與研習 (1) - 設定及收發郵件 - 設定郵件規則 陽明大學資訊與通信中心 陳坤元 2006/03/27.
論文閱讀報告 論文題目:應用模糊理論於颱風降雨量之推估 作者:陳正彬. 模糊化類神經網路 ‧模糊系統的建立 1. 由人類專家建立規則 ex:if 風速大 then 降雨量高 效果受到規則庫完整的影響 2. 經由訓練法則從數值資料得到模糊規則.
McGraw-Hill© The McGraw-Hill Companies, Inc., 2004 第 12 單元 資訊系統開發 McGraw-Hill Education.
Android 遊戲設計模組 1 Android 開發環境建構 郭育政 東吳大學資訊管理系 涂昆源 萬能科技大學資訊工程系 余執彰 萬能科技大學資訊工程系 周建興 淡江大學電機工程系 林旭陽 東吳大學資訊管理系 教育部網路通訊人才培育先導型計畫 ─ 課程發展計畫.
Microsoft Excel.
: Finding Paths in Grid ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11486: Finding Paths in Grid 解題者:李重儀 解題日期: 2008 年 10 月 14 日 題意:給一個 7 個 column.
计算机系 信息处理实验室 Lecture 12 I/O System
Kumar Rajeev SDET Microsoft Corporation. KMDF does not support HID minidrivers natively due to conflicting KMDF and HID architecture requirements HID.
Agile methods: a comparative analysis Diane Strode-University of Wellington the 19 th Annual Conference of the National Advisory Committee on Computing.
Prof. Shih-Hao Hung 洪士灝 Dept. of CSIE & GINM 資工網媒 [ ]
WHDC PowerPoint Template Notes & Handouts
RMI CORBA Matt. 2 RMI VS CORBA 3 4 J2EE 5 Sample Application.
Internet Technology Laboratory Department of Computer and Communication Kun Shan University  官方網站:
Other Thread Synchronization Functions 井民全製作. Introduction.
1 Chap. 7 Response of First-Order RL and RC Circuits Contents 7.1 The Natural Response of an RL Circuit 7.2 The Natural Response of an RC Circuit 7.3 The.
© 2004 Microsoft Corporation. All rights reserved. 1 Processing IO Operations.
Activity Networks AOV 網路 AOE 網路. AOV 網路 (Activity on Vertx Networks)  為了表示一件工作中,各子工程間的先後 關係,我們可以利用有向圖中的有向邊代 表事情進行的順序,位於一條有向邊終點 的事件必須要等待起點的事情完成後,才 可以進行。
Presentation transcript:

I/O Request Flow in WDF Kernel‑Mode Drivers Peter G. Viscarola, Open Systems Resources, Inc. Microsoft DDK Most Valuable Professional May 10, 2006

Introduce to This paper describes how I/O requests are processed within the Microsoft® Windows® operating system and the Windows Driver Foundation (WDF) kernel-mode driver framework (KMDF) I/O flow is a complex topic, so this paper is organized into two parts focusing on the general activities performed by each component that handles the request focusing on the path of the request through different routines in the driver according to the options and configurations the driver chooses In this paper, KMDF driver refers to a kernel-mode WDF driver. Framework refers to the kernel-mode driver framework itself. including the overall path of an I/O request from the initial request by an application through completion of the request by a driver and how a typical KMDF driver processes an I/O request in various driver routines.

The Flow of an I/O Request Through the System Application I/O Requests Common I/O Requests Issued by Applications Create Requests Close Requests Read and Write Requests Device Control Requests Synchronous and Asynchronous Application Requests Are Asynchronous Requests Always Completed Asynchronously? Are Synchronous Requests Always Completed Synchronously?

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 (cont.) 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 Framework to Driver The KMDF Request Processing Pipeline

I/O Request Path from Framework to Driver (cont.) The Framework Routes the Request to the Appropriate Package The I/O Package Checks the I/O Request Type The I/O Package Further Validates Request Parameters Read and write requests Device control requests The Framework Processes the Request Handles the request on behalf of the driver Forwards the requests to the driver for the next-lower device in the device stack. Creates a WDFREQUEST object that represents the arriving request and passes it to the KMDF driver.

KMDF Driver Processing of I/O Requests Processing a Request Internall Processing a Request by Sending It to Another Driver Processing before sending the request. Initializing the next I/O stack location in the request Sending requests synchronously or asynchronously

I/O Completion Path from Driver to Application

I/O Completion Path from Driver to Application (step A) Driver Completion of a Request When an I/O request is fully satisfied I/O status. Completion information. Requested data.

I/O Completion Path from Driver to Application (step B) I/O Completion Path from Framework to I/O Manager When a KMDF driver completes a WDFREQUEST, it calls a function such as WdfRequestComplete. Next, the framework destroys the WDFREQUEST itself, returning any context storage associated with the WDFREQUEST

I/O Completion Path from Driver to Application (step C) I/O Manager Completion of a Request The I/O Manager completes I/O requests in two stages: Stage 1: Completion processing that might take place in any process and thread context (sometimes called an "arbitrary" process and thread context). Stage 2: Completion processing that must take place in the context of the thread that issued the I/O request.

Flow of an I/O Request Within a KMDF Driver describes the path an I/O request takes during processing within a KMDF driver.

Factors that influence the path of an I/O request within a KMDF driver. The type of device being supported. The driver’s WDFQUEUE configuration The driver’s synchronization scope configuration The overall state of the WDFDEVICE and WDFQUEUE.

Framework Receives a Request and Inserts It on a WDFQUEUE Read, write, device control, and internal device control requests are presented to KMDF drivers through WDFQUEUEs. If the device has previously been defined as a filter device object The framework determines the correct WDFQUEUE into which to place the arriving WDFREQUEST The framework then checks the dispatch type for the chosen WDFQUEUE At this point, both a WDFQUEUE and an I/O event processing callback (if the queue dispatch type is not WdfIoQueueDispatchManual) have been chosen

Framework Invokes the Driver's I/O Event Processing Callback Dispatch Type of the Queue WdfIoQueueDispatchParallel a new request is inserted into a WDFQUEUE configured for parallel dispatching WdfIoQueueDispatchSequential WDFQUEUEs configured for sequential dispatching provide for only one WDFREQUEST from the queue to be in progress at a time. WdfIoQueueDispatchManual. Inserting a request into a WDFQUEUE configured for manual dispatching never results in the framework calling a type-specific or default I/O event processing callback

Queue State The state of a queue is managed by KMDF drivers and the framework using the following flags: WdfIoQueueAcceptRequests. When set, this flag indicates that the queue is accepting requests. WdfIoQueueDispatchRequests. When set, this flag indicates that the queue is dispatching requests. WdfIoQueueNoRequests. When set, this flag indicates that the queue is currently empty. WdfioQueueDriverNoRequests. When set, this flag indicates that all requests that have been delivered from this queue to the driver are complete (that is, the driver has no outstanding requests from this queue in progress). WdfIoQueuePnPHeld – When set, this flag indicates that the queue is not accepting requests due to a Plug and Play or power management event.

decision process used by the framework If the queue’s dispatch type is WdfIoQueueDispatchManual If the queue’s dispatch type is either WdfIoQueueDispatchParallel or WdfIoQueueDispatchSequential If the queue’s serialization scope is not WdfSynchronizationScopeNone, a lock is identified. The framework examines the number of requests in progress from the queue

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 Alternatively, a driver might need to create and send one or more requests to another driver Synchronousl Asynchronously, Specifying a Completion Routine Asynchronously, Without Specifying a Completion Routine.

Driver's Interrupt Event Callback Executes Running at device IRQL has several consequences for the driver: Other system processes are blocked when the interrupt event callback executes, due to its high IRQL. Therefore, the amount of processing performed in this routine should be kept to a minimum. Very few KMDF or system functions can be called from the driver’s interrupt event callback, again due to its high IRQL. For example, a driver cannot call WdfRequestComplete from its interrupt event callback, because this function must be called at IRQL DISPATCH_LEVEL or below.

Driver's Interrupt Event Callback Executes The typical KMDF driver performs four basic actions in its interrupt event callback: Ensures that its device is interrupting. Saves the reason for the interrupt and/or data from the interrupt. Acknowledges the interrupt. f additional work is required, requests a callback to its DpcForIsr

Summary This paper describes the major steps that an I/O request from user mode takes as it is processed by Windows, with the goal of helping you understand the overall flow of an I/O request through the system. This paper also describes the major steps that a KMDF driver takes to process a WDFREQUEST. These steps are defined by the device type, driver design, WDFQUEUE and dispatching configuration and the device’s synchronization scope.

心得 目前Windows系統支援最廣的驅動程式模型,是「視窗驅動模型」(Windows Driver Model,WDM)。 視窗驅動模型提供了包括非同步輸入輸出、分層式驅動程式、隨插即用、電源管理、視窗管理規範(Windows Management Instrumentation,WMI)等豐富的功能。目前的Windows也針對不同類型的裝置(例如儲存裝置、網路裝置、音效裝置等),使用共通的驅動程式模型(稱為device-class specific driver models)。不同類型的裝置,先由微軟設計出共通驅動程式模型中的port driver,再由硬體廠商負責設計miniport driver,port driver和miniport driver則為周邊裝置提供完整的驅動力。這種驅動程式模型大大簡化了硬體廠商開發驅動程式的負擔,也縮短了廠商開發的時間。 Reference : http://www.windowstore.com.tw/www/trainning/trainning45.aspx