Program for controlling a virtual computer and computer system for virtulization technology

Information

  • Patent Application
  • 20070234358
  • Publication Number
    20070234358
  • Date Filed
    February 08, 2007
    17 years ago
  • Date Published
    October 04, 2007
    16 years ago
Abstract
Provided is the virtual computer system including an emulation module for emulating an operation based on an operation code for executing the operation of hardware of a server system, an exception event handler module for calling the emulation module when an exception event is generated by a CPU, a code management module for managing a promotion code for emulating the operation of the hardware of the server system, a frequency judgment module for judging whether a frequency of the operation of the hardware of the server system is high, and a switching module for determining whether to call the emulation module by the exception event handler module or to call the emulation module by executing the promotion code based on the judged frequency. Accordingly, the virtual computer system can simultaneously achieve high performance and memory saving in an emulation system.
Description

BRIEF DESCRIPTION OF THE DRAWINGS


FIG. 1 is a block diagram of a physical computer where a virtual computer system is operated according to the first embodiment.



FIG. 2 is a block diagram of hardware and software in the physical computer according to the first embodiment.



FIG. 3 is an explanatory diagram showing an example of a code conversion setting table according to the first embodiment.



FIG. 4 is a block diagram showing a configuration of the frequency judgment module according to the first embodiment.



FIG. 5 is an explanatory diagram showing an example of the HW operation frequency table according to the first embodiment.



FIG. 6 is an explanatory diagram showing an example of the conversion code management table according to the first embodiment.



FIG. 7 is an explanatory diagram showing an example of the conversion code LRU list according to the first embodiment.



FIG. 8 is a flowchart of processing when the VMM operates the guest according to the first embodiment.



FIG. 9 is a flowchart showing the emulation processing of the VMM according to the first embodiment.



FIG. 10 is a flowchart showing the conversion code invalidation processing according to the first embodiment.



FIG. 11 is a flowchart showing the frequency judgment processing according to the first embodiment.



FIG. 12 is a flowchart showing the selection processing of the according to the first embodiment.



FIG. 13 is a flowchart showing the application processing of the code conversion system according to the first embodiment.



FIG. 14 is a flowchart showing the code conversion setting update processing according to the first embodiment.



FIG. 15 is an explanatory diagram of a code conversion setting table according to the second embodiment.



FIG. 16 is an explanatory diagram showing an HW operation frequency table according to the second embodiment.



FIG. 17 is a flowchart showing conversion code invalidation processing according to the second embodiment.



FIG. 18 is a flowchart showing the frequency judgment processing according to the second embodiment.



FIG. 19 is a block diagram of hardware and software including guests and the VMM according to the third embodiment.



FIG. 20 is a block diagram showing a configuration of the frequency judgment module according to the third embodiment.



FIG. 21 is an explanatory diagram showing an example of the HW operation frequency table according to the third embodiment.



FIG. 22 is an explanatory diagram showing an example of the HW operation frequency table according to the third embodiment.



FIG. 23 is a block diagram showing a configuration of the switching module according to the third embodiment.



FIG. 24 is an explanatory diagram showing an example of the emulation system table according to the third embodiment.



FIG. 25 is an explanatory diagram showing an example of the conversion code management table according to the third embodiment.



FIG. 26 is a flowchart of processing when the VMM operates the guest according to the third embodiment.



FIG. 27 is a flowchart showing the emulation processing of the VMM according to the third embodiment.



FIG. 28 is a flowchart showing the conversion code invalidation processing according to the third embodiment.



FIG. 29 is a flowchart showing the frequency judgment processing according to the third embodiment.



FIG. 30 is a flowchart showing the selection processing according to the third embodiment.



FIG. 31 is a flowchart showing the conversion code retrieval processing according to the third embodiment.


Claims
  • 1. A server system, comprising: at least one CPU;a memory for storing data and a program; andan interface for exchanging data with the outside, wherein:the CPU executes the program stored in the memory to execute a virtual machine monitor for operating at least one virtual computer in which an operating system operates; andthe virtual machine monitor includes: an emulation module for emulating an operation based on an operation code for executing the operation of hardware of the server system when the operation of the hardware of the server system is requested by one of the operating system and an application operated in the operating system;an exception event handler module for calling the emulation module when an exception event is generated by the CPU through detection of the operation of the hardware of the server system;a code management module for managing a promotion code used for emulating the operation of the hardware of the server system by switching an operation mode of the CPU to call the emulation module;a frequency judgment module for judging whether a frequency of the operation of the hardware of the server system is high based on a result of comparison with predetermined judgment conditions; anda switching module for determining whether to call the emulation module by one of the exception event handler module and by executing the promotion code based on the judged frequency.
  • 2. The server system according to claim 1, wherein: the CPU includes two operation modes of a hardware operation permission mode and a hardware operation inhibition mode, and generates an exception event to switch the operation mode to the hardware operation permission mode when the operation of the hardware is detected while the operation mode is the hardware operation inhibition mode;the promotion code contains an instruction of switching between the hardware operation permission mode and the hardware operation inhibition mode;the virtual machine monitor includes a generation module for generating a shadow code to emulate the operation of the hardware of the server system, which corresponds to the operation code by calling the promotion code when the operation mode of the CPU is the hardware operation inhibition mode; andwhen the operation is requested while the operation mode of the CPU is the hardware operation inhibition mode, the switching module executes the promotion code by calling the shadow code if a frequency of the operation of the hardware of the server system is high, and calls the emulation module by the promotion code.
  • 3. The server system according to claim 2, wherein when a frequency of a first operation of the hardware of the server system requested by one of the operating system and the application operated in the operating system satisfies predetermined conditions, the switching module calls the emulation module by executing the promotion code rather than the exception event handler module calling the emulation module in a case of executing a second operation code near a first operation code on an instruction address space, for executing the first operation.
  • 4. The server system according to claim 2, wherein: when the virtual machine monitor detects that the operation code to execute the operation has been changed by one of the operating system and the application operated in the operating system, the switching module invalidates a shadow code corresponding to the changed operation code; andthe switching module calls the emulation module by the exception event handler module rather than executing the shadow code to call the emulation module in a case of executing the changed operation code.
  • 5. The server system according to claim 2, wherein when a memory capacity necessary for holding the shadow code and the promotion code becomes short, the switching module selects a shadow code having a longest unexecuted period among the generated shadow codes, deletes the selected shadow code and a promotion code associated with the selected shadow code from the memory, and calls the emulation module by the exception event handler module rather than executing the deleted shadow code.
  • 6. The server system according to claim 1, wherein the frequency judgment module is configured to: hold frequency information with which specifying of the operation of a high frequency becomes possible;judge whether a type of the requested operation is contained in the held frequency information when the operation is requested; andjudge that a frequency of the requested operation is high when the type of the requested operation is contained in the held frequency information.
  • 7. The server system according to claim 1, wherein the frequency judgment module is configured to: hold a number of execution times of an operation code belonging to each of predetermined address ranges in an instruction address space of the operation code for each of the predetermined address ranges; andobtain the number of execution times of all operation codes included in each of the address ranges to which the operation code for executing the requested operation belongs when the operation is requested to judge that a frequency of the requested operation is high when the obtained number of execution times exceeds a predetermined threshold value.
  • 8. The sever system according to claim 1, wherein the frequency judgment module is configured to: hold time information with which specifying of execution time of the operation becomes possible;calculate an interval between time information of execution time of the operation code for executing the requested operation and time information of previous execution time of the operation code for executing the requested operation; andjudge that a frequency of the operation is high when the calculated interval is smaller than a predetermined threshold value.
  • 9. The server system according to claim 1, further comprising: an input unit for receiving the predetermined judgment conditions entered by an administrator; anda storage system for storing the received predetermined judgment conditions.
  • 10. The sever system according to claim 2, wherein: the CPU is shifted to the hardware operation permission mode by setting a VM bit to 0, and shifted to the hardware operation inhibition mode by setting the VM bit to a value other than 0;the shadow code is executed in a state where the VM bit is set to the value other than 0;the promotion code contains an instruction of changing a setting of the VM bit; andthe switching module is configured to: correlate an address of the operation code for executing the operation of the hardware of the server system with a storage address of the shadow code corresponding to the operation code; andexecute the shadow code by replacing the address of the operation code with the address of the shadow code based on the correlation when emulation of the operation is executed to call the emulation module by executing the shadow code.
  • 11. The server system according to claim 2, wherein: the CPU is shifted to the hardware operation permission mode by setting a current privilege level to 0 and setting a VMX root mode, and shifted to the hardware operation inhibition mode by one of setting the current privilege level to a value other than 0 and setting a VMX non-root mode;the shadow code is operated in a state where the current privilege level is set to 3 and the VMX root mode is set;the promotion code contains an instruction of changing the current privilege level; andthe switching module is configured to: correlate an address of the operation code for executing the operation of the hardware of the server system with a storage address of the shadow code; andexecute the shadow code by executing processing branching to the storage address of the shadow code in place of processing branching to the operation code based on the correlation when emulation of the operation is executed to call the emulation module by executing the shadow code.
  • 12. The server system according to claim 2, wherein: the generation module inserts an emulation code contained in the emulation module in the promotion code; andthe operation of the hardware of the server system is executed through execution of the emulation code in addition to the promotion code.
  • 13. The server system according to claim 2, wherein: the generation module inserts the promotion code in the shadow code; andthe operation of the hardware of the server system is emulated in the virtual machine monitor through execution of the promotion code in addition to the shadow code.
  • 14. A server system, comprising: at least one CPU;a memory for storing data and a program; andan interface for exchanging data with the outside, wherein:the CPU executes the program stored in the memory to execute a virtual machine monitor for operating at least one virtual computer in which an operating system operates; andthe virtual machine monitor holds an execution frequency of each operation of hardware of the server system requested by one of the operating system and an application operated in the operating system.
  • 15. A control program for a virtual computer for causing a server system equipped with at least one CPU, a memory for storing data and a program, and an interface for exchanging data with the outside to operate at least one virtual computer in which an operating system operates, comprising: a first step of emulating an operation of hardware based on an operation code for executing the operation of the hardware of the server system when an exception event is generated by the CPU through detection of the operation of the hardware of the server system in receiving a request of the operation of the hardware of the server system by one of the operating system and an application operated in the operating system;a second step of executing a promotion code to emulate the operation of the hardware of the server system by switching an operation mode of the CPU;a third step of judging whether a frequency of the operation is high based on a result of comparison with predetermined judgment conditions; anda fourth step of determining which of the first step and the second step is to be executed based on the judged frequency.
  • 16. The control program for a virtual computer according to claim 15, wherein: the CPU includes two operation modes of a hardware operation permission mode and a hardware operation inhibition mode, and generates an exception event to switch the operation mode to the hardware operation permission mode when the operation of the hardware is detected while the operation mode is the hardware operation inhibition mode;the first step includes a step of switching the operation mode of the CPU to the hardware operation permission mode to emulate the operation when the exception event is generated by the CPU through detection of the operation in receiving the request of the operation while the operation mode of the CPU is the hardware operation inhibition mode;the second step includes a step of generating a shadow code to emulate the operation of the hardware of the server system, which corresponds to the operation code by calling the promotion code when the operation mode of the CPU is the hardware operation inhibition mode; andthe fourth step includes a step of executing the second step if a frequency of the operation of the hardware of the server system is high when the operation is requested while the operation mode of the CPU is the hardware operation inhibition mode.
  • 17. The control program for a virtual computer according to claim 15, wherein when a frequency of a first operation of the hardware of the server system requested by one of the operating system and the application operated in the operating system satisfies predetermined conditions, the fourth step executes the second step in place of the first step in a case of executing a second operation code near a first operation code on an instruction address space, for executing the first operation.
  • 18. The control program for a virtual computer according to claim 16, further comprising the steps of: detecting that the operation code to execute the operation has been changed by one of the operating system and the application operated in the operating system; andinvalidating a shadow code corresponding to the changed operation code,wherein the fourth step executes the first step in place of the second step in a case of executing the changed operation code.
  • 19. The control program for a virtual computer according to claim 16, further comprising the steps of: detecting a shortage of a capacity of the memory necessary for holding the shadow code and the promotion code; andselecting a shadow code having a longest unexecuted period among the generated shadow codes, and deleting the selected shadow code and a promotion code associated with the selected shadow code from the memory,wherein the fourth step executes the first step in place of the second step in a case of executing the deleted shadow code.
  • 20. The control program for a virtual computer according to claim 15, wherein the third step includes the steps of: judging which of the operating system and the application operated in the operating system has requested the operation;holding frequency information with which specifying of the operation of a high frequency becomes possible;judging whether a type of the requested operation is contained in the held frequency information when the operating system has requested the operation of the hardware of the server system; andjudging that a frequency of the requested operation is high when the type of the requested operation is contained in the held frequency information.
  • 21. The control program for a virtual computer according to claim 15, wherein the third step includes the steps of: holding a number of execution times of an operation code belonging to each of predetermined address ranges in an instruction address space of the operation code for each of the predetermined address ranges;obtaining the number of execution times of all operation codes included in each of the address ranges to which the operation code for executing the requested operation belongs when the operation of the hardware of the server system is requested by one of the operating system and the application operated in the operating system; andjudging that a frequency of the requested operation is high when the obtained number of execution times exceeds a predetermined threshold value.
  • 22. The control program for a virtual computer according to claim 15, wherein the third step includes the steps of: judging which of the operating system and the application operated in the operating system has requested the operation;holding time information with which specifying of execution time of the operation becomes possible;calculating an interval between time information of execution time of the operation code for executing the requested operation and time information of previous execution time of the operation code for executing the requested operation when the operating system has requested the operation of the hardware of the server system; andjudging that a frequency of the operation is high when the calculated interval is smaller than a predetermined threshold value.
  • 23. The control program for a virtual computer according to claim 15, further comprising the steps of: receiving the predetermined judgment conditions entered by an administrator; andstoring the received predetermined judgment conditions in a storage system.
  • 24. The control program for a virtual computer according to claim 16, wherein: the first step includes a step of shifting the CPU to the hardware operation permission mode by generating an exception event to set a VM bit of the CPU to 0;the second step includes a step of shifting the CPU to the hardware operation permission mode by executing a vmsw instruction to set the VM bit of the CPU to 0; andthe fourth step includes the steps of: correlating an instruction address of the operation code with a storage address of the shadow code corresponding to the operation code, and executing the second step in place of the first step by replacing the address of the operation code with the address of the shadow code based on the correlation; andexecuting the first step in place of the second step through execution of the operation code.
  • 25. The control program for a virtual computer according to claim 16, wherein: the first step includes a step of shifting the CPU to the hardware operation permission mode by generating a VMexit event to set the CPU to a VMX root mode;the second step includes a step of shifting the CPU to the hardware operation permission mode by executing a current privilege level decrease branch instruction to set a current privilege level of the CPU to 0; andthe fourth step includes the steps of: executing the second step in place of the first step in a case of executing emulation of the operation by executing processing branching to a storage virtual address of the shadow code in place of processing branching to an instruction address of the operation code for executing the operation of the hardware of the server system; andexecuting the first step in place of the second step in a case of executing emulation of the operation by executing the processing branching to the instruction address of the operation code for executing the operation of the hardware of the server system.
  • 26. The control program for a virtual computer according to claim 16, wherein the second step includes the steps of: inserting an emulation code for emulating the operation in the promotion code; andexecuting emulation of the operation of the hardware of the server system through execution of the emulation code in addition to the promotion code.
  • 27. The control program for a virtual computer according to claim 16, wherein the second step includes the steps of: inserting the promotion code in the shadow code; andemulating the operation of the hardware of the server system through execution of the promotion code in addition to the shadow code.
  • 28. A control program for a virtual computer for causing a server system equipped with at least one CPU, a memory for storing data and a program, and an interface for exchanging data with the outside to operate at least one virtual computer in which an operating system operates, which causes the server system to execute a step of holding an execution frequency of each operation of hardware of the server system, which has been requested by one of the operating system and an application operated in the operating system.
Priority Claims (1)
Number Date Country Kind
2006-097594 Mar 2006 JP national