A high-efficiency data exchange system and method between dual hosts
By mapping the physical address of the data exchange card to user space using IOMMU technology, the problems of underutilization of hardware performance and low efficiency in session information lookup between two hosts are solved, thus achieving efficient and secure data exchange.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-02
- Publication Date
- 2026-03-20
AI Technical Summary
Existing methods for communication between two hosts suffer from underutilization of hardware performance and low efficiency in finding session information in high-concurrency scenarios, resulting in low data forwarding efficiency.
The IOMMU technology is used to directly map the physical address of the data exchange card to user space, reducing the frequent copying of data between user space and kernel space, and improving session lookup efficiency by directly passing the virtual address of the session through the process.
It improves data transmission and reception efficiency, reduces the number of data transfers, enhances the efficiency and security of the data exchange process, and avoids the impact of malicious attacks on the process.
Smart Images

Figure CN114328287B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a kind of double host efficient data exchange system and method, belong to data communication technical field. BACKGROUND
[0002] The vigorous development of Internet brings the frequent large-scale information interaction demand between private network and public network, requires private network to have the characteristics of "extensive interconnection, open interaction", while being able to effectively aim at the increasingly high-level, organized and continuous malicious attacks of network boundary. In the face of increasingly severe network security situation, private network and public network usually communicate by non-network mode, implement logical strong isolation protection to private network, effectively guarantee the security of private network.
[0003] The system using non-network communication usually adopts the hardware structure of two hosts plus a data exchange card, when network data reaches any one of the double hosts, the network protocol part in message needs to be stripped, and the valid user data is extracted, and then the data exchange between the double hosts is carried out through the data exchange card through private communication protocol. The conversion between network protocol and private communication protocol will consume a large amount of hardware resources of host, and the data forwarding efficiency is not high. The emergence of emerging network technologies such as DPDK greatly improves the network packet receiving and sending efficiency of the system, so the data exchange efficiency between the double hosts directly affects the communication efficiency between the network domains.
[0004] The current communication mode between the double hosts has the following shortcomings:
[0005] A, under the condition that the hardware performance of general data exchange card is sufficient, the traditional software architecture (including driver and user program) is unreasonable, which cannot exert the maximum hardware performance of data exchange card;
[0006] B, in high concurrency scenario, host will maintain many sessions at the same time. When host receives the message of opposite host, how to quickly and accurately find the session information according to the message content will directly affect the data forwarding efficiency. SUMMARY
[0007] The purpose of the present application is to provide a kind of double host efficient data exchange system and method, by using IOMMU technology, process directly reads and writes, less data handling times, improves the data receiving and sending efficiency.
[0008] To achieve the above purpose, the technical scheme adopted by the present application is as follows:
[0009] The present application provides a kind of double host efficient data exchange system, including host A, host B and data exchange card, the data exchange card is connected with host A and host B respectively through PCI-E interface;
[0010] The data exchange card maps a virtual address space in the host A and the host B respectively;
[0011] The data exchange card is used for copying a message stored in a virtual address space of one host to a virtual address space of another host, so as to realize data exchange between the two hosts.
[0012] The application further provides a high-efficiency data exchange method between two hosts, comprising:
[0013] establishing a mapping relationship between sessions needing to be exchanged in the two hosts;
[0014] filling and forming a message based on the mapping relationship between the sessions;
[0015] copying the message to a virtual address space of a data exchange card mapped to a user space of a host by a process;
[0016] carrying the message from the virtual address space to a physical address space of the data exchange card by the host, so as to complete sending of the message;
[0017] copying the message stored in the physical address space to a virtual address space of another host by the data exchange card;
[0018] directly copying data from the virtual address space of the host by a process of the host, so as to complete receiving of the message.
[0019] Further, the establishing of the mapping relationship between the sessions needing to be exchanged in the two hosts comprises:
[0020] filling the virtual address of the idle session E to a source session virtual address of the message 1 by a process C in the host A, and sending the message 1 to a process D of the host B;
[0021] extracting the source session virtual address in the message 1 by the process D, and binding the source session virtual address with an idle session F in the process D;
[0022] filling the extracted source session virtual address to a destination session virtual address of the message 2, filling the virtual address of the idle session F to a source session virtual address of the message 2, and sending the message 2 to the process C;
[0023] extracting the source session virtual address in the message 2 by the process C according to the destination session virtual address in the message 2, and binding the source session virtual address with a session E, so that the mapping relationship between the session E and the session F is established.
[0024] Further, the application further comprises:
[0025] checking the legality of the destination session virtual address in the message 2 by the process C, and binding the session if the destination session virtual address is legal.
[0026] Further, the legality check comprises:
[0027] Add all session virtual addresses in the process C to a table, check whether the destination session virtual address in the message 2 is in the table, and if yes, it is legal.
[0028] Further, the message comprises a message header, a destination session virtual address, a source session virtual address and message content;
[0029] The filling based on the inter-session mapping relationship to form the message comprises:
[0030] The filling of the message header comprises a message type, a subtype and a valid data length;
[0031] The filling of the message content comprises a request content of the process C to the process D for initiating a new session;
[0032] The virtual address of the session F is filled to the destination session virtual address of the message 3, and the virtual address of the session E is filled to the source session virtual address of the message 3.
[0033] The present application has the following beneficial effects:
[0034] (1) The present application directly maps the device physical address of the data exchange card to the user state through the IOMMU technology, for use of the user state process, reduces the frequent copying of data between the user state and the kernel state, and improves the data transceiving efficiency;
[0035] (2) In the data exchange process of the present application, the process C and the process D respectively in the host A and the host B directly deliver the virtual address of the session in the session mapping, improving the efficiency of the session search; and the process C or the process D firstly checks the legality of the session virtual address when analyzing the message, avoiding the process exception caused by malicious attacks. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1 It is the double-host data exchange system architecture of the present application;
[0037] Figure 2 It is the device address mapping diagram of the data exchange card in the present application;
[0038] Figure 3 It is the communication session diagram between the double hosts in the embodiment of the present application;
[0039] Figure 4 It is the session communication mechanism between the double hosts in the embodiment of the present application. DETAILED DESCRIPTION
[0040] The application is further described below. The following examples are only used to more clearly illustrate the technical solutions of the application, and cannot be used to limit the protection scope of the application.
[0041] The application provides a high-efficiency data exchange system between two hosts, referring to Figure 1 The hardware for data exchange between the two hosts comprises a host A, a host B and a data exchange card.
[0042] Referring to Figure 2 The host converts the physical address of the data exchange card into a virtual address accessible by the user process through IOMMU.
[0043] Based on the above system, the application provides a high-efficiency data exchange method between two hosts, comprising:
[0044] establishing a mapping relationship between the sessions that need to be exchanged in the two hosts;
[0045] filling and forming a message based on the mapping relationship between the sessions;
[0046] copying the message to the virtual address space in the host user space through the process;
[0047] carrying the message from the virtual address space to the physical address space of the data exchange card through the host to complete the sending of the message;
[0048] copying the message stored in the physical address space to the virtual address space of the other host through the data exchange card;
[0049] directly copying the data from the virtual address space of the host through the process of the host to complete the receiving of the message.
[0050] In the application, the communication message between the hosts comprises a message header, a destination session virtual address, a source session virtual address and a message content.
[0051] In one specific embodiment of the application, as shown in Figure 3 , the host A comprises a data process C, the process C comprises a session E, the host B comprises a process D, the process D comprises a session F, the process C and the process D are processes that can access the data exchange card, and the session E and the session F are one of a plurality of sessions.
[0052] Based on the above data exchange method between the two hosts, referring to Figure 4 the sessions between the two hosts are completed through a plurality of messages, and the method comprises the following steps:
[0053] Step 1: When process C synchronizes with process D, process C first selects an idle session E, then fills the virtual address of session E into the source session virtual address of message 1, and sends message 1 to process D;
[0054] Step 2: After process D receives message 1 from process C, process D selects an idle session F, and extracts the source session virtual address (the virtual address of session E) in message 1 to bind with session F;
[0055] Step 3: Process D fills the virtual address of session E into the destination session virtual address of message 2, fills the virtual address of session F into the source session virtual address of message 2, and sends message 2 to process C;
[0056] Step 4: After process C receives message 2 sent by process D, process C first checks the legality of the destination session virtual address in message 2, then quickly finds session E according to the virtual address, extracts the source session virtual address (the virtual address of session F) in message 2 to bind with session E, and the mapping relationship between session E and session F is established at this time;
[0057] Step 5: When session E in process C synchronizes data with session F in process D, process C first fills the message header and message content of message 3, then fills the virtual address of session F into the destination session virtual address of message 3, and fills the virtual address of session E into the source session virtual address of message 3.
[0058] Step 6: Process C directly copies the filled message 3 to the virtual address space of the data exchange card mapped to the user space of host A, and host A directly carries message 3 to the physical address space of the data exchange card to complete the sending of the message.
[0059] Step 7: When host B receives the message, process D is notified to directly copy data from the virtual address space of the data exchange card mapped to host B to complete the reception of the message;
[0060] Step 8: After process D receives message 3 sent by process C, process D first checks the legality of the destination session virtual address in message 3, then quickly finds session F according to the virtual address, and thus process C and process D establish a new pair of sessions, i.e. session E and session F, and after that, process C and process D can send data to each other through the new pair of sessions.
[0061] Step 9: If session F in process D synchronizes data with session E in process C, it is similar to steps 5-8.
[0062] In the embodiment, the legality of the destination session virtual address in message 2 is checked as follows:
[0063] All session virtual addresses in process C are added to a table, and the destination session virtual address in message 2 is checked against the table, and if it is in the table, it is legal.
[0064] Similarly, to check the legality of the destination session virtual address in message 3, all session virtual addresses in process D are added to a table, and the destination session virtual address in message 3 is checked against the table.
[0065] In this embodiment, the filling of the message header includes the message type, the subtype, and the valid data length.
[0066] The filling of the message content includes the content of the request of process C to process D to initiate a new session, which can include the detailed information of session E.
[0067] In this embodiment, the data exchange card respectively maps a virtual address space in host A and host B.
[0068] According to the application, by mapping a virtual address space in host A and host B respectively, the process can directly read and write the virtual address space, and the operation of the virtual address space of the data exchange card is equivalent to the operation of the physical address space of the data isolation card.
[0069] Noun explanation
[0070] IOMMU, the full name of which is Input / Output Memory Management Unit, is mainly used to connect the DMA-capable I / O bus and the main memory.
[0071] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0072] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0073] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0074] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0075] Finally, it should be noted that the above-mentioned embodiments are merely intended to illustrate the technical solutions of the present application, but not to limit the same. Although the present application has been described in detail with reference to the above-mentioned embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or equivalent replaced without departing from the spirit and scope of the present application, and any modification or equivalent replacement should be covered within the scope of protection of the claims of the present application.
Claims
1. A method for efficient data exchange between two hosts, characterized in that, Based on a high-efficiency data exchange system between two hosts, the system includes host A, host B and a data exchange card, and the data exchange card is connected to host A and host B respectively through a PCI-E interface; The data exchange card maps a virtual address space in host A and host B respectively; The data exchange card is used to copy messages stored in the virtual address space of one host to the virtual address space of another host, thereby realizing data exchange between the two hosts. The method includes: Establish a mapping relationship between the sessions that need to be exchanged on the two hosts, including: The virtual address of idle session E is filled into the source session virtual address of message 1 by process C in host A, and message 1 is sent to process D in host B. The source session virtual address in message 1 is extracted by process D and bound to the idle session F in process D; Process D fills the source session virtual address of message 2 with the extracted source session virtual address, fills the source session virtual address of message 2 with the virtual address of idle session F, and sends message 2 to process C. Process C locates session E based on the destination session virtual address in message 2, extracts the source session virtual address from message 2, and binds it to session E. At this point, the mapping relationship between session E and session F is established. Based on the mapping relationship between sessions, messages are populated to form the message; The process copies messages to the data exchange card and maps them to the virtual address space of the host user space; The host moves the message from the virtual address space to the physical address space of the data exchange card to complete the message sending; The data exchange card copies messages stored in the physical address space to the virtual address space of another host. The message is received by having a process on another host directly copy data from the virtual address space of that host.
2. The efficient data exchange method between two hosts according to claim 1, characterized in that, It also includes, Process C checks the validity of the destination session virtual address in message 2; if valid, session binding is then performed.
3. The efficient data exchange method between two hosts according to claim 2, characterized in that, Legality checks include: Add all session virtual addresses in process C to a table, and check if the destination session virtual address in message 2 is in this table. If it is, then it is valid.
4. The efficient data exchange method between two hosts according to claim 1, characterized in that, The message includes a message header, a destination session virtual address, a source session virtual address, and a message content; The process of filling in messages based on the mapping relationship between sessions includes: The message header is padded with message type, subtype, and valid data length; The message content includes the request from process C to process D to establish a new session; Fill the virtual address of session F into the destination session virtual address of message 3, and fill the virtual address of session E into the source session virtual address of message 3.
Citation Information
Patent Citations
Message processing method and system, and storage medium
CN109361608A
Robust sharing of runtime systems
CN1989488A