Not only does this approach support multiple OSs, it cansupport dissimilar OSs, differing in minor ways for example,version and patch level or in major ways for example, com-pletely diff
Trang 1Sun and AMD Special Edition Find out how
Sun and AMD technologies work together!
Trang 2FOR
SUN AND AMD SPECIAL EDITION
Bernard Golden and Clark Scheffy
Trang 3Published by
Wiley Publishing, Inc.
111 River Street
Hoboken, NJ 07030-5774
Copyright © 2008 by Wiley Publishing, Inc., Indianapolis, Indiana
Published by Wiley Publishing, Inc., Indianapolis, Indiana
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the Publisher Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN
46256, (317) 572-3447, fax (317) 572-4355, or online at www.wiley.com/go/permissions
Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for
the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affiliates in the United States and other countries, and may not be used without written permission AMD, the AMD Arrow logo, AMD Opteron, AMD Virtualization, AMD-V, and combinations thereof are registered trademarks of Advanced Micro Devices, Inc HyperTransport is a licensed trademark of the HyperTransport Technology Consortium Sun, the Sun logo, Solaris, StorageTek, Sun Fire, Sun xVM Ops Center, and Sun Ray are trademarks or registered trademarks of Sun Microsystems, Inc in the United States and other countries.
All other trademarks are the property of their respective owners Wiley Publishing, Inc., is not ciated with any product or vendor mentioned in this book.
asso-LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE
NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR NESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE.
COMPLETE-NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITU- ATION THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES IF PRO- FESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS
IT MAY MAKE FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED
IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services, please contact our Customer Care Department within the U.S at 800-762-2974, outside the U.S at 317-572-3993, or fax 317-572-4002 For
details on how to create a custom For Dummies book for your business or organization, contact
bizdev@wiley.com For information about licensing the For Dummies brand for products or
ser-vices, contact BrandedRights&Licenses@Wiley.com
ISBN: 978-0-470-29264-8
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
Publisher’s Acknowledgments
Project Editor: Jennifer Bingham
Editorial Manager: Rev Mengle
Sun Contributors: Laura Davenport, Julianne Raedeke, Tina Shibue, Vijay Sarathay,
Henry Kennedy, Michael Nalls, Amy Ahlers, Lisa Clark, Mark Thacker, Cindy Gallie, Allison Michlig, Frances Sun
AMD Contributors: Valeri Reeder, Steve Demski, Jeff Jones
Trang 4inno-vations designed to increase the level of system tion and enable IT users to harness ever-increasing levels ofcomputer performance
abstrac-At its simplest level, virtualization allows you, virtually and
cost-effectively, to have two or more computers, running two
or more completely different environments, on one piece ofhardware For example, with virtualization, you can have both
a Linux machine and a Windows machine on one system.Alternatively, you could host a Windows 95 desktop and aWindows XP desktop on one workstation
In slightly more technical terms, virtualization essentiallydecouples users and applications from the specific hardwarecharacteristics of the systems they use to perform computa-tional tasks This technology promises to usher in an entirelynew wave of hardware and software innovation For example,and among other benefits, virtualization is designed to sim-plify system upgrades (and in some cases may eliminate theneed for such upgrades), by allowing users to capture thestate of a virtual machine (VM), and then transport that state
in its entirety from an old to a new host system
Virtualization is also designed to enable a generation of moreenergy-efficient computing Processor, memory, and storageresources that today must be delivered in fixed amountsdetermined by real hardware system configurations will bedelivered with finer granularity via dynamically tuned VMs
About This Book
Virtualization For Dummies, Sun and AMD Special Edition
explains how virtualization works and how it can benefit yourorganization The book covers the kinds of issues virtualiza-tion can address and how it addresses them
Trang 5Virtualization For Dummies, Sun and AMD Special Edition
2
Icons Used in This Book
In the margins of this book, you find several helpful little iconsthat can make your journey a little easier:
This icon flags information that you should pay attention to
This icon lets you know that the accompanying text explainssome technical information in detail You don’t need to knowthis stuff to get what you need from the book, but it may beinteresting
A Tip icon lets you know some practical information that canreally help you out is on the way These tips can help save youtime, effort, or money
Trang 6talking about virtualization Technical magazines trumpetthe technology on their covers Virtualization sessions are featured prominently at technology conferences And, pre-
dictably enough, technology vendors are describing how their
product is the latest word in virtualization
Why Virtualization
Is Hot, Hot, Hot
What’s all the shouting about? Why is virtualization the tion of the season? This section goes over four reasons virtu-alization is so important
sensa-Trend #1: Underutilized hardware
Today, many data centers have machines running at only 10 or
15 percent of total processing capacity In other words, 85 or
90 percent of the machine’s power is unused However, a lightlyloaded machine still takes up room and draws electricity, sothe operating cost of today’s underutilized machine can benearly the same as if it were running flat-out
Trang 7Virtualization For Dummies, Sun and AMD Special Edition
4
It doesn’t take a rocket scientist to recognize that this tion is a waste of computing resources And, guess what? Withthe steady improvement in performance characteristics ofcomputer hardware, next year’s machine will have twice asmuch spare capacity as this year’s (and so on, for the foresee-able future) Obviously, there ought to be a better way tomatch computing capacity with load And that’s what virtual-ization does — by enabling a single piece of hardware toseamlessly support multiple systems By applying virtualiza-tion, organizations can raise their hardware utilization ratesdramatically, thereby making much more efficient use of cor-porate capital
situa-So, the first trend that is causing virtualization to be a stream concern is the unending growth of computing powerbrought to us by the friendly folks of the chip industry
main-Trend #2: Data centers run out of space
The business world has undergone an enormous tion over the past 20 years Business process after businessprocess has been captured in software and automated,moving from paper to electrons
transforma-The rise of the Internet has exponentially increased this formation Companies want to communicate with customersand partners in real-time, using the worldwide connectivity ofthe Internet Naturally, this has accelerated the move to com-puterized business processes
trans-The net effect of all this is that huge numbers of servers havebeen put into use over the past decade, which is causing areal estate problem for companies: They’re running out ofspace in their data centers And, by the way, that explosion ofdata calls for new methods of data storage These methods go
by the common moniker of storage virtualization, which, as
you may guess, means making it possible for storage to behandled independently of any particular piece of hardware.Virtualization, by offering the ability to host multiple guestsystems on a single physical server, allows organizations to
Trang 8reclaim data center territory, thereby avoiding the expense
of building out more data center space This is an enormousbenefit of virtualization, because data centers can cost in thetens of millions of dollars to construct
Trend #3: Green initiatives demand better energy efficiency
Power costs used to rank somewhere below what brand ofsoda to keep in the vending machines in most company’sstrategic thinking Companies could assume that electricalpower was cheap and endlessly available
The assumption regarding availability of reliable power waschallenged during the California power scares of a few yearsago Although later evidence caused re-evaluation aboutwhether there was a true power shortage, the events causedcompanies to consider whether they should look for ways to
be less power dependent
Furthermore, the impact of the green revolution has meantthat companies are increasingly looking for ways to reducethe amount of energy they consume — and one of the placesthey look first is their data center
To show the level of concern about the amount of energybeing consumed in data centers, consider these facts:
scientist from the Lawrence Berkeley National Laboratoryshowed that the amount of energy consumed by datacenters in the U.S doubled between 2000 and 2005
Furthermore, energy consumption is expected toincrease another 40 percent by the end of the decade.Current energy consumption by data center servers andassociated cooling costs represents 1.2 percent of thetotal energy consumed in the U.S
"Based, in part, on the results of this study, the UnitedStates Environmental Protection Agency (EPA) has con-vened a working group to establish standards for serverenergy consumption and plans to establish a new
“Energy Star” rating for energy efficient servers
Chapter 1: Wrapping Your Head around Virtualization 5
Trang 9The cost of running computers, coupled with the fact thatmany of the machines filling up data centers are running atlow utilization rates, means that virtualization’s ability toreduce the total number of physical servers can significantlyreduce the overall cost of energy for companies.
Trend #4: System administration costs mount
Computers don’t operate all on their own Every serverrequires care and feeding by system administrators Commonsystem administration tasks include: monitoring hardwarestatus; replacing defective hardware components; installingoperating system (OS) and application software; installing OSand application patches; monitoring critical server resourceslike memory and disk use; and backing up server data to otherstorage mediums for security and redundancy purposes
As you can imagine, these tasks are pretty labor intensive.System administrators — the people who keep the machines humming — don’t come cheap And, unlike programmers,system administrators are usually co-located with the servers,because they need to access the physical hardware
As part of an effort to rein in operations cost increases, alization offers the opportunity to reduce overall systemadministration costs by reducing the overall number ofmachines that need to be taken care of Although many of thetasks associated with system administration (OS and applica-tion patching, doing backups) continue even in a virtualizedenvironment, some of them disappear as physical servers aremigrated to virtual instances Overall, virtualization canreduce system administration requirements drastically,making virtualization an excellent option to address theincreasing cost of operations personnel
virtu-Sorting Out the Types
of Virtualization
Now that you have a rough idea of virtualization and why it’s
an important development, what are your options regarding
Virtualization For Dummies, Sun and AMD Special Edition
6
Trang 10it? In other words, what are some common applications of thetechnology?
A number of common uses for virtualization exist, all centeredaround the concept that virtualization represents an abstrac-tion from physical resources In fact, there are enough kinds
of virtualization to make it a bit confusing to sort out how youmight apply it in your organization The two most commontypes of virtualization applied in the data center are servervirtualization and storage virtualization Within each maintype there are different approaches or “flavors,” each of whichhas its benefits and drawbacks
Server virtualization
There are three main types of server virtualization: ing system virtualization; hardware emulation; and paravirtu-alization, a relatively new concept designed to deliver alighter weight (in terms of application size), higher perform-ance approach to virtualization
operat-Operating system virtualization
Operating system (OS) virtualization (sometimes called tainers) runs on top of an existing host operating system and
con-provides a set of libraries that applications interact with,giving an application the illusion that it is (or they are, if thereare multiple applications) running on a machine dedicated toits use The key thing to understand is that, from the applica-tion’s execution perspective, it sees and interacts only withthose applications running within its virtual OS, and interactswith its virtual OS as though it has sole control of the
resources of the virtual OS Crucially, it can’t see the tions or the OS resources located in another virtual OS
applica-This approach to virtualization is extremely useful if you want
to offer a similar set of operating system functionalities to anumber of different user populations while using only a singlemachine This is an ideal approach for Web hosting compa-nies: They use container virtualization to allow a hosted Website to “believe” it has complete control of a machine, while infact each hosted Web site shares the machine with manyother Web sites, each of which is provided its own container.Operating system virtualization imposes little overhead forthe virtualization capability, thereby ensuring most of the
Chapter 1: Wrapping Your Head around Virtualization 7
Trang 11machine’s resources are available to the applications running
in the containers
There are some limitations to operating system virtualization,though First and foremost, this approach typically limits oper-ating system choice Containerization usually means that thecontainers offer the same operating system as the host OS andeven be consistent in terms of version number and patch level
As you can imagine, this can cause problems if you want to rundifferent applications in the containers, since applications areoften certified for only a certain OS version and patch level.Consequently, operating system virtualization is best suitedfor homogenous configurations — for those arrangementsoperating system virtualization is an excellent choice
Companies offering operating system virtualization includeSun (as part of their Solaris operating system) and SWSoft,which offers the commercial product Virtuozzo as well assponsoring the open source operating system virtualizationproject called OpenVZ
virtual machine monitor or VMM.
The VMM provides a standardized hardware environment thatthe guest OS resides on and interacts with Because the guest
OS and the VMM form a consistent package, that package can
be migrated from one machine to another, even though thephysical machines the packages run upon may differ Thehypervisor, which resides between the VMM and the physicalhardware, translates the calls from the VMM to the specificresources of the physical machine
This approach to virtualization means that applications run in
a truly isolated guest OS, with one or more guest OSs running,one per VMM The VMMs all reside on the virtualization hyper-visor Not only does this approach support multiple OSs, it cansupport dissimilar OSs, differing in minor ways (for example,version and patch level) or in major ways (for example, com-pletely different OSs like Windows and Linux can be run simul-taneously in hardware emulation virtualization software)
Virtualization For Dummies, Sun and AMD Special Edition
8
Trang 12Common applications for hardware emulation are softwaredevelopment and quality assurance, because it allows anumber of different OSs to be run simultaneously, therebyfacilitating parallel development or testing of software in anumber of different operating system environments Hardwareemulation is also used in server consolidation, where anumber of operating system/application environments aremoved from separate physical servers to a single physicalserver running virtualization software.
There are a couple of drawbacks to hardware emulation, ever One is that the virtualization software hurts perform-ance, which is to say that applications often run somewhatslower on virtualized systems than if they were run on unvir-tualized systems
how-Another drawback to hardware emulation is that the ization software presents a standardized hardware interface(the VMM) to the guest operating system The hypervisor pro-vides an interface to the VMM and then translates that intocalls to the actual physical resources on the machine Thismeans that the hypervisor must contain the interfaces to theresources of the machine; these resources are referred to as
virtual-device drivers If you’ve ever installed new hardware in a PC,
you know that you often have to install a device driver intothe operating system so that the new hardware and the oper-ating system can communicate
The device driver issue for hardware emulation is that thehypervisor contains the device drivers and there is no way for new device drivers to be installed by users (unlike on yourtypical PC) Consequently, if a machine has hardware resourcesthe hypervisor has no driver for, the virtualization softwarecan’t be run on that machine This can cause problems, espe-cially for organizations that want to take advantage of newhardware developments
Companies offering hardware emulation virtualization ware include VMware (in two versions, VMware Server andESX Server) and Microsoft, which offers a product calledVirtual Server VMware supports x86 servers only, with anemphasis on the Microsoft OS Microsoft’s Virtual Server isanticipated to be replaced by Hyper-V, which is included as a
soft-Chapter 1: Wrapping Your Head around Virtualization 9
Trang 13component of Microsoft Windows Server 2008 Another bility is Xen, a hypervisor-based open source alternative.
possi-Paravirtualization
Paravirtualization is the name for another approach to server
virtualization In this approach, rather than emulate a plete hardware environment, the virtualization software is athin layer that multiplexes access by guest operating systems
com-to the underlying physical machine resources
There are two advantages to this approach First, it imposesless performance overhead because it is a very small amount
of code Hardware emulation, you’ll recall, inserts an entirehardware emulation layer between the guest operating systemand the physical hardware By contrast, paravirtualization’sthin software layer acts more like a traffic cop, allowing oneguest OS access to the physical resources of the hardwarewhile stopping all other guest OSs from accessing the sameresources at the same time
The second advantage of the paravirtualization approachcompared to hardware emulation is that paravirtualizationdoes not limit you to the device drivers contained in the virtu-alization software; in fact, paravirtualization does not includeany device drivers at all Instead, it uses the device driverscontained in one of the guest operating systems, referred to
as the privileged guest Without going into too much detail
about this architecture here, suffice it to say that this is a efit, since it enables organizations to take advantage
ben-of all the capabilities ben-of the hardware in the server, ratherthan being limited to hardware for which drivers are available
in the virtualization software as in hardware emulation virtualization
It might seem that paravirtualization would be the way to go.However, there has been one significant drawback to thisapproach to virtualization: Because it is lightweight and multi-plexes access to the underlying hardware, paravirtualizationrequires that the guest operating systems be modified inorder to interact with the paravirtualization interfaces Thiscan only be accomplished by having access to the sourcecode of the guest operating system This access is possiblefor open source operating systems like Solaris and Linux,
Virtualization For Dummies, Sun and AMD Special Edition
10
Trang 14and is only possible for Microsoft operating systems withMicrosoft source code access The good news is that Quad-Core AMD Opteron processors featured within Sun x64 sys-tems provide functionality that enables unmodified operatingsystems to be hosted by a paravirtualized hypervisor.
Consequently, this drawback to paravirtualization will ish as servers with these new chips take their place in produc-tion infrastructures
dimin-One example of paravirtualization is a relatively new opensource product called Xen, which is sponsored by a commer-cial company called XenSource Xen is included in the recentLinux distributions from Red Hat and Novell, as well
as being available for many community Linux distributionslike Debian and Ubuntu XenSource itself sells Xen-basedproducts as well Another possibility is Virtual Iron, a Xen-based solution
Storage virtualization
The amount of data organizations are creating and storing isexploding Due to the increasing shift of business processes toWeb-based digital applications, every company is being inun-dated with data
This explosion of data is causing problems for many of them.First, from a sheer storage capacity, many applications gener-ate more data than can be stored physically on a single server.Second, many applications, particularly Internet-based ones,have multiple machines that need to access the same data.Having all of the data sitting on one machine can create a bot-tleneck, not to mention presenting risk from the situationwhere many machines might be made inoperable if a singlemachine containing all the application’s data crashes Finally,the explosion of machines mentioned earlier in the chaptercauses backup problems; in other words, trying to create safecopies of data is a Herculean task when there are hundreds oreven thousands of machines that need data backup
For these reasons, data has moved into virtualization as well Companies use centralized storage (virtualized storage)
as a way of avoiding data access problems Furthermore,moving to centralized data storage can help IT organizationsreduce costs and improve data management efficiency
Chapter 1: Wrapping Your Head around Virtualization 11
Trang 15Virtualization Makes Hardware More Important
Even though virtualization is a software technology, it has theeffect of making hardware more important This is becauseremoving lots of servers and migrating their operating sys-tems to virtual machines makes the remaining servers thatsupport all those virtual machines even more important.Although IT organizations could allow individual servers to godown in a “one application, one server” environment becauseeach system failure would inconvenience a single user popula-tion, virtualization is very different Each server supports multiple virtual machines and multiple user populations If avirtualization host goes down, it may affect many applicationsand all of those applications’ users
The importance of hardware is only going to increase as new,virtualization-ready hardware comes to market There are significant virtualization capabilities being cooked up by hardware manufacturers, so don’t overlook the role of hard-ware in your virtualization infrastructure
Consequently, as you move forward with virtualization ware, the perhaps unexpected effect is that your hardwareenvironment becomes more important
soft-Virtualization For Dummies, Sun and AMD Special Edition
12
Trang 16those boring pizza boxes (the term stems from theresemblance that 1U rack-mount servers have to the box thatpizzas are delivered in, although we tend to believe that it’smore reflective of the fact that pizza and technology are inex-tricably intertwined in the lives of true geeks), in fact a com-puter combines a number of different resources to enable theautomated processing of data.
Four of these resources are crucial to virtualization:
turns random information into organized data CPUsmanipulate strings of characters, add and subtract num-bers, and arrange for information to flow in and out ofthe system As you’ll remember from the previous chap-ter, virtualization enables a single physical computer tosupport multiple virtual guest systems The ability tocoordinate processor access by the separate guest sys-tems is one of the main challenges of virtualization, par-ticularly since the x86 processor was never reallydesigned to support multiple guests
Trang 17Virtualization For Dummies, Sun and AMD Special Edition
14
the data that the processor manipulates Similar to theprocessor, memory must be carefully managed to enablemultiple guests to share a single set of physical memorywithout allowing separate guest systems to overwriteone another’s data And, as you might have guessed, x86memory was not designed with multiple guest access inmind
communicate with one another as well as sending andreceiving data from the great cloud that is the Internet.While data flows back and forth on the physical networkcard within a virtualized system, it’s critical to ensurethat each virtual system receives the appropriate net-work traffic
virtualization is storage — data residing in a place that itcan be retrieved from If you’ve ever installed a harddrive in your own computer, you’ve managed storage! Torepeat the refrain, each virtual guest system must haveits own data storage and the virtualization software mustkeep each guest system’s storage isolated
Managing Operating
System State
State is a term used within computing to (pardon the pun)
state the obvious: at each moment in time, the operatingsystem has a number of pieces of data that reflect its currentcondition For example, if you are writing a document, thestate reflects the sentences you’ve written, the file location onthe disk where the document is stored, the individual valueseach system resource contains, and so on The value thatevery resource has at a given moment of time is described asthe operating system’s state Each of those values is stored insystem memory — when you make a change to an individualcharacter in your word processing document, a tiny bit ofmemory is changed to reflect the new state of your document
In a virtualized world, where multiple guest operating systemsshare a single set of system resources, the ability to save oneguest’s state and restore another guest’s state is vital
Trang 18Because each guest system needs to have its state in systemmemory so that it may operate, the virtualization hypervisorneeds to be clever (and fast!) enough to swap state in and out
of system memory so that each guest can share the systemresources without trampling on one another’s state
State can be difficult to understand — it sort of reminds author Bernard of when he learned calculus — it didn’t makeany sense at all until the day it finally did — and then he real-ized the beauty of the mathematics that Isaac Newton puttogether Think of state as a hotel room Each guest brings his
co-or her possessions to the room Those possessions reflect theguest’s state at that moment — a suitcase, certain clothing,toiletries, perhaps a briefcase containing a computer, papernotebook, and a book or two When one guest leaves, anothermoves into the hotel room and brings his or her possessions.The hotel room is a virtual dwelling that is shared by allguests Now, imagine if the guests all shared the room simulta-neously, with each getting the room for a five minute stretch.You can see the challenge of unpacking and packing every fiveminutes — well, that’s what virtualization accomplishes foroperating systems Virtualization enables operating systems
to pack and unpack their state — except it happens sands of times per second! You can see that the ability to saveand restore state — to manage system memory which is
thou-where state resides — is the key capability for virtualization
software
Virtualizing Memory
Long before computer scientists came up with the notion ofvirtualizing an entire system, architects had already inventedtechniques to virtualize memory management The Atlas com-puter at the University of Manchester was the first system toincorporate virtual memory technology Virtual memory tech-nology lets a system with a limited amount of physicalmemory look much larger to application software To createthis illusion, the OS stores the full memory image of the appli-cation and its data on the system’s hard drive, and transfersrequired pieces of this image into the system’s DRAM memory
as the program executes
Chapter 2: Understanding AMD Virtualization Technology 15
Trang 19To translate the virtual addresses seen by each applicationinto physical DRAM memory addresses, the system relies on a
map (known as a page table) that contains references linking
chunks of virtual memory to real memory Contemporary x86processors include hardware features known as translationlook-aside buffers (TLBs) that cache the translation refer-ences for recently accessed chunks of memory, thus speeding
up the process TLBs play a role in almost all memory ences, so the manner in which they perform their translationscan play a significant role in determining overall system performance
refer-Architects soon learned that TLB design can seriously impactmultitasking systems operations Most tasks in such systemshave unique page tables This forces the operating system toreset (or, more colorfully, “flush”) the TLB each time itswitches from one task to another Then, as the new task exe-cutes, its page table entries fill up the TLB, at least until thenext task switch This constant flushing and reloading canreally eat into performance, especially if each task runs foronly a few milliseconds before the next switch
To mitigate the impact of task switching, architects added atask ID field to each TLB entry This allows the system toretain the mapping information of multiple tasks in the TLBwhile switching between tasks, because it only uses theentries for the task actually executing at any point This inturn eliminates the need for performance-inhibiting TLBflushes At least until virtualization entered the scene
Allocating memory the old way
Because the guest OS running on a virtual machine (VM) isunaware of other guests, it can only assign unique task IDswithin its own environment Thus, multiple VMs can havetasks with the same ID, confusing the TLB and making a realmess There’s a simple solution to this problem — the hypervi-sor merely flushes the TLB every time it switches from one VM
to another This forces the tasks executing in the next VM toreload the TLB with its own page table entries Unfortunately,this approach seriously impacts virtual system performance,giving architects everywhere déjà vu
Virtualization For Dummies, Sun and AMD Special Edition
16
Trang 20A better way of allocating memory
AMD’s CPU architects had a better idea They merely added
a new, VM-specific tag called an address space identifier(ASID) to the TLBs in the AMD Opteron processors withAMD Virtualization technology This concept is known as atagged translation look-aside buffer, or tagged TLB
Each VM has a unique ASID value, known only to the sor and the TLB hardware The ASID is invisible to the guest
hypervi-OS, thus eliminating the need to modify the guest, preservingthe virtual illusion and avoiding any performance degrada-tion Figure 2-1 illustrates the tagged TLB concept Figure 2-2shows how competing processors handle memory in a virtual-ized environment
Figure 2-1: Tagged translation look-aside buffer.
Figure 2-2: The non-AMD-based virtual machine’s memory (shown on
the right side of Figure 2-1) must be flushed every switch, which can slow performance
VM 4
Fill Flush
VM 1 runs on the CPU and loads additional data from memory
As VM 3 takes control and loads its data, other TLB data remains
So when VM 1 takes control back the data it needs is there … resulting in
Un-Tagged TLB Cache lines
Trang 21Solving one problem creating another
Although tagging the TLB allows a system to support multipleVMs without the need to flush the TLB when switchingbetween tasks, it doesn’t solve one sticky problem with man-aging virtualized memory Remember, we’re trying to fool the
OS into thinking that it’s in control of a real system, when inactuality all we’ve done is provide it access to a virtualizedsystem with virtualized physical memory (also known asGuest physical memory) We still need to map from that Guestphysical memory to the actual physical memory plugged intothe system (also called Host physical memory) The way we
do this in many cases is with a technique called Shadow Page
Tables.
Without going into too many techie details, Shadow PageTables are what connect Virtual Machines (VMs) to the actualhardware from a memory standpoint The TLB translates vir-tual memory to Guest physical memory (which is still virtual),Shadow Page Tables translate Guest physical memory to Hostphysical memory Although this process may sound fairlystraightforward, there’s a whole bunch of complex softwarerequired to manage all of this — and that extra managementcan have the negative side effect of slowing down virtualizedapplications So what do smart CPU engineers do when theycome across a complex software problem? They try to solvethat problem quicker and more efficiently in hardware
AMD’s virtualization extensions
If you recall back from earlier in the chapter, CPU architectscreated a TLB to store page tables, which are maps that trans-late from virtual to physical memory Modern CPU architects,being the smart people they are, have developed somethingcalled Virtualized Page Tables that translate all the way fromvirtual memory to Guest physical memory to Host physicalmemory But unlike Shadow Page Tables, which perform thesame function in software, Virtualized Page Tables are builtdirectly into the CPU Not stopping there, modern CPU archi-tects also created a guest TLB, which is where these
Virtualized Page Table translations are stored
Virtualization For Dummies, Sun and AMD Special Edition
18
Trang 22The best part of all of this memory-management hocus pocus
is that virtualized applications can now can now achieve native performance and responsiveness
near-AMD Opteron Processor: The
Green Chip
One of the big reasons companies are moving to virtualization
is to reduce energy consumption Big data centers can useincredible amounts of power, and anything that helps reducepower needs is welcome
The new generation of chips from AMD is even more environment-friendly than before Compared to the previousgeneration of chips, Third Generation AMD Opteron proces-sors (also known as Quad-Core AMD Opteron processors) cansave significant amounts of energy by cleverly adjustingpower consumption according to processing loads
Although it may seem that the power savings for one chipwould be relatively unimportant, keep in mind that today'sdata centers can contain thousands of machines Even a virtu-alized data center, where many physical machines have beenconverted to guest virtual machines, can contain hundreds ofphysical servers — and the energy savings of AMD Opteronprocessors with AMD-V can be enormous when spread acrossthat number of servers
By moving to Quad-Core AMD Opteron processors with AMD-V in a virtualized environment, users can save energy
in two ways:
to processing demands This means less overall energyconsumption (and saving money on energy costs)
heat (chips generate heat as they process information).The reduced heat means less air conditioning is needed
in the data center, further reducing energy consumption(and saving even more money on energy costs!)
Chapter 2: Understanding AMD Virtualization Technology 19
Trang 23So not only does AMD-V make your virtualization run moreeffectively, it makes your data center run more efficiently.But AMD is not resting on its laurels It has even more virtual-ization enhancements included in Quad-Core AMD Opteronprocessors, which are described in the next chapter.
Virtualization For Dummies, Sun and AMD Special Edition
20
Trang 24advances designed to support virtualization However,performance is an ongoing pursuit The better the perform-ance, the more responsive virtual guests are
Even more important is the fact that as individual virtualmachines improve, more of them can be supported on a givenpiece of hardware; in other words, if virtual machine perform-ance goes up, more virtual machines can be squeezed onto aserver, thereby achieving higher virtual machine density
Virtual machine density refers to the ratio of virtual machines
to physical machines The higher the number of virtualmachines that can be supported on a physical system, thehigher the virtual machine density Put another way, thehigher the density, the lower the number of physicalmachines required to run an organization’s virtual systems.And, since one of the main goals of virtualization is to get rid
of physical servers, high density is very desirable, indeed
Trang 25Virtualization For Dummies, Sun and AMD Special Edition
22
AMD Manages Memory
One of the most important tasks for a hypervisor is memorymanagement The ability to keep track of the memory for indi-vidual processes within a virtual machine, and, perhaps moreimportant, to ensure that each virtual machine’s overallmemory is managed is critical for virtualization The lattertask may be referred to as keeping track of virtual machine
state — the settings of all critical system variables at each
moment in time
Keeping track of all those different bits of memory is critical
to ensure that one virtual machine does not modify another’smemory; after all, if a system’s memory is compromised, none
of its data can be trusted
However, it’s not enough that a hypervisor keeps accuratetrack of all the memory settings of the various guest virtualmachines Accuracy must be matched with speed, because ifthe hypervisor takes too long to swap memory in and out, theperformance of the virtualization solution will be unaccept-able (or, to use a fancy technical term, the achievable virtualmachine density will be unacceptably low) It’s not an over-statement to say that efficiently managing memory is the keydeterminant of virtualization performance
In the early days of virtualization, all of the memory ment was done by the hypervisor software While the creators
manage-of the virtualization smanage-oftware were extremely smart, it’s able that software always runs slower than hardware Therefore,figuring out how to move memory management into hardwarewould significantly improve performance and raise VM density
undeni-In the previous chapter, we discuss the hardware advances inAMD Opteron processors with AMD-V technology for man-aging memory:
each VM’s translation look-aside buffer (TLB)
guest’s virtual memory to be mapped through to thephysical memory of the underlying hardware