Method for processing errata by virtual machine, and related device
By maintaining CPU architecture information in the virtual machine monitor and sharing it with virtual machines, it solves the problem of incomplete Errata recognition in heterogeneous CPU architectures, improves the operating stability and performance of virtual machines, and achieves comprehensive understanding of heterogeneous CPU architectures. manage.
Patent Information
- Application Number
- PCT/CN2023/139804
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-30
- Filing Date
- 2023-12-19
- Publication Date
- 2024-10-03
AI Technical Summary
In a heterogeneous CPU architecture, the virtual machine cannot accurately identify and process all CPU Errata and Timer Errata, causing operational stability to be affected.
All CPU type information and Timer Errata information in the CPU architecture are maintained on the backend through the virtual machine monitor (VMM) and shared with the virtual machine to ensure that the virtual machine can identify and repair all possible Errata and realize heterogeneous CPU architecture. comprehensive management.
It improves the operational stability and performance of the virtual machine, avoids the problem of incomplete Errata recognition, ensures that the virtual machine can smoothly handle all Erratas in the heterogeneous CPU architecture, and decouples the virtual machine firmware construction and Timer Errata recognition, avoiding the problem of incomplete Errata recognition. The need to modify the firmware code due to the emergence of new Errata.
Smart Images

Figure CN2023139804_03102024_PF_FP_ABST
Abstract
Description
Method and related equipment for processing errata of virtual machine
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 30, 2023, with application number 202310353270.X and application name “Method and Related Equipment for Processing Errata of Virtual Machine”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a method for a virtual machine to process an errata sheet and related equipment. Background Art
[0003] A heterogeneous central processing unit (CPU) architecture uses multiple different processors. For example, the big.LITTLE architecture includes two CPUs with different architectures. The "LITTLE" CPU is designed to achieve the highest energy efficiency, while the "big" CPU is designed to provide the highest computing performance. Both CPUs can access the same memory area, so workloads can be dynamically scheduled between the two CPUs.
[0004] For different types of CPUs in a heterogeneous CPU architecture, there are generally differences in instruction sets, microarchitectures, feature sets, etc. In view of these differences, operating systems running on heterogeneous CPU architectures often need to perform some architectural compatibility designs, such as shielding the differences between heterogeneous CPUs and providing a unified operating environment for the entire operating system. One of the typical differences between different types of CPUs is the errata. Errata may exist in the CPU's instructions (hereinafter referred to as CPU Errata), and Errata may also exist in the CPU's timer component (hereinafter referred to as Timer Errata). The operating system can manage Errata that exists on different types of CPUs by configuring the Errata management system.
[0005] For virtual machines built based on heterogeneous CPU architectures, the firmware used by the virtual CPU of the virtual machine is built by the virtual machine monitor (VMM). The virtual machine identifies Timer Errata based on the firmware created by the VMM, but the firmware created by the VMM may not add the relevant Timer Errata description field, resulting in incomplete Timer Errata identification. The CPU type information read by the virtual machine is related to the physical CPU where the virtual CPU is located when the virtual machine is started, which may lead to incomplete identified CPU Errata and incomplete identified Timer Errata. Based on the above reasons, the virtual machine Errata management system cannot obtain all Errata existing in the heterogeneous CPU architecture, which in turn causes the virtual machine Errata management system to be unable to smoothly process all Errata existing in the heterogeneous CPU architecture, affecting the normal operation of the business within the virtual machine.
[0006] Summary of the Invention
[0007] In view of this, it is necessary to provide a method for a virtual machine to handle errata, so that the virtual machine can accurately handle Errata existing in the CPU architecture and improve the stability of the virtual machine operation.
[0008] In a first aspect, an embodiment of the present application discloses a method for processing errata by a virtual machine, which is applied to an electronic device. The electronic device includes a CPU architecture composed of at least one physical CPU, and the electronic device runs a virtual machine (VM) and a VMM for managing the VM. The method includes: the VMM obtains Errata-related information of the CPU architecture, and shares the Errata-related information with the VM, the Errata-related information including CPU type information and Timer Errata information; the VM identifies Errata existing in the CPU architecture based on the Errata-related information; and the VM repairs the identified Errata.
[0009] By adopting the above technical solution, the VMM running on the back-end operating system (i.e., the host operating system, host OS) maintains all CPU type information and all Timer Errata information in the CPU architecture and shares it with the front-end VM, so that the VM can identify all possible Errata (such as CPU Errata and Timer Errata) in the CPU architecture. This can avoid the VM's inability to accurately obtain all Errata existing in the heterogeneous CPU architecture, which in turn causes the VM to be unable to smoothly handle the Errata existing in the heterogeneous CPU architecture, thereby improving the operating stability of the business within the VM.
[0010] In some embodiments, the CPU type information includes type information of each physical CPU in the CPU architecture, the Timer Errata information includes first Timer Errata information and second Timer Errata information, and the VMM obtains Errata-related information of the CPU architecture, including: the VMM traverses the system registers of each physical CPU in the CPU architecture to obtain type information of each physical CPU; the VMM compares the CPU type information with a preset Timer Errata table to obtain the first Timer Errata information corresponding to the CPU type information; the VMM obtains an Advanced Configuration and Power Interface (ACPI) table or a Device Tree (DT) table of the firmware in the CPU architecture, reads Timer Errata-related information fields from the ACPI table or the DT table, and obtains the second Timer Errata information based on the Timer Errata-related information fields.
[0011] By adopting the above technical solution, the system registers of each physical CPU in the CPU architecture are traversed by the VMM at the back end, and the type information of each physical CPU is read therefrom, so as to accurately maintain all CPU type information in the CPU architecture. The ACPI table or DT table of the firmware in the CPU architecture is parsed by the VMM at the back end to identify the Timer Errata that may exist in the CPU architecture, and the Timer Errata that may exist in the CPU architecture is supplemented and identified based on the CPU type information, thereby comprehensively collecting the Timer Errata information of the CPU architecture. All the CPU type information and all the Timer Errata information in the CPU architecture maintained by the back end are shared with the VM at the front end, so that the VM can accurately identify all possible Errata in the CPU architecture, decouple the VM firmware construction and the Timer Errata identification (that is, the Timer Errata identification does not rely on the VM firmware), so that when a new Timer Errata appears, there is no need to modify the VM firmware construction code.
[0012] In some embodiments, the electronic device is configured with a shared storage area to which both the VM and the VMM have access rights, and sharing Errata related information with the VM includes: the VMM writing the Errata related information to the shared storage area; and the VM reading the Errata related information from the shared storage area.
[0013] By adopting the above technical solution, communication between VM and VMM is realized by setting up a shared storage area, so that the information maintained by VMM at the back end can be shared with VM at the front end, and the information maintained by VM at the front end can be shared with VMM at the back end. For example, VMM can write the information shared with VM to the shared storage area, and VM reads the information written by VMM from the shared storage area. VM can write the information shared with VMM to the shared storage area, and VMM reads the information written by VM from the shared storage area.
[0014] In some embodiments, the VM identifies Errata existing in the CPU architecture based on Errata-related information, including: the VM compares the CPU type information with a preset CPU Errata table to obtain the CPU Errata existing in the CPU architecture; the VM obtains the Timer Errata existing in the CPU architecture based on the Timer Errata information.
[0015] With the above technical solution, the VM can accurately identify the CPU Errata and Timer Errata existing in the CPU architecture based on the Errata-related information shared by the VMM, allowing the VM to smoothly handle all CPU Errata and Timer Errata existing in heterogeneous CPU architectures, thereby improving the operational stability of services within the VM.
[0016] In some embodiments, a VM is equipped with a guest operating system (guest OS), and the identified errata includes a static management type errata and a dynamic management type errata. The VM repairs the identified errata, including: when the guest OS of the VM runs to errata processing logic for a first errata, and the first errata is a static management type errata, and it is determined that the first errata exists in the CPU architecture, the VM executes the errata repair logic for the first errata to repair the first errata; when the guest OS of the VM runs to errata processing logic for the first errata, and the first errata is a dynamic management type errata, and it is determined that the first errata exists in the CPU architecture, the VM executes the errata repair logic for the first errata to repair the first errata; when the guest OS of the VM runs to errata processing logic for the first errata, and the first errata is a dynamic management type errata, and it is determined that the first errata does not exist in the CPU architecture, the VM executes non-repair logic for the first errata.
[0017] By adopting the above technical solution, Errata can be divided into CPU Errata, Timer Errata, etc. according to its type. Errata can also be divided according to the management method. According to different management methods, it can be divided into two types: static management type Errata and dynamic management type Errata. The operating system of the electronic device (also known as host OS) and the gust OS of the VM can contain Errata processing logic for various Errata. Taking the gust OS of the VM as an example, for static management type Errata, when the guest OS of the VM runs to the Errata processing logic of a certain Errata, if the Errata exists in the CPU architecture, the Errata repair logic can be directly executed. For dynamic management type Errata, the guest OS of the VM When the OS runs into the Errata processing logic of a certain Errata, it can determine whether to execute the Errata repair logic based on the CPU type information of the CPU architecture. For example, if it is determined based on the CPU type information that the CPU architecture has the Errata, the Errata repair logic is executed to repair the Errata. If it is determined that the CPU architecture does not have the Errata, the non-repair logic is executed, that is, the Errata is not repaired. This avoids executing redundant Errata repair logic and improves the performance of the VM.
[0018] In some embodiments, the VM further includes a dynamic Errata management switch. When the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is a dynamic management type Errata, and it is determined that the CPU architecture has the first Errata, the VM executes the Errata repair logic of the first Errata, including: when the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is a dynamic management type Errata, and it is determined that the CPU architecture has the first Errata, and the dynamic Errata management switch is in the off state, the VM executes the Errata repair logic of the first Errata; when the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is a dynamic management type Errata, and it is determined that the CPU architecture does not have the first Errata, the VM executes the non-repair logic of the first Errata, including: in the guest OS of the VM When the OS runs to the Errata processing logic of the first Errata, and the first Errata is a dynamic management type Errata, and it is determined that the CPU architecture does not have the first Errata, and the dynamic Errata management switch is in the off state, the VM executes the non-repair logic of the first Errata.
[0019] By adopting the above technical solution, whether to enable the dynamic Errata processing mechanism can be selected by setting a dynamic Errata management switch in the VM. For example, the VM can set the dynamic Errata management switch to an off state or an on state in response to user operations. If the dynamic Errata management switch is set to an off state, when the guest OS of the VM runs to the Errata processing logic of a certain dynamic management type Errata, it can determine whether to execute the Errata repair logic based on the CPU type information. If it is determined based on the CPU type information that the CPU architecture has the dynamic management type Errata, the Errata repair logic is executed. If it is determined based on the CPU type information that the CPU architecture does not have the dynamic management type Errata, the non-repair logic is executed.
[0020] In some embodiments, the VM also includes a dynamic Errata management switch, which is in an on state. The method for the virtual machine to process an errata sheet also includes: the VMM obtains the physical CPU type information of the VCPU thread of the VM, and shares the physical CPU type information of the VCPU thread with the VM. The VM can also perform Errata repair processing based on the physical CPU type information of the VCPU thread.
[0021] By adopting the above technical solution, if the dynamic Errata management switch is turned on, the physical CPU type information of the VCPU thread is obtained in real time, and the Errata repair logic is determined based on the physical CPU type information of the VCPU thread, thereby avoiding the execution of redundant Errata repair logic and further improving the performance of the VM.
[0022] In some embodiments, a VM is equipped with a guest OS, and the identified Errata includes a static management type Errata and a dynamic management type Errata. The VM performs repair processing on the identified Errata, including: when the guest OS of the VM runs to the Errata processing logic of the second Errata, and the second Errata is the static management type Errata, and it is determined that the CPU architecture has the second Errata, the VM executes the Errata repair logic of the second Errata to repair the second Errata; when the guest OS of the VM runs to the Errata processing logic of the second Errata, and the second Errata is the dynamic management type Errata, and it is determined based on the physical CPU type information of the VCPU thread that the CPU where the VCPU thread is located has the second Errata, the VM executes the Errata repair logic of the second Errata to repair the second Errata; when the guest OS of the VM runs to the Errata processing logic of the second Errata, and the second Errata is the dynamic management type Errata, and it is determined based on the physical CPU type information of the VCPU thread that the VCPU thread is located that the CPU where the VCPU thread is located has the second Errata, the VM executes the Errata repair logic of the second Errata to repair the second Errata; When the OS runs to the Errata processing logic of the second Errata, and the second Errata is a dynamically managed Errata, and it is determined based on the physical CPU type information where the VCPU thread is located that the CPU where the VCPU thread is located does not have the second Errata, the VM executes the non-repair logic of the second Errata.
[0023] With the above technical solution, Errata can be divided into CPU Errata, Timer Errata, etc. according to its type. Errata can also be divided according to the management method. According to the different management methods, it can be divided into two types: static management type Errata and dynamic management type Errata. The host OS of the electronic device and the gust OS of the VM can contain Errata processing logic of various Errata. Taking the gust OS of the VM as an example, for static management type Errata, when the guest OS of the VM runs to the Errata processing logic of a certain Errata, if the Errata exists in the CPU architecture, the Errata repair logic can be directly executed. For dynamic management type Errata, the guest OS of the VM When the OS runs to the Errata processing logic of a certain dynamic management type Errata, it can determine whether to execute the Errata repair logic based on the physical CPU type where the VCPU thread is currently located. For example, by obtaining the physical CPU type where the VCPU thread is currently located, it is determined based on the physical CPU type whether the physical CPU of this type has the dynamic management type Errata. If it is determined that the dynamic management type Errata does not exist in the physical CPU of this type, the non-repair logic is executed. If it is determined that the dynamic management type Errata exists in the physical CPU of this type, the Errata repair logic is executed. This can avoid executing redundant Errata repair logic and improve the performance of the VM.
[0024] In some embodiments, the method for a virtual machine to process an errata sheet further includes: the VM sharing the second Errata processing context with the VMM; and the VMM managing scheduling of a VCPU thread of the VM based on the second Errata processing context.
[0025] By adopting the above technical solution, the Errata processing context of the VCPU thread is maintained in real time on the front end and shared with the back-end VMM. When the VMM determines that the VCPU thread is in the Errata processing logic, it prohibits the VCPU thread from performing cross-type CPU scheduling or prohibits the VCPU thread from performing CPU scheduling. This ensures that the VCPU thread handles Errata correctly and avoids the VCPU thread being scheduled to other CPUs containing the Errata when processing the non-modification logic of a certain Errata, resulting in Errata processing logic errors and affecting the normal operation of the VM.
[0026] In some embodiments, the VMM manages the scheduling of the VCPU thread of the VM based on the second Errata processing context, including: the VMM prohibits the VCPU thread of the VM from performing cross-type CPU scheduling based on the second Errata processing context; or the VMM prohibits the VCPU thread of the VM from performing CPU scheduling based on the second Errata processing context.
[0027] With the above technical solution, when the VMM determines that the VCPU thread is in the Errata processing logic, it prohibits the VCPU thread from performing cross-type CPU scheduling, but allows CPU scheduling of the same type, or directly prohibits the VCPU thread from performing CPU scheduling (that is, CPU scheduling of the same type is also not allowed), ensuring that the VCPU thread correctly handles Errata.
[0028] In some embodiments, the method for processing an errata by a virtual machine further includes: when the second Errata processing is completed, the VM shares the second Errata processing completion context with the VMM; and the VMM restores the CPU scheduling authority of the VCPU thread of the VM based on the second Errata processing completion context.
[0029] With the above technical solution, after the VCPU thread completes Errata processing, the VMM determines that the VCPU thread is not in the Errata processing logic, and restores the CPU free scheduling permission of the VM's VCPU thread, realizing global CPU resource scheduling and management of the VM. This can fully utilize the CPU resources of the CPU architecture, give full play to the balance of computing power and power consumption of the CPU architecture, flexibly support the operation and maintenance of the VM, and improve the application experience deployed on the VM.
[0030] In a second aspect, an embodiment of the present application provides a computer-readable storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method for processing errata by a virtual machine as described in the first aspect.
[0031] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, the memory being used to store instructions, and the processor being used to call instructions in the memory, so that the electronic device executes the method for virtual machine processing errata as described in the first aspect.
[0032] In a fourth aspect, an embodiment of the present application provides a computer program product, which, when executed on an electronic device (such as a computer), enables the electronic device to execute the method for processing errata by a virtual machine as described in the first aspect.
[0033] In a fifth aspect, a device is provided, wherein the device has the function of implementing the electronic device behavior in the method provided in the first aspect. The function can be implemented through hardware or through hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0034] It can be understood that the computer-readable storage medium described in the second aspect, the electronic device described in the third aspect, the computer program product described in the fourth aspect, and the device described in the fifth aspect all correspond to the method of the first aspect. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] FIG1 is a schematic diagram of a system architecture for CPU resource management of virtual machines with heterogeneous CPU architectures according to an embodiment of the present application;
[0036] FIG2 is a schematic structural diagram of an electronic device provided in one embodiment of the present application;
[0037] FIG3 is a schematic diagram of a software structure of an electronic device provided in one embodiment of the present application;
[0038] FIG4 is a schematic diagram of an application architecture of a method for processing errata by a virtual machine according to an embodiment of the present application;
[0039] FIG5a is a schematic diagram of a system architecture for performing errata processing on a virtual machine deployed on an electronic device according to an embodiment of the present application;
[0040] FIG5 b is a schematic diagram of a system architecture for performing errata processing on a virtual machine deployed on an electronic device according to another embodiment of the present application;
[0041] FIG6 is a schematic diagram of the interaction between a virtual machine deployed on an electronic device and a virtual machine monitor according to an embodiment of the present application;
[0042] FIG7 is a schematic diagram of interaction between a virtual machine deployed on an electronic device and a virtual machine monitor provided by another embodiment of the present application;
[0043] FIG8 is a flowchart illustrating the steps of a method for a virtual machine to process an errata sheet provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] It should be noted that in this application, "at least one" means one or more, and "more than one" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The terms "first", "second", "third", "fourth", etc. (if any) in the specification, claims and drawings of this application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0045] In the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0046] Operating System (OS): A computer program that manages computer hardware and software resources.
[0047] Process: It is an operation activity of a program with an independent function on a certain data set. The process is the basic unit of dynamic execution of the operating system. In traditional operating systems, the process is both the basic allocation unit and the basic execution unit. The process can be considered as an instance of a running program.
[0048] A thread is the smallest unit of computational scheduling within an operating system. It is contained within a process and serves as the actual operational unit within that process. A thread is a single, sequential flow of control within a process. Multiple threads can run concurrently within a process, each executing different tasks in parallel.
[0049] Errata: A defect discovered after hardware design is complete that causes certain features to deviate from the architecture and not work properly under certain circumstances, similar to a bug in a software program. Operating systems require special handling for errata, such as executing specific code segments or configuring the hardware in a specific way.
[0050] Virtualization is a resource management technology that abstracts and transforms a host's physical resources, such as network resources, memory, and storage, to create a more tangible representation. This breaks down the barriers between the host's physical structure and allows users to utilize these resources in a more efficient manner than their original configuration. Resources utilized through virtualization are called virtualized resources. Virtualized resources are not restricted by the configuration, location, or physical configuration of existing resources. Generally, virtualized resources include computing resources and storage resources.
[0051] A virtual machine (VM) is one or more virtual computers emulated on a physical computer using software. These VMs operate in a completely isolated environment, functioning like real computers. A guest operating system (OS) can be installed on the VM, which runs one or more applications. The VM can also access network resources. Applications running in the VM behave as if they were operating on a real computer.
[0052] Host layer: as a management layer, it is used to complete the management and allocation of hardware resources; present a virtual hardware platform to virtual machines; implement the scheduling and isolation of virtual machines, etc. In some implementations, the host layer includes a host operating system (host OS) and a virtual monitoring device, such as a VMM or a hypervisor, wherein the virtual monitoring device can be deployed within the host operating system or outside the host operating system. In other implementations, the "host layer" may also include a privileged virtual machine (such as the virtualization architecture Xen). Among them, the virtual hardware platform provides various hardware resources to each virtual computer running on it, such as virtual processors, virtual memory, virtual disks, virtual network cards, etc. The virtual computer runs on the virtual hardware platform prepared for it by the host layer. In this application, the host layer is sometimes referred to as the host.
[0053] The hardware layer refers to the hardware platform on which the virtualization environment runs. The hardware layer can include various hardware components. For example, the hardware layer of a physical computer may include a processor and memory, as well as interrupt controllers, network interface cards (NICs), and input / output (I / O) devices.
[0054] Physical processor: in this application, refers to a physical processing unit, which may specifically be a minimum processing unit, for example, including one physical core. In some embodiments, it may also refer to a processing unit including multiple physical cores.
[0055] Virtual processor: In virtualization, a physical processing unit (e.g., a virtual central processing unit, vCPU) is shared or sliced and provided to a virtual computer. A virtual computer can have one or more virtual processors. When there are multiple virtual processors, one is typically the master virtual processor, and the others are slave virtual processors.
[0056] One or more virtual machines can be created on a host machine. Both the host OS of the host machine and the gust OS of the virtual machine can be deployed with an Errata management system. The Errata management system can identify and repair Errata errors in the host machine's CPU architecture (either homogeneous or heterogeneous) to ensure the normal operation of the host machine. For example, the Errata management system in the host OS of the host machine can identify and repair Errata errors in the CPU architecture while the host OS is running; the Errata management system in the gust OS of the virtual machine can identify and repair Errata errors in the CPU architecture while the gust OS is running to ensure the normal operation of the virtual machine.
[0057] For virtual machines, in order to avoid the problem that when the Errata management system in Gust OS performs non-repair processing on an Errata that does not exist on a certain type of CPU, the VCPU thread is scheduled to other CPUs with this Errata, resulting in Errata processing logic errors and affecting the normal operation of the business within the virtual machine, the VCPU binding core method can be used to solve the above problem. As shown in Figure 1, it is assumed that the electronic device includes two types of CPUs (a first type of CPU and a second type of CPU), virtual machines VM 1 and VM3 are homogeneous core virtual machines, and virtual machine VM2 is a hybrid core virtual machine. VMM performs CPU resource management for each virtual machine. The strategy based on VCPU binding core can only support regional CPU resource management. That is, in the virtual machine design and virtual machine initialization process, the virtual machine's VCPU type is fixedly initialized to a certain type of CPU or several types of CPUs in the heterogeneous CPU architecture; during the entire virtual machine life cycle and the operation and maintenance of the virtual machine, the virtual machine's VCPU can only be scheduled and operated within a certain type of CPU for initial resource management, and cannot support global CPU resource management (cannot schedule between different types of CPUs), cannot fully utilize the CPU resources of the heterogeneous CPU architecture, cannot flexibly schedule across the entire domain according to application load, cannot give full play to the balance of computing power and power consumption of the heterogeneous CPU architecture, cannot flexibly support the operation and maintenance of the virtual machine, and affects the application experience deployed on the virtual machine. In addition, the above solution also has the problem of incomplete Errata recognition, which causes the Errata management system in the virtual machine to be unable to smoothly handle all Errata existing in the heterogeneous CPU architecture.
[0058] To solve the above technical problems, some embodiments of the present application provide a method for virtual machine processing errata, by maintaining all CPU type information and all Timer Errata information in the CPU architecture on the back end (host OS) and sharing them with the front-end virtual machine, so that the Errata management system of the virtual machine can identify all possible CPU Errata and all possible Timer Errata, avoiding the problem of incomplete Errata recognition, which causes the Errata management system in the virtual machine to be unable to smoothly handle all Errata existing in the heterogeneous CPU architecture. In addition, by maintaining and updating the physical CPU type information of the VCPU thread in real time on the back end, and maintaining the Errata processing context of the VCPU thread on the front end, when the VCPU thread is in the Errata processing logic, cross-type CPU scheduling of the VCPU thread is prohibited. After the Errata processing is completed, the CPU free scheduling permission of the VCPU thread is restored, thereby realizing global CPU resource scheduling and management of each virtual machine, making full use of the CPU resources of the heterogeneous CPU architecture, giving full play to the balance of computing power and power consumption of the heterogeneous CPU architecture, flexibly supporting the operation and maintenance of the virtual machine, and improving the application experience deployed on the virtual machine.
[0059] The method for processing errata of a virtual machine provided in an embodiment of the present application can be applied to an electronic device, and the electronic device can communicate with other electronic devices or servers through a communication network. The electronic device of the present application may include a server or a terminal device. The terminal device includes but is not limited to a mobile phone, a foldable electronic device, a tablet computer, a personal computer (PC), a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, a smart home device, and at least one of smart city devices. The embodiment of the present application does not impose any special restrictions on the specific type of electronic device. The communication network can be a wired network or a wireless network. For example, the communication network can be a local area network (LAN) or a wide area network (WAN), such as the Internet. When the communication network is a local area network, illustratively, the communication network may be a short-range communication network such as a wireless fidelity (Wi-Fi) hotspot network, a Wi-Fi P2P network, a Bluetooth network, a ZigBee network, or a near field communication (NFC) network. When the communication network is a wide area network, illustratively, the communication network may be a third-generation wireless telephone technology (3G) network, a fourth-generation mobile communication technology (4G) network, a fifth-generation mobile communication technology (5G) network, a future-evolved public land mobile network (PLMN), or the Internet.
[0060] In some embodiments, the electronic device can install one or more APPs (Applications). APP can be referred to as application, which is a software program that can realize one or more specific functions. For example, communication applications, video applications, audio applications, image shooting applications, cloud desktop applications, etc. Among them, communication applications may include text messaging applications. Image shooting applications may include shooting applications (system cameras or third-party shooting applications). Video applications may include Huawei Video. Audio applications may include Huawei Music. The applications mentioned in the following embodiments may be system applications installed on the electronic device when it leaves the factory, or they may be third-party applications downloaded from the Internet or obtained from other electronic devices by the user during the use of the electronic device.
[0061] Electronic equipment including but not limited to Windows Or other operating systems. Operating system or The operating system is used as an example for explanation.
[0062] FIG2 shows a schematic structural diagram of an electronic device 10 .
[0063] The electronic device 10 may include a processor 110, an external memory interface 120, an internal memory 121, an antenna 1, an antenna 2, a mobile communication module 130, a wireless communication module 140, an audio module 150, a sensor module 160, a camera module 170, a display screen 180, etc.
[0064] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0065] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0066] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 may be a cache memory. The memory can store instructions or data that have been used or are frequently used by processor 110. When processor 110 needs to use these instructions or data, it can directly access them from the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0067] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface. The processor 110 may be connected to modules such as an audio module, a wireless communication module, a display, and a camera through at least one of the above interfaces.
[0068] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is merely illustrative and does not constitute a structural limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0069] The wireless communication function of the electronic device 10 can be implemented through the antenna 1, the antenna 2, the mobile communication module 130, the wireless communication module 140, the modem processor and the baseband processor.
[0070] The mobile communication module 130 can provide solutions for wireless communications, including 2G / 3G / 4G / 5G, applied to the electronic device 10. The mobile communication module 130 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. In some embodiments, at least some of the functional modules of the mobile communication module 130 may be provided in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 130 may be provided in the same device as at least some of the modules of the processor 110.
[0071] The wireless communication module 140 can provide wireless communication solutions for the electronic device 10, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), Bluetooth low energy (BLE), ultra wide band (UWB), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. The wireless communication module 140 can be one or more devices that integrate at least one communication processing module.
[0072] In some embodiments, the electronic device 10 can communicate with a network and other electronic devices via wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS).
[0073] Electronic device 10 can implement display functions using a GPU, display screen 180, and an application processor. A GPU is a microprocessor for image processing that connects display screen 180 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0074] The camera module 170 includes a camera. The display screen 180 is used to display images, videos, etc. The display screen 180 can be a touch screen. The display screen 180 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 10 may include one or more display screens 180.
[0075] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 10. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function.
[0076] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 10, etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional methods or data processing of the electronic device 10 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.
[0077] The audio module 150 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 150 can also be used to encode and decode audio signals. In some embodiments, the audio module 150 can be provided in the processor 110, or some functional modules of the audio module 150 can be provided in the processor 110.
[0078] The software system of the electronic device 10 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present application, the Android system with a layered architecture is used as an example to illustrate the software structure of the electronic device 10.
[0079] FIG3 is a software structure block diagram of the electronic device 10 according to an embodiment of the present application.
[0080] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers: from top to bottom: the application layer, the application framework layer, the Android runtime (ART) and native C / C++ libraries, the hardware abstraction layer (HAL), and the kernel layer.
[0081] The application layer can include a series of application packages.
[0082] As shown in FIG3 , the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
[0083] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0084] As shown in FIG3 , the application framework layer may include a window manager, a content provider, a view system, a resource manager, a notification manager, an activity manager, an input manager, and the like.
[0085] The window manager provides window management services (WMS). WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.
[0086] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0087] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.
[0088] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0089] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include displaying text messages in the status bar, emitting alert sounds, vibrating electronic devices, or flashing indicator lights.
[0090] The Activity Manager can provide Activity Management Service (AMS), which can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers) as well as manage and schedule application processes.
[0091] The Input Manager provides Input Management Service (IMS), which manages system inputs, such as touch screen input, key input, and sensor input. The IMS retrieves events from input device nodes and, through interaction with the WMS, distributes the events to the appropriate window.
[0092] The Android runtime consists of the core libraries and the Android runtime. The Android runtime is responsible for converting source code into machine code. It primarily utilizes ahead-of-time (AOT) and just-in-time (JIT) compilation technologies.
[0093] The core library is mainly used to provide basic Java class library functions, such as basic data structures, mathematics, IO, tools, databases, networks, etc. The core library provides an API for users to develop Android applications.
[0094] Native C / C++ libraries can include multiple functional modules, such as surface manager, media framework, libc, OpenGL ES, SQLite, Webkit, etc.
[0095] Among them, the surface manager is used to manage the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. OpenGL ES provides the drawing and operation of 2D and 3D graphics in applications. SQLite provides a lightweight relational database for applications of electronic device 10.
[0096] The hardware abstraction layer runs in user space, encapsulates kernel layer drivers, and provides a calling interface to the upper layer.
[0097] The kernel layer is the layer between hardware and software. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver.
[0098] 4 , a schematic diagram of an application architecture of a method for processing errata by a virtual machine is exemplarily introduced below.
[0099] In this embodiment, the application architecture may include a hardware layer and a software layer. The hardware layer may include one or more hardware resources. FIG4 illustrates the hardware layer including CPU resources as an example. Assume that the electronic device 10 includes CPUs of two architectures (hereinafter referred to as the first type CPU and the second type CPU for ease of distinction). The first type CPU may include one or more physical cores core1, and the second type CPU may include one or more physical cores core2. The electronic device 10 may be a terminal device or a server, which is not limited in this embodiment of the present application.
[0100] The software layer may include one or more virtual machines and a VMM that manages the one or more virtual machines. The VMM may be a first-type VMM (Type-1 VMM), a second-type VMM (Type-2 VMM), etc., and this application does not limit this. Figure 4 takes the software layer including multiple virtual machines as an example. The module / unit referred to in the embodiment of the present application may refer to a series of computer program instruction segments that can perform specific functions, or it may be a functional module formed by the cooperation of computer program instruction segments and hardware. The division of modules is a logical functional division, and there may be other division methods in actual implementation, which this application does not limit.
[0101] The VMM may include a virtualization Errata management backend module 101 and a resource management module 102. The virtualization Errata management backend module 101 is used to collect CPU type information and Timer Errata information. The CPU type information and Timer Errata information can be presented and saved in the form of arrays, linked lists, bitmaps, etc., which are not limited in this application. For example, the virtualization Errata management backend module 101 can collect CPU type information by traversing all CPUs in the electronic device 10 and reading the system registers of each CPU; the virtualization Errata management backend module 101 can also identify existing Timer Errata by reading the Timer Errata related information field and identifying existing Timer Errata based on CPU type information, thereby achieving comprehensive collection of Timer Errata information. For example, for advanced configuration and power interface (ACPI) type firmware (the firmware used by the host machine's CPU architecture, which has been configured by the device manufacturer when the electronic device leaves the factory), the virtualization Errata management back-end module 101 can parse the ACPI table to obtain the Timer Errata related information field, and then identify the existing Timer Errata; for device tree (DT) type firmware (the firmware used by the host machine's CPU architecture), the virtualization Errata management back-end module 101 can parse the DT table to obtain the Timer Errata related information field, and then identify the existing Timer Errata.
[0102] The resource management module 102 is used to schedule and manage resources for each virtual machine, for example, to schedule and manage CPU resources for each virtual machine.
[0103] Each virtual machine may include a virtualized Errata management front-end module 103 and an Errata management system 104. The virtualized Errata management front-end module 103 is used to obtain the CPU type information and Timer Errata information collected by the virtualized Errata management back-end module 101, and identify Errata (CPU Errata and Timer Errata) in heterogeneous CPU architectures based on the CPU type and Timer Errata information. The Errata management system 104 is used to call the virtualized Errata management front-end module 103 to identify Errata when identifying Errata in heterogeneous CPU architectures or in a certain type of CPU. The Errata management system 104 is also used to perform either repair or non-repair processing on Errata.
[0104] In some embodiments, repairing Errata may refer to executing Errata repair logic to repair Errata, and non-repairing Errata may refer to executing non-repair logic (not repairing the Errata).
[0105] For example, a CPU Errata occurs when erasing data stored in a high-speed cache memory in a CPU. Executing an erase instruction once may result in incomplete erasure of the data. The repair logic for the CPU Errata is to execute a second erase instruction.
[0106] For example, a Timer Errata occurs when reading data of a certain count from the Timer. A single read may result in inaccurate data reading. The repair logic for this CPU Errata is to perform multiple reads (for example, three reads).
[0107] In some embodiments, the virtualized Errata management front-end module 103 may also be integrated into the Errata management system 104, which is not limited in this application. The Errata repair logic and non-repair logic may be a series of computer program instruction segments, which is not limited in this application.
[0108] In some embodiments, the virtualized Errata management backend module 101 is also used to maintain the physical CPU type information of the virtual machine's VCPU thread in real time, and the virtualized Errata management front-end module 103 can obtain the physical CPU type information of the virtual machine's VCPU thread currently located maintained by the virtualized Errata management backend module 101. Before processing a certain Errata, the Errata management system 104 can determine whether to execute Errata repair logic or non-repair logic based on the physical CPU type information where the VCPU thread is located. For example, before processing the first Errata, the Errata management system 104 determines all Erratas that exist on the physical CPU of this type based on the physical CPU type information where the VCPU thread is located. If the first Errata exists on the physical CPU of this type, the Errata repair logic is executed (the first Errata is repaired). If the first Errata does not exist on the physical CPU of this type, the non-repair logic is executed (i.e., the first Errata is not repaired).
[0109] In some embodiments, while the Errata management system 104 is processing an Errata event, the virtualized Errata management front-end module 103 is further configured to maintain an Errata processing context. The virtualized Errata management back-end module 101 can obtain the Errata processing context maintained by the virtualized Errata management front-end module 103 and manage the scheduling of the virtual machine's VCPU threads. For example, the virtualized Errata management back-end module 101 may determine, based on the Errata processing context, that the virtual machine is in Errata processing logic and prohibit the virtual machine's VCPU threads from being scheduled across physical CPU types.
[0110] As shown in Figure 5a, the software layer includes a virtual machine and a VMM that manages the virtual machine. The CPU architecture of the electronic device 10 can be a heterogeneous CPU architecture or a homogeneous CPU architecture.
[0111] The virtualized Errata management backend module 101 may include a CPU type collection unit 1011 and a Timer Errata collection unit 1012. The CPU type collection unit 1011 is used to collect CPU type information. For example, the CPU type collection unit 1011 can collect CPU type information by traversing all CPUs in the electronic device 10 and reading the system registers of each CPU. The Timer Errata collection unit 1012 is used to collect Timer Errata information. For example, the Timer Errata collection unit 1012 can parse the ACPI table or DT table of the firmware of the CPU architecture, read the Timer Errata related information field in the ACPI table or DT table, and identify the existing Timer Errata. The Timer Errata collection unit 1012 also identifies the existing Timer Errata based on the CPU type information, for example, traversing the Timer Errata table in the CPU Timer driver (the Timer Errata table can store the Timer Errata corresponding to each CPU type) based on the CPU type information to identify the existing Timer Errata.
[0112] The virtualization Errata management front-end module 103 can obtain the CPU type information and Timer Errata information collected by the CPU type collection unit 1011 and the Timer Errata collection unit 1012 through an information sharing channel. The information sharing channel can be a channel that enables information exchange between the virtualization Errata management front-end module 103 and the virtualization Errata management back-end module 101.
[0113] In some embodiments, a channel for information sharing between the virtualized Errata management front-end module 103 and the virtualized Errata management back-end module 101 can be established based on para-virtualization (PV) technology. For example, the channel for information sharing between the virtualized Errata management front-end module 103 and the virtualized Errata management back-end module 101 can be established based on shared memory, Hypervisor Call (HVC), etc. Taking shared memory as an example, the virtualized Errata management front-end module 103 can write information shared with the virtualized Errata management back-end module 101 to the shared memory, and the virtualized Errata management back-end module 101 reads the information shared by the virtualized Errata management front-end module 103 from the shared memory. Similarly, the virtualized Errata management back-end module 101 can write information shared with the virtualized Errata management front-end module 103 to the shared memory, and the virtualized Errata management front-end module 103 reads the information shared by the virtualized Errata management back-end module 101 from the shared memory.
[0114] The virtualized Errata management front-end module 103 can identify Errata in the CPU architecture of the electronic device 10 based on the CPU type information and the Timer Errata information. The Errata management system 104 can call the virtualized Errata management front-end module 103 to perform Errata identification when Errata identification is required.
[0115] When the guest OS of the virtual machine runs into the Errata processing logic for a certain Errata, the Errata management system 104 may also determine whether to perform a repair process or a non-repair process for the Errata based on the CPU type information. For example, if the CPU type information determines that the CPU architecture has the Errata, the Errata is repaired (the Errata repair logic is executed). If the CPU type information determines that the CPU architecture does not have the Errata, the Errata is not repaired (the non-repair logic is executed).
[0116] The above solution maintains all CPU type information and all Timer Errata information in the CPU architecture in the backend and shares them with the front-end virtual machine, so that the Errata management system of the virtual machine can identify all possible CPU Errata and all possible Timer Errata. This can avoid the problem that the virtual machine Errata management system cannot obtain all Errata existing in the heterogeneous CPU architecture, which in turn causes the virtual machine Errata management system to be unable to smoothly handle all Errata existing in the heterogeneous CPU architecture, thereby improving the operating stability of the business in the virtual machine. At the same time, the virtual machine firmware construction and Timer Errata identification are decoupled (Timer Errata identification does not rely on the virtual machine firmware), so that when a new Timer Errata occurs, there is no need to modify the construction code of the virtual machine firmware.
[0117] As shown in Figure 5b, the application architecture provides a dynamic Errata handling mechanism that uses a dynamic Errata management switch to select whether to enable the dynamic Errata handling mechanism. For example, the virtual machine can turn the dynamic Errata management switch off or on in response to user operations. The CPU architecture of the electronic device 10 is described using a heterogeneous CPU architecture as an example.
[0118] The virtualization Errata management backend module 101 may include a CPU type collection unit 1011, a Timer Errata collection unit 1012, a VCPU type maintenance unit 1013 and a VCPU scheduling management unit 1014. The functions of the CPU type collection unit 1011 and the Timer Errata collection unit 1012 have been introduced in the above embodiments and will not be repeated here. The VCPU type maintenance unit 1013 is used to maintain the physical CPU type information where the VCPU thread of the virtual machine is located in real time. When the VCPU thread is scheduled to other CPUs, the VCPU type maintenance unit 1013 can update the physical CPU type information where the VCPU thread is located in real time. The VCPU scheduling management unit 1014 is used to control the scheduling of the VCPU thread. For example, when it is determined that the VCPU is in the Errata processing logic, the VCPU thread is prohibited from performing cross-type CPU scheduling.
[0119] If the dynamic Errata management switch is turned off, when the guest OS of the virtual machine runs to the Errata processing logic of a certain Errata, all Errata existing in the current heterogeneous CPU architecture can be determined based on the CPU type information collected by the CPU type collection unit 1011. If the Errata exists in the heterogeneous CPU architecture, the Errata repair logic is executed (the Errata is repaired). If the Errata does not exist in the heterogeneous CPU architecture, the non-repair logic is executed (i.e., the Errata is not repaired). If the dynamic Errata management switch is turned on, when the guest OS of the virtual machine runs to the Errata processing logic of a certain Errata, the physical CPU type information of the VCPU thread is obtained in real time, and based on the physical CPU type information of the VCPU thread, it is determined whether to execute the Errata repair logic or the non-repair logic. For example, based on the physical CPU type information where the VCPU thread is located, all Erratas that exist on the physical CPU of this type are determined. If the Errata exists on the physical CPU of this type, the Errata repair logic is executed (this Errata is repaired). If the Errata does not exist on the physical CPU of this type, the non-repair logic is executed (i.e., this Errata is not repaired). The host OS of the host machine can also determine whether the VCPU thread is allowed to be scheduled by obtaining whether it is in the Errata processing logic, for example, determining whether the VCPU is allowed to be scheduled from the current type of physical CPU to another type of physical CPU. If it is determined that the VCPU thread is in the Errata processing logic, the VCPU thread is prohibited from being scheduled across types of physical CPUs.
[0120] The virtualized Errata management front-end module 103 is further configured to obtain the physical CPU type information of the VCPU thread of the virtual machine maintained by the VCPU type maintenance unit 1013 in real time. For example, the virtualized Errata management front-end module 103 may obtain the physical CPU type information of the VCPU thread of the virtual machine maintained by the VCPU type maintenance unit 1013 in real time through shared memory. The Errata management system 104 is further configured to determine, before performing Errata processing, whether to execute Errata repair logic (repair this Errata) or execute non-repair logic (i.e., not repair this Errata) based on the physical CPU type information of the VCPU thread currently located obtained by the virtualized Errata management front-end module 103.
[0121] In some embodiments, the virtualized Errata management front-end module 103 is also used to maintain the Errata processing context of the VCPU thread of the virtual machine. The Errata processing context is used to characterize the Errata management system 104 in processing Errata (executing Errata repair logic or executing non-repair logic). The VCPU scheduling management unit 1014 can obtain the Errata processing context of the virtualized Errata management front-end module 103, and then determine that the VCPU of the virtual machine is in the Errata processing logic, and prohibit the VCPU thread from performing cross-type physical CPU scheduling. For example, the VCPU scheduling management unit 1014 can obtain the Errata processing context maintained by the virtualized Errata management front-end module 103 through shared memory.
[0122] The above solution maintains and updates the physical CPU type information of the VCPU thread and the Errata processing context of the VCPU thread in real time, so that when the VCPU thread is in the Errata processing logic, cross-type CPU scheduling is prohibited. After the Errata processing is completed, the CPU free scheduling of the VCPU thread is restored, and global CPU resource scheduling and management of each virtual machine are realized. It can fully utilize the CPU resources of the heterogeneous CPU architecture, give full play to the balance of computing power and power consumption of the heterogeneous CPU architecture, flexibly support the operation and maintenance of the virtual machine, and improve the application experience deployed on the virtual machine. In addition, Errata repair logic or non-repair logic is executed according to the physical CPU type information where the VCPU thread is located in real time, which can avoid the execution of redundant Errata repair logic and improve the performance of the virtual machine.
[0123] In some embodiments, CPU Errata and Timer Errata can be further divided into two types based on different Errata management methods: static management type Errata and dynamic management type Errata. That is, based on different Errata management methods, some CPU Errata and Timer Errata can be classified as static management type Errata, and some CPU Errata and Timer Errata can be classified as dynamic management type Errata. In other embodiments, all CPU Errata and Timer Errata can be classified as dynamic management type Errata, or all CPU Errata and Timer Errata can be classified as static management type Errata.
[0124] For static management type Errata, unified Errata repair can be performed. For example, when the virtual machine starts the gust OS, it can identify and repair various static management type Errata existing in the CPU architecture. Or when the guest OS of the virtual machine runs to the Errata processing logic of a certain static management type Errata, if the Errata is identified to exist in the CPU architecture, the Errata repair logic is executed; if the Errata is identified not to exist in the CPU architecture, the non-repair logic is executed.
[0125] For dynamically managed Errata, when the guest OS of a virtual machine runs into the Errata processing logic for a certain Errata, it needs to perceive the CPU type information of the CPU architecture in real time and determine whether to execute the Errata repair logic. If the Errata does not exist, the non-repair logic is executed to avoid executing redundant Errata repair logic, which can improve the performance of the virtual machine.
[0126] For example, for the solution shown in FIG5a, for static management type Errata, the virtual machine can uniformly identify and repair each static management type Errata when the gust OS is started, or when the guest OS of the virtual machine runs to the Errata processing logic of a certain Errata (static management type Errata), if the Errata is identified to exist in the CPU architecture, the Errata repair logic is executed; if the Errata is identified to not exist in the CPU architecture, the non-repair logic is executed. For dynamic management type Errata, when the guest OS of the virtual machine runs to the Errata processing logic of a certain Errata (dynamic management type Errata), it can determine whether to execute the Errata repair logic or the non-repair logic based on the Errata identification result of the virtualization Errata management front-end module 103 (the virtualization Errata management front-end module 103 can identify all Erratas existing in the CPU architecture based on the CPU type information and Timer Errata information collected by the virtualization Errata management back-end module 101). For example, when the guest OS of the virtual machine runs to the Errata processing logic of a certain dynamic management type Errata, if it is determined that the dynamic management type Errata does not exist in the CPU architecture, the non-repair logic is executed; when the guest OS of the virtual machine runs to the Errata processing logic of a certain dynamic management type Errata, if it is determined that the dynamic management type Errata exists in the CPU architecture, the Errata repair logic is executed.
[0127] For example, for the solution shown in Figure 5b, for static management type Errata, the virtual machine can uniformly identify and repair each static management type Errata when the gust OS is started, or when the guest OS of the virtual machine runs to the Errata processing logic of a certain Errata, if the Errata is recognized to exist in the CPU architecture, the Errata repair logic is executed; if the Errata is recognized not to exist in the CPU architecture, the non-repair logic is executed. For dynamic management type Errata, when the guest OS of the virtual machine runs to the Errata processing logic of a certain Errata, it can determine whether to execute the Errata repair logic or the non-repair logic based on the physical CPU type currently located by the VCPU thread. For example, when the guest OS of the virtual machine runs to the Errata processing logic of a certain dynamic management type Errata, by obtaining the physical CPU type where the VCPU thread is currently located, all Errata existing in the physical CPU of this type can be determined based on the physical CPU type. If it is determined that the dynamic management type Errata does not exist in the physical CPU of this type, the non-repair logic is executed; when the guest OS of the virtual machine runs to the Errata processing logic of a certain dynamic management type Errata, if it is determined that the dynamic management type Errata exists in the physical CPU of this type, the Errata repair logic is executed.
[0128] 6 , a schematic diagram of the interaction between a virtual machine and a VMM in an electronic device provided by an embodiment of the present application is exemplarily introduced below.
[0129] In this embodiment, the software layer of the electronic device 10 may be deployed with a VMM and at least one virtual machine. The dynamic Errata management switch is in the off state. The CPU architecture of the electronic device 10 may be a heterogeneous CPU architecture or a homogeneous CPU architecture, which is not limited in this application. The process of interaction between the virtual machine and the VMM may include:
[0130] 61. The VMM starts the virtualized Errata management backend module 101.
[0131] In some embodiments, the virtualized Errata management backend module 101 may be initialized and started based on a kernel-based virtual machine (KVM).
[0132] 62. The virtualized Errata management backend module 101 collects CPU type information and Timer Errata information.
[0133] In some embodiments, the CPU type information is the type of all CPUs included in the CPU architecture. The virtualized Errata management backend module 101 can collect CPU type information by traversing all CPUs in the electronic device 10 and reading the system registers of each CPU. The virtualized Errata management backend module 101 can also parse the ACPI table or DT table of the firmware of the CPU architecture, read the Timer Errata related information field from the ACPI table or DT table, and identify the Timer Errata existing in the CPU based on the Timer Errata related information field. The virtualized Errata management backend module 101 can also identify the Timer Errata existing in the CPU based on the CPU type information.
[0134] For example, the host OS and gust OS may include a CPU errata table that records CPU Erratas for all CPU types. After the host OS or gust OS starts, the collected CPU type information can be compared with the CPU errata table to determine all CPU Erratas for the collected CPU type. The CPU Timer driver of the host OS and gust OS may also include a Timer Errata table. The collected CPU type information can be compared with the Timer errata table to determine all Timer Erratas for the collected CPU type. The ACPI table or DT table of the firmware used by the host's CPU architecture may also record Timer Errata information. By reading the Timer Errata-related information fields from the ACPI table or DT table and identifying existing Timer Errata based on the Timer Errata-related information fields, all Timer Erratas for the CPU can be identified by identifying Timer Errata using the above two methods.
[0135] 63. The virtualized Errata management backend module 101 writes the collected CPU type information and Timer Errata information into the shared storage area.
[0136] In some embodiments, the shared storage area may be a storage area accessible to both the virtual machine and the host machine, and both the virtualized Errata management backend module 101 and the virtualized Errata management front-end module 103 may write information to the shared storage area or read information from the shared storage area. For example, the shared storage area may be set in the memory or disk of the electronic device 10.
[0137] 64. The virtual machine starts the virtualized Errata management front-end module 103 and the Errata management system 104.
[0138] In some embodiments, the virtualized Errata management front-end module 103 may be initialized and started based on KVM.
[0139] In some embodiments, the Errata management system 104 may also be started together with the gust OS of the virtual machine.
[0140] In FIG6 , the interaction step 64 and the interaction step 61 may be executed in parallel or in sequence, which is not limited in the embodiment of the present application.
[0141] 65. The virtualized Errata management front-end module 103 reads the CPU type information and the Timer Errata information from the shared storage area.
[0142] 66. The virtualized Errata management front-end module 103 determines the Errata (CPU Errata and Timer Errata) existing in the CPU architecture according to the CPU type information and the Timer Errata information.
[0143] 67 . When the guest OS of the virtual machine runs the Errata processing logic of the first Errata, the Errata management system 104 processes the first Errata based on the Errata identification result of the virtualized Errata management front-end module 103 .
[0144] In some embodiments, processing the first Errata may include executing Errata repair logic to repair the first Errata, or executing non-repair logic to not repair the first Errata. For example, if it is determined that the CPU architecture has the first Errata, the Errata repair logic is executed to repair the first Errata; if it is determined that the CPU architecture does not have the first Errata, the non-repair logic is executed.
[0145] 7 , a schematic diagram of interaction between a virtual machine and a VMM provided in another embodiment of the present application is exemplarily introduced below.
[0146] In this embodiment, the software layer of the electronic device 10 may be deployed with a VMM and at least one virtual machine. The dynamic Errata management switch is turned on. The CPU architecture of the electronic device 10 may be a heterogeneous CPU architecture or a homogeneous CPU architecture, which is not limited in this application. The process of interaction between the virtual machine and the VMM may include:
[0147] 70 . The VMM starts the virtualized Errata management backend module 101 .
[0148] 71. The virtualization Errata management backend module 101 collects CPU type information and Timer Errata information, and maintains the physical CPU type information where the VCPU thread of the virtual machine is currently located.
[0149] In some embodiments, the physical CPU type information of the current VCPU thread is the type of the CPU on which the VCPU thread is currently located. The virtualization Errata management backend module 101 maintains the physical CPU type information of the VCPU thread of the virtual machine in real time. When the VCPU thread is scheduled to another CPU, the virtualization Errata management backend module 101 can update the physical CPU type information of the VCPU thread in real time.
[0150] 72. The virtualization Errata management backend module 101 writes the collected CPU type information and Timer Errata information, as well as the physical CPU type information where the VCPU thread currently resides, into the shared storage area.
[0151] 73 , the virtual machine starts the virtualized Errata management front-end module 103 and the Errata management system 104 .
[0152] In FIG7 , interaction step 70 and interaction step 73 may be executed in parallel or in sequence, which is not limited in the embodiment of the present application.
[0153] 74. The virtualization Errata management front-end module 103 reads the CPU type information, the Timer Errata information, and the physical CPU type information where the VCPU thread currently resides from the shared storage area.
[0154] 75. The virtualized Errata management front-end module 103 determines the Errata (CPU Errata and Timer Errata) existing in the CPU architecture according to the CPU type information and the Timer Errata information.
[0155] 76. When the guest OS of the virtual machine runs the Errata processing logic of the second Errata, the Errata management system 104 processes the second Errata based on the type information of the physical CPU where the VCPU thread currently resides.
[0156] In some embodiments, processing the second Errata may include executing Errata repair logic to repair the second Errata, or executing non-repair logic to not repair the second Errata. For example, all Errata existing in the CPU architecture may be determined based on the CPU type information and the Timer Errata information, and all Errata existing in the CPU of the type to which the VCPU thread is currently located may be further determined based on the physical CPU type information where the VCPU thread is currently located. If it is determined that the second Errata exists in the CPU of the type to which the VCPU belongs, the Errata repair logic is executed to repair the second Errata. If it is determined that the second Errata does not exist in the CPU of the type to which the VCPU belongs, the non-repair logic is executed.
[0157] 77. The virtualized Errata management front-end module 103 writes the second Errata processing context into the shared storage area.
[0158] In some embodiments, the second Errata processing context indicates that the Errata management system 104 is processing the second Errata (executing Errata repair logic or executing non-repair logic).
[0159] 78. The virtualized Errata management backend module 101 reads the second Errata processing context from the shared storage area.
[0160] 79. The virtualized Errata management backend module 101 manages the scheduling of the VCPU thread of the virtual machine based on the second Errata processing context.
[0161] In some embodiments, the virtualized Errata management backend module 101 can learn that the frontend is processing the second Errata based on the second Errata processing context, and prohibits the VCPU thread of the virtual machine from performing cross-type CPU scheduling, that is, only allows CPU scheduling of the same type.
[0162] In some embodiments, while the front-end is processing the second Errata, the virtualized Errata management back-end module 101 may also prohibit the VCPU thread from performing CPU scheduling, i.e., even CPU scheduling of the same type is not permitted. For example, for a homogeneous CPU architecture, while the front-end is processing the second Errata, the virtualized Errata management back-end module 101 prohibits the VCPU thread from performing CPU scheduling.
[0163] In some embodiments, after the second Errata processing is completed, the virtualized Errata management front-end module 103 can also write the second Errata processing completion context to the shared storage area. The virtualized Errata management back-end module 101 can allow the VCPU thread to be scheduled (same-type CPU scheduling, cross-type CPU scheduling) based on the second Errata processing completion context.
[0164] 8 , an embodiment of the present application provides a method for processing errata by a virtual machine, which is applied to an electronic device 10. The electronic device 10 includes a CPU architecture composed of at least one physical CPU, and the electronic device 10 runs a virtual machine and a VMM for managing the virtual machine. In this embodiment, the method for processing errata by a virtual machine may include:
[0165] In step S81 , the VMM obtains Errata-related information of the CPU architecture and shares the Errata-related information with the virtual machine.
[0166] In some embodiments, Errata related information may include CPU type information, Timer Errata information, etc. For example, if Errata in a CPU architecture includes CPU Errata and Timer Errata, Errata related information may include CPU type information and Timer Errata information.
[0167] The CPU type information includes the type information of each physical CPU in the CPU architecture. The VMM can read the type information of each physical CPU by traversing the system registers of each physical CPU in the CPU architecture. The Timer Errata information includes first Timer Errata information and second Timer Errata information. The VMM can compare the CPU type information with the preset Timer Errata table to obtain the first Timer Errata information corresponding to the CPU type information. The VMM can also obtain the ACPI table or DT table of the firmware in the CPU architecture, read the Timer Errata related information field from the ACPI table or DT table, and parse the Timer Errata related information field to obtain the second Timer Errata information.
[0168] For example, the VMM includes a virtualized Errata management backend module 101, and the virtual machine includes a virtualized Errata management frontend module 103. The virtualized Errata management backend module 101 traverses the system registers of each physical CPU, reads the type information of each physical CPU therefrom, and then summarizes the type information of each physical CPU. The virtualized Errata management backend module 101 reads the Timer Errata related information field from the ACPI table or DT table of the firmware in the CPU architecture, parses the Timer Errata related information field to obtain the second Timer Errata information, and the virtualized Errata management backend module 101 can also compare the CPU type information with the preset Timer Errata table to obtain the first Timer Errata information.
[0169] In some embodiments, a shared storage area, such as shared memory, to which both the virtual machine and the VMM have access rights may be configured on the electronic device 10. The VMM (e.g., the VMM's virtualized Errata management backend module 101) may write Errata-related information to the shared storage area, and the virtual machine (e.g., the virtualized Errata management frontend module 103) may read the Errata-related information written by the VMM from the shared storage area.
[0170] Step S82: The virtual machine identifies the Errata present in the CPU architecture based on the Errata related information.
[0171] In some embodiments, Errata existing in the CPU architecture includes CPU Errata and Timer Errata as an example, but the embodiments of the present application are not limited to this. With the development of technology, other types of Errata may exist, and Errata-related information may also include information for identifying other types of Errata. This application does not limit this.
[0172] The virtual machine can compare the CPU type information with the preset CPU Errata table to obtain all CPU Erratas existing in the CPU architecture. The virtual machine can also obtain all Timer Erratas existing in the CPU architecture based on the Timer Errata information.
[0173] Step S83: The virtual machine repairs the identified Errata.
[0174] In some embodiments, the host OS of the electronic device and the gust OS of the virtual machine may include errata processing logic for various errata, that is, the errata processing logic for various errata is pre-written in the host OS and gust OS. These errata include errata that exists in the CPU architecture and errata that does not exist in the CPU architecture. Errata can be divided into CPU errata, timer errata, etc. according to type. Errata can also be divided into static management type errata and dynamic management type errata according to management method. Taking the first errata as a static management type errata as an example, when the guest OS of the virtual machine runs to the errata processing logic of the first errata and determines that the first errata exists in the CPU architecture, the errata repair logic is executed. Taking the first errata as a dynamic management type errata as an example, when the guest OS of the virtual machine runs to the errata processing logic of the first errata, it determines whether to execute the errata repair logic for the first errata based on the CPU type information of the CPU architecture. For example, based on the CPU type information, it is determined that the CPU architecture has a first Errata, and the Errata repair logic of the first Errata is executed to repair the first Errata. If it is determined that the CPU architecture does not have the first Errata, the non-repair logic of the first Errata is executed, that is, the first Errata is not repaired, thereby avoiding the execution of redundant Errata repair logic, which can improve the performance of the virtual machine.
[0175] In some embodiments, the virtual machine is further configured with a dynamic Errata management switch, which is used to select whether to enable the Errata dynamic processing mechanism. For example, the virtual machine can, in response to a user operation, place the dynamic Errata management switch in an off state or an on state. If the dynamic Errata management switch is placed in an off state, i.e., the Errata dynamic processing mechanism is turned off, when the guest OS of the virtual machine runs into the Errata processing logic of a certain dynamic management type Errata, it is determined based on the CPU type information whether to execute the Errata repair logic. For example, if it is determined based on the CPU type information that the CPU architecture has the dynamic management type Errata, the Errata repair logic is executed. If it is determined based on the CPU type information that the CPU architecture does not have the dynamic management type Errata, the non-repair logic is executed.
[0176] In some embodiments, if the dynamic Errata management switch is turned on, the Errata dynamic processing mechanism is turned on. The VMM can maintain the physical CPU type information of the virtual machine's VCPU thread in real time at the backend, and share the physical CPU type information of the VCPU thread with the virtual machine (for example, the physical CPU type information of the VCPU thread can be shared with the virtual machine through shared memory). The virtual machine can obtain the physical CPU type information of the VCPU thread maintained by the VMM in real time, and determine whether to execute Errata repair logic based on the physical CPU type information of the VCPU thread, thereby avoiding the execution of redundant Errata repair logic, which can further improve the performance of the virtual machine.
[0177] For example, for statically managed Errata, even if the dynamic Errata management switch is turned on, when the guest OS of the virtual machine runs into the Errata processing logic for a statically managed Errata and determines that the CPU architecture has this statically managed Errata, the Errata repair logic can be directly executed. For dynamically managed Errata, if the dynamic Errata management switch is turned on, when the guest OS of the virtual machine runs into the Errata processing logic for a dynamically managed Errata, the Errata repair logic can be determined based on the physical CPU type currently used by the VCPU thread. Taking the second Errata as a dynamically managed Errata as an example, when the guest OS of the virtual machine runs to the Errata processing logic of the second Errata, the virtual machine obtains the physical CPU type where the VCPU thread maintained by the backend is currently located, and determines whether the second Errata exists in the physical CPU of this type based on the physical CPU type. If it is determined that the second Errata does not exist in the physical CPU of this type, the non-repair logic of the second Errata is executed. If it is determined that the second Errata exists in the physical CPU of this type, the Errata repair logic of the second Errata is executed. This can avoid executing redundant Errata repair logic and improve the performance of the virtual machine.
[0178] In some embodiments, when a virtual machine executes the Errata repair logic or non-repair logic of a certain Errata, the virtual machine may also maintain the Errata processing context, and the virtual machine may share the Errata processing context with the VMM (for example, the virtual machine may share the Errata processing context with the VMM based on shared memory), and the VMM may manage the scheduling of the virtual machine's VCPU thread based on the Errata processing context. For example, the VMM may prohibit the virtual machine's VCPU thread from performing cross-type CPU scheduling based on the Errata processing context, or the VMM may prohibit the virtual machine's VCPU thread from performing CPU scheduling based on the Errata processing context, thereby ensuring that the virtual machine's VCPU thread correctly handles Errata and preventing the virtual machine's VCPU thread from being scheduled to other CPUs containing this Errata when processing the non-repair logic of a certain Errata, resulting in Errata processing logic errors and affecting the normal operation of the virtual machine.
[0179] In some embodiments, after a virtual machine's VCPU thread completes Errata processing, the virtual machine may maintain an Errata processing completion context and share the Errata processing completion context with the VMM. The VMM may then restore the CPU scheduling permissions of the virtual machine's VCPU thread based on the Errata processing completion context. For example, the VMM may restore the CPU scheduling permissions of the virtual machine's VCPU thread from prohibiting cross-type CPU scheduling to allowing cross-type CPU scheduling, or from prohibiting CPU scheduling to allowing CPU scheduling.
[0180] In the electronic device 10 provided in an embodiment of the present application, the internal memory 121 can be used to store instructions, and the processor 110 can be used to call the instructions in the internal memory 121, so that the electronic device 10 executes the above-mentioned related method steps to implement the method of the virtual machine processing errata table in the above-mentioned embodiment.
[0181] An embodiment of the present application also provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on the electronic device 10, the electronic device 10 executes the above-mentioned related method steps to implement the method of virtual machine processing errata in the above-mentioned embodiment.
[0182] An embodiment of the present application further provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the above-mentioned related steps to implement the method of processing errata by a virtual machine in the above-mentioned embodiment.
[0183] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory to enable the chip to execute the method of virtual machine processing errata in the above-mentioned method embodiments.
[0184] Among them, the computer storage medium, computer program product or chip provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0185] Through the description of the above embodiments, those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The module referred to in the embodiments of the present application can refer to a series of computer program instruction segments that can complete a specific function, or it can be a functional module formed by the cooperation of computer program instruction segments and hardware.
[0186] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are schematic. For example, the division of the modules or units is a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0187] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0188] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0189] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0190] The above description is only a specific implementation method of the present application, but the protection scope of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in the present application should be included in the protection scope of the present application.
Claims
1. A method for processing an errata sheet by a virtual machine, applied to an electronic device, wherein the electronic device comprises a CPU architecture composed of at least one physical central processing unit (CPU), It is characterized in that The electronic device runs a virtual machine VM and a virtual machine monitor VMM for managing the VM, and the method includes: The VMM obtains Errata related information of the CPU architecture, and shares the Errata related information with the VM, wherein the Errata related information includes CPU type information and Timer Errata information; The VM identifies Errata present in the CPU architecture based on the Errata related information; The VM performs repair processing on the identified Errata.
2. The method for processing errata by a virtual machine according to claim 1, It is characterized in that The CPU type information includes type information of each physical CPU in the CPU architecture, the Timer Errata information includes first Timer Errata information and second Timer Errata information, and the VMM obtains Errata related information of the CPU architecture, including: The VMM traverses the system register of each physical CPU in the CPU architecture to obtain type information of each physical CPU; The VMM compares the CPU type information with a preset Timer Errata table to obtain the first Timer Errata information corresponding to the CPU type information; The VMM obtains an Advanced Configuration and Power Interface (ACPI) table or a Device Tree (DT) table of the firmware in the CPU architecture, reads a Timer Errata related information field from the ACPI table or the DT table, and obtains the second Timer Errata information based on the Timer Errata related information field.
3. The method for processing errata by a virtual machine according to claim 1 or 2, It is characterized in that The electronic device is configured with a shared storage area to which both the VM and the VMM have access rights, and the step of sharing the Errata related information with the VM includes: The VMM writes the Errata related information into the shared storage area; The VM reads the Errata related information from the shared storage area.
4. The method for processing errata by a virtual machine according to claim 3, It is characterized in that The VM identifies Errata existing in the CPU architecture based on the Errata related information, including: The VM compares the CPU type information with a preset CPU Errata table to obtain the CPU Errata existing in the CPU architecture; The VM obtains the Timer Errata existing in the CPU architecture based on the Timer Errata information.
5. The method for processing errata by a virtual machine according to any one of claims 1 to 4, It is characterized in that The VM carries a guest operating system guest OS, the identified Errata includes static management type Errata and dynamic management type Errata, and the VM performs repair processing on the identified Errata, including: When the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is the static management type Errata, and it is determined that the first Errata exists in the CPU architecture, the VM executes the Errata repair logic of the first Errata to repair the first Errata; When the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is the dynamic management type Errata, and it is determined that the first Errata exists in the CPU architecture, the VM executes the Errata repair logic of the first Errata to repair the first Errata; When the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is the dynamic management type Errata, and it is determined that the first Errata does not exist in the CPU architecture, the VM executes the non-repair logic of the first Errata.
6. The method for processing errata by a virtual machine according to claim 5, It is characterized in that The VM further includes a dynamic Errata management switch, wherein when the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is the dynamic management type Errata, and it is determined that the CPU architecture has the first Errata, the VM executes the Errata repair logic of the first Errata, including: When the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is the dynamic management type Errata, and it is determined that the first Errata exists in the CPU architecture, and the dynamic Errata management switch is in a closed state, the VM executes the Errata repair logic of the first Errata; When the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is the dynamic management type Errata, and it is determined that the first Errata does not exist in the CPU architecture, the VM executes the non-repair logic of the first Errata, including: When the guest OS of the VM runs to the Errata processing logic of the first Errata, and the first Errata is the dynamic management type Errata, and it is determined that the first Errata does not exist in the CPU architecture, and the dynamic Errata management switch is in a closed state, the VM executes the non-repair logic of the first Errata.
7. The method for processing errata by a virtual machine according to any one of claims 1 to 4, It is characterized in that The VM further includes a dynamic Errata management switch, the dynamic Errata management switch is in an on state, and the method further includes: The VMM obtains the physical CPU type information of the virtual central processing unit VCPU thread of the VM, and shares the physical CPU type information of the VCPU thread with the VM. The VM can also perform Errata repair processing based on the physical CPU type information of the VCPU thread.
8. The method for processing errata by a virtual machine according to claim 7, It is characterized in that The VM carries a guest OS, the identified Errata includes a static management type Errata and a dynamic management type Errata, and the VM performs repair processing on the identified Errata, including: When the guest OS of the VM runs to the Errata processing logic of the second Errata, and the second Errata is the static management type Errata, and it is determined that the second Errata exists in the CPU architecture, the VM executes the Errata repair logic of the second Errata to repair the second Errata; When the guest OS of the VM runs to the Errata processing logic of the second Errata, and the second Errata is the dynamic management type Errata, and it is determined based on the physical CPU type information where the VCPU thread is located that the CPU where the VCPU thread is located has the second Errata, the VM executes the Errata repair logic of the second Errata to repair the second Errata; When the guest OS of the VM runs to the Errata processing logic of the second Errata, and the second Errata is the dynamic management type Errata, and it is determined based on the physical CPU type information where the VCPU thread is located that the CPU where the VCPU thread is located does not have the second Errata, the VM executes the non-repair logic of the second Errata.
9. The method for processing errata by a virtual machine according to claim 8, It is characterized in that The method further comprises: The VM shares the second Errata processing context with the VMM; The VMM manages scheduling of the VCPU threads of the VM based on the second Errata processing context.
10. The method for processing errata by a virtual machine according to claim 9, It is characterized in that The VMM manages scheduling of the VCPU thread of the VM based on the second Errata processing context, including: The VMM prohibits the VCPU thread of the VM from performing cross-type CPU scheduling based on the second Errata processing context; or The VMM prohibits the VCPU thread of the VM from performing CPU scheduling based on the second Errata processing context.
11. The method for processing errata by a virtual machine according to claim 10, It is characterized in that The method further comprises: When the second Errata processing is completed, the VM shares the second Errata processing completion context with the VMM; The VMM restores the CPU scheduling authority of the VCPU thread of the VM based on the second Errata processing completion context.
12. A computer-readable storage medium, It is characterized in that The method comprises computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the method for processing errata of a virtual machine according to any one of claims 1 to 11.
13. An electronic device, It is characterized in that The electronic device comprises a processor and a memory, the memory is used to store instructions, and the processor is used to call the instructions in the memory, so that the electronic device executes the method for virtual machine processing errata according to any one of claims 1 to 11.
14. A computer program product, It is characterized in that The method comprises computer instructions, and when the computer instructions are executed on a processor, the electronic device executes the method for processing errata of a virtual machine according to any one of claims 1 to 11.
Citation Information
Patent Citations
Method for virtual machine to process corrigenda and related equipment
CN118733190A
Methods, systems and apparatus to capture error conditions in lightweight virtual machine managers
CN104321748A
Virtual machine fault-tolerant system and method for storage faults
CN105068763A
Method and device for processing exception or interruption under heterogeneous instruction set architecture
CN113806006A
Information processing device and resource allocation method
US20160004554A1
