Wdd-Ebook.Pdf

Total Page:16

File Type:pdf, Size:1020Kb

Wdd-Ebook.Pdf The illumos Writing Device Drivers Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more U.S. patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights – Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. This distribution may include materials developed by third parties. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, the Solaris logo, the Java Coffee Cup logo, docs.sun.com, Java, and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. or its subsidiaries in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun™ Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. Products covered by and information contained in this publication are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical or biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited. DOCUMENTATION IS PROVIDED “AS IS” AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTA- TIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. Copyright © 2008 Sun Microsystems, Inc. Contents Contents i List of Figures xvii List of Tables xviii I Designing Device Drivers for the illumos Platform1 1 Overview of illumos Device Drivers5 1.1 Device Driver Basics . .5 What Is a Device Driver? . .5 What Is a Device Driver Entry Point? . .6 1.2 Device Driver Entry Points . .6 Entry Points Common to All Drivers . .7 Device Access Entry Points . .7 Loadable Module Entry Points . .7 Autoconfiguration Entry Points . .7 Kernel Statistics Entry Points . .8 Power Management Entry Point . .8 Summary of Common Entry Points . .8 Entry Points for Block Device Drivers . 10 Entry Points for Character Device Drivers . 11 Entry Points for STREAMS Device Drivers . 12 Entry Points for Memory Mapped Devices . 13 Entry Points for the Generic LAN Device (GLD) Driver . 14 Entry Points for SCSI HBA Drivers . 14 Entry Points for PC Card Drivers . 16 1.3 Considerations in Device Driver Design . 16 DDI/DKI Facilities . 16 Device IDs . 16 Device Properties . 16 Interrupt Handling . 17 Callback Functions . 17 Software State Management . 17 Programmed I/O Device Access . 18 Direct Memory Access (DMA) . 18 Layered Driver Interfaces . 18 Driver Context . 18 i CONTENTS Returning Errors . 19 Dynamic Memory Allocation . 19 Hotplugging . 20 2 illumos Kernel and Device Tree 21 2.1 What Is the Kernel? . 21 Multithreaded Execution Environment . 22 Virtual Memory . 23 Devices as Special Files . 23 DDI/DKI Interfaces . 23 2.2 Overview of the Device Tree . 24 Device Tree Components . 24 Displaying the Device Tree . 25 libdevinfo Library . 26 prtconf Command . 26 /devices Directory . 27 Binding a Driver to a Device . 28 Generic Device Names . 28 3 Multithreading 31 3.1 Locking Primitives . 31 Storage Classes of Driver Data . 31 Mutual-Exclusion Locks . 32 Setting Up Mutexes . 32 Using Mutexes . 32 Readers/Writer Locks . 33 Semaphores . 33 3.2 Thread Synchronization . 34 Condition Variables in Thread Synchronization . 34 Initializing Condition Variables . 34 Waiting for the Condition . 35 Signaling the Condition . 35 cv_wait and cv_timedwait Functions . 36 cv_wait_sig Function . 37 cv_timedwait_sig Function . 37 3.3 Choosing a Locking Scheme . 37 Potential Locking Pitfalls . 38 Threads Unable to Receive Signals . 38 4 Properties 41 4.1 Device Properties . 41 Device Property Names . 42 Creating and Updating Properties . 42 Looking Up Properties . 42 prop_op Entry Point . 44 5 Managing Events and Queueing Tasks 47 5.1 Managing Events . 47 Introduction to Events . 47 ii Contents Using ddi_log_sysevent to Log Events . 48 ddi_log_sysevent Syntax . 48 Sample Code for Logging Events . 49 Defining Event Attributes . 50 5.2 Queueing Tasks . 53 Introduction to Task Queues . 53 Task Queue Interfaces . 54 Using Task Queues . 55 Observing Task Queues . 55 Task Queue Kernel Statistics Counters . 55 Task Queue DTrace SDT Probes . 56 6 Driver Autoconfiguration 59 6.1 Driver Loading and Unloading . 59 6.2 Data Structures Required for Drivers . 60 modlinkage Structure . 60 modldrv Structure . 61 dev_ops Structure . 61 cb_ops Structure . 62 6.3 Loadable Driver Interfaces . ..
Recommended publications
  • Updating Systems and Adding Software in Oracle® Solaris 11.4
    Updating Systems and Adding Software ® in Oracle Solaris 11.4 Part No: E60979 November 2020 Updating Systems and Adding Software in Oracle Solaris 11.4 Part No: E60979 Copyright © 2007, 2020, Oracle and/or its affiliates. License Restrictions Warranty/Consequential Damages Disclaimer This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. Warranty Disclaimer The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. Restricted Rights Notice If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software, any programs embedded, installed or activated on delivered hardware, and modifications of such programs) and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end users are "commercial
    [Show full text]
  • Oracle Solaris Administration IP Services
    Oracle® Solaris Administration: IP Services Part No: 821–1453–11 March 2012 Copyright © 1999, 2012, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT END USERS. Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including anyoperating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government. This software or hardware is developed for general use in a variety of information management applications.
    [Show full text]
  • Solaris 10 End of Life
    Solaris 10 end of life Continue Oracle Solaris 10 has had an amazing OS update, including ground features such as zones (Solaris containers), FSS, Services, Dynamic Tracking (against live production operating systems without impact), and logical domains. These features have been imitated in the market (imitation is the best form of flattery!) like all good things, they have to come to an end. Sun Microsystems was acquired by Oracle and eventually, the largest OS known to the industry, needs to be updated. Oracle has set a retirement date of January 2021. Oracle indicated that Solaris 10 systems would need to raise support costs. Oracle has never provided migratory tools to facilitate migration from Solaris 10 to Solaris 11, so migration to Solaris has been slow. In September 2019, Oracle decided that extended support for Solaris 10 without an additional financial penalty would be delayed until 2024! Well its March 1 is just a reminder that Oracle Solaris 10 is getting the end of life regarding support if you accept extended support from Oracle. Combined with the fact gdpR should take effect on May 25, 2018 you want to make sure that you are either upgraded to Solaris 11.3 or have taken extended support to obtain any patches for security issues. For more information on tanningix releases and support dates of old and new follow this link ×Sestive to abort the Unix Error Operating System originally developed by Sun Microsystems SolarisDeveloperSun Microsystems (acquired by Oracle Corporation in 2009)Written inC, C'OSUnixWorking StateCurrentSource ModelMixedInitial release1992; 28 years ago (1992-06)Last release11.4 / August 28, 2018; 2 years ago (2018-08-28)Marketing targetServer, PlatformsCurrent: SPARC, x86-64 Former: IA-32, PowerPCKernel typeMonolithic with dynamically downloadable modulesDefault user interface GNOME-2-LicenseVariousOfficial websitewww.oracle.com/solaris Solaris is the own operating system Of Unix, originally developed by Sunsystems.
    [Show full text]
  • Solaris-Cluster-Businesscontinuity-168285.Pdf
    An Oracle White Paper September 2010 Oracle Solaris and Oracle Solaris Cluster: Extending Oracle Solaris for Business Continuity Oracle White Paper— Oracle Solaris and Oracle Solaris Cluster: Extending Oracle Solaris for Business Continuity Executive Summary.............................................................................1 Introduction..........................................................................................3 Traditional Solution Components ....................................................5 Oracle Solaris Cluster for Business Continuity....................................6 Oracle Solaris Cluster......................................................................6 Introduction—Basic Clustering ........................................................8 Data Availability .............................................................................10 Applications Availability .................................................................11 Network Availability .......................................................................12 Virtualization and Oracle Solaris Cluster .......................................13 Disaster Recovery—Campus and Beyond ....................................16 A Single HA and DR Solution for Multitier Oracle Applications and Databases ..........................................................17 Oracle Solaris ....................................................................................19 Resource Management .................................................................19
    [Show full text]
  • Adventures with Illumos
    > Adventures with illumos Peter Tribble Theoretical Astrophysicist Sysadmin (DBA) Technology Tinkerer > Introduction ● Long-time systems administrator ● Many years pointing out bugs in Solaris ● Invited onto beta programs ● Then the OpenSolaris project ● Voted onto OpenSolaris Governing Board ● Along came Oracle... ● illumos emerged from the ashes > key strengths ● ZFS – reliable and easy to manage ● Dtrace – extreme observability ● Zones – lightweight virtualization ● Standards – pretty strict ● Compatibility – decades of heritage ● “Solarishness” > Distributions ● Solaris 11 (OpenSolaris based) ● OpenIndiana – OpenSolaris ● OmniOS – server focus ● SmartOS – Joyent's cloud ● Delphix/Nexenta/+ – storage focus ● Tribblix – one of the small fry ● Quite a few others > Solaris 11 ● IPS packaging ● SPARC and x86 – No 32-bit x86 – No older SPARC (eg Vxxx or SunBlades) ● Unique/key features – Kernel Zones – Encrypted ZFS – VM2 > OpenIndiana ● Direct continuation of OpenSolaris – Warts and all ● IPS packaging ● X86 only (32 and 64 bit) ● General purpose ● JDS desktop ● Generally rather stale > OmniOS ● X86 only ● IPS packaging ● Server focus ● Supported commercial offering ● Stable components can be out of date > XStreamOS ● Modern variant of OpenIndiana ● X86 only ● IPS packaging ● Modern lightweight desktop options ● Extra applications – LibreOffice > SmartOS ● Hypervisor, not general purpose ● 64-bit x86 only ● Basis of Joyent cloud ● No inbuilt packaging, pkgsrc for applications ● Added extra features – KVM guests – Lots of zone features –
    [Show full text]
  • Hardware-Driven Evolution in Storage Software by Zev Weiss A
    Hardware-Driven Evolution in Storage Software by Zev Weiss A dissertation submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy (Computer Sciences) at the UNIVERSITY OF WISCONSIN–MADISON 2018 Date of final oral examination: June 8, 2018 ii The dissertation is approved by the following members of the Final Oral Committee: Andrea C. Arpaci-Dusseau, Professor, Computer Sciences Remzi H. Arpaci-Dusseau, Professor, Computer Sciences Michael M. Swift, Professor, Computer Sciences Karthikeyan Sankaralingam, Professor, Computer Sciences Johannes Wallmann, Associate Professor, Mead Witter School of Music i © Copyright by Zev Weiss 2018 All Rights Reserved ii To my parents, for their endless support, and my cousin Charlie, one of the kindest people I’ve ever known. iii Acknowledgments I have taken what might be politely called a “scenic route” of sorts through grad school. While Ph.D. students more focused on a rapid graduation turnaround time might find this regrettable, I am glad to have done so, in part because it has afforded me the opportunities to meet and work with so many excellent people along the way. I owe debts of gratitude to a large cast of characters: To my advisors, Andrea and Remzi Arpaci-Dusseau. It is one of the most common pieces of wisdom imparted on incoming grad students that one’s relationship with one’s advisor (or advisors) is perhaps the single most important factor in whether these years of your life will be pleasant or unpleasant, and I feel exceptionally fortunate to have ended up iv with the advisors that I’ve had.
    [Show full text]
  • Oracle Solaris and Veritas Cluster
    Oracle Solaris and Veritas Cluster An Easy-build Guide Vijay Shankar Upreti Oracle Solaris and Veritas Cluster: An Easy-build Guide Copyright © 2016 by Vijay Shankar Upreti This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law. ISBN-13 (pbk): 978-1-4842-1832-7 ISBN-13 (electronic): 978-1-4842-1833-4 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
    [Show full text]
  • Oracle Solaris 11 Express What's
    ORACLE SOLARIS 11 EXPRESS 2010.11 | WHAT’S NEW ORACLE SOLARIS 11 EXPRESS 2010.11 WHAT’S NEW Oracle Solaris is the industry leading operating system for the enterprise. Oracle Solaris 11 Express 2010.11 raises the bar on the innovation introduced in Oracle Solaris 10, with a unique feature set NEW FEATURE HIGHLIGHTS that few other operating systems can offer. Oracle Solaris 11 Express 2010.11 has been tested and • Oracle Solaris 10 Zones for business optimized for Oracle hardware and software, and is an integral part of Oracle's combined hardware investment protection and software portfolio. • Built-in network virtualization and resource Oracle Solaris 11 Express 2010.11 provides customers with the latest access to Oracle Solaris 11 management for enhanced server workload technology, allowing developers, architects and administrators to test and deploy within an consolidation enterprise environments and greatly simplify their day to day operations. Oracle Solaris 11 Express 2010.11 has the reliability, availability, and serviceability that you'd expect from a leading • Greatly reduced planned and unplanned downtime with new package management tools enterprise operating system. with safe system upgrade With new features such as network based package management tools to greatly decrease planned • New optimizations and features designed to system downtime and provide for a completely safe system upgrade, built-in network virtualization deliver proven scalability and reliability as an and resource control management for an unprecedented level of flexibility for application integrated component of Oracle's Exadata and consolidation, and on-disk ZFS encryption to provide the highest levels of security in your data Exalogic systems center, Oracle Solaris 11 Express 2010.11 is the most exciting release of the Oracle Solaris platform to date.
    [Show full text]
  • Deploying Highly Available Zones with Solaris Cluster 3.2
    Deploying highly available zones with Solaris Cluster 3.2 http://prefetch.net/blog/index.php/2009/04/10/deploying-high... BLOG O’ MATTY HOME BLOG HOME ARTICLES CODE PRESENTATIONS Deploying highly available zones with Solaris Cluster 3.2 Recommended Books I discussed my first impressions of Solaris Cluster 3.2 a while back, and have been using it in various capacities ever since. One thing that I really like about Solaris Cluster is its ability to manage resources running in zones, and fail these resources over to other zones running on the same host, or a zone running on a secondary host. Additionally, Solaris Cluster allows you to migrate zones between nodes, which can be quite handy when resources are tied to a zone and can’t be managed as a scalable services. Configuring zone failover is a piece of cake, and I will describe how to do it in this blog post. To get failover working, you will first need to download and install Solaris Cluster 3.2. You can grab the binaries from sun.com, and you can install them using the installer script that comes in the zip file: $ unzip suncluster_3_2u2-ga-solaris-x86.zip $ cd Solaris_x86 $ ./installer Once you run through the installer, the binaries should be placed in /usr/cluster, and you should be ready to configure the cluster. Prior to doing so, you should add something similar to the following to /etc/profile to make life easier for cluster administrators: PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/sfw/bin:/usr/cluster/bin export PATH TERM=vt100 export TERM Also, if you selected the disabled remote services option during the Solaris install, you should reconfigure the rpc/bind service to allow connections from other cluster members (Solaris Cluster uses RPC extensively for cluster communications).
    [Show full text]
  • The Rise & Development of Illumos
    Fork Yeah! The Rise & Development of illumos Bryan Cantrill VP, Engineering [email protected] @bcantrill WTF is illumos? • An open source descendant of OpenSolaris • ...which itself was a branch of Solaris Nevada • ...which was the name of the release after Solaris 10 • ...and was open but is now closed • ...and is itself a descendant of Solaris 2.x • ...but it can all be called “SunOS 5.x” • ...but not “SunOS 4.x” — thatʼs different • Letʼs start at (or rather, near) the beginning... SunOS: A peopleʼs history • In the early 1990s, after a painful transition to Solaris, much of the SunOS 4.x engineering talent had left • Problems compounded by the adoption of an immature SCM, the Network Software Environment (NSE) • The engineers revolted: Larry McVoy developed a much simpler variant of NSE called NSElite (ancestor to git) • Using NSElite (and later, TeamWare), Roger Faulkner, Tim Marsland, Joe Kowalski and Jeff Bonwick led a sufficiently parallelized development effort to produce Solaris 2.3, “the first version that worked” • ...but with Solaris 2.4, management took over day-to- day operations of the release, and quality slipped again Solaris 2.5: Do or die • Solaris 2.5 absolutely had to get it right — Sun had new hardware, the UltraSPARC-I, that depended on it • To assure quality, the engineers “took over,” with Bonwick installed as the gatekeeper • Bonwick granted authority to “rip it out if itʼs broken" — an early BDFL model, and a template for later generations of engineering leadership • Solaris 2.5 shipped on schedule and at quality
    [Show full text]
  • April 2006 Volume 31 Number 2
    APRIL 2006 VOLUME 31 NUMBER 2 THE USENIX MAGAZINE OPINION Musings RIK FARROW OpenSolaris:The Model TOM HAYNES PROGRAMMING Code Testing and Its Role in Teaching BRIAN KERNIGHAN Modular System Programming in MINIX 3 JORRIT N. HERDER, HERBERT BOS, BEN GRAS, PHILIP HOMBURG, AND ANDREW S. TANENBAUM Some Types of Memory Are More Equal Than Others DIOMEDIS SPINELLIS Simple Software Flow Analysis Using GNU Cflow CHAOS GOLUBITSKY Why You Should Use Ruby LU KE KANIES SYSADMIN Unwanted HTTP:Who Has the Time? DAVI D MALONE Auditing Superuser Usage RANDOLPH LANGLEY C OLUMNS Practical Perl Tools:Programming, Ho Hum DAVID BLANK-EDELMAN VoIP Watch HEISON CHAK /dev/random ROBERT G. FERRELL STANDARDS USENIX Standards Activities NICHOLAS M. STOUGHTON B O OK REVIEWS Book Reviews ELIZABETH ZWICKY, WITH SAM STOVER AND RI K FARROW USENIX NOTES Letter to the Editor TED DOLOTTA Fund to Establish the John Lions Chair C ONFERENCES LISA ’05:The 19th Large Installation System Administration Conference WORLDS ’05: Second Workshop on Real, Large Distributed Systems FAST ’05: 4th USENIX Conference on File and Storage Technologies The Advanced Computing Systems Association Upcoming Events 3RD SYMPOSIUM ON NETWORKED SYSTEMS 2ND STEPS TO REDUCING UNWANTED TRAFFIC ON DESIGN AND IMPLEMENTATION (NSDI ’06) THE INTERNET WORKSHOP (SRUTI ’06) Sponsored by USENIX, in cooperation with ACM SIGCOMM JULY 6–7, 2006, SAN JOSE, CA, USA and ACM SIGOPS http://www.usenix.org/sruti06 MAY 8–10, 2006, SAN JOSE, CA, USA Paper submissions due: April 20, 2006 http://www.usenix.org/nsdi06 2006
    [Show full text]
  • High Availability for Business-Critical IT Services Using Oracle's SPARC
    An Oracle White Paper April 2011 High Availability for Business-Critical IT Services Using Oracle’s SPARC Enterprise M-Series Servers Oracle White Paper— High Availability for Business-Critical IT Services Using Oracle’s SPARC Enterprise M-Series Servers Executive Overview ............................................................................ 1 Introduction ......................................................................................... 1 Oracle’s Comprehensive Approach to Availability .............................. 4 Systems with Mainframe-Class Reliability ...................................... 4 Training and Professional Services ................................................ 5 Process Automation ........................................................................ 5 Minimizing Planned Downtime ............................................................ 5 Dynamic Domains ........................................................................... 6 Online Reconfiguration, Maintenance, and Upgrades .................... 9 Reducing Unplanned Downtime ....................................................... 11 Built-in Hardware Redundancy ..................................................... 11 Configuring Additional System Redundancy................................. 16 Advanced Reliability Features ...................................................... 18 Additional Error Detection, Diagnosis, and Recovery Features .... 24 Maximizing IT Service Stability ......................................................... 26 Oracle
    [Show full text]