|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-FBE6E61F-5A2E-5A7A-BC59-51F072EBED7D" xml:lang="en"><title>Media |
|
13 Driver Migration Guide</title><shortdesc>Describes the issues that need to be considered, when migrating |
|
14 media drivers to a writable data demand paging environment. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <section id="GUID-AB10DA2D-B7CC-47FD-B68A-1610B6BEAAE6"><title>Purpose</title> <p>This |
|
16 document explains the points that have to be considered when migrating existing |
|
17 media drivers to a writable data paging environment. </p> </section> |
|
18 <section id="GUID-EB26A48A-3A34-44E8-9651-C7ED658CED51"><title>Issues Involved</title> <p>The |
|
19 two main issues that have to be addressed when migrating existing media drivers |
|
20 are: </p> <ul> |
|
21 <li id="GUID-68A44C67-6D4E-5D7E-A13B-0A82154073B2"><p>A deadlock condition |
|
22 can occur between the driver and the client process, where both are trying |
|
23 to access the same page of paged memory</p> </li> |
|
24 <li><p>A deadlock condition can occur between the driver and the client process, |
|
25 where the client is allocating on the kernel heap, the paging system tries |
|
26 to page out some data and the media driver also tries to allocate on the kernel |
|
27 heap while servicing the resulting request.</p></li> |
|
28 <li id="GUID-56A3815D-E07B-5195-85C3-0B93C08745C3"><p>Unpredictable delays |
|
29 in servicing a DFC can occur, since memory might need to be paged in.</p> </li> |
|
30 </ul> <p>To address the above issues, the following points will have to be |
|
31 considered/undertaken: </p> <ul> |
|
32 <li id="GUID-A15DB387-AB22-51BB-A4AD-0353932B788C"><p>Pass data by value to |
|
33 DoRequest/DoControl </p> </li> |
|
34 <li id="GUID-0FB5B141-94FE-54E4-9915-2DD50F840879"><p>Return results by using |
|
35 a return code </p> </li> |
|
36 <li id="GUID-9B3D3D25-010E-58C3-9C48-13AF494C3E62"><p>Use of a dedicated DFC |
|
37 queue </p> </li> |
|
38 <li id="GUID-AADA0BD7-75E7-5A11-98EB-F7EF3E1B5139"><p>Determine if unpredictable |
|
39 delays in servicing DFCs are acceptable </p> </li> |
|
40 <li id="GUID-E5B45EC9-DF21-51A9-814C-17CF3C13DFAE"><p>Validate the arguments |
|
41 in the client context as far as possible </p> </li> |
|
42 <li id="GUID-E6E4F7E2-1BE4-5590-AB05-777637C9B32B"><p>Move user memory accesses |
|
43 to client context where possible </p> </li> |
|
44 <li id="GUID-F4B44B27-9AE6-5A8C-B88C-C1809DAF6B89"><p>Replace the use of small |
|
45 fixed-size structures with the use of the TClientDataRequest object </p> </li> |
|
46 <li id="GUID-990D43F2-21C3-5C55-AC13-89C7153EA83B"><p>Pin user memory accessed |
|
47 from DFCs </p><p>Do not allocate on the kernel heap while handling page out |
|
48 requests.</p> <p>The paging algorithm can be over ridden and pages of memory |
|
49 can be kept in memory (pinned). This situation can be reversed by 'unpinning' |
|
50 the page. The TClientBufferRequest API provides this functionality. </p> </li> |
|
51 <li id="GUID-67DB522A-DEB2-5FEA-ACA4-D80D09D80926"><p>Re-write the driver |
|
52 to use shared chunks </p> </li> |
|
53 <li id="GUID-A298C045-2260-55B5-89B9-595E3AF5472F"><p>No fast mutex may be |
|
54 held when calling APIs that access user memory </p> </li> |
|
55 <li id="GUID-F9F79078-0CBC-5E8F-899F-117D148C605A"><p>No kernel mutex may |
|
56 be held </p> </li> |
|
57 <li id="GUID-D378D276-CAF0-5B8B-BDA2-4D18EB87F96A"><p>Use the new APIs, (See |
|
58 the <xref href="GUID-592B6D20-4ABA-5C79-9734-D18E2CE4A86C.dita">Writable Data Paging |
|
59 Overview</xref> ). </p> </li> |
|
60 </ul> </section> |
|
61 <section id="GUID-32E564F3-D66A-472B-A3C1-D2D61807A5F2"><title>See |
|
62 also</title> <ul> |
|
63 <li id="GUID-77417650-C1F4-5ABC-9E75-54D274556FCD"><p> <xref href="GUID-E7C55048-5B7A-5BF2-B7F4-4D731659B88C.dita">Device |
|
64 Driver Writing and Migration Guide</xref> </p> <p>This document explains |
|
65 techniques for writing device drivers on data paged systems and migrating |
|
66 device drivers to data paged systems. </p> </li> |
|
67 </ul> </section> |
|
68 </conbody></concept> |