Device migration method, device migration device, electronic device, and storage medium

The device migration method enhances virtual machine resource allocation by prioritizing and migrating physical device use among virtual machines, addressing inefficiencies in existing resource allocation methods.

JP2026102933APending Publication Date: 2026-06-23XG TECHNOLOGIES PTE LTD

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
XG TECHNOLOGIES PTE LTD
Filing Date
2026-03-31
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing virtual machine resource allocation methods result in low utilization rates and efficiency due to exclusive or limited access to physical devices, leading to inefficiencies in computing tasks.

Method used

A device migration method that dynamically adjusts resource allocation by comparing priorities between virtual machines, allowing exclusive use or shared use of physical devices based on priority, enabling migration between virtual machines.

Benefits of technology

Improves resource utilization and operational efficiency of virtual machines by ensuring they can acquire necessary resources as needed, either exclusively or shared among multiple machines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2026102933000001_ABST
    Figure 2026102933000001_ABST
Patent Text Reader

Abstract

This disclosure relates to a device migration method, a device migration device, an electronic device, and a storage medium. [Solution] This method involves the first virtual machine transmitting a request message to the second virtual machine requesting the use of a target device. If the second virtual machine is pass-through connected to the target device, the method compares the first priority for the first virtual machine to use the target device with the second priority for the second virtual machine to use the target device. In response to the first priority being higher than the second priority, the first pass-through binding between the second virtual machine and the target device is released, and a migration message is sent to the first virtual machine instructing it to establish a second pass-through binding between the first virtual machine and the target device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and particularly to a device migration method, a device migration apparatus, an electronic device, and a storage medium.

Background Art

[0002] Currently, a virtual machine can access a physical device through a device passthrough or virtualization technology (for example, full virtualization technology that simulates a device with a Hypervisor, or para-virtualization technology such as Virtio) to obtain resources of the physical device. When accessing a physical device in the device passthrough mode, one physical device can only be used by one virtual machine, and multiple virtual machines cannot share the resources of one physical device, resulting in low resource utilization rate of the physical device. When accessing a physical device with virtualization technology, multiple virtual machines can share the resources of one physical device, but since the resources of the physical device are competed or divided among multiple virtual machines, the resources available to each virtual machine are limited.

Summary of the Invention

Problems to be Solved by the Invention

[0003] In order to solve the above technical problems, the present disclosure provides a device migration method, a device migration apparatus, an electronic device, and a storage medium, which can dynamically adjust the resources of a physical device when a virtual machine uses the physical device, so that not only a single virtual machine can exclusively use the physical device, but also the physical device can be migrated among multiple virtual machines for shared use by multiple virtual machines, thereby improving the resource utilization rate of the physical device and enabling the virtual machine to obtain more resources as needed, and significantly improving the working efficiency of the virtual machine.

Means for Solving the Problems

[0004] A device migration method according to a first aspect of the present disclosure includes the steps of: transmitting a request message from a first virtual machine to a second virtual machine requesting the use of a target device; comparing a first priority for the first virtual machine to use the target device with a second priority for the second virtual machine to use the target device, if the second virtual machine is pass-through connected to the target device; releasing a first pass-through binding between the second virtual machine and the target device in response to the first priority being higher than the second priority; and sending a migration message to the first virtual machine instructing it to perform a second pass-through binding between the first virtual machine and the target device.

[0005] A device migration device according to a second aspect of the present disclosure includes: a transmission module for transmitting a request message from a first virtual machine to a second virtual machine requesting the use of a target device; a comparison module for comparing a first priority for the first virtual machine to use the target device with a second priority for the second virtual machine to use the target device, if the second virtual machine is pass-through connected to the target device; a pass-through release module for releasing a first pass-through binding between the second virtual machine and the target device in response that the first priority is higher than the second priority; and a transmission module for sending a migration message to the first virtual machine instructing it to perform a second pass-through binding between the first virtual machine and the target device.

[0006] A computer-readable storage medium according to a third aspect of the present disclosure, when executed by a processor, causes the processor to execute a device migration method according to a first aspect of the present disclosure.

[0007] An electronic device according to a fourth aspect of this disclosure includes a processor and a memory for storing instructions that the processor can execute, and the device migration method according to a first aspect of this disclosure is realized by the processor reading and executing an executable instruction from the memory.

[0008] In the fifth aspect of the present disclosure, when an instruction in the computer program product is executed by a processor, the processor causes the processor to execute the device migration method according to the first aspect of the present disclosure. [Effects of the Invention]

[0009] According to the technical configuration of the embodiment of this disclosure, the first virtual machine transmits a request message to the second virtual machine requesting the use of a target device. If the second virtual machine is pass-through connected to the target device, the first priority for the first virtual machine to use the target device is compared with the second priority for the second virtual machine to use the target device. In response to the first priority being higher than the second priority, the first pass-through binding between the second virtual machine and the target device is released, and a migration message is sent to the first virtual machine instructing it to establish a second pass-through binding between the first virtual machine and the target device. As can be seen from the above, the embodiment of this disclosure can control the migration of a physical device between multiple virtual machines based on the priority of different virtual machines using the physical device, and when a physical device is migrated to a virtual machine, it can be used exclusively by that virtual machine. In this case, the physical device can be used exclusively by a single virtual machine, or it can be migrated between multiple virtual machines and shared by multiple virtual machines, improving the resource utilization of the physical device, allowing virtual machines to acquire more resources as needed, and significantly improving the work efficiency of the virtual machines. [Brief explanation of the drawing]

[0010] [Figure 1] This is a system diagram to which this disclosure applies. [Figure 2] This is a schematic flowchart of a device migration method according to an exemplary embodiment of the present disclosure. [Figure 3] This is a schematic flowchart of a device migration method according to another exemplary embodiment of the present disclosure. [Figure 4] This is a schematic diagram of the data interaction process in a device migration method according to an exemplary embodiment of the present disclosure. [Figure 5] This is a schematic diagram of the data interaction process in a device migration method according to another exemplary embodiment of the present disclosure. [Figure 6] This is a schematic diagram of the data interaction process in a device migration method according to yet another exemplary embodiment of the present disclosure. [Figure 7] This is a schematic diagram of the structure of a device transfer device according to an exemplary embodiment of the present disclosure. [Figure 8] This is a schematic diagram of the structure of a device transfer device according to another exemplary embodiment of the present disclosure. [Figure 9] This is a structural diagram of an electronic device relating to an exemplary embodiment of the present disclosure. [Modes for carrying out the invention]

[0011] Hereinafter, exemplary embodiments of the Disclosure will be described in detail with reference to the drawings in order to interpret the Disclosure, and the embodiments described are only a selection of embodiments of the Disclosure, not all embodiments, and the Disclosure is not limited to the exemplary embodiments.

[0012] Unless otherwise stated, the scope of this disclosure is not limited to the relative arrangements, numerical expressions, and numerical values ​​of the components and steps described in these embodiments.

[0013] [Summary of the application] Virtual machines need to obtain resources from physical devices to perform computing tasks while working. Generally, the more resources a virtual machine obtains from physical devices, the stronger its computing power and the more efficient it is. The demand for physical device resources during a virtual machine's operation changes dynamically. If the demand for physical device resources increases, the virtual machine may need to support the execution of computing tasks with resources from multiple physical devices. Conversely, if the demand for physical device resources decreases, the virtual machine may be able to efficiently complete computing tasks with resources from only one physical device.

[0014] In related technologies, there are two ways in which a virtual machine can acquire resources from a physical device. The first method is device passthrough, and the second method is virtualization technology. When a virtual machine acquires resources from a physical device using the first method, in order to meet the demand for supporting the execution of the virtual machine's computing tasks with the resources of multiple physical devices, the virtual machine must monopolize multiple physical devices using the device passthrough method. In this case, other virtual machines cannot use any of these multiple physical devices. If the virtual machine's demand for resources from a physical device decreases, the virtual machine only needs to use the resources of one of the multiple physical devices. However, in this case, the resources of the other physical devices cannot be used by other virtual machines, and the resource utilization rate of the physical devices decreases. When a virtual machine acquires resources from a physical device using the second method, the resources of one physical device are shared among multiple virtual machines. As a result, the virtual machine cannot meet the demand for supporting the execution of its computing tasks with the resources of multiple physical devices. The resources acquired by the virtual machine from the physical device become insufficient to support the execution of the computing tasks, and the efficiency of the virtual machine decreases. In this case, the execution time of the virtual machine's computing tasks increases, and in severe cases, it may cause the computing tasks to fail or terminate.

[0015] As can be seen from the above, in related technologies, there are only two ways for a virtual machine to acquire resources from a physical device, and a virtual machine can only choose one of these two methods during operation. This leads to problems such as low utilization of physical device resources or low work efficiency of the virtual machine during the virtual machine's operation. If a virtual machine could exclusively use a physical device during operation, and if the physical device could be shared by multiple virtual machines without dividing its resources, the above problems could be effectively solved. To address this issue, the embodiments of this disclosure provide a device migration method, a device migration device, an electronic device, and a storage medium that enable a virtual machine to exclusively use a physical device during operation, and to share the physical device with multiple virtual machines without dividing its resources, thereby effectively improving the utilization of physical device resources and the work efficiency of the virtual machine during the virtual machine's operation.

[0016] [Example System] Figure 1 is a system diagram to which this disclosure applies. As shown in Figure 1, the working system 100 includes a plurality of virtual machines 101, a virtualization platform 102, and a physical device 103.

[0017] An operating system (for example, operating system 1, operating system 2, ..., operating system n (where n is a natural number greater than or equal to 2) in Figure 1) can be executed on the virtual machine 101, and such operating system can be an embedded system (for example, an intelligent vehicle electronic control system or an industrial automation control system, etc.).

[0018] Exemplarily, the intelligent vehicle electronic control system can be, for example, an intelligent cockpit system, an automatic driving system, or an in-vehicle cockpit-driving integrated system that integrates the intelligent cockpit function and the automatic driving function into one high-performance computing unit. The industrial automation control system can be, for example, an industrial robot control system, or a production line automation control system, etc.

[0019] The operating systems executed on different virtual machines 101 may be the same or different. For example, among the operating system 1, operating system 2, ···, operating system n (n is a natural number greater than or equal to 2) in FIG. 1, any two operating systems may be the same operating system or different operating systems.

[0020] In the virtualization platform 102, virtualization software (for example, Hypervisor, not shown in FIG. 1) is executed. The virtualization software includes a pass-through module 1021. The virtual machine 101 is pass-through connected to the physical device 103 through the pass-through module 1021, and can directly obtain resources from the physical device 103. A plurality of virtual machines 101 are created by the virtualization platform 102 and managed by the virtualization platform 102.

[0021] The physical device 103 can be a device that can be passthrough connected to the virtual machine 101, such as a graphics card, a network interface card (NIC), a storage device (e.g., a hard disk drive (HDD), a solid state drive (SSD)), a Universal Serial Bus (USB) controller (e.g., a printer, a scanner), an input / output (I / O) device, or an audio device.

[0022] Note that Figure 1 shows only one physical device 103 as an example. In the embodiments of this disclosure, there may be multiple physical devices 103.

[0023] [Example Method] Figure 2 is a schematic flowchart of a device migration method according to an exemplary embodiment of the present disclosure. This embodiment can be applied to a terminal device on which a virtual machine 101 resides, and as shown in Figure 2, the device migration method may include the following steps S210 to S240.

[0024] In step S210, the first virtual machine transmits a request message to the second virtual machine requesting the use of the target device.

[0025] The first virtual machine and the second virtual machine are different virtual machines, and both are managed by the same virtualization platform. That is, the first virtual machine is managed by a virtualization platform, which also manages at least one other target virtual machine, and the second virtual machine is one of the at least one target virtual machine mentioned above. The target device is the physical device 103 described above.

[0026] The first virtual machine is not pass-through connected to the target device. If the first virtual machine requires resources from the target device, the first virtual machine transmits a request message to each of the at least one of the target virtual machines to request the use of the target device, thereby achieving the objective of requesting the use of the target device from the target virtual machines that are pass-through connected to the target device among the at least one of the target virtual machines.

[0027] In step S220, if the second virtual machine is pass-through connected to the target device, the first priority for the first virtual machine to use the target device is compared to the second priority for the second virtual machine to use the target device.

[0028] The second virtual machine may or may not be connected to the target device via passthrough. If the second virtual machine is connected to the target device via passthrough, the second virtual machine monopolizes the resources of the target device, and in this case, the first virtual machine cannot use the resources of the target device. To determine whether the first virtual machine can use the resources of the target device preferentially over the second virtual machine, the first priority for the first virtual machine to use the target device and the second priority for the second virtual machine to use the target device are pre-configured, and the first priority and second priority are compared. Based on the result of the comparison between the first and second priorities, it is determined whether the first virtual machine can use the resources of the target device preferentially.

[0029] The first priority for the first virtual machine to use the target device and the second priority for the second virtual machine to use the target device can be set according to the actual circumstances, and are not limited to the embodiments of this disclosure.

[0030] When setting the priority for virtual machines to use a target device, one priority can be set for each virtual machine. For example, the first virtual machine's priority can be set to priority 1, and the second virtual machine's priority can be set to priority 2. In this case, the first priority for the first virtual machine to use any physical device is priority 1, and the second priority for the second virtual machine to use any physical device is priority 2. In other words, the priority for virtual machines to use a target device is independent of the target device and does not change with changes to the target device.

[0031] For example, if the target device is physical device 1 (e.g., a graphics card), the first priority for the first virtual machine to use the target device is priority 1, and the second priority for the second virtual machine to use the target device is priority 2. If the target device is physical device 2 (e.g., a network interface card), the first priority for the first virtual machine to use the target device remains priority 1, and the second priority for the second virtual machine to use the target device remains priority 2. In other words, regardless of whether the target device has changed, neither the first priority for the first virtual machine to use the target device nor the second priority for the second virtual machine to use the target device changes.

[0032] When setting the priority for each virtual machine to use a target device, the priority of multiple virtual machines can be set based on the priority order in which multiple virtual machines use the target device. For example, the priority for multiple virtual machines to use physical device 1 can be set based on the priority order in which multiple virtual machines use physical device 1, and the priority for multiple virtual machines to use physical device 2 can be set based on the priority order in which multiple virtual machines use physical device 2. If the priority order in which multiple virtual machines use physical device 1 differs from the priority order in which multiple virtual machines use physical device 2, the priority for each virtual machine to use the target device will change according to the difference in target devices.

[0033] For example, if the target device is physical device 1 (e.g., a graphics card), the priority order for the first virtual machine and the second virtual machine to use physical device 1 is that the first virtual machine uses it first, followed by the second virtual machine. The first priority for the first virtual machine to use physical device 1 is priority 1, and the second priority for the second virtual machine to use physical device 1 is priority 2, with priority 1 being higher than priority 2. If the target device is physical device 2 (e.g., a network interface card), the priority order for the first virtual machine and the second virtual machine to use physical device 2 is that the second virtual machine uses it first, followed by the first virtual machine. The first priority for the first virtual machine to use physical device 2 is priority 2, and the second priority for the second virtual machine to use physical device 2 is priority 1. In other words, when the target device is changed, the first priority for the first virtual machine to use the target device and the second priority for the second virtual machine to use the target device also change accordingly.

[0034] If the second virtual machine is not pass-through connected to the target device, the second virtual machine will not respond to request messages requesting the use of the target device.

[0035] In step S230, in response to the first priority being higher than the second priority, the first pass-through binding between the second virtual machine and the target device is released.

[0036] If the first priority is higher than the second priority, the first virtual machine can preferentially use the resources of the target device, and the second virtual machine can release the first pass-through binding between the second virtual machine and the target device, allowing other virtual machines other than the second virtual machine to use the resources of the target device.

[0037] In step S240, a migration message is sent to the first virtual machine instructing it to perform a second pass-through binding between the first virtual machine and the target device.

[0038] The second virtual machine can send a migration message to the first virtual machine, which then performs a second pass-through binding to the target device based on the migration message, making the resources of the target device available to the first virtual machine.

[0039] As can be seen from steps S210 to S240 above, the target device can be used exclusively by the first or second virtual machine, or it can be migrated between the first and second virtual machines and shared by both. In this case, the virtual machines can acquire more resources as needed, effectively improving the resource utilization of the physical device and the operational efficiency of the virtual machines.

[0040] The device migration method according to the embodiment of the present disclosure involves the first virtual machine transmitting a request message to the second virtual machine requesting the use of a target device. If the second virtual machine is pass-through connected to the target device, the first priority for the first virtual machine to use the target device is compared with the second priority for the second virtual machine to use the target device. In response to the first priority being higher than the second priority, the first pass-through binding between the second virtual machine and the target device is released, and a migration message is sent to the first virtual machine instructing it to establish a second pass-through binding between the first virtual machine and the target device. As can be seen from the above, the embodiment of the present disclosure can control the migration of a physical device between multiple virtual machines based on the priority of different virtual machines using the physical device, and when a physical device is migrated to a virtual machine, it can be used exclusively by that virtual machine. In this case, the physical device can not only be used exclusively by a single virtual machine, but can also be migrated between multiple virtual machines and shared by multiple virtual machines, improving the resource utilization of the physical device, allowing virtual machines to acquire more resources as needed, and significantly improving the work efficiency of the virtual machines.

[0041] Figure 3 is a schematic flowchart of a device migration method according to an exemplary embodiment of the present disclosure. As shown in Figure 3, after step S220 is performed, steps S310 to S330 can be further performed.

[0042] In step S310, in response to the first priority being lower than the second priority, it is detected whether the second virtual machine is using the target device.

[0043] After comparing the first priority with the second priority, if the first priority is lower than the second priority, the first virtual machine cannot use the target device resources preferentially over the second virtual machine. In this case, the system detects whether the second virtual machine is using the target device and determines whether the target device resources are idle.

[0044] In step S320, if the second virtual machine is using the target device, the first pass-through binding between the second virtual machine and the target device is released after the second virtual machine has finished using the target device.

[0045] If the second virtual machine is using the target device, it means that the resources of the target device are being used by the second virtual machine. The first virtual machine has a lower priority than the second virtual machine, and in this case, the first virtual machine cannot use the resources of the target device preferentially over the second virtual machine. Therefore, the first virtual machine waits for the second virtual machine to finish using the target device. After the second virtual machine has finished using the target device, the second virtual machine releases the first pass-through binding between itself and the target device to avoid affecting the second virtual machine's use of the target device resources.

[0046] In step S330, if the second virtual machine is not using the target device, the first pass-through binding between the second virtual machine and the target device is immediately released.

[0047] If the second virtual machine is not using the target device, it means the target device's resources are idle. The second virtual machine immediately releases the first pass-through binding between the second virtual machine and the target device, allowing other virtual machines to immediately use the target device's resources.

[0048] After performing step S330, step S240 can be continued to directly perform a second pass-through binding between the first virtual machine and the target device if the target device is not pass-through connected to other virtual machines, allowing the first virtual machine to use the resources of the target device.

[0049] As can be seen from the above, in the embodiments of this disclosure, if the first virtual machine needs to use the resources of the target device but cannot use the resources of the target device preferentially over the second virtual machine, when the second virtual machine has finished using the target device or when the second virtual machine is not using the target device, the target device can be migrated from the second virtual machine to the first virtual machine, and the first pass-through binding between the second virtual machine and the target device can be released, provided that this affects the normal operation of the second virtual machine, thereby allowing the first virtual machine to use the resources of the target device and improving the resource utilization rate of the physical device without affecting the normal operation of the virtual machines.

[0050] In some embodiments, a method for a first virtual machine to transmit a request message to a second virtual machine requesting the use of a target device may include the step of transmitting a request message from the first virtual machine to the second virtual machine requesting the use of a target device based on a shared memory mechanism.

[0051] A shared memory mechanism is a type of inter-process communication (IPC) mechanism. It allows multiple processes to access the same memory area, enabling data from different processes to be directly shared within that memory area, and allowing for high-speed transfer of large amounts of data between processes.

[0052] Exemplary, as shown in Figure 4, the working system 100 includes a first virtual machine 101A, a second virtual machine 101B, a virtualization platform 102, a pass-through module 1021, and a target device 1031. The first virtual machine 101A runs operating system A, the second virtual machine 101B runs operating system B, operating system A runs control program C1, and operating system B runs control program C2.

[0053] Control program C1 may be a user-mode program that needs to communicate with other processes in operating system A, and control program C2 may be a user-mode program that needs to communicate with other processes in operating system B. When the first virtual machine transmits a request message to the second virtual machine requesting the use of a target device, the arrows in Figure 4 between control program C1 and the shared memory for inter-process communication, and between the shared memory for inter-process communication and control program C2 can be referenced. The direction of the arrows represents the direction of message transmission. As shown in Figure 4, first control program C1 sends a request message to the shared memory for inter-process communication requesting the use of a target device, and then the control program of the other virtual machine can receive the request message requesting the use of the target device via the shared memory for inter-process communication. Control program C2, which runs on operating system B of the second virtual machine 101B, receives the request message requesting the use of the target device via the shared memory for inter-process communication.

[0054] By transmitting request messages requesting the use of a target device based on a shared memory mechanism, data and resource requests can be efficiently shared between the first virtual machine and the second virtual machine, thereby improving processing efficiency.

[0055] In some embodiments, the process of releasing the first pass-through binding between the second virtual machine and the target device can be implemented in the following manner: a release command is sent to a pass-through module in the virtualization platform, instructing the pass-through module to release the first pass-through binding based on the release command.

[0056] For example, as shown in Figure 5, the direction of the arrows in Figure 5 represents the direction of message transmission. When releasing the first pass-through binding between the second virtual machine and the target device, the operating system B in the second virtual machine 101B sends a release command to the pass-through module 1021 in the virtualization platform 102. After receiving the release command, the pass-through module 1021 releases the first pass-through binding between the second virtual machine 101B and the target device 1031 based on the release command.

[0057] In some embodiments, the step of sending a migration message to a first virtual machine to instruct it to perform a second pass-through binding between the first virtual machine and a target device includes the step of sending a migration message to the first virtual machine, which in turn sends a binding instruction to a pass-through module in the virtualization platform to instruct the pass-through module to perform a second pass-through binding between the target device and the first virtual machine based on the binding instruction.

[0058] For illustrative purposes, continuing to refer to Figure 5, after releasing the first pass-through binding between the second virtual machine and the target device, the control program C2 in the second virtual machine 101B can send a transition message to the shared memory for inter-process communication, and the control program C1 in the first virtual machine 101A can retrieve the transition message from the shared memory for inter-process communication. In this case, after releasing the first pass-through binding between the second virtual machine and the target device, the first virtual machine can be notified that a second pass-through binding with the target device can be performed.

[0059] An operating system running on a virtual machine executes a driver program, which is used for interaction between the operating system and physical devices to enable interaction between the virtual machine and physical devices. Therefore, in some embodiments, the step of sending a disbinding command to a passthrough module in the virtualization platform to instruct the passthrough module to release a first passthrough binding based on the disbinding command may include the step of calling a first driver program to send a disbinding command to the passthrough module in the virtualization platform to instruct the passthrough module to release a first passthrough binding based on the disbinding command.

[0060] The first driver program runs on the operating system of the second virtual machine.

[0061] As an example, as shown in Figure 6, the direction of the arrows in Figure 6 represents the direction of message transmission, and the symbols on the arrows represent the execution order. Referring to Figure 6, first, the control program C1 in the first virtual machine 101A sends a request message to the shared memory for inter-process communication requesting the use of the target device (corresponding to the flow corresponding to the arrow labeled 1), and then, the control program C2 in the second virtual machine 101B receives the same request message from the shared memory for inter-process communication requesting the use of the target device (corresponding to the flow corresponding to the arrow labeled 2). Subsequently, the control program C2 determines whether the second virtual machine 101B is pass-through bound to the target device (the specific determination method can be set by those skilled in the art according to the actual situation, and is not limited thereto in the embodiments of this disclosure). If the control program C2 determines that the second virtual machine 101B is pass-through bound to the target device 1031 (i.e., the second virtual machine 101B currently has exclusive access to the target device 1031), as shown in Figure 6, the control program C2 in the second virtual machine 101B calls the driver program D2 executed by the operating system B (corresponding to the flow corresponding to the arrow in reference numeral 3), and the call to the driver program D2 sends a disbinding command to the pass-through module 1021 (corresponding to the flow corresponding to the arrow in reference numeral 4).

[0062] Note that Figure 6 only shows the case where the control program C2 determines that the second virtual machine 101B is pass-through bound to the target device 1031. If the control program C2 determines that the second virtual machine 101B is not pass-through bound to the target device 1031, the control program C2 does not respond to the received request message requesting the use of the target device and terminates the flow.

[0063] In some embodiments, the process of sending a migration message to the first virtual machine based on a driver program in the virtual machine's operating system, the first virtual machine responding to the migration message by sending a binding instruction to a passthrough module in the virtualization platform, and instructing the passthrough module to perform a second passthrough binding between the target device and the first virtual machine based on the binding instruction, includes the steps of: receiving a first event signal sent by the first driver program triggered by a first interrupt signal; the passthrough module sending a first interrupt signal to the first driver program if the first passthrough binding is successfully released; and responding to the first event signal, the shared module The steps include sending a migration message to a first virtual machine based on a Mori mechanism, the first virtual machine responding to the migration message by calling a second driver program to send a binding instruction to a passthrough module in the virtualization platform, instructing the passthrough module to perform a second passthrough binding between the target device and the first virtual machine based on the binding instruction, and the first virtual machine receiving a second event signal sent by the second driver program triggered by a second interrupt signal, the first virtual machine responding to the second event signal by using the target device, wherein the passthrough module sends a second interrupt signal to the second driver program if the second passthrough binding is successfully completed.

[0064] The second driver program runs on the operating system of the first virtual machine. The first interrupt signal can be considered a signal that invokes the interrupt handling routine of the first driver program, which instructs the first driver program to send a first event signal to the control program in the second virtual machine, and the first event signal instructs the control program in the second virtual machine to send a transition message to the first virtual machine. The second interrupt signal can be considered a signal that invokes the interrupt handling routine of the second driver program, which instructs the second driver program to send a second event signal to the control program in the first virtual machine, and the second event signal instructs the control program in the first virtual machine to start using the target device.

[0065] Illustratively, as shown in Figure 6, the driver program D2 (corresponding to the first driver program described above) sends a disbinding command to the pass-through module 1021 by calling it, instructing the pass-through module 1021 to disengage the first pass-through binding between the second virtual machine 101B and the target device 1031. If the first pass-through binding is successfully disengaged, the pass-through module 1021 sends a first interrupt signal to the driver program D2 in the second virtual machine 101B (corresponding to the flow corresponding to the arrow in reference numeral 5), the driver program D2, triggered by the first interrupt signal, sends a first event signal to the control program C2 in the second virtual machine 101B (corresponding to the flow corresponding to the arrow in reference numeral 6), the control program C2, in response to the first event signal, sends a transition message to the shared memory for inter-process communication (corresponding to the flow corresponding to the arrow in reference numeral 7), and the control in the first virtual machine 101A Program C1 receives the above transition message via the shared memory for inter-process communication (corresponding to the flow corresponding to the arrow in reference numeral 8), and control program C1 calls driver program D1 in the first virtual machine based on the transition message (corresponding to the flow corresponding to the arrow in reference numeral 9), and driver program D1 (corresponding to the above second driver program) sends a binding instruction to passthrough module 1021 (corresponding to the flow corresponding to the arrow in reference numeral 10), instructing passthrough module 1021 to perform a second passthrough binding between the first virtual machine 101A and target device 1031. The pass-through module 1021 sends a second interrupt signal to the driver program D1 in the first virtual machine (corresponding to the flow corresponding to the arrow in reference numeral 11) when the second pass-through binding is successfully completed. The driver program D1, triggered by the second interrupt signal, sends a second event signal to the control program C1 in the first virtual machine 101A (corresponding to the flow corresponding to the arrow in reference numeral 12). The control program C1 responds to the second event signal by controlling the first virtual machine 101A to use the target device 1031.

[0066] The process by which the pass-through module 1021 releases the first pass-through binding is as follows: First, the pass-through module 1021 releases the mapping relationship between the second virtual machine and the memory of the target device. Next, the pass-through module 1021 removes the interrupt routing settings currently assigned to the second virtual machine by the target device so that the second virtual machine does not receive interrupt signals sent from the target device. Finally, the pass-through module 1021 stops the data flow of the System Memory Management Unit (SMMU) Direct Memory Access (DMA) so that the second virtual machine does not access the memory space of other virtual machines, thereby achieving secure isolation of data during the migration process of the target device.

[0067] The process by which the passthrough module 1021 performs the second passthrough binding is as follows: First, the passthrough module 1021 establishes a mapping relationship between the first virtual machine and the memory of the target device. Next, the passthrough module 1021 adds an interrupt routing setting that the target device is currently assigned to the first virtual machine, so that the first virtual machine can receive interrupt signals sent from the target device. Finally, the passthrough module 1021 initiates an SMMU DMA data flow to support the first virtual machine in directly accessing the target device.

[0068] In some embodiments, the device migration method of the embodiments of this disclosure can be applied to scenarios in the automotive cockpit and driver integration field. In the automotive cockpit and driver integration field, the functional modules of the intelligent cockpit domain and the functional modules of the intelligent driver domain can run on different virtual machines, where the first virtual machine is the virtual machine on which the functional modules of the intelligent cockpit domain run, and the second virtual machine is the virtual machine on which the functional modules of the intelligent driver domain run. In this case, it is possible to migrate a physical device between the virtual machine on which the functional modules of the intelligent cockpit domain run and the virtual machine on which the functional modules of the intelligent driver domain run, thereby maximizing the use of the resources of the physical device and enabling the virtual machines on which the functional modules of the intelligent driver domain run and the virtual machines on which the functional modules of the intelligent cockpit domain run to acquire more resources as needed, thereby effectively improving the operational efficiency of virtual machines in the automotive cockpit and driver integration field scenarios.

[0069] [Example device] Figure 7 is a schematic diagram of the structure of a device transfer device according to an exemplary embodiment of the present disclosure. As shown in Figure 7, the device transfer device 700 includes a transmission module 701, a comparison module 702, a pass-through release module 703, and a transmission module 704.

[0070] The transmission module 701 transmits a request message from the first virtual machine to the second virtual machine requesting the use of the target device.

[0071] The comparison module 702 compares the first priority for the first virtual machine to use the target device with the second priority for the second virtual machine to use the target device, assuming the second virtual machine has a passthrough connection to the target device.

[0072] The passthrough release module 703 releases the first passthrough binding between the second virtual machine and the target device in response to the first priority being higher than the second priority.

[0073] The transmission module 704 sends a migration message to the first virtual machine, instructing it to perform a second pass-through binding between the first virtual machine and the target device.

[0074] The device migration device according to the embodiment of the present disclosure transmits a request message from the first virtual machine to the second virtual machine requesting the use of a target device. If the second virtual machine is pass-through connected to the target device, the device compares the first priority for the first virtual machine to use the target device with the second priority for the second virtual machine to use the target device. In response to the first priority being higher than the second priority, the device can release the first pass-through binding between the second virtual machine and the target device, and send a migration message to the first virtual machine instructing it to establish a second pass-through binding between the first virtual machine and the target device. As can be seen from the above, the embodiment of the present disclosure can control the migration of a physical device between multiple virtual machines based on the priority of different virtual machines using the physical device, and when a physical device is migrated to a virtual machine, it can be used exclusively by that virtual machine. In this case, the physical device can be used exclusively by a single virtual machine, or it can be migrated between multiple virtual machines and shared by multiple virtual machines, improving the resource utilization of the physical device, allowing virtual machines to acquire more resources as needed, and significantly improving the work efficiency of the virtual machines.

[0075] In some embodiments, as shown in Figure 8, the device migration device 700 further includes a detection module 705, a first processing module 706, and a second processing module 707.

[0076] The detection module 705 detects whether the second virtual machine is using the target device in response to the first priority being lower than the second priority.

[0077] If the second virtual machine is using the target device, the first processing module 706 releases the first pass-through binding between the second virtual machine and the target device after the second virtual machine has finished using the target device.

[0078] The second processing module 707 immediately releases the first pass-through binding between the second virtual machine and the target device if the second virtual machine is not using the target device.

[0079] In some embodiments, the passthrough release module 703, the first processing module 706, and the second processing module 707, when specifically releasing the first passthrough binding between the second virtual machine and the target device, send a release command to the passthrough module in the virtualization platform, instructing the passthrough module to release the first passthrough binding based on the release command.

[0080] In some embodiments, the transmitting module 704 specifically sends a migration message to a first virtual machine, which in response to the migration message sends a binding command to a passthrough module in the virtualization platform, instructing the passthrough module to perform a second passthrough binding between the target device and the first virtual machine based on the binding command.

[0081] In some embodiments, the transmission module 701 specifically transmits a request message from the first virtual machine to the second virtual machine requesting the use of a target device, based on a shared memory mechanism.

[0082] In some embodiments, the passthrough release module 703, the first processing module 706, and the second processing module 707, specifically when releasing the first passthrough binding between the second virtual machine and the target device, call the first driver program to send a release command to the passthrough module in the virtualization platform, instructing the passthrough module to release the first passthrough binding based on the release command.

[0083] In some embodiments, the transmitting module 704 specifically receives a first event signal transmitted by a first driver program triggered by a first interrupt signal, the pass-through module sends a first interrupt signal to the first driver program when the first pass-through binding is successfully released, sends a transition message to the first virtual machine based on the shared memory mechanism in response to the first event signal, the first virtual machine responds to the transition message by calling a second driver program to send a binding instruction to the pass-through module in the virtualization platform, instructing the pass-through module to perform a second pass-through binding between the target device and the first virtual machine based on the binding instruction, the first virtual machine receives a second event signal transmitted by a second driver program triggered by a second interrupt signal, the first virtual machine uses the target device in response to the second event signal, and the pass-through module sends a second interrupt signal to the second driver program when the second pass-through binding is successfully completed.

[0084] The beneficial technical effects corresponding to the exemplary embodiment of this apparatus can be found by referring to the corresponding beneficial technical effects in the exemplary method section above, and therefore, their explanation is omitted here.

[0085] [Example electronic device] Figure 10 is a structural diagram of an electronic device according to an embodiment of the present disclosure, and includes at least one processor 111 and memory 112.

[0086] The processor 111 can be a central processing unit (CPU) or another form of processing unit having data processing capability and / or instruction execution capability, and can control other components in the electronic device 11 to perform a desired function.

[0087] The memory 112 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. The computer-readable storage media may store one or more computer program instructions, and the processor 111 may execute one or more computer program instructions to realize the device migration method and / or other desired functions in each embodiment of the present disclosure described above.

[0088] As an example, the electronic device 11 may further include input devices 113 and output devices 114 connected to each other via a bus system and / or other forms of connection mechanisms (not shown).

[0089] This input device 113 may include, for example, a keyboard, a mouse, etc.

[0090] This output device 114 can output various types of information to the outside. This output device 114 may include, for example, a display, speaker, printer, communication network, and remote output devices connected thereto.

[0091] For simplicity, Figure 9 shows only some of the components of the electronic device 11 relating to this disclosure, omitting components such as buses and input / output interfaces. Otherwise, the electronic device 11 may further include any other suitable components depending on the specific application.

[0092] [Examples of computer program products and computer-readable storage media] Embodiments of this disclosure provide a computer program product including computer program instructions, in addition to the methods and apparatus described above. When the computer program instructions are executed by a processor, the processor is caused to perform the steps of the device transition method of various embodiments of this disclosure described in the “Exemplary Methods” portion above.

[0093] Computer program products can be created using one or any combination of programming languages ​​to produce program code for performing the operations of the embodiments of this disclosure, including object-oriented programming languages ​​such as Java and C++, and traditional procedural programming languages ​​such as the C language or similar programming languages. The program code may run entirely on a user computing device, partially on a user device, run as a standalone software package, run partially on a user computing device and partially on a remote computing device, or run entirely on a remote computing device or a server.

[0094] Furthermore, embodiments of the present disclosure further provide a computer-readable storage medium in which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor is made to perform the steps of the device transition method of various embodiments of the present disclosure described in the “Exemplary Methods” portion above.

[0095] Any combination of one or more readable media can be used as a computer-readable storage medium. A readable medium can be a readable signal medium or a readable storage medium. A readable storage medium can include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any combination thereof. More specific examples (non-exclusive list) of readable storage media include electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.

[0096] While the basic principles of this disclosure have been explained above with reference to specific examples, the advantages, merits, and effects mentioned in this disclosure are merely illustrative and not limiting, and these advantages, merits, and effects are not necessarily present in every example of this disclosure. Furthermore, the specific details of the above disclosure are merely illustrative and easy-to-understand effects and are not limiting, and the above details do not necessarily limit this disclosure to being realized by the above specific details.

[0097] Those skilled in the art can make various modifications and alterations to the present disclosure without departing from the spirit and scope of the present application. Thus, if such modifications and alterations of the present application fall within the claims of the present disclosure and the equivalent art thereto, the present disclosure also includes such modifications and alterations.

Claims

1. A device migration method in which each step is performed by a device migration device, The first virtual machine transmits a request message to the second virtual machine requesting the use of the target device, If the second virtual machine is pass-through connected to the target device, the steps include comparing the first priority for the first virtual machine to use the target device with the second priority for the second virtual machine to use the target device, In response to the first priority being higher than the second priority, the first pass-through binding between the second virtual machine and the target device is released. The steps include sending a migration message to the first virtual machine instructing it to perform a second pass-through binding between the first virtual machine and the target device, A device migration method characterized by the following features.

2. The aforementioned device migration method is: In response to the first priority being lower than the second priority, the steps include detecting whether the second virtual machine is using the target device, If the second virtual machine is using the target device, the first pass-through binding between the second virtual machine and the target device is released after the second virtual machine has finished using the target device. The further step includes immediately releasing the first pass-through binding between the second virtual machine and the target device if the second virtual machine is not using the target device. The device migration method according to feature 1.

3. The step of releasing the first pass-through binding between the second virtual machine and the target device is: The process includes sending a disbinding command to a passthrough module in a virtualization platform, instructing the passthrough module to disbinding the first passthrough binding based on the disbinding command, The device migration method according to feature 1.

4. The step of sending a migration message to the first virtual machine to instruct it to perform a second pass-through binding between the first virtual machine and the target device is: The process includes sending a migration message to the first virtual machine, the first virtual machine responding to the migration message by sending a binding command to a passthrough module in the virtualization platform, instructing the passthrough module to perform the second passthrough binding between the target device and the first virtual machine based on the binding command, The device migration method according to feature 3.

5. The step of the first virtual machine transmitting a request message to the second virtual machine requesting the use of the target device is: The process includes the step of transmitting a request message from the first virtual machine to the second virtual machine requesting the use of a target device, based on a shared memory mechanism. The device migration method according to feature 1.

6. The step of sending a disbinding command to a passthrough module in the virtualization platform and instructing the passthrough module to disbinding the first passthrough binding based on the disbinding command is: The process includes calling a first driver program to send the unbinding command to a passthrough module in the virtualization platform, instructing the passthrough module to unbinding the first passthrough binding based on the unbinding command, The device migration method according to feature 4.

7. The steps include sending a migration message to the first virtual machine, the first virtual machine responding to the migration message by sending a binding command to a passthrough module in the virtualization platform, and instructing the passthrough module to perform the second passthrough binding between the target device and the first virtual machine based on the binding command, The steps include: receiving a first event signal transmitted by the first driver program triggered by a first interrupt signal, wherein the pass-through module transmits the first interrupt signal to the first driver program when the first pass-through binding is successfully released; Steps include: sending the migration message to the first virtual machine based on the shared memory mechanism in response to the first event signal; the first virtual machine responding to the migration message by calling a second driver program to send a binding instruction to a passthrough module in the virtualization platform, instructing the passthrough module to perform the second passthrough binding between the target device and the first virtual machine based on the binding instruction; The first virtual machine receives a second event signal transmitted by the second driver program triggered by a second interrupt signal, and the first virtual machine uses the target device in response to the second event signal, the passthrough module sending the second interrupt signal to the second driver program if the second passthrough binding is successfully completed, The device migration method according to feature 6.

8. A transmission module for transmitting a request message from the first virtual machine to the second virtual machine requesting the use of a target device, When the second virtual machine is pass-through connected to the target device, a comparison module for comparing the first priority for the first virtual machine to use the target device with the second priority for the second virtual machine to use the target device, A passthrough release module for releasing the first passthrough binding between the second virtual machine and the target device in response to the first priority being higher than the second priority, The system includes a send module for sending a migration message to the first virtual machine to instruct it to perform a second pass-through binding between the first virtual machine and the target device, A device migration device characterized by the following features.

9. A computer-readable storage medium, When executed by a processor, the processor stores computer program instructions for causing it to perform the device migration method described in any one of claims 1 to 7. A computer-readable storage medium characterized by the following features.

10. An electronic device comprising one or more processors and memory in which computer program instructions are stored, When the computer program instruction is executed by the processor, the processor is instructed to execute the device migration method described in any one of claims 1 to 7. An electronic device characterized by the following features.