Ubiquitous operating system virtual hardware resource migration method and system, terminal and medium
By adopting a virtual hardware resource migration method based on the Virtio interface, the problem of managing and migrating heterogeneous hardware resources in ubiquitous operating systems is solved, achieving efficient and flexible management and dynamic configuration of heterogeneous resources and optimizing the migration process.
Patent Information
- Application Number
- CN202410801929.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2025-12-23
AI Technical Summary
Existing ubiquitous operating systems lack effective resource abstraction methods and technologies, making it difficult to fully utilize heterogeneous hardware resources and migrate resources across system boundaries. The traditional Virtio interface fails to meet the dynamic management needs of ubiquitous computing scenarios.
A virtual hardware resource migration method based on the Virtio interface is adopted. By establishing a network connection between the source system and the target system, serializing the data plane and control plane information of the virtual device, and rebuilding the virtual device driver on the target system, the state recovery of the virtual device is achieved.
It enables flexible and dynamic management of heterogeneous hardware resources, improves resource utilization, supports on-demand resource flow and flexible expansion, and optimizes downtime and system redundancy during migration.
Smart Images

Figure CN121187698A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer virtualization, ubiquitous computing and device driving, in particular to a ubiquitous operating system virtual hardware resource migration method and system based on a Virtio interface, a terminal and a medium. BACKGROUND
[0002] Ubiquitous operating system (UOS) is a new type of operating system proposed for the "human-machine-merger" ubiquitous computing environment, including Internet of Things operating system, smart city operating system and industrial control operating system, etc. UOS retains the core elements of traditional operating systems, while generalizing and extending in the ubiquitous computing scenario. Ubiquitous computing scenarios cover a variety of processors, memories, and various performance and power-constrained sensors and actuators, etc., with high heterogeneity and fragmentation. How to manage these heterogeneous hardware resources is one of the challenges of current ubiquitous operating system research and development. On the one hand, there is still a lack of effective resource abstraction methods and technologies in the ubiquitous computing environment, which limits the full use of heterogeneous hardware resources. On the other hand, many devices in the ubiquitous environment are generally different from traditional computing environments in performance, power consumption and real-time performance, which puts forward new demands for resource abstraction technology and methods of ubiquitous operating system.
[0003] Virtualization technology is a technology that abstracts physical hardware resources into virtual form, which has the advantages of flexible sharing and management of resources, and improves the utilization of hardware. Heterogeneous resource virtualization is an extension of virtualization technology in the ubiquitous computing environment. The introduction of virtualization technology provides a possible solution for efficient resource abstraction and management in the ubiquitous computing scenario, and its resource abstraction and flexible expansion characteristics are also suitable for the needs of the ubiquitous computing scenario. Traditional device virtualization technology faces traditional operating systems and mainly abstracts and virtualizes the management of traditional hardware such as block devices, network devices and PCI buses. In the ubiquitous scenario, virtualization technology is applied to industrial internet, embedded devices and vehicle systems, etc., which need to face complex heterogeneous hardware resources. The diversity of ubiquitous scenarios and the heterogeneity of hardware resources make it difficult for traditional virtualization technology to establish a unified, generalized and flexible resource virtual abstraction method.
[0004] The Virtio interface is a set of virtual device driver implementation standards proposed to optimize the performance of traditional I / O virtualization. Virtio decouples the device driver into front-end and back-end, the front-end runs in the guest machine, and the back-end runs in the host machine, and the two interact through shared memory space, shared queue Virtqueue and other ways. Virtio has become one of the current mainstream device virtualization solutions. At present, the devices commonly used in ubiquitous scenarios almost all have Virtio interfaces (such as Virtio-GPU / Virtio-keyboard / Virtio-i2c / Virtio-SPI / Virtio-camera / Virtio-GPIO, etc.), and even file systems, memory systems and other high-level infrastructure also have Virtio interfaces (such as Virtio-fs / Virtio-mem, etc.), which have broad adaptability. The introduction of Virtio interface standard can make the implementation of ubiquitous operating system virtualization more unified and standardized. Even in a non-virtualized environment, the introduction of Virtio interface can provide a set of general standards for resource abstraction and management, reducing the development cost of ubiquitous hardware resource abstraction methods. However, if Virtio interface is directly applied to ubiquitous operating system, the following technical problems will be faced: Ubiquitous operating system usually runs in a distributed and heterogeneous environment, involving various different hardware and software systems, and the existing standard Virtio interface focuses on the resource virtualization abstraction of a single system, without focusing on device migration and other cross-border operations, which limits the ability range of ubiquitous computing applications and makes it difficult to provide dynamic resource management in ubiquitous scenarios.
[0005] Migration technology refers to the process of transferring data, applications, configurations, and user environments from one physical device to another in the field of computer science and information technology. This technology plays an important role in hardware upgrades, device replacements, disaster recovery, and migration in cloud computing environments. The goal of migration technology is to ensure data integrity, minimize downtime, and maintain user experience consistency. Virtual device migration, as part of system migration, migrates device-related configurations and data information to ensure consistent user environment operation. However, if migration technology is directly applied to ubiquitous operating systems, the following technical problems will be faced: The existing mainstream ubiquitous operating system focuses on the management of local heterogeneous hardware resources, without focusing on cross-system resource abstraction and management mechanisms, and there is no unified and standardized migration standard method and interface to achieve cross-system boundary migration of resources. SUMMARY
[0006] The present application aims at the above-mentioned deficiencies in the prior art, and provides a ubiquitous operating system virtual hardware resource migration method, system, terminal and medium, which realizes migration of a virtual device based on device virtualization abstraction of a Virtio interface standard in a ubiquitous scenario.
[0007] According to one aspect of the present application, a ubiquitous operating system virtual hardware resource migration method based on a Virtio interface is provided, comprising:
[0008] The source system and the target system for migration are determined, network-related configurations are respectively performed, and a corresponding sending and receiving process is started according to a set migration strategy, and the source system calls a network stack to establish a network connection with the target system;
[0009] The source system serializes and packs information of a data plane and a control plane of the virtual device to obtain virtual device information;
[0010] The target system calls a network stack interface on the source system to form a corresponding interface with the source system; the source system uses the network connection to send the virtual device information to the corresponding interface of the target system, and the target system receives corresponding data through the corresponding interface;
[0011] The target system creates and initializes a Virtio virtual device driver, and according to the received virtual device information, analyzes and reconstructs information of a data plane and a control plane, and restores the state of the virtual device;
[0012] The state of the reconstructed virtual device on the target system is consistent with that of the source system, and an upper-layer application ends the migration process by calling a migration interface, and restores normal operation of the device.
[0013] Preferably, the source system and the target system for migration are determined, network-related configurations are respectively performed, and a corresponding sending and receiving process is started according to a set migration strategy, and the source system calls a network stack to establish a network connection with the target system, comprising:
[0014] The network-related configuration of the target system is initialized, and a receiving process of virtual device migration on the target system is started according to a set migration strategy;
[0015] Migration meta-information of the target system is configured on the source system, the network-related configuration of the source system is initialized, and a sending process of virtual device migration is started according to a set migration strategy;
[0016] The source system calls a network stack to establish a network connection with the target system; if the device is currently in an idle state, the subsequent migration process is entered; if the device is currently performing an I / O operation, the subsequent I / O request is blocked after the current operation is ended, and the migration process is entered.
[0017] Preferably, the migration meta-information of the target system comprises: IP address, network port and other migration meta-information of the target system.
[0018] Preferably, the source system serializes and packs the data plane and control plane information of the virtual device to obtain virtual device information, comprising:
[0019] For a virtual device based on a Virtio interface, read-write data related to I / O operations is taken as the data plane information; wherein the read-write data related to I / O operations comprises: Virtio requests in a Virtqueue in shared memory between the front and back ends of a Virtio device; when the virtual device is migrated, the source system reads the unprocessed I / O requests in the Virtqueue and serializes and processes them;
[0020] For a virtual device based on a Virtio interface, corresponding configuration information is taken as the control plane information; wherein the configuration information comprises: configuration information of the Virtio device and configuration information of physical hardware; when the virtual device on the source system is running, a corresponding area in memory is maintained to record the control plane information; when the virtual device is migrated, the source system reads the recorded configuration information in the memory and serializes and processes them;
[0021] The serialized and processed data plane information and control plane information are packed to obtain virtual device information.
[0022] Preferably, the target system calls a network stack interface on the source system to form a corresponding interface with the source system; the source system uses a network connection to migrate and send the virtual device information to the corresponding interface of the target system, and the target system receives corresponding data through the corresponding interface, comprising:
[0023] The target system calls a network stack interface on the source system to form a corresponding interface with the source system;
[0024] The migration process is performed on the virtual device information, and the corresponding information is sent from the source system to the corresponding interface of the target system using a network connection;
[0025] The target system receives the virtual device information through the corresponding interface.
[0026] Preferably, the target system creates and initializes a Virtio virtual device driver, and according to the received virtual device information, analyzes and reconstructs the information of the data plane and the control plane to restore the state of the virtual device, comprising:
[0027] For the data plane information, a new memory area is allocated on the target system, a new Virtio request is created, and necessary pointer information is replaced to complete the reconstruction of the Virtqueue.
[0028] For the information of the control plane, including the configuration information of the Virtio device and the configuration information of the physical hardware; wherein, the target system directly operates the memory data structure of the Virtio device driver according to the received configuration information of the Virtio device, to configure the state of the Virtio virtual device; and the target system interacts with the underlying physical device of the target system according to the received configuration information of the physical hardware, to call the interface provided by the underlying physical device, to complete the configuration of the physical hardware.
[0029] Preferably, the necessary pointer information includes pointer information of a Virtqueue pointing to a Virtio request memory region.
[0030] Preferably, the state of the Virtio virtual device includes a virtual device name, a virtual device attribute and a virtual device interface.
[0031] Preferably, the set migration strategy includes any one or any multiple of the following:
[0032] a replay migration strategy, in which the source system Virtio device records an operation log of configuring the device state when normally running, to maintain a state abstraction of the physical hardware; and when migration is performed, the corresponding configuration operation is replayed on the target system according to the operation log of configuring the device state and the state abstraction of the physical hardware, to complete the state reconstruction of the virtual device and the physical device of the target system;
[0033] a shadow device migration strategy, in which the source system Virtio device maintains a mirrored Virtio virtual device as a shadow device of the source system on the target system when normally running; the shadow device does not need to perform actual I / O operation, but only needs to synchronously execute the configuration operation of the control plane of the Virtio device, to keep the state of the shadow device on the target system the same as that of the source system Virtio device;
[0034] an incremental migration strategy, in which, when migration is performed, the Virtio requests in the Virtqueue of the source system that have not been processed are not migrated, but are still processed by the Virtio device and the physical hardware of the source system; when the reconstruction of the Virtio virtual device of the target system is completed, the newly generated Virtio requests enter the new Virtqueue and are processed by the Virtio virtual device and the physical device of the target system; at the same time, the target system receives and processes the return results of the Virtio requests in the Virtqueue of the source system in a remote connection manner, until the Virtio requests in the Virtqueue of the source system are all processed.
[0035] According to another aspect of the present application, there is provided a ubiquitous operating system virtual hardware resource migration system, comprising: a first migration management module arranged on a source system and a second migration management module arranged on a target system; wherein:
[0036] The first migration management module is configured to:
[0037] perform network-related configuration on the source system, start a corresponding sending process according to a set migration strategy, and call a network stack to establish a network connection with the second migration management module;
[0038] serialize and package information of a data plane and a control plane of a virtual device to obtain virtual device information;
[0039] migrate and send the virtual device information to a corresponding interface of the target system by using the network connection;
[0040] The second migration management module is configured to:
[0041] perform network-related configuration on the target system, and start a corresponding receiving process;
[0042] call a network stack interface on the source system to form a corresponding interface with the source system, and receive the virtual device information through the corresponding interface;
[0043] create and initialize a Virtio virtual device driver, and parse and reconstruct information of a data plane and a control plane according to the received virtual device information to restore a state of the virtual device;
[0044] call a migration interface for an upper layer application to end the migration process and restore normal operation of the device.
[0045] According to a third aspect of the present application, there is provided a computer terminal comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the computer program, is configured to execute the method according to any one of the preceding embodiments of the present application, or run the system according to the preceding embodiments of the present application.
[0046] According to a fourth aspect of the present application, there is provided a computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, is configured to execute the method according to any one of the preceding embodiments of the present application, or run the system according to the preceding embodiments of the present application.
[0047] Thanks to the above technical solutions, the present application has at least one of the following beneficial effects compared with the prior art:
[0048] The application provides a ubiquitous operating system virtual hardware resource migration method, system, terminal and medium, based on Virtio standard technology, provides a flexible dynamic management mechanism for hardware resources in ubiquitous computing, and realizes heterogeneous resource capability abstraction, dynamic decoupling, on-demand flow and other characteristics.
[0049] The ubiquitous operating system virtual hardware resource migration method, system, terminal and medium provided by the application enable more efficient and flexible resource management of heterogeneous hardware in a ubiquitous scenario, improve resource utilization, and provide dynamic resource configuration and flexible expansion capabilities.
[0050] The ubiquitous operating system virtual hardware resource migration method, system, terminal and medium provided by the application realize different migration strategies through a dynamic management mechanism, and the virtual device migration management module can complete migration in different ways to meet the needs of different business scenarios.
[0051] The ubiquitous operating system virtual hardware resource migration method, system, terminal and medium provided by the application can balance migration downtime, system redundancy and maintenance complexity by adopting different Virtio virtual device migration strategies, and optimize migration effects for different business loads and application scenarios. BRIEF DESCRIPTION OF DRAWINGS
[0052] Other features, objects and advantages of the application will become more apparent through reading the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0053] Figure 1 The working flowchart of the ubiquitous operating system virtual hardware resource migration method in an embodiment of the application.
[0054] Figure 2 The component module schematic diagram of the ubiquitous operating system virtual hardware resource migration system in an embodiment of the application.
[0055] Figure 3 The working block diagram of the ubiquitous operating system virtual hardware resource migration method in a preferred embodiment of the application.
[0056] Figure 4 The working block diagram of the virtual device migration management module in a preferred embodiment of the application.
[0057] Figure 5 The migration strategy working block diagram of the dynamic management mechanism in a preferred embodiment of the application. DETAILED DESCRIPTION
[0058] The following will make a detailed description of the embodiments of the present application: the embodiments are implemented on the premise of the technical solutions of the present application, and give detailed implementation manners and specific operation processes. It should be pointed out that, for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the protection scope of the present application.
[0059] An embodiment of the present application provides a virtual hardware resource migration method of an ubiquitous operating system, which faces heterogeneous hardware resources in an ubiquitous scene, provides a flexible dynamic management mechanism for hardware resources in ubiquitous computing based on Virtio standard technology, realizes heterogeneous resource capability abstraction, dynamic decoupling, on-demand flow and other characteristics, so that the heterogeneous hardware in the ubiquitous scene can be more efficiently and flexibly managed, and the resource utilization rate is improved while providing the ability of dynamic resource configuration and flexible expansion.
[0060] Specifically, as shown in the figure, Figure 1 The virtual hardware resource migration method of the ubiquitous operating system provided by the embodiment can include the following operations:
[0061] S1, determine the source system and the target system of migration, respectively perform network-related configuration, and start the corresponding sending and receiving processes according to the set migration strategy, and the source system calls the network stack to establish a network connection with the target system;
[0062] S2, the source system serializes and packages the information of the data plane and the control plane of the virtual device to obtain virtual device information;
[0063] S3, the target system calls the network stack interface on the source system to form a corresponding interface with the source system; the source system uses the network connection to send the virtual device information to the corresponding interface of the target system, and the target system receives the corresponding data through the corresponding interface;
[0064] S4, the target system creates and initializes a Virtio virtual device driver, and according to the received virtual device information, analyzes and reconstructs the information of the data plane and the control plane, and restores the state of the virtual device;
[0065] S5, the state of the reconstructed virtual device on the target system is consistent with that of the source system, and the upper-layer application ends the migration process by calling the migration interface to restore the normal operation of the device.
[0066] In some preferred embodiments, the above S1, determining the source system and the target system of migration, respectively performing network-related configuration, and starting the corresponding sending and receiving processes according to the set migration strategy, and the source system calling the network stack to establish a network connection with the target system, can further include the following operations:
[0067] S11, initialize the network related configuration of the target system, and start the receiving process of the virtual device migration on the target system according to the set migration strategy;
[0068] S12, configure the migration meta information of the target system on the source system, initialize the network related configuration of the source system, and start the sending process of the virtual device migration according to the set migration strategy;
[0069] S13, the source system calls the network stack to establish a network connection with the target system; if the device is currently in an idle state, the subsequent migration process is entered; if the device is currently performing an I / O operation, the subsequent I / O request is blocked after the current operation is completed, and the migration process is entered.
[0070] In some preferred embodiments, the migration meta information of the target system in S12 includes the IP address of the target system, network port and other migration meta information.
[0071] In some preferred embodiments, the source system serializes and packages the data plane and control plane information of the virtual device in S2 to obtain the virtual device information, which can further include the following operations:
[0072] S21, for a virtual device based on a Virtio interface, the read and write data related to I / O operations are taken as the information of the data plane; wherein the read and write data related to I / O operations include Virtio requests in a Virtqueue in shared memory between the front and back ends of a Virtio device; when the virtual device is migrated, the source system reads the unprocessed I / O requests in the Virtqueue and performs serialization processing;
[0073] S22, for a virtual device based on a Virtio interface, the corresponding configuration information is taken as the information of the control plane; wherein the configuration information includes the configuration information of the Virtio device and the configuration information of the physical hardware; the virtual device on the source system maintains a corresponding area in the memory for recording the information of the control plane when running; when the virtual device is migrated, the source system reads the recorded configuration information in the memory and performs serialization processing;
[0074] S23, the serialized information of the data plane and the control plane is packaged to obtain the virtual device information.
[0075] In some preferred embodiments, the target system calls the network stack interface on the source system in S3 to form a corresponding interface with the source system; the source system uses the network connection to send the virtual device information to the corresponding interface of the target system, and the target system receives the corresponding data through the corresponding interface, which can further include the following operations:
[0076] S31, the target system calls the network stack interface on the source system, forming a corresponding interface with the source system;
[0077] S32, a migration process is performed on the virtual device information, and the corresponding information is sent from the source system to the corresponding interface of the target system by using the network connection;
[0078] S33, the target system receives the virtual device information through the corresponding interface.
[0079] In some preferred embodiments, S4 above, the target system creates and initializes the Virtio virtual device driver, and according to the received virtual device information, parses and reconstructs the information of the data plane and the control plane of the virtual device, restores the state of the virtual device, and can further include the following operations:
[0080] S41, for the information of the data plane, a new memory area is allocated on the target system, a new Virtio request is created, and necessary pointer information is replaced to complete the reconstruction of the Virtqueue;
[0081] S42, for the information of the control plane, including the configuration information of the Virtio device and the configuration information of the physical hardware; wherein, the target system directly operates the memory data structure of the Virtio device driver according to the received configuration information of the Virtio device, configures the state of the Virtio virtual device; the target system interacts with the underlying physical device of the target system according to the received configuration information of the physical hardware, calls the interface provided by the underlying physical device, and completes the physical hardware configuration.
[0082] In some preferred embodiments, S41 above, the necessary pointer information includes: pointer information of Virtqueue pointing to the Virtio request memory area.
[0083] In some preferred embodiments, S42 above, configuring the state of the Virtio virtual device includes: virtual device name, virtual device attribute and virtual device interface.
[0084] In some preferred embodiments, S3 above, the set migration strategy can further include any one or any multiple of the following operations:
[0085] - configure the playback migration strategy, in which the source system records the operation log of configuring the device state when the Virtio device is normally running, and maintains the state abstraction of the physical hardware; when migrating, the corresponding configuration operation is played back on the target system according to the operation log of configuring the device state and the state abstraction of the physical hardware, and the state reconstruction of the virtual device and the physical device of the target system is completed.
[0086] -Shadow device migration strategy, in which, when the source system Virtio device is running normally, a mirrored Virtio virtual device is maintained on the target system as a shadow device of the source system; the shadow device does not need to perform actual I / O operation, but only needs to synchronously perform the configuration operation of the Virtio device control plane, so as to keep the shadow device state on the target system same as the Virtio device of the source system; when migration is performed, a large amount of control plane state migration is not needed, and the downtime of migration is shortened.
[0087] - Incremental migration strategy: in this strategy, when migration is performed, the Virtio requests in the Virtqueue of the source system that have not been processed are not migrated, but are still processed by the Virtio device and the physical hardware of the source system; when the Virtio virtual device of the target system is rebuilt, the newly generated Virtio requests enter the new Virtqueue and are processed by the Virtio virtual device and the physical device of the target system; at the same time, the target system receives and processes the return results of the Virtio requests in the Virtqueue of the source system in a remote connection manner until the Virtio requests in the Virtqueue of the source system are all processed; this strategy does not need to perform data plane content migration, and the downtime of migration is shortened.
[0088] Another embodiment of the present application provides a ubiquitous operating system virtual hardware resource migration system.
[0089] Specifically, as shown in the figure, Figure 2 the ubiquitous operating system virtual hardware resource migration system provided by this embodiment can include: a first migration management module arranged on a source system and a second migration management module arranged on a target system; wherein:
[0090] The first migration management module is configured to:
[0091] - perform network-related configuration on the source system, start a corresponding sending process according to a set migration strategy, and call a network stack to establish a network connection with the second migration management module;
[0092] - serialize and package the information of the data plane and the control plane of the virtual device to obtain virtual device information;
[0093] - migrate and send the virtual device information to a corresponding interface of the target system by using the network connection;
[0094] The second migration management module is configured to:
[0095] - perform network-related configuration on the target system, and start a corresponding receiving process;
[0096] - calling a network stack interface on the source system, forming a corresponding interface with the source system, and receiving virtual device information through the corresponding interface;
[0097] - creating and initializing a Virtio virtual device driver, and parsing and reconstructing information of a data plane and a control plane of the virtual device driver according to the received virtual device information, to restore a state of the virtual device;
[0098] - ending the migration process and restoring normal operation of the device by calling a migration interface for an upper layer application.
[0099] In some preferred embodiments, the first migration management module can further include the following modules:
[0100] a network module, configured to perform network-related configuration on the source system, and start a corresponding sending process according to a set migration strategy, to establish a network connection between the network stack and the second migration management module;
[0101] a serialization module, configured to perform serialization processing on information of a data plane and a control plane of the virtual device;
[0102] a device packaging module, configured to perform packaging processing on the serialized data, and send the data to the second migration management module.
[0103] In some preferred embodiments, the second migration management module can further include the following modules:
[0104] a network module, configured to perform network-related configuration on the target system, and start a corresponding receiving process according to a set migration strategy, to form a corresponding interface with the source system by calling a network stack interface on the source system;
[0105] a serialization module, configured to perform deserialization processing on the received virtual device information;
[0106] a device reconstruction module, configured to reconstruct the virtual device according to the deserialized data.
[0107] It should be noted that the steps in the method provided by the present application can be implemented by corresponding modules, devices, units, etc. in the system, and those skilled in the art can refer to the technical solutions of the method to realize the composition of the system, that is, the embodiments in the method can be understood as preferred examples of constructing the system, which will not be described here.
[0108] Another embodiment of the present application provides a computer terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, can be used to execute the method of any one of the above embodiments of the present application, or run the system of any one of the above embodiments of the present application.
[0109] Optionally, a memory for storing programs; the memory can include volatile memory (e.g., random-access memory (RAM), such as static random-access memory (SRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), etc.), and can also include non-volatile memory (e.g., flash memory). The memory is used to store computer programs (e.g., application programs, functional modules, etc. for implementing the above method), computer instructions, etc. The above computer programs, computer instructions, etc. can be stored in one or more memories in partitions. And the above computer programs, computer instructions, data, etc. can be called by the processor.
[0110] The above computer programs, computer instructions, etc. can be stored in one or more memories in partitions. And the above computer programs, computer instructions, data, etc. can be called by the processor.
[0111] The processor is used to execute the computer program stored in the memory to realize each step in the method or each module of the system. For details, please refer to the related description in the above method and system embodiments.
[0112] The processor and the memory can be an independent structure or an integrated structure. When the processor and the memory are independent structures, the memory and the processor can be coupled and connected through a bus.
[0113] Another embodiment of the application provides a computer readable storage medium having a computer program stored thereon, which, when executed by a processor, can be used to execute the method of any one of the above embodiments of the application, or run the system of any one of the above embodiments of the application.
[0114] The above technical solutions provided by the embodiments of the application will be described in further detail below in combination with a preferred embodiment and the accompanying drawings.
[0115] The technical solutions provided in the preferred embodiment mainly include the following three aspects:
[0116] I. A ubiquitous operating system virtual hardware resource migration method based on a Virtio interface;
[0117] II. A system for virtual hardware resource migration of a ubiquitous operating system based on a Virtio interface;
[0118] III. A virtual device migration strategy based on Virtio.
[0119] The specific description is as follows.
[0120] I. A method for virtual hardware resource migration of a ubiquitous operating system based on a Virtio interface, as shown in FIG. 1, which is a working block diagram of the method. In the method, the following steps are mainly included: Figure 3
[0121] 1. Preparation stage, including:
[0122] 1.1, Target system: the user or application determines the target system for migration, and starts the receiving process of virtual device migration on the target system according to the set migration strategy. The migration module of the target system initializes the network related configuration, creates a network interface, calls the network stack to enter the network port listening state, and waits for the migration source system to establish a migration connection.
[0123] 1.2, Source system: the user or application configures the IP address, network port and other migration meta information of the target system on the source system for migration, and starts the sending process of virtual device migration. The migration module of the source system initializes the network related configuration according to the user's configuration
[0124] 1.3, The source system calls the network stack to establish a network connection with the target system. If the device is currently in an idle state, it will enter the subsequent migration process; if the device is currently performing an I / O operation, it will block subsequent I / O requests after the current operation ends and enter the migration process.
[0125] 2. Device packaging: the migration source system integrates, collects and packages the information of the data plane and the control plane of the virtual device for migration.
[0126] 2.1, Data plane: for a virtual device based on a Virtio interface, the data plane refers to the read and write data related to I / O operations, i.e., Virtio requests in the Virtqueue in the shared memory between the front and back ends of Virtio. When the virtual device is migrated, the virtual device migration module reads the unprocessed I / O requests in the Virtqueue and performs serialization operation to facilitate network transmission.
[0127] 2.2, Control plane: For the Virtio interface-based virtual device, the control plane includes two parts: Virtio device configuration information, physical hardware configuration information. When the virtual device on the source system runs, it will maintain the corresponding area in the memory to record the configuration information of the control plane. When the virtual device migrates, the migration module will read the configuration information recorded in the memory, and perform serialization operation to facilitate network transmission.
[0128] 3, Data migration: The migration module migrates and sends the data packaged after serialization processing by calling the network stack interface on the source system, and sends it to the corresponding interface of the target system using network connection. The migration module of the target system receives data through the network stack.
[0129] 4, Device reconstruction: The migration module creates and initializes the Virtio virtual device driver on the target system, and according to the received virtual device information, parses and reconstructs the state of the data plane and the control plane, and restores the state of the virtual device.
[0130] 4.1, Data plane: For the device information of the data plane, it mainly refers to the Virtqueue in the shared memory between the Virtio front and back ends and the Virtio request therein. The migration module allocates a new memory area according to the received data plane information, creates a new Virtio request, and replaces the necessary pointer information to complete the reconstruction of the Virtqueue.
[0131] 4.2, Control plane: For the device information of the control plane, it mainly refers to the Virtio device configuration information and the physical hardware configuration information. Virtio device configuration information only exists in memory, and the migration module directly operates the memory data structure of the Virtio device driver according to the received control plane information to configure the state of the Virtio virtual device, including device name, device attribute, device interface, etc. The physical hardware configuration information needs to interact with the underlying physical hardware of the target system, and the migration module will call the interface provided by the physical device according to the received configuration information to complete the physical hardware configuration.
[0132] 5, Recovery execution: After the virtual device is reconstructed on the target system, its memory state and hardware state are consistent with those of the source system, and the user or upper application can end the migration process by calling the migration interface to restore the normal operation of the device.
[0133] Through the above method, the migration of the Virtio virtual device is completed, the dynamic and on-demand deployment of the virtual device on different physical terminals is realized, and the resource utilization in the ubiquitous computing scenario is more efficient and flexible.
[0134] II. Virtio interface-based ubiquitous operating system virtual hardware resource migration system, such as Figure 4The system is shown in the composition and working block diagram. In the system, the following modules are mainly included:
[0135] 1. Migration management module (referred to as migration module) is located in the device driver layer, and is arranged on the source system and the target system respectively, and is mainly responsible for providing a series of interfaces for the application layer for device migration, and executing related processes of device migration.
[0136] 2. The migration module mainly includes a network module, a serialization module, a device packaging module and a device reconstruction module; wherein:
[0137] 2.1, network module: interacting with the network device driver of the operating system, establishing the network connection between the source system and the target system, recording the network socket, IP address, port, communication protocol, communication configuration and the like. For the source system, the network module is responsible for calling the sending port to send the serialized and packaged device data to the target system; for the target system, the network module is responsible for listening to the specified port, receiving the network packet and calling the corresponding processing function to execute the device reconstruction process.
[0138] 2.2, serialization module: since the information of Virtio virtual device includes various structures and pointers, related serialization library functions need to be called to serialize the data and configuration of Virtio virtual device for network transmission. The serialization module will newly create a memory area, and perform serialization and reorganization operations according to the structure of the input data, to convert the memory data structure into a byte stream. At the same time, in the target system, the serialization module is also responsible for completing the deserialization operation of the byte stream, converting a memory area into the data structure of Virtio virtual device, including: deserializing the control plane information of Virtio virtual device, including the configuration information of Virtio virtual device and the configuration information of the physical device of the source system; deserializing the data plane information of Virtio virtual device, that is, the Virtio request to be processed in Virtqueue, including its corresponding I / O load.
[0139] 2.3, device packaging module: serializing and sending the related contents of Virtio virtual device, including:
[0140] serializing and processing the data plane information of Virtio virtual device, that is, the Virtio request to be processed in Virtqueue, including its corresponding I / O load;
[0141] serializing and processing the control plane information of Virtio virtual device, including the configuration information of Virtio virtual device and the configuration information of the physical device of the source system.
[0142] calling the network module to send the serialized and packaged contents.
[0143] 2.4, device reconstruction module: receive the deserialization of the relevant data of the Virtio virtual device and perform device reconstruction.
[0144] Call the network module, receive the serialized packaged data, and perform deserialization processing through the serialization module.
[0145] Synchronize the control plane information of the deserialized Virtio virtual device to the Virtio virtual device and physical device of the target system;
[0146] Reconstruct the corresponding Virtio request in the data plane information of the Virtio virtual device and fill it into the Virtqueue.
[0147] The corresponding module design of the Virtio interface-based ubiquitous operating system virtual hardware resource migration system modularizes and decouples the migration function module of the Virtio virtual device, and undertakes the whole migration process, creating conditions for flexible management and dynamic deployment of resources.
[0148] III. Virtio-based virtual device migration strategy, as shown in Figure 5 , including the following contents:
[0149] Based on the migration of Virtio virtual devices, multiple migration strategies can be adopted to adjust different links in the migration process and adapt to different scenarios and business needs; Migration strategies include but are not limited to: configuration playback migration strategy, shadow device migration strategy, incremental migration strategy; Among them:
[0150] 1. Configuration playback migration strategy: can be used as the default Virtio virtual device migration strategy. The source system Virtio virtual device will record the operation log of configuring the device state when running normally, and maintain the state abstraction of the physical device. When migrating, the corresponding configuration operation needs to be played back on the target system according to the configuration operation log and device state abstraction, and the state reconstruction of the target system virtual device and physical device is completed.
[0151] 2. Shadow device migration strategy: when the source system Virtio virtual device is running normally, a mirrored Virtio virtual device is maintained on the target system as a shadow device of the source system. The shadow device does not need to perform actual I / O operations, but only needs to synchronize the configuration operation of the Virtio virtual device control plane to keep the device state the same as the source system device. When migrating, there is no need to migrate a large amount of control plane state, which shortens the downtime of migration.
[0152] 3. Incremental migration strategy: when migrating, the Virtqueue of the source system that has not been processed Virtio request does not migrate, and is still processed by the virtual device and physical device of the source system. When the Virtio virtual device of the target system is rebuilt, the newly generated Virtio request enters the new Virtqueue, which is processed by the virtual device and physical device of the target system. At the same time, the target system receives and processes the return results of the Virtqueue Virtio request of the source system in a remote connection mode until all Virtio requests in the source system Virtqueue are processed. This strategy does not need to migrate the data plane content, which shortens the downtime of migration.
[0153] By adopting different Virtio virtual device migration strategies, the migration downtime, system redundancy and maintenance complexity can be balanced, and the migration effect can be optimized for different business loads and application scenarios.
[0154] The technical solutions provided by the above embodiments of the application will be further described in detail below with reference to a specific application example.
[0155] The virtual hardware resource migration technology used in the specific application example is implemented for the XiUOS industrial internet of things operating system to achieve the migration of the virtual device of the ubiquitous hardware. The underlying physical hardware used by the system is two 64-bit RISC-V architecture embedded development boards, which have built-in MCU of K210 type, support I2C, CAN, UART, GPIO and other bus protocols / peripherals. Both terminals are loaded with W5500 Ethernet modules, and the terminals are connected by wire through Ethernet. The operating system used by the terminal is the XiUOS silicon crystal operating system, which provides basic functions of the operating system for ubiquitous scenarios, and has device drivers of part of hardware resources and virtual device drivers based on Virtio interface. At the same time, the system also provides a network protocol stack based on Lwip. In addition, the specific application example also uses some necessary physical peripherals.
[0156] On the above system, the specific application example adopts the ubiquitous operating system virtual hardware resource migration method based on its Virtio virtual device driver, including establishing network connection between terminal A and terminal B through Lwip network protocol stack, packaging the control plane and data plane of Virtio virtual device on terminal A, migrating data based on Ethernet network, and rebuilding the control plane and data plane of Virtio virtual device on terminal B, as shown in Figure 3 In order to complete the above functions, the application also provides a modular component, i.e. the ubiquitous operating system virtual hardware resource migration system, as shown in Figure 4As shown, the inside is composed of a plurality of sub-modules, including a serialization module, a network module, a device packaging module and a device reconstruction module. The migration module cooperates with the application layer and the device driver layer to complete the migration process. Through the modular design, the function and strategy of virtual device migration can be decoupled, and each module can interact according to different strategies to meet the needs of different migration scenarios. Therefore, the specific application example sets the virtual device migration strategy, that is, the configuration playback migration strategy, the shadow device migration strategy and the incremental migration strategy, such as Figure 5 It should be noted that the strategy of device migration is not limited to the above method, and different strategies can be realized based on the virtual device migration management module of the present application according to actual needs. Through the above content, a corresponding ubiquitous operating system virtual hardware resource migration technology is realized.
[0157] The ubiquitous operating system virtual hardware resource migration method, system, terminal and medium provided by the above embodiments of the present application complete the Virtio virtual device migration from the source system to the target system through the steps of establishing network connection, device packaging, data migration and device reconstruction based on the Virtio interface. By using the virtual device migration strategy, the virtual device migration management module can complete the migration in different ways through different execution processes to meet the needs of different business scenarios.
[0158] The above embodiments of the present application are described. It should be understood that the present application is not limited to the above specific embodiments, and those skilled in the art can make various modifications or changes within the scope of the claims, which does not affect the essential content of the present application.
[0159] The above describes specific embodiments of the present application. It should be understood that the present application is not limited to the above specific embodiments, and those skilled in the art can make various modifications or changes within the scope of the claims, which does not affect the essential content of the present application.
Claims
1. A method for migrating virtual hardware resources in a ubiquitous operating system, characterized in that, The method comprises the following steps: determining a source system and a target system for migration, respectively configuring network-related configurations, and starting corresponding sending and receiving processes according to a set migration strategy, and the source system calling a network stack to establish a network connection with the target system; the source system serializes and packs information of a data plane and a control plane of a virtual device to obtain virtual device information; the target system calls a network stack interface on the source system to form a corresponding interface with the source system; the source system uses the network connection to send the virtual device information to the corresponding interface of the target system, and the target system receives corresponding data through the corresponding interface; the target system creates and initializes a Virtio virtual device driver, and analyzes and reconstructs information of a data plane and a control plane according to the received virtual device information to restore the state of the virtual device; the state of the reconstructed virtual device on the target system is consistent with that of the source system, and an upper-layer application ends the migration process by calling a migration interface to restore normal operation of the device.
2. The virtual hardware resource migration method of ubiquitous operating system according to claim 1, wherein, The method of determining a source system and a target system for migration, respectively configuring network-related configurations, and starting corresponding sending and receiving processes according to a set migration strategy, and the source system calling a network stack to establish a network connection with the target system comprises the following steps: initializing network-related configurations of the target system, and starting a receiving process of virtual device migration on the target system according to a set migration strategy; configuring migration meta-information of the target system on the source system, initializing network-related configurations of the source system, and starting a sending process of virtual device migration according to a set migration strategy; the source system calls a network stack to establish a network connection with the target system; if the device is currently in an idle state, the subsequent migration process is entered; if the device is currently performing an I / O operation, the subsequent I / O request is blocked after the current operation ends, and the migration process is entered.
3. The virtual hardware resource migration method for pervasive operating system according to claim 1, wherein, The method of the source system serializing and packing information of a data plane and a control plane of a virtual device to obtain virtual device information comprises the following steps: for a virtual device based on a Virtio interface, I / O operation-related read / write data is taken as information of the data plane; wherein the I / O operation-related read / write data comprises Virtio requests in a Virtqueue in shared memory between front and back ends of a Virtio device; during virtual device migration, the source system reads unprocessed I / O requests in the Virtqueue and serializes the unprocessed I / O requests; for a virtual device based on a Virtio interface, corresponding configuration information is taken as information of the control plane; wherein the configuration information comprises configuration information of the Virtio device and configuration information of physical hardware; during runtime of the virtual device on the source system, a corresponding area in memory is maintained to record the information of the control plane; during virtual device migration, the source system reads the recorded configuration information in the memory and serializes the configuration information; the serialized information of the data plane and the information of the control plane are packed to obtain the virtual device information.
4. The virtual hardware resource migration method of ubiquitous operating system according to claim 1, wherein, The target system calls a network stack interface on the source system to form a corresponding interface with the source system. The source system utilizes a network connection to send the virtual device information to a corresponding interface of the target system, and the target system receives corresponding data through the corresponding interface, including: The target system calls a network stack interface on the source system to form a corresponding interface with the source system; The migration process is performed on the virtual device information, and the corresponding information is sent from the source system to the corresponding interface of the target system using a network connection; The target system receives the virtual device information through the corresponding interface.
5. The virtual hardware resource migration method of ubiquitous operating system according to claim 1, wherein, The target system creates and initializes a Virtio virtual device driver, and according to the received virtual device information, parses and reconstructs the information of the data plane and the control plane, and restores the state of the virtual device, including: For the information of the data plane, a new memory area is allocated on the target system, a new Virtio request is created, and necessary pointer information is replaced to complete the reconstruction of the Virtqueue; For the information of the control plane, including the configuration information of the Virtio device and the configuration information of the physical hardware; wherein, the target system directly operates the memory data structure of the Virtio device driver according to the received configuration information of the Virtio device, and configures the state of the Virtio virtual device; the target system interacts with the underlying physical device of the target system according to the received configuration information of the physical hardware, calls the interface provided by the underlying physical device, and completes the physical hardware configuration.
6. The virtual hardware resource migration method of ubiquitous operating system according to claim 5, wherein, The necessary pointer information includes: pointer information of the Virtqueue pointing to the Virtio request memory area; The configuration of the state of the Virtio virtual device includes: virtual device name, virtual device attribute and virtual device interface.
7. The pervasive operating system virtual hardware resource migration method according to any of claims 1-6, wherein, The set migration strategy includes any one or any multiple of the following: - Configuration replay migration strategy, in which the source system Virtio device records the operation log of configuring the device state when it is normally running, and maintains the state abstraction of the physical hardware; when migrating, the corresponding configuration operation is replayed on the target system according to the operation log of configuring the device state and the state abstraction of the physical hardware, to complete the state reconstruction of the virtual device and the physical device of the target system; - Shadow device migration strategy, in which the source system Virtio device normally runs, and a mirrored Virtio virtual device is maintained on the target system as a shadow device of the source system; the shadow device does not need to perform actual I / O operation, but only needs to synchronize the configuration operation of the Virtio device control plane to keep the state of the shadow device on the target system the same as that of the source system Virtio device. - Incremental migration strategy: in this strategy, when migration is performed, the Virtqueue of the source system that has not been processed Virtio request does not migrate, and is still processed by the Virtio device and physical hardware of the source system; when the target system Virtio virtual device is rebuilt, the newly generated Virtio request enters the new Virtqueue, which is processed by the target system Virtio virtual device and physical device; at the same time, the target system receives and processes the return results of the Virtqueue Virtio request of the source system in a remote connection mode until the Virtqueue Virtio request of the source system is processed.
8. A pervasive operating system virtual hardware resource migration system, comprising: Comprise: The first migration management module arranged on the source system and the second migration management module arranged on the target system; wherein: The first migration management module is used for: - performing network-related configuration on the source system, starting the corresponding sending process according to the set migration strategy, and calling the network stack to establish network connection with the second migration management module; - performing serialization processing and packaging on the data plane and the control plane information of the virtual device to obtain virtual device information; - migrating and sending the virtual device information to the corresponding interface of the target system by using the network connection; The second migration management module is used for: - performing network-related configuration on the target system to start the corresponding receiving process; - calling the network stack interface on the source system to form the corresponding interface with the source system, and receiving the virtual device information through the corresponding interface; - creating and initializing the Virtio virtual device driver, and analyzing and rebuilding the data plane and the control plane information according to the received virtual device information to restore the state of the virtual device; - calling the migration interface for the upper layer application to end the migration process and restore the normal operation of the device.
9. A computer terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program and can be used to execute the method of any one of claims 1-7, or run the system of claim 8.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor and can be used to execute the method of any one of claims 1-7, or run the system of claim 8.