IA-64 Linux Kernel: Design And Implementation

Paperback | January 30, 2002

byDavid Mosberger, Stephane Eranian

not yet rated|write a review
The IA-64 Linux kernel makes extraordinary power available to every Linux developer. In IA-64 Linux Kernel: Design and Implementation, the kernel project's leaders systematically present every major subsystem, introducing interfaces used by Linux to abstract platform differences, showing how these interfaces are used in IA-64, and illuminating key issues associated with Linux kernel operation on any platform. Covers processes, tasks, threads, virtual memory, I/O, symmetric multiprocessing, bootstrapping, and more.

Pricing and Purchase Info

$76.12

In stock online
Ships free on orders over $25
HURRY, ONLY 1 LEFT!

From the Publisher

The IA-64 Linux kernel makes extraordinary power available to every Linux developer. In IA-64 Linux Kernel: Design and Implementation, the kernel project's leaders systematically present every major subsystem, introducing interfaces used by Linux to abstract platform differences, showing how these interfaces are used in IA-64, and illu...

From the Jacket

The authoritative guide to the IA-64 Linux kernel implementation. Authoritative and complete description of the Linux kernel for IA-64/IPF (Itanium Processor Family) Provides an in-depth discussion of the ideas and concepts behind the Linux hardware abstraction interfaces, the IA-64 design space, and their actual realization From the ...

DAVID MOSBERGER is a Senior Research Scientist at HP Labs. In early 1998, he founded the project to bring Linux to the IA-64 platform, later developing the first IA-64 version of the GNU C compiler and GNU toolchain. He has been serving as lead architect, developer, and gatekeeper of the IA-64 Linux kernel source code. STÉPHANE ERANI...
Format:PaperbackPublished:January 30, 2002Publisher:Pearson EducationLanguage:English

The following ISBNs are associated with this title:

ISBN - 10:0130610143

ISBN - 13:9780130610140

Customer Reviews of IA-64 Linux Kernel: Design And Implementation

Reviews

Extra Content

From the Author

PREFACEThis book grew out of the simple desire to describe exactly how Linux works on an IA64 machine. By realizing that desire, we hope not only to shine a light on the inner workings of Linux, but also to share some of the excitement and the creative processes that are involved in solving the many technical challenges that arise when designing an operating system for a platform as radical and innovative as IA64. Many of the innovations in IA64 are targeted at increasing performance by giving a compiler more control over the CPU. However, as we see in this book, IA64 also comes with a powerful system architecture which supports—indeed encourages—innovative solutions at the operatingsystem level.Linux is a nononsense operating system, sticking to tried and true principles whenever possible. At the same time, Linux has always been able to adapt quickly to genuine advances in hardware and operatingsystem technology. Thus, while we believe that the design and implementation described in this book provide a solid foundation, we also believe that there is plenty of room for improvement. In this sense, we hope to encourage research and development around this platform. Of course, the fact that Linux is an Open Source operating system also helps make it an ideal test bed for exploring new ideas. Unlike more speculative operating systems, Linux offers the opportunity to turn truly inspired solutions into practice almost overnight.Given that the Linux source code is freely available, some people may wonder whether it would not be possible to learn Linux and its IA64 implementation directly from reading the source code. It is true that the source code contains the most precise description of how Linux works, but too much precision sometimes hurts: it can make us see all the trees but miss the forest. Source code also can explain only how things are done, not why they are done in a particular way. This book is designed to compensate for these shortcomings. When introducing a new topic, we start at a high level, describing the ideas, principles, and motivations for the approaches taken by Linux. Then we describe the hardware abstraction interfaces used by Linux and, finally, their IA64 implementations. Throughout these discussions, the focus is always on what needs to be accomplished. How they are accomplished is described also, but at a sufficiently high level that avoids drowning a reader in details. This implies that this book can be used in two primary ways: readers mainly interested in an overview of Linux/ia64 find a selfcontained and authoritative description. Readers interested in gaining handson experience find a smooth introduction to the world of Linux/ia64 and the underlying source code. To assist with the latter, the descriptions in this book have embedded in them pointers to key pieces of the Linux source code. Those pointers tend to be most accurate for Linux kernel version v2.4.14, though they also apply to earlier and later versions.INTENDED AUDIENCEThis book is primarily targeted at professionals interested in learning more about how the Linux kernel works on IA64. In addition, hardware architects may find the book useful as a case study of how one particular operating system takes advantage of IA64. Similarly, software architects interested in designing other operating systems for IA64 will find many tips on how to handle some of the more advanced features of IA64. For example, the book discusses the operatingsystem impact of speculative execution, the register stack, and the virtual hash page table walker. Finally, students in the area of Computer Science and Engineering may find the book interesting as a description of how a real, generalpurpose operating system works on real hardware.Among the Linux professionals, the book should be of most direct value to general kernel programmers, authors of device drivers, and application programmers interested in tuning performance for IA64. Beyond that, the descriptions of the Linux hardware abstraction interfaces are valid independently of the target platform. We believe that the interface descriptions in this book are among the most accurate and most comprehensive descriptions in existence. But we should caution that these interfaces were developed by a large group of developers over a long period of time and, to some degree, they continue to evolve. For that reason, we cannot claim that the descriptions are authoritative beyond the IA64 platform, though we did try to make them as inclusive as possible.Knowledge of the C programming language is a prerequisite for this book. Familiarity with basic operatingsystem concepts, assembly programming, and the machine organization of computers are also helpful, though not strictly required. No prior knowledge of IA64 is needed.ORGANIZATIONThe first two chapters of this book contain introductory material. Chapter 1, Introduction, provides background information on the evolution of both microprocessor architectures and Linux. The second half of the chapter is dedicated to an overview of the Linux kernel. As part of this overview, we also establish the terminology used throughout the remainder of the book.Chapter 2, IA64 Architecture, introduces the IA64 architecture and software conventions. IA64 is a rich architecture that cannot be learned overnight. Because of this, we recommend that this chapter first be read in a fluid fashion, without undue attention to details. Once a basic familiarity has been established, the reader may then want to revisit the chapter from time to time and study specific aspects in more detail.The next three chapters describe the most fundamental components of Linux and how they work on IA64: Chapter 3, Processes, Tasks, and Threads, describes aspects related to scheduling and execution. It starts with an overview of key data structures, then moves on to describe the Linux thread interface and the various synchronization primitives that Linux supports. Chapter 4, Virtual Memory, describes the virtual memory system of Linux. A brief introduction is followed by detailed descriptions of all hardware abstraction interfaces and their IA64 implementations. Topics covered include the Linux page tables, linearlymapped virtual page tables, TLB (translation lookaside buffer) management, page fault handling, and memory coherency. Chapter 5, Kernel Entry and Exit, describes all aspects related to entering and exiting the kernel. In particular, it explains how system calls and signals work, as well as how data is passed across the user/kernel boundary. Like the preceding two chapters, this one starts by describing the Linux aspects that apply to all platforms and completes the discussion with descriptions of the IA64 implementations.The next three chapters are fairly independent of each other. Chapter 6, Stack Unwinding, discusses the general topic of stack unwinding. While the topic is not really IA64 specific, it does play a more important role on this platform. Indeed, anyone wishing to write IA64 assembly code needs to be familiar with the material presented in the third section of this chapter. The other sections describe the IA64 kernel unwinder and its implementation. Chapter 7, Device I/O, describes aspects related to device input/output (I/O). Specifically, it covers the hardware abstraction interfaces for programmed I/O (both memorymapped and portbased), DMA (direct memory access), and device interrupts. The interface descriptions are followed by descriptions of their IA64 realizations. Chapter 8, Symmetric Multiprocessing, discusses aspects specific to multiprocessor (MP) machines. Where appropriate, the other chapters cover MP aspects in the course of normal discussion, but this chapter covers all remaining issues. In particular, the first section provides an overview of the Linux locking principles and the MP support interface. The remaining two sections cover the handling of CPUspecific data areas and the issue of maintaining highresolution timestamps on MP machines.The final three chapters are mostly IA64 specific. Chapter 9, Understanding System Performance, introduces the IA64 performance monitoring support, its Itanium implementation, and the associated perfmon kernel subsystem. This chapter should be of great value to anyone interested in characterizing and tuning the performance of IA64 programs, whether the programs are normal applications or part of the Linux kernel. Chapter 10, Booting, covers all aspects related to booting a machine. The first two sections contain an overview of the IA64 firmware and the IA64 bootloader. The third section covers the Linux bootstrap interface and its implementation on IA64. Chapter 11, IA32 Compatibility, describes how Linux/ia64 manages to provide backward compatibility with IA32. By its very nature, this discussion is IA64 specific. However, most 64bit Linux platforms provide backward compatibility with some 32bit platform. For this reason, many of the topics and solutions discussed here apply to other platforms as well.A glossary of terms and abbreviations used in this book is provided in Appendix E. We would like to encourage the reader to refer to it whenever encountering an acronym that may seem unfamiliar. PROVIDING FEEDBACKWhile we strived to make this book as interesting, useful, and accurate as possible, we encourage our readers to provide feedback on how to improve future editions. For this purpose, we set up a web site at the following address (URL):http://www.lia64.org/book/Please visit this site to report errors or to make suggestions for improvements. The web site also contains an uptodate errata, links to related software and tools, and a summary of the evolution of Linux as it pertains to this book.David Mosberger and Stéphane EranianPalo Alto, CaliforniaNovember, 2001

Read from the Book

PREFACE This book grew out of the simple desire to describe exactly how Linux works on an IA-64 machine. By realizing that desire, we hope not only to shine a light on the inner workings of Linux, but also to share some of the excitement and the creative processes that are involved in solving the many technical challenges that arise when designing an operating system for a platform as radical and innovative as IA-64. Many of the innovations in IA-64 are targeted at increasing performance by giving a compiler more control over the CPU. However, as we see in this book, IA-64 also comes with a powerful system architecture which supports—indeed encourages—innovative solutions at the operating-system level. Linux is a no-nonsense operating system, sticking to tried and true principles whenever possible. At the same time, Linux has always been able to adapt quickly to genuine advances in hardware and operating-system technology. Thus, while we believe that the design and implementation described in this book provide a solid foundation, we also believe that there is plenty of room for improvement. In this sense, we hope to encourage research and development around this platform. Of course, the fact that Linux is an Open Source operating system also helps make it an ideal test bed for exploring new ideas. Unlike more speculative operating systems, Linux offers the opportunity to turn truly inspired solutions into practice almost overnight. Given that the Linux source code is freely available, some people may wonder whether it would not be possible to learn Linux and its IA-64 implementation directly from reading the source code. It is true that the source code contains the most precise description of how Linux works, but too much precision sometimes hurts: it can make us see all the trees but miss the forest. Source code also can explain only how things are done, not why they are done in a particular way. This book is designed to compensate for these shortcomings. When introducing a new topic, we start at a high level, describing the ideas, principles, and motivations for the approaches taken by Linux. Then we describe the hardware abstraction interfaces used by Linux and, finally, their IA-64 implementations. Throughout these discussions, the focus is always on what needs to be accomplished. How they are accomplished is described also, but at a sufficiently high level that avoids drowning a reader in details. This implies that this book can be used in two primary ways: readers mainly interested in an overview of Linux/ia64 find a self-contained and authoritative description. Readers interested in gaining hands-on experience find a smooth introduction to the world of Linux/ia64 and the underlying source code. To assist with the latter, the descriptions in this book have embedded in them pointers to key pieces of the Linux source code. Those pointers tend to be most accurate for Linux kernel version v2.4.14, though they also apply to earlier and later versions. INTENDED AUDIENCE This book is primarily targeted at professionals interested in learning more about how the Linux kernel works on IA-64. In addition, hardware architects may find the book useful as a case study of how one particular operating system takes advantage of IA-64. Similarly, software architects interested in designing other operating systems for IA-64 will find many tips on how to handle some of the more advanced features of IA-64. For example, the book discusses the operating-system impact of speculative execution, the register stack, and the virtual hash page table walker. Finally, students in the area of Computer Science and Engineering may find the book interesting as a description of how a real, general-purpose operating system works on real hardware. Among the Linux professionals, the book should be of most direct value to general kernel programmers, authors of device drivers, and application programmers interested in tuning performance for IA-64. Beyond that, the descriptions of the Linux hardware abstraction interfaces are valid independently of the target platform. We believe that the interface descriptions in this book are among the most accurate and most comprehensive descriptions in existence. But we should caution that these interfaces were developed by a large group of developers over a long period of time and, to some degree, they continue to evolve. For that reason, we cannot claim that the descriptions are authoritative beyond the IA-64 platform, though we did try to make them as inclusive as possible. Knowledge of the C programming language is a prerequisite for this book. Familiarity with basic operating-system concepts, assembly programming, and the machine organization of computers are also helpful, though not strictly required. No prior knowledge of IA-64 is needed. ORGANIZATION The first two chapters of this book contain introductory material. Chapter 1, Introduction, provides background information on the evolution of both microprocessor architectures and Linux. The second half of the chapter is dedicated to an overview of the Linux kernel. As part of this overview, we also establish the terminology used throughout the remainder of the book. Chapter 2, IA-64 Architecture, introduces the IA-64 architecture and software conventions. IA-64 is a rich architecture that cannot be learned overnight. Because of this, we recommend that this chapter first be read in a fluid fashion, without undue attention to details. Once a basic familiarity has been established, the reader may then want to revisit the chapter from time to time and study specific aspects in more detail. The next three chapters describe the most fundamental components of Linux and how they work on IA-64: Chapter 3, Processes, Tasks, and Threads, describes aspects related to scheduling and execution. It starts with an overview of key data structures, then moves on to describe the Linux thread interface and the various synchronization primitives that Linux supports. Chapter 4, Virtual Memory, describes the virtual memory system of Linux. A brief introduction is followed by detailed descriptions of all hardware abstraction interfaces and their IA-64 implementations. Topics covered include the Linux page tables, linearly-mapped virtual page tables, TLB (translation lookaside buffer) management, page fault handling, and memory coherency. Chapter 5, Kernel Entry and Exit, describes all aspects related to entering and exiting the kernel. In particular, it explains how system calls and signals work, as well as how data is passed across the user/kernel boundary. Like the preceding two chapters, this one starts by describing the Linux aspects that apply to all platforms and completes the discussion with descriptions of the IA-64 implementations. The next three chapters are fairly independent of each other. Chapter 6, Stack Unwinding, discusses the general topic of stack unwinding. While the topic is not really IA-64 specific, it does play a more important role on this platform. Indeed, anyone wishing to write IA-64 assembly code needs to be familiar with the material presented in the third section of this chapter. The other sections describe the IA-64 kernel unwinder and its implementation. Chapter 7, Device I/O, describes aspects related to device input/output (I/O). Specifically, it covers the hardware abstraction interfaces for programmed I/O (both memory-mapped and port-based), DMA (direct memory access), and device interrupts. The interface descriptions are followed by descriptions of their IA-64 realizations. Chapter 8, Symmetric Multiprocessing, discusses aspects specific to multiprocessor (MP) machines. Where appropriate, the other chapters cover MP aspects in the course of normal discussion, but this chapter covers all remaining issues. In particular, the first section provides an overview of the Linux locking principles and the MP support interface. The remaining two sections cover the handling of CPU-specific data areas and the issue of maintaining high-resolution timestamps on MP machines. The final three chapters are mostly IA-64 specific. Chapter 9, Understanding System Performance, introduces the IA-64 performance monitoring support, its Itanium implementation, and the associated perfmon kernel subsystem. This chapter should be of great value to anyone interested in characterizing and tuning the performance of IA-64 programs, whether the programs are normal applications or part of the Linux kernel. Chapter 10, Booting, covers all aspects related to booting a machine. The first two sections contain an overview of the IA-64 firmware and the IA-64 bootloader. The third section covers the Linux bootstrap interface and its implementation on IA-64. Chapter 11, IA-32 Compatibility, describes how Linux/ia64 manages to provide backward compatibility with IA-32. By its very nature, this discussion is IA-64 specific. However, most 64-bit Linux platforms provide backward compatibility with some 32-bit platform. For this reason, many of the topics and solutions discussed here apply to other platforms as well. A glossary of terms and abbreviations used in this book is provided in Appendix E. We would like to encourage the reader to refer to it whenever encountering an acronym that may seem unfamiliar. PROVIDING FEEDBACK While we strived to make this book as interesting, useful, and accurate as possible, we encourage our readers to provide feedback on how to improve future editions. For this purpose, we set up a web site at the following address (URL): http://www.lia64.org/book/ Please visit this site to report errors or to make suggestions for improvements. The web site also contains an up-to-date errata, links to related software and tools, and a summary of the evolution of Linux as it pertains to this book. David Mosberger and Stéphane EranianPalo Alto, CaliforniaNovember, 2001

Table of Contents



List of Figures.


List of Tables.


Foreword.


Preface.


1. Introduction.

Microprocessors: From CISC to EPIC. Overview of the Linux Kernel. Summary.



2. IA-64 Architecture.

User-Level Instruction Set Architecture. Runtime and Software Conventions. System Instruction Set Architecture. The Register Stack Engine (RSE). Summary.



3. Processes, Tasks, and Threads.

Introduction to Linux Tasks. The Thread Interface. Thread Synchronization. Summary.



4. Virtual Memory.

Introduction to the Virtual Memory System. Address Space of a Linux Process. Page Tables. Translation Lookaside Buffer (TLB). Page Fault Handling. Memory Coherency. Switching Address Spaces. Discussion and Summary.



5. Kernel Entry and Exit.

Interruptions. System Calls. Signals. Kernel Access to User Memory. Summary.



6. Stack Unwinding.

IA-64 ELF Unwind Sections. The Kernel Unwind Interface. Embedding Unwind Information in Assembly Code. Implementation Aspects. Summary.



7. DEVICE I/O.

Introduction. Programmed I/O. Direct Memory Access (DMA). Device Interrupts. Summary.

8. Symmetric Multiprocessing. @@AHEADS = Introduction to Multiprocessing on Linux. Linux Locking Principles. Multiprocessor Support Interface. CPU-Specific Data Area. Tracking Wall-Clock Time with High Resolution. Summary.



9. Understanding System Performance.

IA-64 Performance Monitoring Unit Overview. Extending the PMU: The Itanium Example. Kernel Support for Performance Monitoring. Summary.



10. Booting.

IA-64 Firmware Overview. The Bootloader. Kernel Initialization. Summary.



11. IA-32 Compatibility.

Architectural Support for IA-32. Linux Support for IA-32 Applications. Summary.



Appendix A. IA-64 CPU Models.


Appendix B. Kernel Register Usage.


Appendix C. IA-64 Instructions.

Integer Instructions. Memory Instructions. Semaphore Instructions. Branch Instructions. Control Instructions. Multimedia Instructions. Floating-Point Instructions. Privileged Instructions.



Appendix D: Itanium PMU Events.


Glossary.


Bibliography.


Index.