Communication method, electronic apparatus, vehicle, and storage medium

By establishing a global routing table between virtual machines and using the Binder communication mechanism and the Virtio technology framework, the security deficiencies in virtual machine communication are resolved, achieving efficient and secure inter-virtual machine communication and ensuring the accuracy of data transmission and system isolation.

WO2026012049A1PCT designated stage Publication Date: 2026-01-15BYD CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/100739
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-07-09
Filing Date
2025-06-12
Publication Date
2026-01-15

AI Technical Summary

Technical Problem

In the field of smart cockpits, there are security issues with communication between virtual machines, especially due to security risks caused by unauthorized access to memory data by virtual machines.

Method used

By establishing a global routing table between virtual machines, the isolation and security of communication data are ensured. The communication data is sent to the target virtual machine using a preset global routing table. Efficient and secure inter-virtual machine communication is achieved by utilizing the Binder communication mechanism and the Virtio technology framework.

Benefits of technology

Ensure the accuracy and security of communication data, prevent malicious access and data tampering by virtual machines, improve system security and isolation, and meet the communication needs between different virtual machines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025100739_15012026_PF_FP_ABST
    Figure CN2025100739_15012026_PF_FP_ABST
Patent Text Reader

Abstract

A communication method, an electronic apparatus, a vehicle, and a storage medium. The communication method comprises: acquiring communication data of a first virtual machine, the communication data comprising information on a second virtual machine serving as a receiving end, and the first virtual machine and the second virtual machine being isolated from each other; and when the first virtual machine and the second virtual machine are different virtual machines, sending the communication data to the second virtual machine on the basis of a preset global routing table.
Need to check novelty before this filing date? Find Prior Art

Description

Communication methods, electronic devices, vehicles and storage media

[0001] Cross-reference to related applications

[0002] This application is based on and claims priority to Chinese Patent Application No. CN202410912636.7, filed on July 9, 2024, the entire contents of which are incorporated herein by reference. Technical Field

[0003] This invention relates to the field of software development technology, and more specifically, to a communication method, electronic device, vehicle, and non-volatile computer-readable storage medium. Background Technology

[0004] The current mainstream technology in the field of smart cockpits is to build multiple virtual machines to deploy multiple operating systems. Different virtual machines interact by accessing the same shared memory.

[0005] However, when different virtual machines access the same shared memory, there may be situations where some virtual machines access memory data without authorization or without permission, resulting in insufficient security during virtual machine communication. Summary of the Invention

[0006] The present invention aims to at least partially solve one of the technical problems in the related art.

[0007] Therefore, one object of the present invention is to provide a communication method comprising: acquiring communication data of a first virtual machine, the communication data including a second virtual machine as the receiving end, the first virtual machine and the second virtual machine being isolated from each other; and, when the first virtual machine and the second virtual machine are different virtual machines, sending the communication data to the second virtual machine based on a preset global routing table.

[0008] According to one embodiment of the present invention, the virtual machines are isolated from each other, and the global routing table includes global routing information between the master virtual machine and each child virtual machine in each virtual machine. The step of sending the communication data to the second virtual machine based on the preset global routing table includes: when both the first virtual machine and the second virtual machine are child virtual machines, sending the communication data to the master virtual machine based on the preset global routing table, and forwarding the communication data to the second virtual machine through the master virtual machine; when the first virtual machine is the child virtual machine and the second virtual machine is the master virtual machine, sending the communication data to the second virtual machine based on the preset global routing table.

[0009] According to one embodiment of the present invention, the first virtual machine and the second virtual machine communicate through the same preset process communication mechanism.

[0010] According to one embodiment of the present invention, the process communication mechanism includes the Binder communication mechanism.

[0011] According to one embodiment of the present invention, the step of sending the communication data to the main virtual machine based on a preset global routing table, and forwarding the communication data to the second virtual machine through the main virtual machine, includes: establishing a first communication link between the first virtual machine and the main virtual machine, and a second communication link between the second virtual machine and the main virtual machine based on the global routing table, the address of the first virtual machine, the address of the second virtual machine, and the address of the main virtual machine; controlling the first virtual machine to send the communication data to the main virtual machine based on the first communication link; and controlling the main virtual machine to forward the communication data to the second virtual machine based on the second communication link.

[0012] According to one embodiment of the present invention, controlling the first virtual machine to send the communication data to the main virtual machine based on the first communication link includes: registering a device virtualization network component in a remote call component corresponding to a preset process communication mechanism; and calling the device virtualization network component to send the communication data to the main virtual machine through the first communication link.

[0013] According to one embodiment of the present invention, the method further includes: assigning an address to the virtual machine when creating the virtual machine; and creating or updating the global routing table based on the address.

[0014] According to one embodiment of the present invention, the method further includes: determining target virtual machines that do not contain a preset process communication mechanism in each virtual machine; adding a component corresponding to the preset process communication mechanism in each target virtual machine to construct the preset process communication mechanism in each target virtual machine.

[0015] According to one embodiment of the present invention, the virtual machines communicate with each other through a device virtualization network, which is implemented based on the Virtio technology framework.

[0016] According to one embodiment of the present invention, the method further includes: when the first virtual machine and the second virtual machine are the same virtual machine, determining a target process within the same virtual machine; and transmitting the communication data to the target process based on a driver component of a preset process communication mechanism.

[0017] Another object of the present invention is to provide an electronic device including a processor connected to a memory; the memory stores a computer program, and the processor executes the computer program to implement instructions for the communication method described in any of the above embodiments.

[0018] Another object of the present invention is to provide a vehicle including the electronic device described in any of the above embodiments.

[0019] Another object of the present invention is to provide a non-volatile computer-readable storage medium comprising a computer program, which, when executed by a processor, causes the processor to perform the communication method described in any of the above embodiments.

[0020] The communication method, electronic device, vehicle, and non-volatile computer-readable storage medium of this application acquire communication data from a first virtual machine. This communication data includes a second virtual machine acting as the receiving end. The first and second virtual machines are isolated from each other, ensuring the security and independence of each virtual machine. When the first and second virtual machines are different virtual machines, the communication data is sent to the second virtual machine based on a preset global routing table. In the communication between the first and second virtual machines, the preset global routing table ensures that the communication data is correctly routed to the corresponding second virtual machine, avoiding data loss and transmission errors, thus ensuring communication accuracy. Since communication does not require multiple virtual machines to access shared memory, it also prevents malicious access, unauthorized access, and malicious tampering of data in shared memory, improving system security and isolation, and meeting the communication needs between different virtual machines.

[0021] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0022] Figure 1 is a schematic diagram of the prior art of a communication method according to an embodiment of the present invention;

[0023] Figure 2 is a schematic diagram of a communication method according to an embodiment of the present invention;

[0024] Figure 3 is a flowchart illustrating a communication method according to an embodiment of the present invention;

[0025] Figure 4 is a flowchart illustrating a communication method according to an embodiment of the present invention;

[0026] Figure 5 is a flowchart illustrating a communication method according to an embodiment of the present invention;

[0027] Figure 6 is a flowchart illustrating a communication method according to an embodiment of the present invention;

[0028] Figure 7 is a schematic diagram of a communication method according to an embodiment of the present invention;

[0029] Figure 8 is a flowchart illustrating a communication method according to an embodiment of the present invention;

[0030] Figure 9 is a schematic diagram of a communication method according to an embodiment of the present invention;

[0031] Figure 10 is a flowchart illustrating a communication method according to an embodiment of the present invention;

[0032] Figure 11 is a flowchart illustrating a communication method according to an embodiment of the present invention;

[0033] Figure 12 is a schematic diagram of a communication device according to an embodiment of the present invention;

[0034] Figure 13 is a structural schematic diagram of a vehicle according to an embodiment of the present invention;

[0035] Figure 14 is a schematic diagram of the connection state between a non-volatile computer-readable storage medium and a processor according to an embodiment of the present invention. Detailed Implementation

[0036] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.

[0037] To facilitate understanding of this application, the following explanations are provided for the terms used in this application:

[0038] 1. Cloud server: A cloud technology (IT) product that provides cloud computing services. Cloud servers are characterized by simplicity, efficiency, security, reliability, elastic scaling of processing power, reduced development and maintenance difficulty and overall IT costs. They provide a comprehensive business service platform for various Internet users, integrating the three core elements of Internet applications: computing, storage, and network, and providing public Internet infrastructure services. The communication method of this application can be implemented based on a cloud server.

[0039] 2. Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computing, storage, processing, and sharing. Cloud technology is a collective term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies applied to cloud computing business models. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.

[0040] Cloud computing is a computing model that distributes computing tasks across a large pool of computers, enabling various application systems to access computing power, storage space, and information services as needed. The network providing these resources is called the "cloud." From the user's perspective, resources in the "cloud" appear infinitely scalable, readily available, on-demand, and expandable, with payment based on usage.

[0041] As a provider of fundamental cloud computing capabilities, a cloud resource pool (referred to as a cloud platform, generally called Infrastructure as a Service (IaaS) platform) is established. Various types of virtual resources are deployed in the resource pool for external customers to choose from. The cloud resource pool mainly includes: computing devices (virtualized machines containing operating systems), storage devices, and network devices.

[0042] Based on logical functional division, a Platform as a Service (PaaS) layer can be deployed on top of the IaaS layer, and a Software as a Service (SaaS) layer can be deployed on top of the PaaS layer. Alternatively, SaaS can be directly deployed on top of IaaS. PaaS is a platform for running software, such as databases and web containers. SaaS refers to various types of business software, such as web portals and bulk SMS senders. Generally, SaaS and PaaS are upper layers compared to IaaS. In the embodiments of this application, the communication method is implemented based on a cloud server, and the cloud platform operator provides services for creating cloud servers.

[0043] 3. Virtual Machine Monitor (VMM): This is the software, firmware, or hardware used to create and run virtual machines.

[0044] 4. A virtual machine (VM) is a complete computer system simulated by software, possessing full hardware system functionality and running in a completely isolated environment. Any task that can be performed on a physical computer can also be performed in a VM. When creating a VM, a portion of the physical machine's hard drive and memory capacity is used as the VM's hard drive and memory capacity. Each VM has its own independent CMOS, hard drive, and operating system, and can be operated just like a physical machine.

[0045] 5. The Binder communication mechanism is an inter-process communication (IPC) mechanism in the Android system based on a client-server architecture. It has the advantages of high efficiency and security in data transmission and exchange.

[0046] With the continuous development of my country's automotive industry, the intelligent cockpit field is supporting more and more business scenarios. The current mainstream technical approach is to build multiple virtual machines on a Hypervisor (Virtual Machine Monitor, VMM) to deploy multiple operating systems, with these operating systems isolated from each other.

[0047] These virtual machines can be divided into host virtual machines, which assume a control role, and guest virtual machines, which perform functional tasks. Typically, the host virtual machine has the highest privileges, can manage the various guest virtual machines, and can access their data via shared memory. To ensure the security of the hypervisor, the guest virtual machines are isolated from each other; therefore, how to achieve communication between multiple different virtual machines is a problem that urgently needs to be solved in this field.

[0048] Please refer to Figure 1. Currently, the Hypervisor (i.e., the virtual machine monitor in Figure 1) typically allocates shared memory to each Guest virtual machine based on their request messages. For example, in Figure 1, with Guest virtual machine 1 (i.e., Guest virtual machine 1 in Figure 1) as the sender (Client) and Guest virtual machine 2 (i.e., Guest virtual machine 2 in Figure 1) as the receiver (Server), Guest virtual machine 1 and Guest virtual machine 2 access the same shared memory to enable communication between them.

[0049] While this method enables communication between Guest virtual machines, the fact that multiple Guest virtual machines directly access the same shared memory region raises security risks, such as malicious access and data leaks (e.g., unauthorized access by a malicious Guest virtual machine or unauthorized access to the memory of other Guest virtual machines), can occur if access control is not strictly enforced. Furthermore, malicious attackers can directly tamper with data in shared memory, disrupting communication and collaboration between virtual machines. Additionally, for Guest virtual machines running on different operating systems, differences in memory management and thread scheduling complicate shared memory management and synchronization, making compatibility across different systems difficult.

[0050] To address the aforementioned technical problems, embodiments of this application provide a communication method.

[0051] The following describes one application scenario of the technical solution of this application. As shown in Figure 2, the communication method provided by this application can be applied to the application scenario shown in Figure 2. The communication method is applied to a communication system 1000, which includes a sub-virtual machine 100 (i.e., a Guest virtual machine) and a main virtual machine 200 (i.e., a Host virtual machine).

[0052] Optionally, the sub-virtual machine 100 is used to execute various tasks, and the master virtual machine 200 is used to manage the sub-virtual machines 100.

[0053] Optionally, the sub-virtual machine 100 is built on the main virtual machine 200 and the Hypervisor (i.e., the virtual machine monitor in Figure 2).

[0054] It should be noted that Figure 2 is only an example. In reality, the number of sub-virtual machines 100 and main virtual machines 200 is not limited, and no specific limitation is made in this embodiment.

[0055] The communication method of this application will be described in detail below:

[0056] Please refer to Figures 2 and 3. An embodiment of this application provides a communication method, which includes:

[0057] Step 011: Obtain the communication data of the first virtual machine. The communication data includes the second virtual machine as the receiving end. The first virtual machine and the second virtual machine are isolated from each other.

[0058] The first virtual machine can be either a host virtual machine or a guest virtual machine; the second virtual machine can also be either a host virtual machine or a guest virtual machine. The communication data can be in the form of text, images, audio, video, etc. When the first virtual machine performs a task that requires interaction with virtual machines or processes, communication data will be generated. The communication data includes information about the second virtual machine as the receiving end (such as address information (Internet Protocol Address, IP)).

[0059] Specifically, one or more Guest virtual machines can be created based on the Host virtual machine and the Hypervisor. The Guest virtual machines are virtualization instances running on the Host virtual machine. To ensure system security, the virtual machines created on the Hypervisor are isolated from each other. By obtaining communication data from the first virtual machine (the sender), which includes information about the second virtual machine (the receiver), such as its IP address, the receiver (Server), sender (Client), and content of the communication can be determined.

[0060] Step 012: If the first virtual machine and the second virtual machine are different virtual machines, the communication data is sent to the second virtual machine based on the preset global routing table.

[0061] The global routing table is a record table that records the routing information of each virtual machine (such as the IP information and routing identifier of each virtual machine). Based on the global routing table, communication data can be routed to the corresponding virtual machines.

[0062] Specifically, the IP addresses in the global routing table can be used to determine whether the first virtual machine and the second virtual machine are the same virtual machine. If the first and second virtual machines are different virtual machines, communication data is routed from the first virtual machine to the second virtual machine based on the global routing table. For example, if the first and second virtual machines are different Guest virtual machines, since both Guest virtual machines have global routing tables (meaning both can determine the IP addresses and routes of each virtual machine), communication data can be transmitted from the first virtual machine (i.e., the first Guest virtual machine) to the second virtual machine (i.e., the second Guest virtual machine) based on the global routing table. This ensures the security of system communication while completing the transmission of communication data.

[0063] Thus, by acquiring communication data from the first virtual machine, including the second virtual machine (such as its IP information) as the receiving end, and ensuring the security and independence of each virtual machine by isolating the first and second virtual machines, communication data is sent to the second virtual machine based on a preset global routing table when the first and second virtual machines are different. In the communication between the first and second virtual machines, the preset global routing table ensures that communication data is correctly routed to the corresponding second virtual machine, avoiding data loss and transmission errors, thus ensuring communication accuracy. Since communication does not require multiple virtual machines to access shared memory, it also prevents malicious access, unauthorized access, and malicious tampering of data in shared memory, improving system security and isolation, and meeting the communication needs between different virtual machines.

[0064] Please refer to Figure 4. Optionally, the communication method also includes:

[0065] Step 013: When creating a virtual machine, allocate an address to the virtual machine being created;

[0066] Step 014: Create or update the global routing table based on the address.

[0067] The address can be an IP address.

[0068] Specifically, when creating multiple virtual machines on the hypervisor, IP addresses can be assigned to each virtual machine through manual configuration or Dynamic Host Configuration Protocol (DHCP), and a global routing table can be created based on each IP address. If a virtual machine without an IP address is detected (such as when a newly created virtual machine is detected), an IP address is assigned to the newly created virtual machine, and the global routing table is updated based on the newly assigned IP address.

[0069] For example, taking the creation of a new Guest virtual machine based on the Hypervisor, the assignment of an IP address to the Guest virtual machine, and the initiation of an update request to the global routing table as an example, the Host virtual machine can obtain the IP address of the Guest virtual machine through the virtualization I / O interface, and update the global routing table based on the IP address to obtain the updated global routing table.

[0070] In other words, a global routing table can be generated based on the IP addresses of each virtual machine when multiple virtual machines are created, and the IP address of the new virtual machine can be added to the global routing table when a new virtual machine is created to update the global routing table; or, a global routing table can be generated based on the IP address of the first virtual machine when the first virtual machine is created, and then the global routing table can be continuously updated based on the IP addresses of the second and subsequent virtual machines to generate a preset global routing table.

[0071] Referring to Figure 5, in some implementations, the virtual machines are isolated from each other, and the global routing table includes global routing information between the master virtual machine and each child virtual machine. Step 012: When the first virtual machine and the second virtual machine are different virtual machines, based on the preset global routing table, the communication data is sent to the second virtual machine, including:

[0072] Step 0121: When both the first virtual machine and the second virtual machine are child virtual machines, based on the preset global routing table, the communication data is sent to the master virtual machine and then forwarded to the second virtual machine through the master virtual machine;

[0073] Step 0122: When the first virtual machine is a child virtual machine and the second virtual machine is the master virtual machine, communication data is sent to the second virtual machine based on the preset global routing table.

[0074] The global routing table includes global routing information between the master virtual machine and each child virtual machine. Based on the global routing information in the global routing table, routing can be performed to complete communication between virtual machines.

[0075] Specifically, when both the first and second virtual machines are Guest virtual machines, the IP address and routing path of the second virtual machine receiving communication data are determined based on a preset global routing table. The communication data is then sent to the Host virtual machine via a virtual network, and then forwarded by the Host virtual machine to the second virtual machine (the receiving end) via the virtual network. This maintains the isolation between Guest virtual machines, thus ensuring system security. Conversely, when the first virtual machine is a Guest virtual machine and the second virtual machine is a Host virtual machine, the first virtual machine is routed based on the preset global routing table to send communication data to the Host virtual machine via the virtual network, thus completing the communication. Forwarding via the Host virtual machine ensures that the isolation between virtual machines remains unaffected, improving system security.

[0076] Optionally, both the first virtual machine and the second virtual machine communicate through the same preset process communication mechanism.

[0077] Among them, the process communication mechanism includes the Binder communication mechanism.

[0078] Both Linux and Android are operating systems, and virtual machines can run on both. Because Linux and Android use different communication mechanisms, to improve compatibility and enable cross-system communication between virtual machines running on Linux and Android, virtual machines running on Linux need to be equipped with components that also implement the Binder mechanism.

[0079] Please refer to Figure 6. In some embodiments, the communication method further includes:

[0080] Step 015: Identify the target virtual machine that does not contain the preset inter-process communication mechanism among all virtual machines;

[0081] Step 016: Add the component corresponding to the preset process communication mechanism to each target virtual machine to build the preset process communication mechanism in each target virtual machine.

[0082] Specifically, to ensure compatibility with the Android system's Binder communication mechanism, it's possible to identify target virtual machines (such as those running on Linux) that lack the Binder communication mechanism. These target virtual machines lack the necessary communication components for implementing Binder communication. Therefore, the Binder framework of these target virtual machines can be restructured by adding components corresponding to the Binder communication mechanism (such as Binder driver components) to each target virtual machine. This allows the Binder communication mechanism to be built in each target virtual machine, enabling efficient and secure communication when sending data.

[0083] For example, referring to Figure 7, let's take adding a first component 10, a second component 20, a third component 30, a fourth component 40, and a fifth component 50 to the target virtual machine. Here, the first component 10 is the ServiceManager component 10, the second component 20 is the BinderProxy component 20, the third component 30 is the BBinder component 30, the fourth component 40 is the BpBinder component 40, and the fifth component 50 is the Binder driver component 50. The ServiceManager component 10 is used to start and manage system processes, and to register and search for services. The BinderProxy component 20 is used for client-side data access. The BBinder component 30 represents the inter-process communication interface for Binder local objects, the BpBinder component 40 represents the inter-process communication interface for Binder proxy objects, and the Binder driver component 50 is used to drive communication. By adding components corresponding to each Binder communication mechanism, the target virtual machine can implement Binder communication.

[0084] After building the same pre-defined process communication mechanism (i.e., Binder communication mechanism) for virtual machines running on various systems, it is also necessary to consider how to implement virtual network services between different systems.

[0085] Taking the widely used Vsock (a socket type for virtualization environments that can establish network connections between Host and Guest virtual machines) as an example, in Vsock, the Host virtual machine has permission to access the memory address of the Guest virtual machine. Therefore, the convenience of Vsock communication is more reflected in the transmission efficiency between the Host and Guest virtual machines.

[0086] However, when communicating between two Guest virtual machines, since the two Guest virtual machines are isolated from each other, the Guest virtual machine cannot locate the memory address of the other Guest virtual machine, and data transfer cannot be achieved through Vsock.

[0087] Optionally, the virtual machines communicate with each other through a device virtualization network, which is implemented based on the Virtio technology framework.

[0088] The transmission protocol defined by the Virtio technology framework is the device virtualization network. Virtio is a technology used to provide a unified communication framework and programming interface between virtual machines and hypervisor devices, in order to reduce compatibility issues caused by cross-platform compatibility and improve program development efficiency. In other words, Virtio is a technology that establishes a communication channel between host virtual machines and guest virtual machines based on virtualization technology.

[0089] Optionally, the virtualization network completed by the Host virtual machine is defined as Vhost, and the virtual machine network completed by the Guest virtual machine is defined as Virtio-net.

[0090] Specifically, virtualization management tools (such as libvirt, an open-source daemon and management tool for managing virtualization platforms) can be used to configure the corresponding Virtio-net network interface and network parameters for each Guest virtual machine. In other words, the corresponding device virtualization network component can be configured for each Guest virtual machine, and Virtio network communication between virtual machines can be achieved based on the Virtio driver and each device virtualization network component.

[0091] It is understandable that Virtio creates and updates a pre-defined global routing table, and based on this global routing table, it enables the transmission of communication data from the first virtual machine to the second virtual machine. During the data transmission process, it is easier to build a communication network without having to consider whether the data transmission object is the host virtual machine, which can improve the applicability of communication. Moreover, compared with communication methods such as Vsock, Virtio also has the advantages of greater flexibility and universality.

[0092] Please refer to Figure 8. In some embodiments, step 0121: When both the first virtual machine and the second virtual machine are child virtual machines, communication data is sent to the master virtual machine based on a preset global routing table, and the communication data is forwarded to the second virtual machine through the master virtual machine, including:

[0093] Step 01211: Based on the global routing table, the address of the first virtual machine, the address of the second virtual machine, and the address of the master virtual machine, establish the first communication link between the first virtual machine and the master virtual machine, and the second communication link between the second virtual machine and the master virtual machine;

[0094] Step 01212: Based on the first communication link, control the first virtual machine to send communication data to the main virtual machine;

[0095] Step 01213: Based on the second communication link, control the main virtual machine to forward communication data to the second virtual machine.

[0096] Specifically, a first communication link can be established between the first virtual machine and the master virtual machine based on the address of the first virtual machine and the address of the master virtual machine included in the global routing table. A second communication link can be established between the second virtual machine and the master virtual machine based on the address of the second virtual machine and the address of the master virtual machine. When both the first virtual machine and the second virtual machine are child virtual machines, the first virtual machine is controlled to send communication data to the master virtual machine based on the first communication link. After receiving the communication data, the master virtual machine is controlled to forward the communication data to the second virtual machine.

[0097] For example, referring to Figure 9, taking the first virtual machine as sub-virtual machine 103 (i.e., Guest virtual machine 103) and the second virtual machine as sub-virtual machine 104 (i.e., Guest virtual machine 104) as an example, the following is an explanation: by establishing a corresponding first network 11 (i.e., Virtio-net 11) in Guest virtual machine 103 and a corresponding second network 12 (i.e., Virtio-net 12) in Guest virtual machine 104, and establishing a third network 21 (i.e., Vhost 21) in host virtual machine 201 (i.e., Host virtual machine 201), a first communication link is established between Guest virtual machine 103 and Host virtual machine 201 based on the address of Guest virtual machine 103 and the address of Host virtual machine 201, and a second communication link is established between Guest virtual machine 104 and Host virtual machine 201 based on the address of Guest virtual machine 104 and the address of Host virtual machine 201. Communication data is transmitted from Guest virtual machine 103 to Host virtual machine 201 via the first communication link, and then forwarded from Host virtual machine 201 to Guest virtual machine 104 via the second communication link.

[0098] Please refer to Figure 10. Optionally, step 01212: Based on the first communication link, control the first virtual machine to send communication data to the main virtual machine, including:

[0099] Step 01214: Register the device virtualization network component in the remote call component corresponding to the preset process communication mechanism;

[0100] Step 01215: Invoke the device virtualization network component to send communication data to the host virtual machine via the first communication link.

[0101] Among them, the remote call component (RpcSession) can be a communication component used to forward communication data.

[0102] Specifically, when the first virtual machine and the second virtual machine are different virtual machines, the device virtualization network components required by Virtio-net are registered in RpcSession, and then the device virtualization network components are called to transmit communication data to the Host virtual machine through Virtio-net.

[0103] For example, referring to Figures 7 and 9, taking Guest virtual machine 103 as the first virtual machine and Guest virtual machine 104 as the second virtual machine as an example, when Guest virtual machine 103 initiates a communication request, by obtaining the communication data of Guest virtual machine 103, which includes the IP of Guest virtual machine 104, Guest virtual machine 103 transmits the communication data from the Client to the BpBinder component by calling the BinderProxy component of the sending end 13 (i.e., the Client end 13). (For example, by calling the Proxy Class (i.e., the substitute class) in the BinderProxy component and calling the writeParcelable() method in the Parcel class (i.e., the container), and transmitting the data to the BpBinder component through the transact() method in the base class IBinder (i.e., the interface). The BpBinder component transmits the data to RpcSession through methods such as transact(). Since the device virtualization network component required by Virtio-net has been registered in RpcSession, the communication data can be transmitted to the Host virtual machine 201 based on Virtio-net 11 by calling the device virtualization network component. The `writeParcelable()` method is used to serialize an object into a byte stream for transmission or persistent storage between different components, while the `transact()` method is used to perform a set of related operations in a database system and maintain data consistency throughout these operations.

[0104] Host virtual machine 201 establishes communication with Guest virtual machine 104 through Vhost21 to transmit communication data to Guest virtual machine 104. For Guest virtual machine 104, communication data enters the receiving end 14 (i.e., Server end 14) of Guest virtual machine 104 from the device virtualization network component required by Virtio-net 12. The RpcSession of Guest virtual machine 104 transmits the communication data to the BBinder component of Guest virtual machine 104. The BBinder component of Guest virtual machine 104 receives the communication data transmitted by RpcSession through the onTransact() method and forwards it to IBinder. Guest virtual machine 104 retrieves the communication data through the onTransact() method in IBinder and the readParcelable() method in the Parcel class. In this way, cross-system and cross-domain communication between the first and second virtual machines is possible even when the first and second virtual machines are different. The onTransact() method is used to handle inter-process communication requests, and the readParcelable() method is used to read data.

[0105] Please refer to Figure 11. In some embodiments, the communication method further includes:

[0106] Step 017: If the first virtual machine and the second virtual machine are the same virtual machine, determine the target process within the same virtual machine;

[0107] Step 018: The driver component, based on the preset process communication mechanism, transmits communication data to the target process.

[0108] Specifically, when the first virtual machine and the second virtual machine are the same virtual machine, that is, when the transmission of communication data occurs within the same virtual machine, the target process can be determined, and the Binder driver component can be called based on IPC in the Binder communication mechanism to transmit the communication data to the target process.

[0109] For example, when the first virtual machine and the second virtual machine are the same virtual machine, the transact() method in the ThreadState class (a class that describes the state of a thread or manages the state transitions of a thread) based on the IPC mechanism transmits the communication data from the client to the Binder driver component corresponding to the Binder communication mechanism. Then, the Binder driver component is called to allocate a shared memory space vm_area through the mmap function and establish a mapping between the shared memory space vm_area and binder_buffer. On the server side of the first virtual machine, the communication data sent by the client is received through IPC communication and then passed to BBinder, thereby completing the intra-domain communication of the first virtual machine.

[0110] Thus, regardless of whether the first and second virtual machines are the same virtual machine, based on the Binder mechanism, virtual machines running on different systems can achieve cross-system communication while maintaining compatibility with their own inter-process communication. Furthermore, network interconnection between virtual machines is achieved through Virtio, resulting in high communication efficiency, security, and portability.

[0111] Referring to Figure 12, to facilitate better implementation of the communication method of the embodiments of this application, this application also provides a communication device 300. The communication device 300 may include an acquisition module 301 and a transmission module 302. The acquisition module 301 is used to acquire communication data of a first virtual machine, the communication data including a second virtual machine as the receiving end, the first virtual machine and the second virtual machine being isolated from each other. The transmission module 302 is used to send the communication data to the second virtual machine based on a preset global routing table when the first virtual machine and the second virtual machine are different virtual machines.

[0112] In one embodiment, the virtual machines are isolated from each other, and the global routing table includes global routing information between the master virtual machine and each child virtual machine in each virtual machine. The sending module 302 is further configured to send communication data to the master virtual machine based on the preset global routing table when both the first virtual machine and the second virtual machine are child virtual machines, and forward the communication data to the second virtual machine through the master virtual machine; when the first virtual machine is a child virtual machine and the second virtual machine is the master virtual machine, send communication data to the second virtual machine based on the preset global routing table.

[0113] In one embodiment, the sending module 302 is further configured to establish a first communication link between the first virtual machine and the master virtual machine, and a second communication link between the second virtual machine and the master virtual machine, based on the global routing table, the address of the first virtual machine, the address of the second virtual machine, and the address of the master virtual machine; control the first virtual machine to send communication data to the master virtual machine based on the first communication link; and control the master virtual machine to forward communication data to the second virtual machine based on the second communication link.

[0114] In one embodiment, the sending module 302 is further configured to register a device virtualization network component in the remote call component corresponding to the preset process communication mechanism; and call the device virtualization network component to send communication data to the main virtual machine through the first communication link.

[0115] In one embodiment, the communication device 300 further includes a creation module 303, which is used to assign an address to the virtual machine when creating the virtual machine; and to create or update a global routing table based on the address.

[0116] In one embodiment, the communication device 300 further includes a construction module 304, which is used to determine the target virtual machines that do not contain a preset process communication mechanism in each virtual machine; and to add components corresponding to the preset process communication mechanism in each target virtual machine to construct the preset process communication mechanism in each target virtual machine.

[0117] In one embodiment, the communication device 300 further includes a transmission module 305, which is used to determine the target process within the same virtual machine when the first virtual machine and the second virtual machine are the same virtual machine; and to transmit communication data to the target process based on a driver component of a preset process communication mechanism.

[0118] The communication device 300 has been described above from the perspective of functional modules with reference to the accompanying drawings. These functional modules can be implemented in hardware, in software instructions, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in this application can be completed by integrated logic circuits in the processor's hardware and / or by software instructions. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware encoding processor, or execution by a combination of hardware and software modules in the encoding processor. Optionally, the software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps in the above method embodiments.

[0119] The electronic device according to the embodiments of this application includes a processor connected to a memory, which stores a computer program. The processor executes the computer program to implement the communication method described in any of the above-mentioned embodiments. For the sake of brevity, it will not be described in detail here.

[0120] Please refer to Figure 13, in which the electronic device can serve as the vehicle's processor and can be installed in the vehicle to enable the vehicle to implement the communication method of any of the above embodiments via the electronic device.

[0121] The vehicle described in this application includes the communication device or electronic device described in the above embodiments, such as a vehicle processor. The vehicle implements the communication method described in any of the above embodiments through the communication device or electronic device.

[0122] In one embodiment, the internal structure of the vehicle may be as shown in FIG13, including a processor 402, a memory 403, a network interface 404, a display screen 401, and an input device 405 connected via a system bus.

[0123] The vehicle's processor 402 provides computing and control capabilities. The vehicle's memory 403 includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The vehicle's network interface 404 is used for communication with external devices via a network connection. When the computer program is executed by the processor, it implements the communication method of any of the above embodiments. The vehicle's display screen 401 can be a liquid crystal display screen or an e-ink display screen. The vehicle's input device 405 can be a touch layer covering the display screen 401, or it can be a button, trackball, or touchpad installed on the vehicle, or it can be an external keyboard, touchpad, or mouse, etc.

[0124] Those skilled in the art will understand that the structure shown in Figure 13 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0125] Please refer to Figure 14. This application also provides a computer-readable storage medium 600, on which a computer program 610 is stored. When the computer program 610 is executed by the processor 620, the steps of the communication method of any of the above embodiments are implemented. For the sake of brevity, they will not be described in detail here.

[0126] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this invention and simplifying the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.

[0127] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0128] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," "linking," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0129] In this invention, unless otherwise explicitly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature is in indirect contact with the second feature through an intermediate medium. Furthermore, "above," "over," and "on top" of the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply that the first feature is at a lower horizontal level than the second feature.

[0130] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0131] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

A communication method, wherein, include: Acquire communication data of a first virtual machine, the communication data including a second virtual machine as the receiving end, the first virtual machine and the second virtual machine being isolated from each other; If the first virtual machine and the second virtual machine are different virtual machines, the communication data is sent to the second virtual machine based on a preset global routing table. The communication method according to claim 1, wherein, The virtual machines are isolated from each other. The global routing table includes global routing information between the master virtual machine and each child virtual machine. Sending the communication data to the second virtual machine based on the preset global routing table includes: When both the first virtual machine and the second virtual machine are child virtual machines, the communication data is sent to the main virtual machine based on a preset global routing table, and then forwarded to the second virtual machine through the main virtual machine. When the first virtual machine is the sub-virtual machine and the second virtual machine is the master virtual machine, the communication data is sent to the second virtual machine based on a preset global routing table. The communication method according to claim 1 or 2, wherein, Both the first virtual machine and the second virtual machine communicate through the same preset process communication mechanism. The communication method according to claim 3, wherein, The process communication mechanism includes the Binder communication mechanism. The communication method according to claim 2 or 3, wherein, The step of sending the communication data to the main virtual machine based on a preset global routing table, and then forwarding the communication data to the second virtual machine through the main virtual machine, includes: Based on the global routing table, the address of the first virtual machine, the address of the second virtual machine, and the address of the master virtual machine, a first communication link between the first virtual machine and the master virtual machine, and a second communication link between the second virtual machine and the master virtual machine are established. Based on the first communication link, control the first virtual machine to send the communication data to the main virtual machine; Based on the second communication link, the master virtual machine is controlled to forward the communication data to the second virtual machine. The communication method according to claim 5, wherein, The step of controlling the first virtual machine to send the communication data to the master virtual machine based on the first communication link includes: Register the device virtualization network component in the remote call component corresponding to the preset process communication mechanism; The device virtualization network component is invoked to send the communication data to the main virtual machine via the first communication link. The communication method according to any one of claims 1-6, wherein, Also includes: When creating a virtual machine, an address is assigned to the virtual machine being created; Based on the address, create or update the global routing table. The communication method according to any one of claims 1-6, wherein, Also includes: Identify the target virtual machines among the virtual machines that do not contain the default inter-process communication mechanism; Add the component corresponding to the preset process communication mechanism to each of the target virtual machines to build the preset process communication mechanism in each of the target virtual machines. The communication method according to claim 1, wherein, Also includes: If the first virtual machine and the second virtual machine are the same virtual machine, determine the target process within the same virtual machine; The driver component, based on a preset process communication mechanism, transmits the communication data to the target process. The communication method according to any one of claims 1-9, wherein, The virtual machines communicate with each other through a device virtualization network, which is implemented based on the Virtio technology framework. An electronic device, wherein, include: Processor, the processor being connected to memory; The memory stores a computer program, and the processor executes the computer program to implement the instructions of the communication method according to any one of claims 1 to 10. A type of vehicle, in which, include: The electronic device according to claim 11. A non-volatile computer-readable storage medium containing a computer program, wherein, When the computer program is executed by a processor, the processor performs the communication method according to any one of claims 1-10.

Citation Information

Patent Citations

  • Method for processing data in vehicle and related equipment

    CN114880658A

  • Cloud environment access method and device

    CN116599900A

  • Data transmission method and device, electronic equipment and storage medium

    CN117014390A

  • Tenant communication method and device, electronic equipment and storage medium

    CN117792995A

  • Communication method, electronic device, vehicle and storage medium

    CN118474027A