PRODUCT SUPPORT ANNOUNCEMENT
Some videos and Web Editions may be returning errors on launch. Learn more.
The authoritative guide to the IA-64 Linux kernel implementation.
The IA-64 architecture and Itanium processors are designed to offer unprecedented levels of performance, expandability, and reliabilityand with the delivery of the IA-64 Linux kernel, that power is now accessible to every Linux developer. In this authoritative book, the IA-64 Linux kernel project's leaders take you "under the hood" with Linux for IA-64, demonstrating exactly how it makes the most of the IA-64's breakthrough capabilities.
They begin by introducing the IA-64 architecture, instruction set, and key features. Next, they cover every major Linux kernel subsystem in unprecedented detail, presenting the interfaces used by Linux to abstract hardware differences and showing how these interfaces have been realized in the IA-64 environment. Coverage includes:
This book not only focuses on the ideas and concepts you need to work with this radically innovative architecture: it illuminates the key issues associated with Linux kernel operation on any platform, existing or new.
List of Figures.
List of Tables.
Microprocessors: From CISC to EPIC. Overview of the Linux Kernel. Summary.
User-Level Instruction Set Architecture. Runtime and Software Conventions. System Instruction Set Architecture. The Register Stack Engine (RSE). Summary.
Introduction to Linux Tasks. The Thread Interface. Thread Synchronization. Summary.
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.
Interruptions. System Calls. Signals. Kernel Access to User Memory. Summary.
IA-64 ELF Unwind Sections. The Kernel Unwind Interface. Embedding Unwind Information in Assembly Code. Implementation Aspects. Summary.
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.
IA-64 Performance Monitoring Unit Overview. Extending the PMU: The Itanium Example. Kernel Support for Performance Monitoring. Summary.
IA-64 Firmware Overview. The Bootloader. Kernel Initialization. Summary.
Architectural Support for IA-32. Linux Support for IA-32 Applications. Summary.
Integer Instructions. Memory Instructions. Semaphore Instructions. Branch Instructions. Control Instructions. Multimedia Instructions. Floating-Point Instructions. Privileged Instructions.
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 supportsindeed encouragesinnovative 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.
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.
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.
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):
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 Eranian
Palo Alto, California