SOC chip, electronic device and method for preventing configuration data loss
Patent Information
- Application Number
- CN202211532051.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-01
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2042-12-01
AI Technical Summary
[0005]鉴于此,本申请的目的在于提供一种SOC芯片、电子设备及防止配置数据丢失的方法,以改善现有解决同步问题的方案所存在的效率低的问题
Smart Images

Figure CN115757266B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer technology, and specifically relates to a SOC chip, electronic device, and method for preventing configuration data loss. Background Technology
[0002] Hardware virtualization products based on SRIOV (Single Root IO Virtualization) technology require an identical register set for each virtual device (VF) during the design phase to ensure that VFs are independent and do not interfere with each other. However, as device functions become more complex and the number of VFs increases, the register space they occupy also becomes larger. Due to limitations in chip manufacturing processes, it is difficult to ensure that each VF has its own independent register space.
[0003] A common solution is for all Virtual Functions (VFs) to share a single register space. Only the driver component corresponding to an active VF is allowed to access and modify the shared register configuration. Driver components corresponding to VFs in standby mode are not authorized to access or modify the shared register configuration. A standby driver component can only write its own configuration data (which may be page table configuration-related data, such as the configured page table address) into the device memory (on-chip memory). This allows the VFM (VF Manager) module (responsible for virtual device state management) to restore the configuration data previously written to the device memory by the driver component corresponding to VFj to the shared registers when switching VF states (e.g., switching VFi from active to standby, and switching VFj from standby to active). While this solution solves the register space problem, it introduces synchronization issues between the VF driver component and the VFM module, which can easily lead to the loss of configuration data written to the shared registers.
[0004] Currently, to solve the synchronization problem, every VF driver component needs to request permission from the virtual monitor before accessing shared registers. Only after authorization can it access and modify the shared register configuration; otherwise, it must wait. While this method solves the synchronization problem, it is inefficient because every time a VF driver component accesses shared registers, permission must be requested from the virtual monitor, and the synchronization problem only occurs during state transitions. Furthermore, this process requires the virtual monitor to decide which VF driver component to authorize, which also takes time. Summary of the Invention
[0005] Therefore, the purpose of this application is to provide a SOC chip, an electronic device, and a method for preventing configuration data loss, so as to improve the low efficiency of existing solutions to the synchronization problem.
[0006] The embodiments of this application are implemented as follows:
[0007] In a first aspect, embodiments of this application provide a System-on-Chip (SOC) chip applied to an electronic device, wherein at least two virtual devices are deployed in the electronic device, and the electronic device further includes a Virtual Function Management (VFM) module responsible for the state management of each virtual device. The SOC chip includes: a kernel on which a virtual monitor for managing each virtual device and a driver component for driving each virtual device are deployed; each driver component is configured to, upon receiving an interrupt information sent by the VFM module, stop updating configuration data and synchronize the interrupt information to the virtual monitor; and, upon receiving information from the virtual monitor indicating that the state switch is complete, resume updating configuration data; the virtual monitor is configured to, upon receiving the interrupt information, issue a state switch command to the VFM module; and, after the VFM module completes the state switch, send information indicating that the state switch is complete to the driver components corresponding to the two virtual devices involved in the state switch.
[0008] In this embodiment, by actively sending interrupt information to the driver components corresponding to the two virtual devices (VFs) participating in the state switch, they are notified that the device is in a switching state, pausing or delaying configuration data updates, and resuming configuration data updates after the switch is completed. This avoids the synchronization problem caused by updating configuration data during VF state switch. Moreover, only the driver components corresponding to the two virtual devices participating in the state switch need to be sent interrupt information, which effectively reduces the number of participating VFs and the interaction frequency between the driver components and the virtual monitor. Compared with the existing solutions to the synchronization problem (where all VF driver components need to request permission from the virtual monitor every time they access the shared registers), this method improves efficiency.
[0009] In one possible implementation of the first aspect embodiment, the virtual monitor is further configured to send a notification to the VFM module that it is ready to perform a state switch before issuing a state switch command to the VFM module, so that the VFM module can respond to the notification and send the interrupt information to the driver components corresponding to the two virtual devices participating in the state switch.
[0010] In this embodiment, a notification to prepare for state switching is sent to the VFM module before issuing a state switching command to the VFM module, so that the VFM module can promptly send interrupt information to the driver components corresponding to the two virtual devices participating in the state switching, and suspend configuration data updates in a timely manner.
[0011] Secondly, this application also provides a SOC chip for use in an electronic device, wherein at least two virtual devices are deployed in the electronic device, and the electronic device further includes a VFM module responsible for the state management of each virtual device. The SOC chip includes: a kernel on which a driver component for driving each virtual device is deployed; and a driver component corresponding to each virtual device for obtaining the current state of the corresponding virtual device from the VFM module. If the current state of the virtual device obtained before and after updating the configuration data is inconsistent, the configuration data is updated again.
[0012] In this embodiment, the current state of the corresponding virtual device is actively obtained from the VFM module. Then, the states obtained before and after the configuration data update are compared. If the current states of the virtual device obtained before and after the configuration data update are inconsistent, the configuration data is updated again to achieve an "error correction" function. This allows the system to automatically recover from configuration data loss caused during VF state switching. Furthermore, this solution does not require information interaction between the driver component and the virtual monitor, nor does it require the virtual monitor to make decisions, effectively improving efficiency.
[0013] In one possible implementation of the second aspect embodiment, the driver component corresponding to each virtual device is configured to: if the current state of the virtual device obtained before updating the configuration data is in standby mode, and the current state of the virtual device obtained after updating the configuration data is in working mode, stop updating the configuration data to the on-chip memory, and update the configuration data back to the shared register; or if the current state of the virtual device obtained before updating the configuration data is in working mode, and the current state of the virtual device obtained after updating the configuration data is in standby mode, stop updating the configuration data to the shared register, and update the configuration data back to the on-chip memory.
[0014] In this embodiment of the application, when updating the configuration data, the update location is different for different states. In this way, whether the virtual device is switched from working state to standby state or from standby state to working state, the configuration data lost during the VF state switching process can be recovered automatically.
[0015] Thirdly, embodiments of this application also provide an electronic device, wherein at least two virtual devices are deployed in the electronic device, the electronic device comprising: a first SOC chip and a second SOC chip; the first SOC chip having a virtual monitor for managing each of the virtual devices and a driver component for driving each of the virtual devices deployed thereon; the second SOC chip comprising: a VFM module responsible for state management of each of the virtual devices; each of the driver components being configured to, upon receiving an interrupt information sent by the VFM module, stop updating configuration data and synchronize the interrupt information to the virtual monitor; and to resume updating configuration data upon receiving information indicating that the state switch is complete sent by the virtual monitor; the virtual monitor being configured to, upon receiving the interrupt information, issue a state switch command to the VFM module; and, after the VFM module completes the state switch, send information indicating that the state switch is complete to the driver components corresponding to the two virtual devices involved in the state switch.
[0016] In one possible implementation of the third aspect embodiment, the VFM module is configured to send the interrupt information to the driver components corresponding to the two virtual devices participating in the state switching; and in response to the state switching command, switch the state of the two virtual devices participating in the state switching, and notify the virtual monitor after the state switching is completed.
[0017] In one possible implementation of the third aspect embodiment, the virtual monitor is further configured to send a notification to the VFM module indicating preparation for a state switch before issuing a state switch command to the VFM module; correspondingly, the VFM module is configured to respond to the notification by sending the interrupt information to the driver components corresponding to the two virtual devices participating in the state switch.
[0018] In one possible implementation of the third aspect embodiment, the second SOC chip further includes: a shared register and on-chip memory; the VFM module is further configured to read configuration data of the target virtual device from the on-chip memory and synchronize the configuration data of the target virtual device to the shared register during the state switching process; wherein, the target virtual device is the virtual device whose state is switched to the working state among the two virtual devices participating in the state switching.
[0019] Fourthly, embodiments of this application also provide an electronic device, wherein at least two virtual devices are deployed in the electronic device, the electronic device comprising: a first SOC chip having a driver component deployed thereon for driving each of the virtual devices; a second SOC chip including: a VFM module responsible for state management of each of the virtual devices; and a driver component corresponding to each of the virtual devices, used to obtain the current state of the corresponding virtual device from the VFM module, and if the current state of the virtual device obtained before and after updating the configuration data is inconsistent, the configuration data is updated again.
[0020] In one possible implementation of the fourth aspect embodiment, the driver component corresponding to each virtual device is configured to: if the current state of the virtual device obtained before updating the configuration data is in standby mode, and the current state of the virtual device obtained after updating the configuration data is in working mode, stop updating the configuration data to the on-chip memory, and update the configuration data back to the shared register; or, if the current state of the virtual device obtained before updating the configuration data is in working mode, and the current state of the virtual device obtained after updating the configuration data is in standby mode, stop updating the configuration data to the shared register, and update the configuration data back to the on-chip memory.
[0021] In one possible implementation of the fourth aspect embodiment, the first SOC chip is further equipped with a virtual monitor for managing each of the virtual devices; the virtual monitor is used to issue a state switching command to the VFM module; the VFM module is used to respond to the state switching command, switch the state of the two virtual devices involved in the state switching, and notify the virtual monitor after the state switching is completed.
[0022] Fifthly, embodiments of this application also provide a method for preventing configuration data loss, characterized in that it is applied to an electronic device, the electronic device including a VFM module, the VFM module being responsible for managing the state of each virtual device deployed in the electronic device; the method includes: obtaining the current state of the corresponding virtual device from the VFM module; if the current state of the virtual device obtained before and after updating the configuration data is inconsistent, updating the configuration data again.
[0023] In one possible implementation of the fifth aspect embodiment, if the current state of the virtual device obtained before and after updating the configuration data is inconsistent, the configuration data is updated again, including: if the current state of the virtual device obtained before updating the configuration data is in standby mode, and the current state of the virtual device obtained after updating the configuration data is in working mode, the update of the configuration data to the on-chip memory is stopped, and the configuration data is updated to the shared register again; or, if the current state of the virtual device obtained before updating the configuration data is in working mode, and the current state of the virtual device obtained after updating the configuration data is in standby mode, the update of the configuration data to the shared register is stopped, and the configuration data is updated to the on-chip memory again.
[0024] Sixthly, embodiments of this application also provide a method for preventing configuration data loss, characterized in that it is applied to an electronic device, the electronic device including a VFM module, the VFM module being responsible for managing the state of each virtual device deployed in the electronic device, the electronic device also being deployed with driver components for driving each virtual device; receiving interrupt information sent by the driver components corresponding to two virtual devices about to participate in state switching, wherein the interrupt information is used to cause the driver components corresponding to the two virtual devices participating in state switching to pause or stop updating configuration data; issuing a state switching command to the VFM module, so that the VFM module responds to the state switching command and performs state switching on the two virtual devices participating in state switching; after the VFM module completes the state switching, sending information indicating the completion of state switching to the driver components corresponding to the two virtual devices participating in state switching, so that the driver components corresponding to the two virtual devices participating in state switching resume updating configuration data.
[0025] In a possible implementation of the sixth aspect embodiment, before receiving interrupt information sent by the driver components corresponding to the two virtual devices about to participate in the state switch, the method further includes:
[0026] A notification is sent to the VFM module to prepare for a state switch, so that the VFM module, in response to the notification, sends the interrupt information to the driver components corresponding to the two virtual devices participating in the state switch.
[0027] Other features and advantages of this application will be set forth in the following description. The objectives and other advantages of this application can be realized and obtained through the structures specifically pointed out in the written description and the accompanying drawings. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The above and other objects, features, and advantages of this application will become clearer through the drawings. The same reference numerals indicate the same parts in all the drawings. The drawings are not intentionally drawn to scale to actual size; the focus is on illustrating the main points of this application.
[0029] Figure 1 The diagram illustrates the principle of the synchronization problem between the VFj-driver and the VFM module provided in the embodiment of this application.
[0030] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown.
[0031] Figure 3 This illustration shows an interactive diagram of various modules in an electronic device provided in an embodiment of this application.
[0032] Figure 4 This illustration shows an interactive diagram of various modules in another electronic device provided in an embodiment of this application.
[0033] Figure 5 A flowchart illustrating a method for preventing configuration data loss according to an embodiment of this application is shown.
[0034] Figure 6 A flowchart illustrating another method for preventing configuration data loss provided in an embodiment of this application is shown. Detailed Implementation
[0035] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0036] It should be noted that similar reference numerals and letters in the following figures denote similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, relational terms such as "first," "second," etc., in the description of this application are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0037] Furthermore, the term "and / or" in this application is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0038] Given that virtual devices (VFs) are prone to synchronization issues between their corresponding driver components and the VFM module during state transitions, for example, assuming two virtual devices, VFi and VFj, when the VFM module switches the states of VFi and VFj (e.g., switching VFi from active to standby and VFj from standby to active, or vice versa), the VFM module loads (reads) VFj's configuration data from on-chip memory and synchronizes it to a shared register (a register shared by all virtual devices). If the driver component (VFj-driver) of VFj updates the shared register with the latest configuration data (since a virtual device in active state can directly modify shared registers), the VFM module will overwrite the latest configuration data in the shared register with the old configuration data in on-chip memory. This causes a synchronization problem between the driver component of the active virtual device accessing the shared register and the VFM module accessing the shared register, resulting in the loss of configuration data in the shared register.
[0039] The schematic diagram that leads to the synchronization problem between VFj-driver and VFM module is as follows: Figure 1As shown, for example, after the VFM module switches VFj from standby to working state, the first step is: the VFM module reads the configuration data of VFj from the on-chip memory; the second step is: the VFj-driver writes the latest configuration data of VFj into the shared register before the VFM module; the third step is: the VFM module then writes the old configuration data of VFj (relative to the latest configuration data of VFj) into the shared register, which causes the VFM module to overwrite the latest configuration data in the shared register with the old configuration data.
[0040] To address this issue, this application proposes two methods to prevent configuration data loss, thereby resolving the synchronization problem caused by updating configuration data during VF state switching. During VF state switching, the VFM module loads the configuration data of the virtual device in the working state from the on-chip memory and synchronizes it to the shared register. The virtual device in the working state can directly modify the shared register, thus causing a synchronization problem.
[0041] Solution 1: During VF state switching, the VFM module proactively sends interrupt information to the driver components corresponding to the two virtual devices involved in the state switch to notify them that the device is in a switching state, pausing or delaying configuration data updates. Configuration data updates resume only after the switch is complete. This avoids synchronization problems caused by updating configuration data during VF state switching. Furthermore, by only sending interrupt information to the driver components corresponding to the two virtual devices involved in the state switch, the number of participating VFs is effectively reduced, and the interaction frequency between the driver components and the virtual monitor is significantly decreased. Compared to existing solutions for synchronization problems (where all VF driver components need to request permissions from the virtual monitor each time they access shared registers), this solution improves efficiency.
[0042] Solution 2: By actively retrieving the current state of the corresponding virtual device from the VFM module, and then comparing the virtual device states retrieved before and after the configuration data update, if the current states are inconsistent, the configuration data is updated again; otherwise, no special handling is required. This two-step verification method compares the VF state information before and after the configuration update, achieving an "error correction" function and automatically recovering from configuration data loss caused during VF state switching. Furthermore, this solution eliminates the need for information exchange between the driver component and the virtual monitor, and also eliminates the need for the virtual monitor to make decisions, effectively improving efficiency.
[0043] The two methods for preventing configuration data loss provided in this application are both applied to electronic devices. For example... Figure 2As shown, the electronic device has at least two virtual devices deployed in it (virtual devices are usually deployed in the operating system of the electronic device). Each virtual device is an independent device. Through virtualization technology (such as SRIOV technology), a physical device can be virtualized into multiple virtual devices.
[0044] This electronic device includes a first SOC (System on Chip) chip and a second SOC chip, which are connected together. This electronic device can be a computer, server, or similar device.
[0045] The first and second SOC chips mentioned above can be different. For example, the first and second SOC chips can both be integrated circuit chips with signal processing capabilities. The aforementioned SOC chips can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. General-purpose SOC chips can be microprocessors or any conventional processor.
[0046] In one implementation, the first SOC chip can be a CPU, and the second SOC chip can be a graphics processing unit (GPU) or a GPGPU (General Purpose Graphics Processing Unit).
[0047] The first SOC chip deploys a virtual monitor (hypervisor) for managing each virtual device and a driver component for driving each virtual device. Each virtual device corresponds to an independent driver component; for example, the driver component for VFi is VFi-driver, and the driver component for VFj is VFj-driver. The virtual monitor contains a PF (Physical Function) driver, which is the driver component running on the virtual monitor and is responsible for the management and scheduling of virtual devices.
[0048] The second SOC chip includes shared registers, on-chip memory, and a VFM module responsible for virtual device status management. The VFM module is connected to both the shared registers and the on-chip memory. The VFM can synchronize the configuration data of virtual devices in their active state, stored in the on-chip memory, to the shared registers. The on-chip memory stores the configuration data of each virtual device, while the shared registers are used to store the configuration data of virtual devices in their active state.
[0049] On-chip memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc.
[0050] When different solutions (Solution 1 and Solution 2) are adopted to solve the above technical problems, the same module in the electronic device plays a different role in different solutions.
[0051] If the above-mentioned solution 1 is used to solve the synchronization problem caused by updating configuration data during VF state switching, then:
[0052] Each driver component is configured to stop updating configuration data and synchronize the interrupt information to the virtual monitor after receiving an interrupt message from the VFM module, and to resume updating configuration data after receiving a message from the virtual monitor indicating that the representation state switch is complete.
[0053] The virtual monitor, upon receiving interrupt information from the driver components corresponding to the two virtual devices about to undergo a state switch, issues a state switch command to the VFM module. This command includes the names of the two virtual devices and the desired state to be switched. The VFM module responds to the command and switches the states of the two virtual devices accordingly, for example, switching VFi from standby to active and VFj from active to standby. After the VFM module completes the state switch, the virtual monitor sends a message indicating the completion of the switch to the driver components corresponding to the two virtual devices, allowing these driver components to resume updating their configuration data.
[0054] The VFM module is used to send interrupt information to the driver components corresponding to the two virtual devices participating in the state switch, and to respond to state switch commands, switch the states of the two virtual devices, and notify the virtual monitor after the state switch is completed. During the state switch, the VFM module is also used to read the configuration data of the target virtual device from the on-chip memory and synchronize the configuration data of the target virtual device to the shared register. The target virtual device is the virtual device whose state is switched to the working state among the two virtual devices participating in the state switch. That is, during the state switch, the VFM module loads the configuration data of the virtual device in the working state from the on-chip memory and synchronizes it to the shared register.
[0055] Optionally, the virtual monitor is also used to send a notification to the VFM module that it is ready to perform a state switch before formally issuing a state switch command to the VFM module. Accordingly, the VFM module is used to respond to the notification and send interrupt information to the driver components corresponding to the two virtual devices participating in the state switch.
[0056] To better understand the above process, examples will be provided below, along with... Figure 3 The interactive flowchart shown illustrates the principle of Solution 1. Assume the two virtual devices involved in the state switching are VFi and VFj. In one implementation, the process of Solution 1 may include:
[0057] (1): The virtual monitor sends a notification to the VFM module indicating that it is ready to perform a state switch, such as switching VFi to the working state and VFj to the standby state. It should be noted that the state switch has not yet started at this time. VFj is still in the working state and can still modify the shared register configuration. VFi is still in the standby state and can still modify the on-chip memory.
[0058] (2): In response to this notification, the VFM module actively sends interrupt information to the VFi-driver and VFj-driver to notify them to pause the configuration data update operation. For example, the VFj-driver pauses updating configuration data to the shared register, and the VFi-driver pauses updating configuration data to the on-chip memory.
[0059] (3): VFi-driver and VFj-driver synchronize the interrupt information to the virtual monitor in order to confirm to the virtual monitor that they have received the interrupt information.
[0060] (4): After receiving the interrupt information, the virtual monitor sends a formal state switching command to the VFM module.
[0061] (5): The VFM module responds to the state switching command and switches the state of the two virtual devices involved in the state switching, such as switching the state of VFi to the working state and the state of VFj to the standby state. It also reads the configuration data of VFi from the on-chip memory and synchronizes the configuration data of VFi to the shared register. After the state switching is completed, it informs the virtual monitor.
[0062] (6): After the VFM module completes the state switch, the virtual monitor sends information indicating that the state switch is complete to the VFi-driver and VFj-driver.
[0063] (7): After receiving the information from the virtual monitor indicating that the representation state switch is complete, the VFi-driver and VFj-driver can resume configuration data updates. At this time, the VFi is in the working state and can directly modify the configuration of the shared registers and update the configuration data directly to the shared registers; the VFj is in the standby state and cannot modify the shared registers, but can only update the configuration data to the on-chip memory.
[0064] As can be seen from the above description, VFi-driver and VFj-driver will only update the configuration data after receiving the information from the virtual monitor indicating that the representation state switch is complete. They will not modify the shared register configuration at the same time as the VFM module. This solves the synchronization problem caused by the driver component and the VFM module accessing the shared register at the same time, and thus avoids the problem of configuration data loss.
[0065] If the above-mentioned scheme 2 is used to solve the synchronization problem caused by updating configuration data during VF state switching, then:
[0066] The driver component for each virtual device is used to obtain the current state of the corresponding virtual device from the VFM module. If the current state of the virtual device obtained before and after the configuration data update is inconsistent, the configuration data is updated again. If the current state of the virtual device obtained before and after the configuration data update is consistent, no processing is required.
[0067] If the current state of the virtual device obtained before updating the configuration data is in standby mode, and the current state of the virtual device obtained after updating the configuration data is in working mode, stop updating the configuration data to the on-chip memory, and update the configuration data to the shared register again; or, if the current state of the virtual device obtained before updating the configuration data is in working mode, and the current state of the virtual device obtained after updating the configuration data is in standby mode, stop updating the configuration data to the shared register, and update the configuration data to the on-chip memory again.
[0068] In this implementation, the virtual monitor issues state switching commands to the VFM module; the VFM module responds to the state switching commands, switches the states of the two virtual devices involved in the state switching, and notifies the virtual monitor after the state switching is complete. The VFM module is also used to read configuration data of the target virtual device from on-chip memory and synchronize the target virtual device's configuration data to a shared register during the state switching process; wherein the target virtual device is the virtual device whose state is switched to the working state among the two virtual devices involved in the state switching.
[0069] To better understand the above process, examples will be provided below, along with... Figure 4 The interactive flowchart shown illustrates the principle of Solution 2. Assume the two virtual devices involved in the state switching are VFi and VFj. In one implementation, the process of Solution 2 may include:
[0070] (1): Before updating the configuration data, VFi-driver and VFj-driver first read the status information of VFi and VFj in the VFM module. Assume that VFi is in standby mode and VFj is in working mode.
[0071] (2): The virtual monitor sends a state switching command to the VFM module, such as switching the state of VFi to working state and the state of VFj to standby state.
[0072] (3): The VFM module responds to the state switching command and switches the state of the two virtual devices involved in the state switching, such as switching the state of VFi to the working state and the state of VFj to the standby state. It also reads the configuration data of VFi from the on-chip memory and synchronizes the configuration data of VFi to the shared register. After the state switching is completed, it informs the virtual monitor.
[0073] (4): The VFi-driver updates the configuration data in the on-chip memory, and the VFj-driver updates the configuration data in the shared register. Since the VFj-driver is unaware that the VFj state has switched to standby, it will also update the VFj configuration data in the shared register. However, because the VFj state has actually switched to standby, this update operation will not succeed, resulting in the loss of the VFj configuration data updated to the shared register. Similarly, the latest VFi configuration data will also be lost. Since the VFi-driver is unaware that the VFi state has switched to working, it will write the configuration data to the on-chip memory when updating the configuration data. Before this, the VFM module, during state switching, will synchronize the old VFi configuration data stored in the on-chip memory to the shared register. Therefore, the shared register stores the old VFi configuration data, resulting in the loss of the latest VFi configuration data.
[0074] (5): The VFi-driver reads the status information of VFi in the VFM module. At this time, VFi is in the working state. It finds that the status obtained before and after is inconsistent, indicating that a state switch has occurred and configuration data may be lost. Therefore, it stops updating the configuration data and waits for the state switch to complete. Similarly, the VFj-driver reads the status information of VFj in the VFM module. At this time, VFj is in the standby state. It finds that the status obtained before and after is inconsistent, indicating that a state switch has occurred and configuration data may be lost. Therefore, it stops updating the configuration data and waits for the state switch to complete.
[0075] (6): After the state transition is complete, the VFi-driver updates the configuration data to the shared registers. After the VFj-driver is complete, it updates the configuration data to the on-chip memory.
[0076] In one implementation, the virtual monitor, upon receiving information from the VFM module indicating that the state transition is complete, may notify the VFi-driver and VFj-driver, thus informing them of the completion of the state transition. In another implementation, the VFi-driver and VFj-driver may determine the completion of the state transition by actively reading the status information of the corresponding virtual device in the VFM module.
[0077] As described above, Solution 2 possesses an "error correction" function, capable of automatically recovering from configuration data loss caused during VF state switching, thus resolving the configuration data loss issue resulting from synchronization problems. Furthermore, this solution eliminates the need for information exchange between the driver component and the virtual monitor, and also eliminates the need for the virtual monitor to make decisions, effectively improving efficiency.
[0078] Through the above Figure 3 , Figure 4 As can be seen from the interaction flowchart shown, the roles of the driver component, the virtual monitor, and the VFM module are different in different solutions. For example, in solution 2, the VFM module does not need to send interrupt information to the driver components corresponding to the two virtual devices involved in the state switch, the driver component does not need to synchronize the interrupt information to the virtual monitor, and the virtual monitor does not need to send a notification to the VFM module to prepare for the state switch before issuing the state switch command.
[0079] Based on the same inventive concept, this application also provides a SOC chip (i.e., the first SOC chip mentioned above) applied to an electronic device, in which at least two virtual devices are deployed, and the electronic device further includes a VFM module responsible for the state management of each virtual device. The SOC chip includes a core, on which a virtual monitor for managing each virtual device and a driver component for driving each virtual device are deployed. Each virtual device corresponds to an independent driver component.
[0080] If the above-mentioned solution 1 is used to solve the synchronization problem caused by updating configuration data during VF state switching, then:
[0081] Each driver component in this process is configured to stop updating configuration data and synchronize the interrupt information to the virtual monitor after receiving an interrupt message from the VFM module; and to resume updating configuration data after receiving a message from the virtual monitor indicating that the representation state switch is complete.
[0082] The virtual monitor is used to issue a state switching command to the VFM module after receiving an interrupt message; and to send information indicating the completion of the state switching to the driver components corresponding to the two virtual devices involved in the state switching after the VFM module completes the state switching. The virtual monitor is also used to send a notification to the VFM module indicating preparation for a state switching before issuing the state switching command, so that the VFM module, in response to the notification, sends interrupt information to the driver components corresponding to the two virtual devices involved in the state switching.
[0083] If the above-mentioned scheme 2 is used to solve the synchronization problem caused by updating configuration data during VF state switching, then:
[0084] The driver component corresponding to each virtual device is used to obtain the current state of the corresponding virtual device from the VFM module. If the current state of the virtual device obtained before and after the configuration data update is inconsistent, the configuration data is updated again. In one implementation, the driver component corresponding to each virtual device is used to: if the current state of the virtual device obtained before the configuration data update is in standby mode, and the current state of the virtual device obtained after the configuration data update is in working mode, stop updating the configuration data to the on-chip memory, and update the configuration data to the shared register again; or, if the current state of the virtual device obtained before the configuration data update is in working mode, and the current state of the virtual device obtained after the configuration data update is in standby mode, stop updating the configuration data to the shared register, and update the configuration data to the on-chip memory again.
[0085] The implementation principle and technical effects of the SOC chip embodiment are the same as those of the aforementioned electronic device embodiment. For the sake of brevity, any parts not mentioned in the SOC chip embodiment can be referred to the corresponding content in the aforementioned electronic device embodiment.
[0086] Based on the same inventive concept, embodiments of this application also provide a method for preventing configuration data loss in an electronic device, the electronic device including a VFM module, the VFM module being responsible for managing the state of each virtual device deployed in the electronic device. The following, in conjunction with... Figure 5 The principle behind this will be explained as shown.
[0087] S1: Obtain the current state of the corresponding virtual device from the VFM module.
[0088] For example, the driver component corresponding to each virtual device can obtain the current state of the corresponding virtual device from the VFM module every preset time period (which can be customized).
[0089] S2: If the current state of the virtual device obtained before and after updating the configuration data is inconsistent, update the configuration data again.
[0090] If the current state of the virtual device obtained before and after updating the configuration data is inconsistent, it indicates that the state of the virtual device has been switched, which will cause the configuration data to be lost. The configuration data needs to be updated again to recover the lost configuration data.
[0091] If the current state of the virtual device obtained before updating the configuration data is in standby mode, and the current state of the virtual device obtained after updating the configuration data is in working mode, stop updating the configuration data to the on-chip memory, and update the configuration data to the shared register again; or, if the current state of the virtual device obtained before updating the configuration data is in working mode, and the current state of the virtual device obtained after updating the configuration data is in standby mode, stop updating the configuration data to the shared register, and update the configuration data to the on-chip memory again.
[0092] Based on the same inventive concept, this application also provides another method for preventing configuration data loss in an electronic device. The electronic device includes a VFM module, which manages the state of each virtual device deployed in the electronic device. The electronic device also deploys driver components for driving each virtual device. The following describes a method for preventing configuration data loss in an electronic device. Figure 6 The principle behind this will be explained as shown.
[0093] S10: Receive interrupt information sent by the driver components corresponding to the two virtual devices that are about to participate in the state switch.
[0094] It can be a virtual monitor that receives interrupt information sent by the driver components of the two virtual devices that are about to participate in the state switch.
[0095] S20: Send a state switching command to the VFM module so that the VFM module responds to the state switching command and switches the state of the two virtual devices involved in the state switching.
[0096] After receiving the interrupt information, the virtual monitor sends a state switching command to the VFM module, so that the VFM module responds to the state switching command and switches the state of the two virtual devices involved in the state switching.
[0097] Optionally, before issuing a state switching command to the VFM module, the virtual monitor also sends a notification to the VFM module indicating that a state switching is in progress, so that the VFM module responds to the notification and sends interrupt information to the driver components corresponding to the two virtual devices involved in the state switching.
[0098] S30: After the VFM module completes the state switch, it sends information indicating the completion of the state switch to the driver components corresponding to the two virtual devices that participated in the state switch, so that the driver components corresponding to the two virtual devices that participated in the state switch can resume configuration data updates.
[0099] After the VFM module completes the state switch, it sends information indicating the completion of the state switch to the driver components corresponding to the two virtual devices that participated in the state switch, so that the driver components corresponding to the two virtual devices that participated in the state switch can resume configuration data updates.
[0100] The implementation principle and technical effects of the method embodiment are the same as those of the aforementioned electronic device embodiment. For the sake of brevity, any parts not mentioned in the method embodiment can be referred to the corresponding content in the aforementioned electronic device embodiment.
[0101] This application also provides a non-volatile computer-readable storage medium (hereinafter referred to as the storage medium) storing a computer program. When the computer program is run by a computer, such as the aforementioned electronic device, it executes the method described above for preventing configuration data loss. The aforementioned computer-readable storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0102] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0103] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0104] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A SOC chip, characterized in that, Applied to an electronic device, wherein at least two virtual devices are deployed in the electronic device, and the electronic device further includes a VFM module responsible for the state management of each virtual device, the SOC chip comprising: The kernel, on which virtual monitors for managing each of the virtual devices and driver components for driving each of the virtual devices are deployed; Each of the aforementioned drive components is configured to stop updating configuration data and synchronize the interrupt information to the virtual monitor after receiving an interrupt information sent by the VFM module; and to resume updating configuration data after receiving a representation state switching completion information sent by the virtual monitor. The virtual monitor is used to send a state switching command to the VFM module after receiving the interrupt information; and after the VFM module completes the state switching, send information indicating the completion of the state switching to the driver components corresponding to the two virtual devices involved in the state switching.
2. The SOC chip according to claim 1, characterized in that, The virtual monitor is also configured to send a notification to the VFM module that it is ready to perform a state switch before issuing a state switch command to the VFM module, so that the VFM module can respond to the notification and send the interrupt information to the driver components corresponding to the two virtual devices participating in the state switch.
3. A SOC chip, characterized in that, Applied to an electronic device, wherein at least two virtual devices are deployed in the electronic device, and the electronic device further includes a VFM module responsible for the state management of each virtual device, the SOC chip comprising: The kernel, on which driver components for driving each of the virtual devices are deployed; The driver component corresponding to each virtual device is used to obtain the current state of the corresponding virtual device from the VFM module. If the current state of the virtual device obtained before and after updating the configuration data is inconsistent, the configuration data is updated again. The driver component corresponding to each virtual device is used for: If the virtual device's current state was in standby mode before the configuration data update, and its current state is in working mode after the configuration data update, stop updating the configuration data to on-chip memory and update the configuration data to the shared register again; or If the current state of the virtual device obtained before updating the configuration data is in a working state, and the current state of the virtual device obtained after updating the configuration data is in a standby state, stop updating the configuration data to the shared register, and update the configuration data to the on-chip memory again.
4. An electronic device, characterized in that, The electronic device deploys at least two virtual devices, and the electronic device includes: A first SOC chip has a virtual monitor for managing each of the virtual devices and a driver component for driving each of the virtual devices deployed thereon. The second SOC chip includes: a VFM module responsible for the state management of each of the virtual devices; Each of the aforementioned drive components is configured to stop updating configuration data and synchronize the interrupt information to the virtual monitor after receiving an interrupt information sent by the VFM module; and to resume updating configuration data after receiving a representation state switching completion information sent by the virtual monitor. The virtual monitor is used to send a state switching command to the VFM module after receiving the interrupt information; and after the VFM module completes the state switching, send information indicating the completion of the state switching to the driver components corresponding to the two virtual devices involved in the state switching.
5. The electronic device according to claim 4, characterized in that, The VFM module is used to send the interrupt information to the driver components corresponding to the two virtual devices participating in the state switch; and to respond to the state switch command to switch the state of the two virtual devices participating in the state switch, and to notify the virtual monitor after the state switch is completed.
6. The electronic device according to claim 4, characterized in that, The virtual monitor is also used to send a notification to the VFM module that it is preparing to perform a state switch before issuing a state switch command to the VFM module; accordingly, The VFM module is used to respond to the notification by sending the interrupt information to the driver components corresponding to the two virtual devices participating in the state switch.
7. The electronic device according to any one of claims 4-6, characterized in that, The second SOC chip also includes: shared registers and on-chip memory; The VFM module is also used to read the configuration data of the target virtual device from the on-chip memory and synchronize the configuration data of the target virtual device to the shared register during the state switching process; wherein, the target virtual device is the virtual device whose state is switched to the working state among the two virtual devices participating in the state switching.
8. An electronic device, characterized in that, The electronic device deploys at least two virtual devices, and the electronic device includes: A first SOC chip, on which driver components for driving each of the virtual devices are deployed; The second SOC chip includes: a VFM module responsible for the state management of each of the virtual devices; The driver component corresponding to each virtual device is used to obtain the current state of the corresponding virtual device from the VFM module. If the current state of the virtual device obtained before and after updating the configuration data is inconsistent, the configuration data is updated again. The first SOC chip also has a virtual monitor deployed on it for managing each of the virtual devices; The virtual monitor is used to send state switching commands to the VFM module; The VFM module is used to respond to the state switching command, switch the state of the two virtual devices involved in the state switching, and notify the virtual monitor after the state switching is completed.
9. The electronic device according to claim 8, characterized in that, The driver component corresponding to each virtual device is used for: If the virtual device's current state was in standby mode before the configuration data update, and its current state is in working mode after the configuration data update, stop updating the configuration data to on-chip memory and re-update the configuration data to the shared register; or, If the current state of the virtual device obtained before updating the configuration data is in a working state, and the current state of the virtual device obtained after updating the configuration data is in a standby state, stop updating the configuration data to the shared register, and update the configuration data to the on-chip memory again.
10. A method for preventing configuration data loss, characterized in that, Applied to an electronic device, the electronic device including a VFM module, the VFM module being responsible for managing the state of each virtual device deployed in the electronic device; the method includes: Obtain the current state of the corresponding virtual device from the VFM module; If the current state of the virtual device obtained before and after updating the configuration data is inconsistent, update the configuration data again; If the current state of the virtual device obtained before and after the configuration data update is inconsistent, update the configuration data again, including: If the virtual device's current state is in standby mode before the configuration data update, and the current state is in working mode after the configuration data update, stop updating the configuration data to on-chip memory, and re-update the configuration data to the shared register; or, If the current state of the virtual device obtained before updating the configuration data is in a working state, and the current state of the virtual device obtained after updating the configuration data is in a standby state, stop updating the configuration data to the shared register, and update the configuration data to the on-chip memory again.
11. A method for preventing configuration data loss, characterized in that, The device is applied to an electronic device, which includes a VFM module that manages the state of each virtual device deployed in the electronic device, and the electronic device also has a driver component for driving each virtual device. Receive interrupt information sent by the driver components corresponding to the two virtual devices that are about to participate in the state switch, wherein the interrupt information is used to cause the driver components corresponding to the two virtual devices participating in the state switch to pause or stop updating the configuration data; A state switching command is sent to the VFM module so that the VFM module responds to the state switching command and switches the state of the two virtual devices involved in the state switching. After the VFM module completes the state switch, it sends information indicating the completion of the state switch to the driver components corresponding to the two virtual devices that participated in the state switch, so that the driver components corresponding to the two virtual devices that participated in the state switch can resume configuration data updates.
12. The method according to claim 11, characterized in that, Before receiving interrupt information sent by the driver components corresponding to the two virtual devices that are about to participate in the state switch, the method further includes: A notification is sent to the VFM module to prepare for a state switch, so that the VFM module, in response to the notification, sends the interrupt information to the driver components corresponding to the two virtual devices participating in the state switch.
Citation Information
Patent Citations
Early virtualization context switch for virtualized accelerated processing device
CN110832457A