Method for virtual machine to process corrigenda and related equipment

By VMM maintaining and sharing CPU type information and Timer Errata information on the backend, virtual machines can accurately identify and process Erratas in heterogeneous CPU architectures, solving the problem of virtual machines not being able to obtain all Erratas, and improving operational stability and performance.

CN118733190APending Publication Date: 2024-10-01HUAWEI TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310353270.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-30
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In a heterogeneous CPU architecture, the Errata management system of a virtual machine cannot obtain all CPU Erratas and Timer Erratas, causing the virtual machine to be unable to successfully process Erratas in the heterogeneous CPU architecture, affecting the normal operation of the virtual machine.

Method used

All CPU type information and Timer Errata information are maintained on the back end through the virtual machine monitor (VMM) and shared with the virtual machine. Based on this information, the virtual machine identifies and repairs Errata in the CPU architecture to achieve comprehensive management of heterogeneous CPU architecture. .

Benefits of technology

It ensures that the virtual machine can accurately identify and process all Erratas in the heterogeneous CPU architecture, improves the operational stability and performance of the virtual machine, avoids the problem of incomplete Errata recognition, and eliminates the need to modify the virtual machine's firmware construction code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733190A_ABST
    Figure CN118733190A_ABST
Patent Text Reader

Abstract

The invention provides a method for processing a corrigenda by a virtual machine and related equipment, and relates to the technical field of computers. The method for processing the corrigenda by the virtual machine is applied to the electronic equipment, the electronic equipment comprises a CPU framework composed of at least one physical CPU, the VM and a VMM used for managing the VM run in the electronic equipment, and the method comprises the steps that the VMM obtains Error related information of the CPU framework and shares the Error related information to the VM, and the Error related information comprises CPU type information and Timer Error information; the VM identifies Errata existing in the CPU architecture on the basis of the Errata related information; and the VM carries out repair processing on the identified Error. According to the method and the device, the virtual machine can accurately process Error existing in the CPU architecture, and the running stability of the virtual machine is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] 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

[0002] A heterogeneous central processing unit (CPU) architecture is one that uses multiple different processors. For example, the big.LITTLE architecture includes two CPUs with different architectures, where the "LITTLE" CPU is designed to achieve the highest energy efficiency and 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.

[0003] 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 instructions of the CPU (hereinafter referred to as CPU Errata), and Errata may also exist in the timer component of the CPU (hereinafter referred to as Timer Errata). The operating system can manage Errata that exists in different types of CPUs by configuring the Errata management system.

[0004] 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 recognition. 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 CPU Errata recognition or incomplete Timer Errata recognition. 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. Summary of the invention

[0005] In view of this, it is necessary to provide a method for a virtual machine to process an errata sheet, so that the virtual machine can accurately process Errata existing in the CPU architecture and improve the stability of the virtual machine operation.

[0006] In a first aspect, an embodiment of the present application discloses a method for a virtual machine to process errata, which is applied to an electronic device. The electronic device includes a CPU architecture composed of at least one physical CPU. 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.

[0007] 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 them 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, which can avoid the problem that the VM cannot accurately obtain all Errata existing in the heterogeneous CPU architecture, thereby causing the VM to be unable to smoothly handle the Errata existing in the heterogeneous CPU architecture, thereby improving the operating stability of the business in the VM.

[0008] 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 the 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.

[0009] By adopting the above technical scheme, the system registers of each physical CPU in the CPU architecture are traversed at the back end by the VMM, and the type information of each physical CPU is read therefrom, so as to accurately maintain all CPU type information in the CPU architecture, and the ACPI table or DT table of the firmware in the CPU architecture is parsed at the back end by the VMM 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 according to the CPU type information, so as to comprehensively collect the Timer Errata information of the CPU architecture, and all the CPU type information and all the Timer Errata information of 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, and decouple the firmware construction of the VM and the identification of the Timer Errata (that is, the identification of the Timer Errata does not rely on the firmware of the VM), so that when a new Timer Errata appears, there is no need to modify the construction code of the VM firmware.

[0010] In some embodiments, a shared storage area to which both VM and VMM have access rights is configured on the electronic device, and Errata related information is shared with the VM, including: the VMM writes the Errata related information to the shared storage area; and the VM reads the Errata related information from the shared storage area.

[0011] 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 the VM at the front end, and the information maintained by VM at the front end can be shared with the 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.

[0012] 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.

[0013] By adopting 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, so that the VM can smoothly handle all CPU Errata and Timer Errata existing in the heterogeneous CPU architecture, thereby improving the operation stability of the business within the VM.

[0014] 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 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 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 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 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 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 a 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.

[0015] By adopting the above technical scheme, Errata can be classified into CPU Errata, Timer Errata, etc. according to its type. Errata can also be classified 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 called host OS) and the gust OS of the VM can include 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 Errata, it can determine whether to execute the Errata repair logic 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 the Errata, and 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, thereby avoiding the execution of redundant Errata repair logic, and improving the performance of the VM.

[0016] 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 dynamically managed 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 dynamically managed type Errata, and it is determined that the CPU architecture has the first Errata, 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 a dynamically managed 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.

[0017] By adopting the above technical solution, whether to turn on the Errata dynamic processing mechanism can be selected by setting a dynamic Errata management switch in the VM. For example, the VM can respond to user operations and put the dynamic Errata management switch in an off state or an on state. If the dynamic Errata management switch is put in 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 be determined whether to execute the Errata repair logic according to 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.

[0018] In some embodiments, the VM also includes a dynamic Errata management switch, the dynamic Errata management switch is in an on state, and the method for the virtual machine to process the errata sheet also includes: the VMM obtains the physical CPU type information where the VCPU thread of the VM is located, and shares the physical CPU type information where the VCPU thread is located with the VM, and the VM can also perform Errata repair processing based on the physical CPU type information where the VCPU thread is located.

[0019] 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 whether to execute 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.

[0020] 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 a 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 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.

[0021] By adopting the above technical scheme, Errata can be classified into CPU Errata, Timer Errata, etc. according to the type. Errata can also be classified 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 include 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 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.

[0022] In some embodiments, the method for a virtual machine to process an errata sheet further includes: the VM shares the second Errata processing context with the VMM; and the VMM manages scheduling of the VCPU thread of the VM based on the second Errata processing context.

[0023] By adopting the above technical solution, the Errata processing context of the VCPU thread is maintained in real time at the front end and shared with the back-end VMM, so that when the VMM determines that the VCPU thread is in the Errata processing logic, the VCPU thread is prohibited from performing cross-type CPU scheduling, or the VCPU thread is prohibited from performing CPU scheduling, thereby ensuring that the VCPU thread correctly handles Errata and avoiding 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.

[0024] 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.

[0025] By adopting the above technical solution, when 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 the same type of CPU scheduling, or directly prohibits the VCPU thread from performing CPU scheduling (that is, the same type of CPU scheduling is also not allowed), thereby ensuring that the VCPU thread correctly handles Errata.

[0026] In some embodiments, the method for processing an errata sheet 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.

[0027] By adopting 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 authority of the VCPU thread of the VM, so as to realize global CPU resource scheduling and management of the VM, which can make full use of 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.

[0028] In a second aspect, an embodiment of the present application provides a computer-readable storage medium, including computer instructions, which, when executed on an electronic device, enables the electronic device to execute the method for processing errata by a virtual machine as described in the first aspect.

[0029] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising 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.

[0030] In a fourth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device (such as a computer), the electronic device executes the method for virtual machine processing errata as described in the first aspect.

[0031] 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 by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.

[0032] 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

[0033] Figure 1 A schematic diagram of a system architecture for CPU resource management of a virtual machine with a heterogeneous CPU architecture provided in one embodiment of the present application;

[0034] Figure 2 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application;

[0035] Figure 3 A schematic diagram of a software structure of an electronic device provided in one embodiment of the present application;

[0036] Figure 4 A schematic diagram of an application architecture of a method for processing errata by a virtual machine provided in an embodiment of the present application;

[0037] Figure 5a A schematic diagram of a system architecture for performing errata processing on a virtual machine deployed on an electronic device provided in an embodiment of the present application;

[0038] Figure 5b A schematic diagram of a system architecture for performing errata processing on a virtual machine deployed on an electronic device provided in another embodiment of the present application;

[0039] Figure 6 A schematic diagram of the interaction between a virtual machine and a virtual machine monitor deployed on an electronic device provided in an embodiment of the present application;

[0040] Figure 7 A schematic diagram of interaction between a virtual machine and a virtual machine monitor deployed on an electronic device provided in another embodiment of the present application;

[0041] Figure 8 A schematic flowchart of the steps of a method for processing an errata sheet by a virtual machine provided in one embodiment of the present application. DETAILED DESCRIPTION

[0042] 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.

[0043] In the embodiments of the present 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 the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0044] Operating System (OS): A computer program that manages computer hardware and software resources.

[0045] 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 the traditional operating system, 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.

[0046] Thread: It is the smallest unit that the operating system can schedule operations. It is contained in the process and is the actual operation unit in the process. A thread refers to a single sequential control flow in the process. Multiple threads can run concurrently in a process, and each thread executes different tasks in parallel.

[0047] Errata: It is a defect found after the hardware design is completed that some specific functions will cause the hardware to deviate from the architecture and not work properly under certain circumstances, similar to a bug in a software program. The operating system needs to handle Errata specially, such as executing a specific code segment or configuring the hardware in a specific way.

[0048] Virtualization: It is a resource management technology that abstracts and transforms various physical resources of the host, such as network resources, memory and storage resources, to break the inseparable barriers between the physical structures of the host, so that users can use these resources in a better way than the original configuration. The resources used through virtualization are called virtualized resources, which are not restricted by the setting up method, region or physical configuration of existing resources. Generally, virtualized resources include computing resources and storage resources.

[0049] Virtual machine (VM): refers to one or more virtual computers simulated on a physical computer through software. These virtual machines run in a completely isolated environment and work just like real computers. A guest operating system (guest OS) can be installed on the virtual machine, and one or more applications can run on the guest OS. The virtual machine can also access network resources. For applications running in the virtual machine, it is like working in a real computer.

[0050] 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 a virtual processor, virtual memory, virtual disk, virtual network card, 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.

[0051] Hardware layer: refers to the hardware platform on which the virtualized environment runs. The hardware layer may include a variety of hardware. For example, the hardware layer of a physical computer may include a processor and memory, as well as an interrupt controller, a network interface card (NIC), and input / output (I / O) devices.

[0052] 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, and in some embodiments may also refer to a processing unit including multiple physical cores.

[0053] Virtual processor: Under virtualization technology, a representation of a physical processing unit provided to a virtual computer in a shared or sliced ​​manner, for example, a virtual central processing unit (vCPU). A virtual computer can have one or more virtual processors serving it. When there are multiple virtual processors, there is usually one virtual processor that is the master virtual processor and the others are slave virtual processors.

[0054] One or more virtual machines can be created on the host machine. The host OS of the host machine and the gust OS of the virtual machine can both be deployed with the Errata management system. The Errata management system can identify and repair Errata in the CPU architecture (homogeneous CPU architecture or heterogeneous CPU architecture) of the host machine 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 in the CPU architecture during the operation of the host OS; the Errata management system in the gust OS of the virtual machine can identify and repair Errata in the CPU architecture during the operation of the gust OS to ensure the normal operation of the virtual machine.

[0055] 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 another CPU with this Errata, which causes Errata processing logic errors and affects the normal operation of the business in the virtual machine, the VCPU binding core method can be used to solve the above problem. Figure 1As shown, 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 VM1 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 VCPU type of the virtual machine is fixedly initialized to a certain type of CPU or several types of CPUs in the heterogeneous CPU architecture; during the entire life cycle of the virtual machine and the operation and maintenance process of the virtual machine, the VCPU of the virtual machine can only be scheduled and operated in a certain type of CPU for initialization resource management, and cannot support global CPU resource management (cannot be scheduled between different types of CPUs), cannot fully utilize the CPU resources of the heterogeneous CPU architecture, cannot be elastically scheduled across the entire domain according to the application load, cannot play the balance of computing power & power consumption of the heterogeneous CPU architecture, cannot flexibly support the operation and maintenance of the virtual machine, and affect 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 in the heterogeneous CPU architecture.

[0056] 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 incomplete Errata recognition, resulting in the Errata management system in the virtual machine being unable to smoothly handle all Errata problems existing in the heterogeneous CPU architecture, and by real-time maintenance and updating of the physical CPU type information where the VCPU thread is located 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, and after the Errata processing is completed, the CPU free scheduling authority of the VCPU thread is restored, so as to realize global CPU resource scheduling and management of each virtual machine, and make full use of 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.

[0057] The method for processing errata by 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 (personal computer, PC), a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook, a cellular phone, a personal digital assistant (personal digital assistant, PDA), an augmented reality (augmented reality, AR) device, a virtual reality (virtual reality, VR) device, an artificial intelligence (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 the 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 (local area networks, LAN) or a wide area network (wide area networks, WAN), such as the Internet. When the communication network is a local area network, exemplarily, the communication network may be a short-distance 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, exemplarily, 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.

[0058] In some embodiments, the electronic device may install one or more APPs (Applications). APP can be referred to as an application, which is a software program that can implement one or more specific functions. For example, communication applications, video applications, audio applications, image capture applications, cloud desktop applications, and the like. Among them, communication applications may include text messaging applications, for example. Image capture applications may include shooting applications (system cameras or third-party shooting applications). Video applications may include Huawei Video, for example. 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.

[0059] Electronic equipment includes but is not limited to Windows Or other operating systems. Operating system or The operating system is used as an example for explanation.

[0060] Figure 2 A schematic structural diagram of an electronic device 10 is shown.

[0061] 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.

[0062] It is to be understood that the structure illustrated in the embodiment of the present application does 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 in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0063] 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 processor (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), etc. Different processing units may be independent devices or integrated into one or more processors.

[0064] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 may be a cache memory. The memory may store instructions or data that have been used or are frequently used by the processor 110. If the processor 110 needs to use the instructions or data, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0065] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (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, etc. The processor 110 may be connected to an audio module, a wireless communication module, a display, a camera, and other modules through at least one of the above interfaces.

[0066] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration 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 in the above embodiments, or a combination of multiple interface connection methods.

[0067] 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.

[0068] The mobile communication module 130 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., 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 functional modules of the mobile communication module 130 may be set in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 130 may be set in the same device as at least some modules of the processor 110.

[0069] The wireless communication module 140 can provide wireless communication solutions 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 (IR), etc., which are applied to the electronic device 10. The wireless communication module 140 can be one or more devices integrating at least one communication processing module.

[0070] In some embodiments, the electronic device 10 can communicate with the network and other electronic devices through wireless communication technology. The wireless communication technology 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, etc. 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).

[0071] The electronic device 10 can realize the display function through a GPU, a display screen 180, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 180 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0072] 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), Miniled, MicroLed, 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.

[0073] 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 via the external memory interface 120 to implement a data storage function.

[0074] 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. Among them, 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.

[0075] 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 arranged in the processor 110, or some functional modules of the audio module 150 can be arranged in the processor 110.

[0076] The software system of the electronic device 10 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 10.

[0077] Figure 3 It is a software structure block diagram of the electronic device 10 according to an embodiment of the present application.

[0078] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime (ART) and native C / C++ library, hardware abstract layer (HAL) and kernel layer.

[0079] The application layer can include a series of application packages.

[0080] like Figure 3 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.

[0081] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0082] like Figure 3 As shown, 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.

[0083] 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.

[0084] 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.

[0085] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0086] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0087] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0088] The activity manager can provide activity management services (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.

[0089] The input manager can provide input management services (IMS), which can be used to manage system input, such as touch screen input, key input, sensor input, etc. IMS takes events from input device nodes and distributes them to appropriate windows through interaction with WMS.

[0090] The Android runtime includes the core library and the Android runtime. The Android runtime is responsible for converting source code into machine code. The Android runtime mainly uses the ahead of time (AOT) compilation technology and the just in time (JIT) compilation technology.

[0091] 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.

[0092] The native C / C++ library can include multiple functional modules, such as surface manager, media framework, libc, OpenGL ES, SQLite, Webkit, etc.

[0093] Among them, the surface manager is used to manage the display subsystem and provide 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, etc. 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 drawing and operation of 2D graphics and 3D graphics in applications. SQLite provides a lightweight relational database for applications of electronic device 10.

[0094] The hardware abstraction layer runs in user space, encapsulates kernel layer drivers, and provides a calling interface to the upper layer.

[0095] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0096] Combine the following Figure 4 , an exemplary application architecture diagram of a method for a virtual machine to process errata.

[0097] 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. Figure 4 Take the hardware layer including CPU resources as an example for explanation. Assume that the electronic device 10 includes two types of CPU 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 the embodiments of the present application.

[0098] 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 Take the software layer including multiple virtual machines as an example. The module / unit referred to in the embodiments of the present application may refer to a series of computer program instruction segments that can complete specific functions, or may be a functional module formed by the cooperation of computer program instruction segments and hardware. The division of modules is a logical function division, and there may be other division methods in actual implementation, which is not limited in the present application.

[0099] The VMM may include a virtualized Errata management backend module 101 and a resource management module 102. The virtualized Errata management backend module 101 is used to collect CPU type information and Timer Errata information, which may be presented and saved in the form of arrays, linked lists, bitmaps, etc., and the present application does not limit this. For example, the virtualized Errata management backend module 101 may 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 may also identify the existing Timer Errata by reading the Timer Errata related information field and identifying the existing Timer Errata according to the CPU type information, thereby realizing 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 backend module 101 can parse the ACPI table to obtain the Timer Errata related information field therefrom, 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 backend module 101 can parse the DT table to obtain the Timer Errata related information field therefrom, and then identify the existing Timer Errata.

[0100] 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.

[0101] 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) existing in the heterogeneous CPU architecture based on the CPU type information and Timer Errata information. The Errata management system 104 is used to call the virtualized Errata management front-end module 103 to perform Errata identification when identifying Errata existing in a heterogeneous CPU architecture or a certain type of CPU. The Errata management system 104 is also used to perform repair processing or non-repair processing on Errata.

[0102] 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).

[0103] For example, a CPU Errata occurs when erasing data stored in a high-speed cache memory (cache) in a CPU. Executing an erase instruction once may result in incomplete erasure of the data. The repair logic of the CPU Errata is to execute a second erase instruction.

[0104] For example, a Timer Errata is an Errata when reading data of a certain count from the Timer. A single read may result in inaccurate data reading. The repair logic of the CPU Errata is to perform multiple reads (for example, three reads).

[0105] 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 the non-repair logic may be a series of computer program instruction segments, which is not limited in this application.

[0106] In some embodiments, the virtualized Errata management backend module 101 is also used to maintain the physical CPU type information of the VCPU thread of the virtual machine in real time, and the virtualized Errata management front-end module 103 can obtain the physical CPU type information of the VCPU thread of the virtual machine 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 existing in the physical CPU of this type based on the physical CPU type information where the VCPU thread is located. If the first Errata exists in the physical CPU of this type, the Errata repair logic is executed (the first Errata is repaired). If the first Errata does not exist in the physical CPU of this type, the non-repair logic is executed (i.e., the first Errata is not repaired).

[0107] In some embodiments, during the process of Errata management system 104 processing a certain Errata, virtualized Errata management front-end module 103 is also used to maintain Errata processing context. Virtualized Errata management back-end module 101 can obtain Errata processing context maintained by virtualized Errata management front-end module 103, and manage the scheduling of VCPU threads of virtual machines. For example, virtualized Errata management back-end module 101 determines that the virtual machine is in Errata processing logic based on Errata processing context, and prohibits VCPU threads of virtual machines from performing cross-type physical CPU scheduling.

[0108] like Figure 5a As shown, the software layer includes a virtual machine and a VMM for managing the virtual machine. The CPU architecture of the electronic device 10 can be a heterogeneous CPU architecture or a homogeneous CPU architecture.

[0109] 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 read the Timer Errata related information field in the ACPI table or DT table of the firmware of the CPU architecture by parsing the ACPI table or DT table, and identify the existing Timer Errata. The Timer Errata collection unit 1012 also identifies the existing Timer Errata according to the CPU type information, for example, based on the CPU type information, traverses the Timer Errata table in the CPU Timer driver (the Timer Errata table can store the Timer Errata corresponding to each CPU type) to identify the existing Timer Errata.

[0110] The virtualized 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 the information sharing channel. The information sharing channel can refer to a channel for realizing information exchange between the virtualized Errata management front-end module 103 and the virtualized Errata management back-end module 101.

[0111] 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 may be constructed based on para-virtualization (PV) technology. For example, a channel for information sharing between the virtualized Errata management front-end module 103 and the virtualized Errata management back-end module 101 may be constructed based on shared memory, Hypervisor Call (HVC), etc. Taking shared memory as an example, the virtualized Errata management front-end module 103 may write information shared to the virtualized Errata management back-end module 101 into 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 may write information shared to the virtualized Errata management front-end module 103 into 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.

[0112] 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.

[0113] When the guest OS of the virtual machine runs to the Errata processing logic of a certain Errata, the Errata management system 104 can also determine whether to perform a repair process or a non-repair process on the Errata according to the CPU type information. For example, if it is determined according to the CPU type information that the CPU architecture has the Errata, the Errata is repaired (the Errata repair logic is executed); if it is determined according to the CPU type information that the CPU architecture does not have the Errata, the Errata is non-repaired (the non-repair logic is executed).

[0114] The above solution maintains all CPU type information and all Timer Errata information in the CPU architecture in the back end 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, which can avoid the problem that the virtual machine Errata management system cannot obtain all Errata in the heterogeneous CPU architecture, and then the virtual machine Errata management system cannot smoothly handle all Errata in the heterogeneous CPU architecture, thereby improving the operation stability of the business in the virtual machine, and at the same time decouples the firmware construction of the virtual machine and the identification of Timer Errata (does not rely on the firmware of the virtual machine to identify Timer Errata), so that when a new Timer Errata appears, there is no need to modify the construction code of the virtual machine's firmware.

[0115] like Figure 5b As shown, the application architecture provides an Errata dynamic processing mechanism, and uses a dynamic Errata management switch to select whether to turn on the Errata dynamic processing mechanism. For example, the virtual machine can respond to user operations and put the dynamic Errata management switch in an off state or an on state. The CPU architecture of the electronic device 10 is described by taking a heterogeneous CPU architecture as an example.

[0116] 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.

[0117] 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 Errata existing in the physical CPU of this type is determined. If the Errata exists in the physical CPU of this type, the Errata repair logic is executed (the Errata is repaired). If the Errata does not exist in the physical CPU of this type, the non-repair logic is executed (i.e., the 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 the VCPU thread 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.

[0118] The virtualized Errata management front-end module 103 is also used to obtain the physical CPU type information where the VCPU thread of the virtual machine maintained by the VCPU type maintenance unit 1013 is located in real time. For example, the virtualized Errata management front-end module 103 can obtain the physical CPU type information where the VCPU thread of the virtual machine maintained by the VCPU type maintenance unit 1013 is located in real time through shared memory. The Errata management system 104 is also used to determine whether to execute Errata repair logic (repair this Errata) or execute non-repair logic (i.e., do not repair this Errata) based on the physical CPU type information where the VCPU thread currently resides obtained by the virtualized Errata management front-end module 103 before Errata processing.

[0119] 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, and 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.

[0120] The above scheme maintains and updates the physical CPU type information where the VCPU thread is located 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 to achieve global CPU resource scheduling and management of each virtual machine. It can make full use of 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 virtual machines, 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.

[0121] In some embodiments, for CPU Errata and Timer Errata, CPU Errata and Timer Errata can also be divided into two types according to different Errata management methods: static management type Errata and dynamic management type Errata. That is, according to different Errata management methods, some CPU Errata and Timer Errata can be divided into static management type Errata, and some CPU Errata and Timer Errata can be divided into dynamic management type Errata. In other embodiments, all CPU Errata and Timer Errata can also be divided into dynamic management type Errata, and all CPU Errata and Timer Errata can also be divided into static management type Errata.

[0122] For static management type Errata, unified Errata repair can be performed. For example, when the virtual machine starts gustOS, 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 static management type Errata, if it is recognized that the Errata exists in the CPU architecture, the Errata repair logic is executed; if it is recognized that the Errata does not exist in the CPU architecture, the non-repair logic is executed.

[0123] For dynamically managed Errata, when the guest OS of the virtual machine runs to the Errata processing logic of a certain Errata, it is necessary to perceive the CPU type information of the CPU architecture in real time to determine whether to execute the Errata repair logic. If this Errata does not exist, execute the non-repair logic to avoid executing redundant Errata repair logic, which can improve the performance of the virtual machine.

[0124] For example, for Figure 5a As for the scheme shown, for static management type Errata, the virtual machine can uniformly identify and repair each static management type Errata when gustOS 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 it is identified that the Errata exists in the CPU architecture, the Errata repair logic is executed, and if it is identified that the Errata does 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 be determined whether to execute the Errata repair logic or the non-repair logic based on the Errata identification result of the virtualized Errata management front-end module 103 (the virtualized Errata management front-end module 103 can identify all Errata existing in the CPU architecture based on the CPU type information and Timer Errata information collected by the virtualized 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.

[0125] For example, for Figure 5bAs for the scheme shown, for static management type Errata, the virtual machine can uniformly identify and repair each static management type Errata when gustOS is started, or when the guest OS of the virtual machine runs to the Errata processing logic of a certain Errata, if it is recognized that the Errata exists in the CPU architecture, the Errata repair logic is executed, and if it is recognized that the Errata does 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, it can determine whether to execute the Errata repair logic or the non-repair logic based on the physical CPU type where the VCPU thread is currently located. 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.

[0126] Combine the following Figure 6 , a schematic diagram of the interaction between a virtual machine and a VMM in an electronic device provided in an embodiment of the present application is exemplarily introduced.

[0127] 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 an off state, and 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:

[0128] 61. The VMM starts the virtualized Errata management backend module 101.

[0129] In some embodiments, the virtualized Errata management backend module 101 may be initialized and started based on a kernel-based virtual machine (KVM).

[0130] 62. The virtualized Errata management backend module 101 collects CPU type information and Timer Errata information.

[0131] In some embodiments, the CPU type information is the types 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 according to the CPU type information.

[0132] For example, the host OS and gust OS may include a CPU errata table, which records the CPU Errata of all types of CPUs. After the host OS or gust OS is started, the CPU type information collected can be compared with the CPU errata table to determine all CPU Errata of the collected CPU type. The CPU Timer driver of the host OS and gustOS may include a Timer Errata table, which can be compared with the Timererrata table based on the collected CPU type information to determine all Timer Errata of the collected CPU type. The ACPI table or DT table of the firmware used by the CPU architecture of the host machine may also record Timer Errata information. By reading the Timer Errata related information field from the ACPI table or DT table, the existing Timer Errata is identified based on the Timer Errata related information field. By identifying Timer Errata in the above two ways, all Timer Errata of the CPU can be identified.

[0133] 63. The virtualized Errata management backend module 101 writes the collected CPU type information and Timer Errata information into the shared storage area.

[0134] In some embodiments, the shared storage area may refer to 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 frontend 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.

[0135] 64. The virtual machine starts the virtualized Errata management front-end module 103 and the Errata management system 104.

[0136] In some embodiments, the virtualized Errata management front-end module 103 may be initialized and started based on KVM.

[0137] In some embodiments, the Errata management system 104 may also be started together with the gust OS of the virtual machine.

[0138] exist Figure 6 In the embodiment, the interaction step 64 and the interaction step 61 can be executed in parallel or in sequence, which is not limited in the embodiment of the present application.

[0139] 65. The virtualized Errata management front-end module 103 reads the CPU type information and the TimerErrata information from the shared storage area.

[0140] 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.

[0141] 67 . When the guest OS of the virtual machine runs to 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 .

[0142] 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, and if it is determined that the CPU architecture does not have the first Errata, the non-repair logic is executed.

[0143] Combine the following Figure 7 , exemplarily introduces a schematic diagram of the interaction between a virtual machine and a VMM provided in another embodiment of the present application.

[0144] 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 an on state, and 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:

[0145] 70 . The VMM starts the virtualized Errata management backend module 101 .

[0146] 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.

[0147] In some embodiments, the physical CPU type information where the VCPU thread is currently located is the type of the CPU where the VCPU thread is currently located. The virtualization Errata management backend module 101 maintains 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 virtualization Errata management backend module 101 can update the physical CPU type information where the VCPU thread is located in real time.

[0148] 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.

[0149] 73 , the virtual machine starts the virtualized Errata management front-end module 103 and the Errata management system 104 .

[0150] exist Figure 7 In the embodiment, the interaction step 70 and the interaction step 73 may be executed in parallel or in sequence, which is not limited in the embodiment of the present application.

[0151] 74. The virtualized Errata management front-end module 103 reads the CPU type information, the TimerErrata information, and the physical CPU type information where the VCPU thread currently resides from the shared storage area.

[0152] 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.

[0153] 76. When the guest OS of the virtual machine runs to 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.

[0154] 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 where 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 CPU of the type where the VCPU is located has a second Errata, the Errata repair logic is executed to repair the second Errata. If it is determined that the CPU of the type where the VCPU is located does not have a second Errata, the non-repair logic is executed.

[0155] 77. The virtualized Errata management front-end module 103 writes the second Errata processing context into the shared storage area.

[0156] In some embodiments, the second Errata processing context represents that the Errata management system 104 is processing the second Errata (executing Errata repair logic or executing non-repair logic).

[0157] 78. The virtualized Errata management backend module 101 reads the second Errata processing context from the shared storage area.

[0158] 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.

[0159] In some embodiments, the virtualized Errata management backend module 101 can learn that the front end 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 allowing CPU scheduling of the same type.

[0160] In some embodiments, when the front end is processing the second Errata, the virtualized Errata management backend module 101 may also prohibit the VCPU thread from performing CPU scheduling, that is, the same type of CPU scheduling is also not allowed. For example, for a homogeneous CPU architecture, when the front end is processing the second Errata, the virtualized Errata management backend module 101 prohibits the VCPU thread from performing CPU scheduling.

[0161] 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.

[0162] Reference Figure 8 As shown, an embodiment of the present application provides a method for a virtual machine to process an errata sheet, which is applied to an electronic device 10, wherein 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 a virtual machine to process an errata sheet may include:

[0163] Step S81, the VMM obtains Errata related information of the CPU architecture, and shares the Errata related information with the virtual machine.

[0164] In some embodiments, Errata related information may include CPU type information, Timer Errata information, etc. Taking the example that Errata existing in the CPU architecture includes CPU Errata and Timer Errata, Errata related information may include CPU type information and Timer Errata information.

[0165] 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 the first Timer Errata information and the second Timer Errata information. The VMM can compare the CPU type information with the preset TimerErrata 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.

[0166] 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 register 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.

[0167] In some embodiments, a shared storage area, such as a 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 virtualized Errata management backend module 101 of the VMM) may write Errata related information to the shared storage area, and the virtual machine (e.g., the virtualized Errata management frontend module 103 of the virtual machine) may read the Errata related information written by the VMM from the shared storage area.

[0168] Step S82: The virtual machine identifies Errata existing in the CPU architecture based on Errata related information.

[0169] 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, which is not limited in the present application.

[0170] 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.

[0171] Step S83: The virtual machine repairs the identified Errata.

[0172] 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 the gust OS, and these errata include errata that exists in the CPU architecture, and errata that does not exist in the CPU architecture. Errata can include CPU errata, timer errata, etc. according to the type. Errata can also be divided according to the management method, and can be divided into static management type errata and dynamic management type errata. 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 CPU architecture has the first errata, 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 is determined whether to execute the errata repair logic of 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, and improving the performance of the virtual machine.

[0173] In some embodiments, the virtual machine is also configured with a dynamic Errata management switch, and the dynamic Errata management switch is used to select whether to turn on the Errata dynamic processing mechanism. For example, the virtual machine can respond to user operations and put the dynamic Errata management switch in an off state or an on state. If the dynamic Errata management switch is put in an off state, that is, the Errata dynamic processing mechanism is turned off, when the guest OS of the virtual machine runs to the Errata processing logic of a certain dynamic management type Errata, it is determined whether to execute the Errata repair logic according to the CPU type information. 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, and 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.

[0174] 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 VCPU thread of the virtual machine in real time at the back end, 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 the 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.

[0175] For example, for static management type Errata, even 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 static management type Errata, and it is determined that the CPU architecture has the static management type Errata, the Errata repair logic can be directly executed. For dynamic management type Errata, 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 dynamic management type Errata, it can be determined whether to execute the Errata repair logic based on the physical CPU type where the VCPU thread is currently located. Taking the second Errata as a dynamically managed type 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 there is a second Errata in the physical CPU of this type based on the physical CPU type. If it is determined that there is no second Errata in the physical CPU of this type, the non-repair logic of the second Errata is executed. If it is determined that there is a second Errata in the physical CPU of this type, the Errata repair logic of the second Errata is executed, which can avoid executing redundant Errata repair logic and improve the performance of the virtual machine.

[0176] In some embodiments, when the 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 manages the scheduling of the VCPU thread of the virtual machine based on the Errata processing context. For example, the VMM may prohibit the VCPU thread of the virtual machine from performing cross-type CPU scheduling based on the Errata processing context, or the VMM may prohibit the VCPU thread of the virtual machine from performing CPU scheduling based on the Errata processing context, thereby ensuring that the VCPU thread of the virtual machine correctly handles Errata, and preventing the VCPU thread of the virtual machine from being scheduled to other CPUs containing this Errata when processing the non-repair logic of a certain Errata, resulting in an Errata processing logic error, which affects the normal operation of the virtual machine.

[0177] In some embodiments, after the VCPU thread of the virtual machine completes Errata processing, the virtual machine may maintain the Errata processing completion context, and share the Errata processing completion context with the VMM, and the VMM may restore the CPU scheduling authority of the VCPU thread of the virtual machine based on the Errata processing completion context. For example, the VCPU thread of the virtual machine may be restored from prohibiting cross-type CPU scheduling to allowing cross-type CPU scheduling of the VCPU thread of the virtual machine, and the VCPU thread of the virtual machine may be restored from prohibiting CPU scheduling to allowing CPU scheduling of the VCPU thread of the virtual machine.

[0178] In the electronic device 10 provided in the 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 virtual machine processing errata in the above-mentioned embodiment.

[0179] 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.

[0180] The 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 for processing errata by a virtual machine in the above-mentioned embodiment.

[0181] 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 execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory to enable the chip to execute the method of virtual machine processing errata in the above-mentioned method embodiments.

[0182] 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.

[0183] Through the description of the above implementation methods, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned 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 specific functions, or it can be a functional module formed by the cooperation of computer program instruction segments and hardware.

[0184] In the several embodiments provided in the present 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, such as 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.

[0185] The units described as separate components may or may not be physically separated, 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 different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0186] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0187] 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 perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

[0188] The above description is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions 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 errata 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), 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 an errata sheet by a virtual machine according to claim 1, wherein: 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, 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 an errata sheet by a virtual machine according to claim 3, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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

Cited By

  • Method for processing errata by virtual machine, and related device

    EP4679268A1

  • Method for processing errata by virtual machine, and related device

    WO2024198545A1