Communication method and device, electronic equipment and storage medium
By querying the target event identifier in the multi-core processor system and determining the target interrupt channel, the problem of low interrupt communication accuracy is solved, and accurate data transmission in the multi-core system is achieved and communication efficiency is improved.
Patent Information
- Application Number
- CN202410870229.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-30
- Publication Date
- 2024-12-06
AI Technical Summary
In multi-core processor systems, the accuracy of interrupt communication is low, resulting in frequent interrupt conflicts and communication failures during data transmission.
By querying the target event identifier in the communication management module and determining the target interrupt channel in the multi-core system through this identifier, the accurate transmission of the interrupt signal is ensured and interrupt conflicts are avoided.
Improve the accuracy of interrupted communication in multi-core systems, ensure that data is correctly read in shared memory, and enhance the communication efficiency between processors.
Smart Images

Figure CN119088586A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of chip communications, and in particular to a communication method, device, electronic equipment and storage medium. Background Art
[0002] With the rapid development of information technology, single-core processing systems can no longer meet most processing needs, and multi-core processor systems have gradually become the core processing platform for computing-intensive and data-intensive applications. In multi-core processing systems, different types of processing cores are often included, and different types of processing cores work together to provide overall computing power and processing efficiency. In current multi-core processor systems, inter-core communication relies on interrupts and shared memory mechanisms to complete inter-core communication. When data transmission is required, the sender usually sends a signal to the receiver through an interrupt, and the receiver then reads the data from the shared memory. When multiple cores try to send or receive data through the same interrupt channel, interrupt conflicts may occur frequently, resulting in communication failure or data loss. Therefore, how to provide a communication method to solve the low accuracy of existing interrupt communication has become an urgent problem to be solved. Summary of the invention
[0003] The embodiment of the present invention provides a communication method, which aims to solve the problem of low accuracy of existing interrupt communication. The communication management module queries the target event identifier in the interrupt channel information of the first processing core through the communication connection with the first processing core, and sends an interrupt signal to the second processing core through the target event identifier, so that the second processing core can read the target data from the shared memory. Since the event identifier is unique, the accuracy of interrupt communication in a multi-core system can be guaranteed.
[0004] In a first aspect, an embodiment of the present invention provides a communication method, the communication method is applied to a communication management module of a multi-core system, the multi-core system includes multiple processing cores, the communication management module is communicatively connected with the multiple processing cores, each two processing cores communicate with each other through multiple interrupt channels, each two processing cores have a shared memory, each processing core stores interrupt channel information, the method comprises the following steps:
[0005] After the target data is written into the shared memory between the first processing core and the second processing core, querying whether the interrupt channel information of the first processing core contains the target event identifier between the first processing core and the second processing core, and obtaining a channel query result of the first processing core; the first processing core and the second processing core are two different processing cores among the plurality of processing cores;
[0006] Based on the channel query result, determining a target interrupt channel between the first processing core and the second processing core from a plurality of interrupt channels between the first processing core and the second processing core, the target interrupt channel carrying the target event identifier;
[0007] The first processing core is controlled to send an interrupt signal to the second processing core through the target interrupt channel, so that the second processing core reads the target data in the shared memory.
[0008] Optionally, the determining, based on the channel query result, a target interrupt channel between the first processing core and the second processing core from a plurality of interrupt channels between the first processing core and the second processing core comprises:
[0009] If the channel query result of the first processing core is that the target event identifier exists in the interrupt channel information of the first processing core, then determining an interrupt channel carrying the target event identifier as a target interrupt channel among multiple interrupt channels between the first processing core and the second processing core;
[0010] If the channel query result is that the target event identifier does not exist in the interrupt channel information of the first processing core, determining a target communication link between the first processing core and the second processing core, the target communication link including at least the first processing core and the second processing core;
[0011] Based on the interrupt channel information of each processing core in the target communication link, the load of each interrupt channel between the first processing core and the second processing core is determined, and based on the load of each interrupt channel, the target interrupt channel between the first processing core and the second processing core is determined.
[0012] Optionally, the target communication link includes a first processing main core and a second processing main core, the first processing core is a first processing main core, the second processing core is a second processing main core, the first processing main core and the second processing main core are in different chips, the first processing main core and the second processing main core are connected via a plurality of interrupt channels, and determining a target interrupt channel between the first processing core and the second processing core based on the load of each of the interrupt channels includes:
[0013] Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0014] Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0015] Based on the first interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
[0016] Optionally, the target communication link includes a first processing slave core, a first processing master core, and a second processing master core, the first processing core is the first processing slave core, the second processing core is the second processing master core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core and the first processing master core are connected via a plurality of interrupt channels, and determining a target interrupt channel between the first processing core and the second processing core based on the load of each of the interrupt channels includes:
[0017] Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0018] Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0019] Determining, based on the interrupt channel information of the first processing slave core, a load of each of the interrupt channels between the first processing slave core and the first processing master core;
[0020] Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the first processing slave core and the first processing master core as a second interrupt channel between the first processing slave core and the first processing master core;
[0021] Based on the first interrupt channel and the second interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
[0022] Optionally, the target communication link includes a first processing master core, a second processing master core, and a second processing slave core, the first processing core is the first processing master core, the second processing core is the second processing slave core, the second processing slave core and the second processing master core are in the same chip, the second processing slave core is connected to the second processing master core via a plurality of interrupt channels, and determining the target interrupt channel between the first processing core and the second processing core based on the load of each of the interrupt channels includes:
[0023] Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0024] Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0025] Determining the load of each of the interrupt channels between the second processing master core and the second processing slave core based on the interrupt channel information of the second processing master core;
[0026] Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the second processing master core and the second processing slave core as a third interrupt channel between the second processing master core and the second processing slave core;
[0027] Based on the first interrupt channel and the third interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
[0028] Optionally, the target communication link includes a first processing slave core, a first processing master core, a second processing master core and a second processing slave core, the first processing core is the first processing slave core, the second processing core is the second processing slave core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core and the first processing master core are connected via a plurality of interrupt channels, the second processing slave core and the second processing master core are in the same chip, the second processing slave core and the second processing master core are connected via a plurality of interrupt channels, and determining the target interrupt channel between the first processing core and the second processing core based on the load of each of the interrupt channels includes:
[0029] Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0030] Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0031] Determining, based on the interrupt channel information of the first processing slave core, a load of each of the interrupt channels between the first processing slave core and the first processing master core;
[0032] Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the first processing slave core and the first processing master core as a second interrupt channel between the first processing slave core and the first processing master core;
[0033] Determining the load of each of the interrupt channels between the second processing master core and the second processing slave core based on the interrupt channel information of the second processing master core;
[0034] Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the second processing master core and the second processing slave core as a third interrupt channel between the second processing master core and the second processing slave core;
[0035] Based on the first interrupt channel, the second interrupt channel, and the third interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
[0036] Optionally, the interrupt channel information includes a channel identifier, the target event identifier corresponds to the channel identifier one-to-one, and the controlling the first processing core to send an interrupt signal to the second processing core through the target interrupt channel so that the second processing core reads target data in the shared memory includes:
[0037] Determine a channel identifier corresponding to the target event identifier;
[0038] The first processing core is controlled to call a target interrupt channel between the first processing core and the second processing core based on a channel identifier corresponding to the target event identifier, so that the target interrupt channel sends an interrupt signal to the second processing core.
[0039] Optionally, the interrupt channel information further includes the last use time of each interrupt channel and the interrupt channel handle information corresponding to each interrupt channel. The communication method further includes:
[0040] Regularly comparing the last usage time of each of the interruption channels with the current time;
[0041] When the time interval between the last used time and the current time is greater than a preset time threshold, the interrupt channel handle information of the interrupt channel corresponding to the last used time is deleted from the interrupt channel information.
[0042] Optionally, the interrupt channel information further includes an interrupt channel handle number, where the interrupt channel handle number is the number of the interrupt channel handle information, and when the time interval between the last use time and the current time is greater than a preset time threshold, after deleting the interrupt channel handle information of the interrupt channel corresponding to the last use time in the interrupt channel information, the method further includes:
[0043] Based on the deleted interrupt channel handle information, updating the interrupt channel handle number;
[0044] When the number of interrupt channel handles between the first processing core and the second processing core in the interrupt channel information of the first processing core is zero, the interrupt channel information between the first processing core and the second processing core is deleted.
[0045] In a second aspect, an embodiment of the present invention further provides a communication system, comprising a plurality of processing cores and a communication management module, wherein the communication management module is communicatively connected with the plurality of processing cores, each two processing cores communicate with each other through a plurality of interrupt channels, each two processing cores have a shared memory, each processing core stores interrupt channel information, the plurality of processing cores include a first processing core and a second processing core, and the method comprises the following steps:
[0046] The first processing core is used to write the target data into a shared memory between the first processing core and the second processing core;
[0047] The management module is used to query whether there is a target event identifier between the first processing core and the second processing core in the interrupt channel information of the first processing core, and obtain a channel query result of the first processing core;
[0048] The management module is further used to determine a target interrupt channel between the first processing core and the second processing core from among a plurality of interrupt channels between the first processing core and the second processing core, wherein the target interrupt channel carries the target event identifier;
[0049] The first processing core is further configured to send an interrupt signal to the second processing core through a target interrupt channel, so that the second processing core reads target data in the shared memory.
[0050] In a third aspect, an embodiment of the present invention further provides a communication device, the communication device comprising:
[0051] a query module, configured to query, after the first processing core writes target data into a shared memory between the first processing core and the second processing core, whether there is a target event identifier between the first processing core and the second processing core in the interrupt channel information of the first processing core, and obtain a channel query result of the first processing core; the first processing core and the second processing core are two different processing cores among the plurality of processing cores;
[0052] a determination module, configured to determine, based on the channel query result, a target interrupt channel between the first processing core and the second processing core from among a plurality of interrupt channels between the first processing core and the second processing core, the target interrupt channel carrying the target event identifier;
[0053] The sending module is used to control the first processing core to send an interrupt signal to the second processing core through the target interrupt channel, so that the second processing core reads the target data in the shared memory.
[0054] In a fourth aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the communication method provided in the embodiment of the present invention when executing the computer program.
[0055] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the communication method provided in the embodiment of the invention are implemented.
[0056] In an embodiment of the present invention, after the first processing core writes the target data into the shared memory between the first processing core and the second processing core, the interrupt channel information of the first processing core is queried to see whether there is a target event identifier between the first processing core and the second processing core, and the channel query result of the first processing core is obtained; the first processing core and the second processing core are two different processing cores among the multiple processing cores; based on the channel query result, the target interrupt channel between the first processing core and the second processing core is determined from the multiple interrupt channels between the first processing core and the second processing core, and the target interrupt channel carries the target event identifier; the first processing core is controlled to send an interrupt signal to the second processing core through the target interrupt channel, so that the second processing core reads the target data in the shared memory. The communication management module queries the target event identifier in the interrupt channel information of the first processing core through the communication connection with the first processing core, and sends the interrupt signal to the second processing core through the target event identifier, so that the second processing core can read the target data from the shared memory. Since the event identifier is unique, the accuracy of interrupt communication in the multi-core system can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0058] Figure 1 is a flow chart of a communication method provided by an embodiment of the present invention;
[0059] Figure 2 This is an interrupt connection structure diagram of a multi-core system provided by an embodiment of the present invention;
[0060] Figure 3 is a flow chart of an interrupt channel allocation method provided by an embodiment of the present invention;
[0061] Figure 4 is a flowchart of an initialization method provided by an embodiment of the present invention;
[0062] Figure 5 is a flow chart of a method for using a communication device provided by an embodiment of the present invention;
[0063] Figure 6 is a schematic structural diagram of a communication device provided in an embodiment of the present invention;
[0064] Figure 7 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;
[0065] Figure 8 It is a structural diagram of a communication system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0066] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0067] like Figure 1 As shown, Figure 1 is a flow chart of a communication method provided by an embodiment of the present invention, including:
[0068] 101. After the first processing core writes target data into the shared memory between the first processing core and the second processing core, query whether there is a target event identifier between the first processing core and the second processing core in the interrupt channel information of the first processing core to obtain a channel query result of the first processing core.
[0069] In an embodiment of the present invention, the above-mentioned communication method can be applied to a communication management module of a multi-core system, wherein the multi-core system includes multiple processing cores, each processing core is communicatively connected to the above-mentioned communication management module, and the above-mentioned communication management module can perform interrupt management on the multiple processing cores in the above-mentioned multi-core system through the above-mentioned communication connection to implement the communication method provided in the embodiment of the present invention. For example, the above-mentioned communication management module can query the interrupt channel information of any processing core through the above-mentioned communication connection to determine the target interrupt channel of any processing core after writing the target data, or can update the interrupt channel information of any processing core after determining the target interrupt channel.
[0070] Each two of the above-mentioned processing cores communicate through multiple interrupt channels, and each two of the above-mentioned processing cores have a shared memory. The above-mentioned processing cores may include a first processing core and a second processing core. The above-mentioned first processing core can be understood as a sending end that needs to interrupt communication. Each processing core stores an interrupt channel information, and the interrupt channel information stored in each processing core stores the information of the interrupt channel between the above-mentioned processing core and other processing cores. Specifically, the above-mentioned multi-core system includes at least two chips, each chip includes at least one processing main core, and the processing main cores of different chips are connected through interrupt channels. The above-mentioned multi-core system can be a heterogeneous multi-core system or a non-heterogeneous multi-core system. The above-mentioned chip can also include any number of processing slave cores, and the specific number is determined according to the requirements when the above-mentioned chip is designed. When the above-mentioned multi-core system is a non-heterogeneous multi-core system, the processing cores of the above-mentioned at least two chips are chips of the same type. When the above-mentioned multi-core system is a heterogeneous multi-core system, the processing cores of at least two of the above-mentioned at least two chips are not chips of the same type, for example, it can be an ARM type chip or a Risc-V type chip.
[0071] Among them, the first processing core can be the first processing master core or the first processing slave core, and the first processing master core and the first processing slave core are connected through an interrupt channel, and the second processing core can be the second processing master core or the second processing slave core, and the second processing master core and the second processing slave core are connected through an interrupt channel. It can be understood that the above-mentioned first processing core and the second processing core are processing cores of different chips, and different chips communicate with each other through interrupt channels between processing master cores. The processing slave cores of different chips are not directly connected through interrupt channels. If interrupt communication is required between processing slave cores of different chips, the interrupt signal needs to be transferred through the processing master core to achieve indirect interrupt communication.
[0072] Specifically, the multi-core system can be Figure 2 The interrupt connection structure diagram of a multi-core system shown further illustrates that Figure 2In the embodiment, a host, chip 0, chip 1, and chip N are included, wherein the host core of the host is connected to chip 0 via a PCIE channel, the number of the PCIE channels may be 24, and the host may be understood as a host used by the user layer, chip 0 may include 1 processing main core (i.e., chip 0 main core) and 1 processing slave core (i.e., chip 0 slave core), wherein 32 interrupt channels (32Mailbox channels) are provided between the processing main core and the processing slave core, chip 1 may include 1 processing main core (i.e., chip 1 main core) and 1 processing slave core (i.e., chip 1 slave core), wherein 32 interrupt channels (32Mailbox channels) are provided between the processing main core and the processing slave core, and chip N may include 1 processing main core (i.e., chip N main core) and 1 processing slave core (i.e., chip N slave core), wherein 32 interrupt channels (32Mailbox channels) are provided between the processing main core and the processing slave core. Interrupt communication between different chips is performed through interrupt channels between processing main cores. For example, the processing core of chip 0 is connected to the processing core of chip 1 and the processing core of chip N through the interrupt channels (die-to-die channels) between the cores. It can be understood that Figure 2 The connection relationship between the interrupt channels of the main cores is 1:n-1. Figure 2 Only the main core channel of chip 0 is used as an example. Similarly, the main cores of chip 1 and chip N also have interrupt channels between the main cores (Die-to-Die channels), and the interrupt channels between the main cores can also be 32. It can be understood that Figure 2 This is only one of the structural diagrams of the interrupt connection of the multi-core system. The embodiment of the present invention does not specifically limit the number of channels and the connection structure between channels. Those skilled in the art can Figure 2 If non-creative changes are made, they still fall within the above Figure 2 The connection structure range.
[0073] More specifically, after the first processing core writes the target data in the shared memory between the first processing core and the second processing core, the first processing core can traverse and query in the interrupt channel information whether there is an event identifier between the first processing core and the second processing core. If there is an event identifier between the first processing core and the second processing core, the channel query result is that there is an event identifier between the first processing core and the second processing core. If there is no event identifier between the first processing core and the second processing core, the channel query result is that there is no event identifier between the first processing core and the second processing core.
[0074] It should be noted that the shared memory is a shared memory between the first processing core and the second processing core, and the address of the shared memory is unique. The addresses of the shared memories between different processing cores are different and not shared. The event identifier is determined according to the address of the shared memory between the first processing core and the second processing core, and the event identifier is unique. The address may be a head address and / or a tail address.
[0075] 102. Based on the channel query result, determine a target interrupt channel between the first processing core and the second processing core from a plurality of interrupt channels between the first processing core and the second processing core.
[0076] In an embodiment of the present invention, the target interrupt channel carries a target event identifier. If the channel query result is that there is an event identifier between the first processing core and the second processing core, the corresponding interrupt channel can be located according to the event identifier as the target interrupt channel. If the channel query result is that there is no event identifier between the first processing core and the second processing core, the load status of each interrupt channel between the first processing core and the second processing core can be determined based on the interrupt channel information, and the target interrupt channel can be determined according to the load status.
[0077] 103. Control the first processing core to send an interrupt signal to the second processing core through a target interrupt channel, so that the second processing core reads target data in the shared memory.
[0078] In the embodiment of the present invention, the interrupt signal is a signal prompting the second processing core to interrupt. The target data is specific data that needs to be read when the first processing core requires the second processing core to interrupt.
[0079] Specifically, after the communication management module determines that there is a target event identifier between the first processing core and the second processing core in the interrupt channel information, it can determine the channel identifier of the target interrupt channel based on the target event identifier. After determining the channel identifier, it can control the first processing core to locate and call the target interrupt channel through the channel identifier, so that the target interrupt channel sends the interrupt signal to the second processing core, thereby enabling the second processing core to read the target data in the shared memory.
[0080] In an embodiment of the present invention, after the first processing core writes the target data into the shared memory between the first processing core and the second processing core, the interrupt channel information of the first processing core is queried to see whether there is a target event identifier between the first processing core and the second processing core, and the channel query result of the first processing core is obtained; the first processing core and the second processing core are two different processing cores among the multiple processing cores; based on the channel query result, the target interrupt channel between the first processing core and the second processing core is determined from the multiple interrupt channels between the first processing core and the second processing core, and the target interrupt channel carries the target event identifier; the first processing core is controlled to send an interrupt signal to the second processing core through the target interrupt channel, so that the second processing core reads the target data in the shared memory. The communication management module queries the target event identifier in the interrupt channel information of the first processing core through the communication connection with the first processing core, and sends the interrupt signal to the second processing core through the target event identifier, so that the second processing core can read the target data from the shared memory. Since the event identifier is unique, the accuracy of interrupt communication in the multi-core system can be guaranteed.
[0081] Optionally, in the step of determining a target interrupt channel between the first processing core and the second processing core from among multiple interrupt channels between the first processing core and the second processing core based on a channel query result, if the channel query result of the first processing core is that there is a target event identifier in the interrupt channel information of the first processing core, then an interrupt channel carrying the target event identifier is determined as the target interrupt channel from among multiple interrupt channels between the first processing core and the second processing core; if the channel query result is that there is no target event identifier in the interrupt channel information of the first processing core, then a target communication link between the first processing core and the second processing core is determined, the target communication link including at least the first processing core and the second processing core; based on the interrupt channel information of each processing core in the target communication link, the load of each interrupt channel between the first processing core and the second processing core is determined, and based on the load of each interrupt channel, the target interrupt channel between the first processing core and the second processing core is determined.
[0082] In an embodiment of the present invention, if the channel query result of the first processing core is that there is a target event identifier in the interrupt channel information of the first processing core, then the interrupt channel carrying the target event identifier can be determined as the target interrupt channel among the multiple terminal channels between the first processing core and the second processing core, and the above-mentioned interrupt signal can be transmitted to the second processing core through the above-mentioned target interrupt channel.
[0083] The target communication link may be composed of processing cores between the first processing core and the second processing core. For example, when the first processing core is the first main processing core and the second processing core is the second main processing core, the target communication link may be composed of the first main processing core and the second main processing core.
[0084] When the above-mentioned first processing core is the first processing slave core and the second processing core is the second processing master core, the above-mentioned target communication link may include the first processing slave core, the first processing master core and the second processing master core, the first processing slave core and the first processing master core communicate through the interrupt channel, and the first processing master core and the first processing master core communicate through the interrupt channel.
[0085] When the first processing core is a first processing master core and the second processing core is a second processing slave core, the target communication link may include the first processing master core, the second processing master core and the second processing slave core, and the processing cores communicate with each other through an interrupt channel.
[0086] When the first processing core is the first processing slave core and the second processing core is the second processing slave core, the target communication link may include the first processing slave core, the first processing slave master core, the second processing master core and the second processing slave core, and the processing cores communicate with each other through interrupt channels.
[0087] After determining the above-mentioned target link, the load of each interrupt channel between the first processing core and the second processing core can be determined according to the interrupt channel information of each processing core in the target communication link, and based on the load of each interrupt channel, the target interrupt channel between the first processing core and the second processing core can be determined.
[0088] Optionally, the target communication link includes a first processing main core and a second processing main core, the first processing core is the first processing main core, the second processing core is the second processing main core, the first processing main core and the second processing main core are in different chips, and the first processing main core and the second processing main core are connected through multiple interrupt channels. In the step of determining the target interrupt channel between the first processing core and the second processing core based on the load of each interrupt channel, the load of each interrupt channel between the first processing main core and the second processing main core can also be determined based on the interrupt channel information of the first processing main core; the first interrupt channel with the smallest load is determined among the multiple interrupt channels between the first processing main core and the second processing main core; based on the first interrupt channel, a target event identifier is added to obtain the target interrupt channel between the first processing core and the second processing core.
[0089] In an embodiment of the present invention, when the first processing core is the first processing main core and the second processing core is the second processing main core, the corresponding target communication link includes the first processing main core, the second processing main core, and the interrupt channel between the first processing main core and the second processing main core. The interrupt channel carrying the target event identifier is the target interrupt channel, and the interrupt channel not carrying the target event identifier is not the target interrupt channel. Therefore, the interrupt channel with the least load can be determined in the interrupt channel between the first processing main core and the second processing main core according to the interrupt channel information of the first processing main core, as the first interrupt channel, and after adding the corresponding target event identifier to the first interrupt channel, the first interrupt channel is determined as the target interrupt channel between the first processing core and the second processing core.
[0090] Optionally, the target communication link includes a first processing slave core, a first processing master core and a second processing master core, the first processing core is the first processing slave core, the second processing core is the second processing master core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core and the first processing master core are connected through multiple interrupt channels, and in the step of determining the target interrupt channel between the first processing core and the second processing core based on the load of each interrupt channel, the load of each interrupt channel between the first processing master core and the second processing master core can also be determined based on the interrupt channel information of the first processing master core; the first interrupt channel with the smallest load is determined from the multiple interrupt channels between the first processing master core and the second processing master core; the load of each interrupt channel between the first processing slave core and the first processing master core is determined based on the interrupt channel information of the first processing slave core; the interrupt channel with the smallest load is determined from the multiple interrupt channels between the first processing slave core and the first processing master core as the second interrupt channel between the first processing slave core and the first processing master core; based on the first interrupt channel and the second interrupt channel, a target event identifier is added to obtain the target interrupt channel between the first processing core and the second processing core.
[0091] In an embodiment of the present invention, when the first processing core is the first processing slave core and the second processing core is the second processing master core, the corresponding target communication link includes the first processing slave core, the first processing master core, the second processing master core, the interrupt channel between the first processing slave core and the first processing master core, and the interrupt channel between the first processing master core and the second processing master core. According to the interrupt channel information of the first processing master core, the interrupt channel with the least load can be determined as the first interrupt channel in the interrupt channel between the first processing master core and the second processing master core, and at the same time, based on the interrupt channel information of the first processing master core, the interrupt channel with the lowest load can be determined as the first interrupt channel in the interrupt channel between the first processing master core and the second processing master core, and based on the interrupt channel information of the first processing slave core, the interrupt channel with the lowest load can be determined as the second interrupt channel in the interrupt channel between the first processing slave core and the first processing master core, and after adding the above-mentioned target event identifier to the above-mentioned first interrupt channel and the second interrupt channel, the first interrupt channel and the second interrupt channel are determined as the target interrupt channel.
[0092] Optionally, the target communication link includes a first processing main core, a second processing main core and a second processing slave core, the first processing core is the first processing main core, the second processing core is the second processing slave core, the second processing slave core and the second processing main core are in the same chip, and the second processing slave core is connected to the second processing main core through multiple interrupt channels. In the step of determining the target interrupt channel between the first processing core and the second processing core based on the load of each interrupt channel, the load of each interrupt channel between the first processing main core and the second processing main core can also be determined based on the interrupt channel information of the first processing main core; the first interrupt channel with the smallest load is determined from the multiple interrupt channels between the first processing main core and the second processing main core; the load of each interrupt channel between the second processing main core and the second processing slave core is determined based on the interrupt channel information of the second processing main core; the interrupt channel with the smallest load is determined from the multiple interrupt channels between the second processing main core and the second processing slave core as the third interrupt channel between the second processing main core and the second processing slave core; based on the first interrupt channel and the third interrupt channel, a target event identifier is added to obtain the target interrupt channel between the first processing core and the second processing core.
[0093] In an embodiment of the present invention, when the first processing core is the first processing master core and the second processing core is the second processing slave core, the corresponding target communication link includes the first processing master core, the second processing master core, the second processing slave core, the interrupt channel between the second processing slave core and the second processing master core, and the interrupt channel between the first processing master core and the second processing master core. According to the interrupt channel information of the first processing master core, the interrupt channel with the least load can be determined as the first interrupt channel in the interrupt channel between the first processing master core and the second processing master core, and at the same time, based on the interrupt channel information of the first processing master core, the interrupt channel with the lowest load can be determined as the first interrupt channel in the interrupt channel between the first processing master core and the second processing master core, and based on the interrupt channel information of the second processing master core, the interrupt channel with the lowest load can be determined as the third interrupt channel in the interrupt channel between the second processing master core and the second processing slave core, and after adding the above-mentioned target event identifier to the above-mentioned first interrupt channel and the third interrupt channel, the first interrupt channel and the third interrupt channel are determined as the target interrupt channel.
[0094] Optionally, the target communication link includes a first processing slave core, a first processing master core, a second processing master core and a second processing slave core, the first processing core is the first processing slave core, the second processing core is the second processing slave core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core and the first processing master core are connected via a plurality of interrupt channels, the second processing slave core and the second processing master core are in the same chip, the second processing slave core and the second processing master core are connected via a plurality of interrupt channels, in the step of determining the target interrupt channel between the first processing core and the second processing core based on the load of each interrupt channel, the load of each interrupt channel between the first processing master core and the second processing master core can also be determined based on the interrupt channel information of the first processing master core; in the plurality of interrupt channels between the first processing master core and the second processing master core Determine the first interrupt channel with the smallest load; determine the load of each interrupt channel between the first processing slave core and the first processing main core based on the interrupt channel information of the first processing slave core; determine the interrupt channel with the smallest load from multiple interrupt channels between the first processing slave core and the first processing main core as the second interrupt channel between the first processing slave core and the first processing main core; determine the load of each interrupt channel between the second processing main core and the second processing slave core based on the interrupt channel information of the second processing main core; determine the interrupt channel with the smallest load from multiple interrupt channels between the second processing main core and the second processing slave core as the third interrupt channel between the second processing main core and the second processing slave core; based on the first interrupt channel, the second interrupt channel and the third interrupt channel, add a target event identifier to obtain a target interrupt channel between the first processing core and the second processing core.
[0095] In an embodiment of the present invention, when the above-mentioned first processing core is a first processing slave core and the above-mentioned second processing core is a second processing slave core, its corresponding target communication link includes the first processing slave core, the first processing master core, the second processing master core, the second processing slave core, an interrupt channel between the first processing slave core and the first processing master core, and an interrupt channel between the first processing master core and the second processing master core, and an interrupt channel between the second processing master core and the second processing slave core. According to the interrupt channel information of the first processing main core, the interrupt channel with the least load can be determined as the first interrupt channel among the interrupt channels between the first processing main core and the second processing main core. At the same time, based on the interrupt channel information of the first processing main core, the interrupt channel with the lowest load can be determined as the first interrupt channel among the interrupt channels between the first processing main core and the second processing main core. Based on the interrupt channel information of the first processing slave core, the interrupt channel with the lowest load can be determined as the second interrupt channel among the interrupt channels between the first processing slave core and the first processing main core. Based on the interrupt channel information of the second processing main core, the interrupt channel with the lowest load can be determined as the third interrupt channel among the interrupt channels between the second processing main core and the second processing slave core. The above-mentioned target event identifier is added to the above-mentioned first interrupt channel, the second interrupt channel and the third interrupt channel to obtain the above-mentioned target interrupt channel.
[0096] More specifically, the interrupt channel information may also include the number of interrupt channel handles and interrupt channel handle information. The number of interrupt channel handles corresponding to each interrupt channel may be understood as the number of concurrently used handles of the interrupt channel. The interrupt channel handle may be understood as recording the event identifier on the interrupt channel and the node identifier of the communication object corresponding to the event identifier. The interrupt channel handle information may be understood as recording the usage details of each handle in the interrupt channel. The number of interrupt channel handles is proportional to the load state. The larger the number of interrupt channel handles of the interrupt channel, the higher the load state of the interrupt channel, and vice versa.
[0097] The method for confirming the interrupt channel with the lowest load can be to sort the interrupt channels between every two processing cores in descending order according to the number of interrupt channel handles mentioned above, and insert the channel identifier of the interrupt channel into a preset sorting empty set to obtain a load sorting set for each of the above interrupt channels. Based on the above load sorting set, the terminal channel with the lowest load is screened out from small to large as the above target interrupt channel.
[0098] In a possible embodiment, if there are multiple interrupt channels with the lowest load (i.e., the same load), one of the interrupt channels with the lowest load can be randomly selected as the interrupt channel to be used, and the target interrupt channel can be determined based on the interrupt channel to be used. Alternatively, the multiple interrupt channels with the lowest load can be sorted based on the last use time of the multiple interrupt channels with the lowest load, and the interrupt channel with a high sorting priority is taken as the interrupt channel to be used, and the target interrupt channel can be determined based on the interrupt channel to be used. Among them, among the multiple interrupt channels with the lowest load, the longer the last use time of the channel is compared to the current time, the higher the priority of the corresponding interrupt channel is, and the shorter the last use time of the channel is compared to the current time, the lower the priority of the corresponding interrupt channel is.
[0099] Optionally, the interrupt channel information includes a channel identifier, and the target event identifier corresponds to the channel identifier one-to-one. In the step in which the first processing core sends an interrupt signal to the second processing core through the target interrupt channel so that the second processing core reads the target data in the shared memory, the channel identifier corresponding to the target event identifier can also be determined; the first processing core calls the target interrupt channel between the first processing core and the second processing core based on the channel identifier corresponding to the target event identifier, so that the target interrupt channel sends an interrupt signal to the second processing core.
[0100] In an embodiment of the present invention, the above-mentioned interrupt channel information also includes a channel identifier, and the above-mentioned event identifier and the above-mentioned channel identifier are mapped one-to-one, and each channel identifier also corresponds to a communication link. After the above-mentioned communication management module determines that there is a target event identifier between the above-mentioned first processing core and the above-mentioned second processing core in the interrupt channel information, the channel identifier of the above-mentioned target interrupt channel can be determined according to the mapping relationship between the above-mentioned target event identifier and the above-mentioned channel identifier, and the above-mentioned target interrupt channel is called through the above-mentioned channel identifier, so that the first processing core sends an interrupt signal to the second processing main core through the above-mentioned target interrupt channel, so that the second processing core reads the target data in the shared memory.
[0101] Specifically, if the same interrupt signal needs to be sent subsequently, the target interrupt channel can be called again through the channel identifier, so that the first processing core sends the interrupt signal to the second processing core through the target interrupt channel.
[0102] It is understandable that the target event identifier and channel identifier corresponding to each target interrupt channel are stored in the interrupt channel handle information of the same interrupt channel information. Therefore, if the same interrupt signal needs to be sent later, the interrupt channel handle information where the target event identifier is located can be queried to obtain the channel identifier.
[0103] Optionally, the interrupt channel information also includes the last usage time of each interrupt channel and the interrupt channel handle information corresponding to each interrupt channel. In the steps of the communication method, the last usage time of each interrupt channel can also be compared with the current time on a regular basis; when the time interval between the last usage time and the current time is greater than a preset time threshold, the interrupt channel handle information of the interrupt channel corresponding to the last usage time is deleted from the interrupt channel information.
[0104] In an embodiment of the present invention, the last use time is the last use time of the interrupt channel, that is, the time when the interrupt signal was last sent. The last use time of each interrupt channel of each processing core in the multi-core system can be compared with the current time regularly; when the time interval between the last use time and the current time is greater than the preset time threshold, it means that the interrupt channel has not been used for a long time. At this time, the interrupt channel handle information of the interrupt channel can be deleted to release the occupation of the interrupt channel and improve the communication efficiency of the interrupt communication. The preset time threshold can be a fixed value, for example, ten seconds, fifteen seconds, etc., or it can also be determined according to the number of interrupt channels in the multi-core system. If the number of channels is more, the preset time threshold can be set larger accordingly to retain the interrupt channel handle information as much as possible to avoid the situation where the information is deleted at the last moment and is needed at the next moment. If the number of channels is less, the preset time threshold can be set smaller accordingly to avoid the situation where the number of channels is insufficient and interrupt blocking occurs as much as possible.
[0105] Optionally, the interrupt channel information also includes the number of interrupt channel handles, which is the number of interrupt channel handle information. When the time interval between the last use time and the current time is greater than a preset time threshold, in the step after deleting the interrupt channel handle information of the interrupt channel corresponding to the last use time in the interrupt channel information, the number of interrupt channel handles can also be updated based on the deleted interrupt channel handle information; when the number of interrupt channel handles between the first processing core and the second processing core in the interrupt channel information of the first processing core is zero, the interrupt channel information between the first processing core and the second processing core is deleted.
[0106] In the embodiment of the present invention, the interrupt channel handle number can be understood as the number of interrupt channel handle information of all interrupt channels between the two processing cores. Therefore, if the interrupt channel handle number of the interrupt channel information is zero, it means that the interrupt channels between the two processing cores have not been used for a long time. Therefore, the interrupt channel information between the first processing core and the second processing core can be deleted to release the occupation of the interrupt channel information. It can be understood that the interrupt channel information between the first processing core and the second processing core can include the interrupt channel information related to the second processing core stored in the first processing core and the interrupt channel information related to the first processing core stored in the second processing core.
[0107] Specifically, the interrupt channel handle number may be updated according to the number of interrupt channel handle information deleted. The update may be a subtraction, in which the number of interrupt channel handles minus the number of interrupt channel handle information deleted is subtracted to complete the update.
[0108] For example, if the interrupt channel handle information corresponding to two interrupt channels is deleted, and when the interrupt channel handle information corresponding to the above two interrupt channels is deleted, the number of interrupt channel handles is nine, the above number of interrupt channel handles is subtracted from the interrupt channel handle information corresponding to the above two interrupt channels, and the interrupt channel handle number seven at the moment when the interrupt channel handle information corresponding to the two interrupt channels is deleted is obtained.
[0109] like Figure 3 As shown, an embodiment of the present invention also provides a flowchart of interrupt channel allocation. In the embodiment of the present invention, an array `die_channel_mappings` is used to save interrupt channel information `DieEventMap` for each processing core. The above array can be designed according to the chip structure characteristics, for example, it can be designed according to the interconnection and communication requirements between processing cores. The length of the above array can be determined according to the number of processing main cores of the chip in a multi-core system. For example, if the number of processing main cores of the chip is 8, the length of the above array can be 8, and the above array saves the interrupt channel information of this core and the other seven main cores. The above interrupt channel information `DieEventMap` may include a field `total_channels`, which is used to indicate the total number of interrupt channels currently in use, and its maximum value is determined according to the number of interrupt channels between each processing core. The above interrupt channel information may also include an array `event_count
[32] ` for recording the current number of concurrently used handles of each channel, and `events
[32] ` for recording the usage details of each handle on each channel (i.e., `EventMapping`). The above usage details `EventMapping` include an event identifier `event_id`, the most recent usage time of the channel, and the associated handle information.
[0110] When the multi-core system is used for the first time, the array `die_channel_mappings` may be initialized to zero through a memory setting operation to prepare for subsequent channel allocation.
[0111] Specifically, when receiving the interrupt channel release request from the first processing core, if the multi-core system is used for the first time, the above `die_channel_mappings` is initialized. If it is not used for the first time, the channel of the target event identifier (i.e., event ID) can be searched. When the corresponding target event identifier is found, it means that there is a corresponding release channel. If the corresponding event identifier is not found, it means that the channel has been released. The query result is updated to the above array `die_channel_mappings`, and according to the above `die_channel_mappings`, it is checked whether there is a target event identifier corresponding to the interrupt channel release request in the existing interrupt channel. If there is a corresponding target event identifier, the channel identifier corresponding to the above identifier is returned to the above `die_channel_mappings` for use by the above interrupt channel release request. If the target event identifier corresponding to the interrupt channel release request is not found, an interrupt channel with the least load state can be allocated to the above interrupt channel release request, and updated to the above `die_channel_mappings` for use by the above interrupt channel release request.
[0112] At the same time, periodically check whether the channel is inactive (i.e., whether it needs to be recycled). If an inactive channel is found, clear the unused interrupt channel and update the above `die_channel_mappings`. Specifically, the last usage time recorded in all the above `EventMapping` can be checked every 1 second. If the usage time of any event identifier exceeds ten seconds without being updated, the corresponding `EventMapping` will be destroyed and the `event_count` of the channel related to it will be reduced. If the `event_count` of the relevant channel drops to zero, the system will delete the `EventMap` of the channel.
[0113] like Figure 4 As shown, the embodiment of the present invention also provides a flowchart of an initialization method, which includes:
[0114] The first step, when initialization begins, is to identify the node ID (i.e., the target node identifier).
[0115] In the second step, if the target node is identified as the chip Die0 (i.e., chip 0), the PCIE interrupt channel between chip 0 and the host, the interrupt channel between the processing main core of chip 0 and the processing slave core, the interrupt channel between the processing main core of chip 0 and the processing main core of other chips, and the interrupt channel between the processing slave core of chip 0 and the processing main core of chip 0 are initialized;
[0116] If the target node is identified as other Die (i.e. not this chip), then initialize the interrupt channel between the processing main core of chip N to the processing slave core of chip N, the interrupt channel between the processing main core inside other chips (i.e. other Die, not this chip and not chip N) to the processing main core of chip N, and the interrupt channel between the processing slave core of other chips to the processing main core.
[0117] like Figure 5 As shown, the embodiment of the present invention also provides a flow chart of using a communication device, which includes:
[0118] Step 1: Initialization phase: Bind the interrupt callback function to each interrupt channel through the above communication device.
[0119] Step 2: When the user layer opens the device, the corresponding event identifier (i.e. event ID, event_id) and the target node identifier of the communication object (i.e. target node ID, target_node_id) will be registered. The above event identifier and target node identifier will be stored in a handle (i.e. handle), and the above handle will be stored in a global linked list (i.e. global list, notifier_handle_list) for global management and indexing.
[0120] Step 3: When the communication party (i.e., the first processing core) finishes writing data to the shared memory, the target processing core (i.e., the second processing core) is determined based on the target node identifier in the above handle, and the channel identifier (i.e., channel ID, chan_id) of the interrupt channel is obtained using the above communication method. If the same interrupt signal is sent each time, the same channel identifier is used until the communication object (i.e., the second processing core) is destroyed or there is no communication for a long time, then the occupation of the above channel identifier will be released.
[0121] Step 4: After the second processing core receives the interrupt, it locates the corresponding handle through the target event identifier and saves the channel identifier for the channel through which the current handle sends the interrupt. Then, the interrupt processing is completed by waking up the poll blocking of the handle at the user level. Specifically, an atomic integer variable can be used to record the number of interrupts, which can provide effective management for receiving multiple interrupts in succession.
[0122] It should be noted that when operating the device at the user level, the device is first initialized by passing in the event identifier (event_id) and the target node identifier (target_node_id) through the ioctl interface, then an interrupt is sent through ioctl, and finally the select wait mechanism is used to block and wait for interrupt notification.
[0123] like Figure 6 As shown, an embodiment of the present invention further provides a communication device, including:
[0124] A query module 601 is used for, after the first processing core writes the target data into the shared memory between the first processing core and the second processing core, querying whether there is a target event identifier between the first processing core and the second processing core in the interrupt channel information of the first processing core, and obtaining a channel query result of the first processing core; the first processing core and the second processing core are two different processing cores among the multiple processing cores;
[0125] A determination module 602, configured to determine, based on the channel query result, a target interrupt channel between the first processing core and the second processing core from among a plurality of interrupt channels between the first processing core and the second processing core, wherein the target interrupt channel carries the target event identifier;
[0126] The sending module 603 is used to control the first processing core to send an interrupt signal to the second processing core through the target interrupt channel, so that the second processing core reads the target data in the shared memory.
[0127] Optionally, the determining module 602 includes:
[0128] a first determining submodule, configured to determine, if the channel query result of the first processing core is that the target event identifier exists in the interrupt channel information of the first processing core, an interrupt channel carrying the target event identifier from among multiple interrupt channels between the first processing core and the second processing core as a target interrupt channel;
[0129] A second determining submodule, configured to determine a target communication link between the first processing core and the second processing core if the channel query result is that the target event identifier does not exist in the interrupt channel information of the first processing core, the target communication link including at least the first processing core and the second processing core;
[0130] The third determination submodule is used to determine the load of each interrupt channel between the first processing core and the second processing core based on the interrupt channel information of each processing core in the target communication link, and determine the target interrupt channel between the first processing core and the second processing core based on the load of each interrupt channel.
[0131] Optionally, the target communication link includes a first processing main core and a second processing main core, the first processing core is a first processing main core, the second processing core is a second processing main core, the first processing main core and the second processing main core are in different chips, the first processing main core and the second processing main core are connected via a plurality of interrupt channels, and the third determining submodule includes:
[0132] A first determining unit, configured to determine a load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0133] a second determining unit, configured to determine a first interrupt channel having a smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0134] The first adding unit is used to add the target event identifier based on the first interrupt channel to obtain a target interrupt channel between the first processing core and the second processing core.
[0135] Optionally, the target communication link includes a first processing slave core, a first processing master core, and a second processing master core, the first processing core is the first processing slave core, the second processing core is the second processing master core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core is connected to the first processing master core via a plurality of interrupt channels, and the third determining submodule further includes:
[0136] a third determining unit, configured to determine a load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0137] a fourth determining unit, configured to determine a first interrupt channel having a smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0138] a fifth determining unit, configured to determine a load of each of the interrupt channels between the first processing slave core and the first processing master core based on the interrupt channel information of the first processing slave core;
[0139] a sixth determining unit, configured to determine an interrupt channel with the smallest load among the plurality of interrupt channels between the first processing slave core and the first processing master core as a second interrupt channel between the first processing slave core and the first processing master core;
[0140] The second adding unit is used to add the target event identifier based on the first interrupt channel and the second interrupt channel to obtain a target interrupt channel between the first processing core and the second processing core.
[0141] Optionally, the target communication link includes a first processing master core, a second processing master core and a second processing slave core, the first processing core is the first processing master core, the second processing core is the second processing slave core, the second processing slave core and the second processing master core are in the same chip, the second processing slave core is connected to the second processing master core via a plurality of interrupt channels, and the third determining submodule further includes:
[0142] a seventh determining unit, configured to determine a load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0143] An eighth determining unit, configured to determine a first interrupt channel having a smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0144] a ninth determining unit, configured to determine a load of each of the interrupt channels between the second processing master core and the second processing slave core based on the interrupt channel information of the second processing master core;
[0145] a tenth determining unit, configured to determine an interrupt channel with the smallest load among the plurality of interrupt channels between the second processing master core and the second processing slave core as a third interrupt channel between the second processing master core and the second processing slave core;
[0146] An eleventh adding unit is used to add the target event identifier based on the first interrupt channel and the third interrupt channel to obtain a target interrupt channel between the first processing core and the second processing core.
[0147] Optionally, the target communication link includes a first processing slave core, a first processing master core, a second processing master core and a second processing slave core, the first processing core is the first processing slave core, the second processing core is the second processing slave core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core and the first processing master core are connected through multiple interrupt channels, the second processing slave core and the second processing master core are in the same chip, the second processing slave core and the second processing master core are connected through multiple interrupt channels, and the third determining submodule further includes:
[0148] a twelfth determining unit, configured to determine a load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0149] a thirteenth determining unit, configured to determine a first interrupt channel having a smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0150] a fourteenth determining unit, configured to determine a load of each of the interrupt channels between the first processing slave core and the first processing master core based on the interrupt channel information of the first processing slave core;
[0151] a fifteenth determining unit, configured to determine an interrupt channel with the smallest load among the plurality of interrupt channels between the first processing slave core and the first processing master core as a second interrupt channel between the first processing slave core and the first processing master core;
[0152] a sixteenth determining unit, configured to determine a load of each of the interrupt channels between the second processing master core and the second processing slave core based on the interrupt channel information of the second processing master core;
[0153] a seventeenth determining unit, configured to determine an interrupt channel with the smallest load among the plurality of interrupt channels between the second processing master core and the second processing slave core as a third interrupt channel between the second processing master core and the second processing slave core;
[0154] The fourth adding unit is used to add the target event identifier based on the first interrupt channel, the second interrupt channel and the third interrupt channel to obtain the target interrupt channel between the first processing core and the second processing core.
[0155] Optionally, the interrupt channel information includes a channel identifier, the target event identifier corresponds to the channel identifier one by one, and the sending module 603 includes:
[0156] A fourth determination submodule, used to determine a channel identifier corresponding to the target event identifier;
[0157] The first calling submodule is used to control the first processing core to call the target interrupt channel between the first processing core and the second processing core based on the channel identifier corresponding to the target event identifier, so that the target interrupt channel sends an interrupt signal to the second processing core.
[0158] Optionally, the interrupt channel information further includes the last use time of each interrupt channel and the interrupt channel handle information corresponding to each interrupt channel, and the communication device further includes:
[0159] A comparison module, used for periodically comparing the last use time of each interrupt channel with the current time;
[0160] The first deleting module is configured to delete the interrupt channel handle information of the interrupt channel corresponding to the last used time from the interrupt channel information when the time interval between the last used time and the current time is greater than a preset time threshold.
[0161] Optionally, the interrupt channel information further includes the number of interrupt channel handles, where the number of interrupt channel handles is the number of the interrupt channel handle information, and the communication device further includes:
[0162] A second deleting module, used for updating the number of interrupt channel handles based on the deleted interrupt channel handle information;
[0163] The third deleting module is used to delete the interrupt channel information between the first processing core and the second processing core when the number of interrupt channel handles between the first processing core and the second processing core in the interrupt channel information of the first processing core is zero.
[0164] like Figure 7 As shown, an embodiment of the present invention further provides an electronic device, characterized in that it includes a processor, and the processor can execute any one of the above communication methods.
[0165] Specifically, it includes a processor 701 and a memory 702, and a computer program for executing the communication method which is stored in the memory 702 and can be run on the processor 701, wherein:
[0166] The processor 701 runs the computer program of the communication method stored in the memory 702 and performs the following steps:
[0167] After the first processing core writes the target data into the shared memory between the first processing core and the second processing core, querying whether the interrupt channel information of the first processing core contains the target event identifier between the first processing core and the second processing core, and obtaining the channel query result of the first processing core; the first processing core and the second processing core are two different processing cores among the plurality of processing cores;
[0168] Based on the channel query result, determining a target interrupt channel between the first processing core and the second processing core from a plurality of interrupt channels between the first processing core and the second processing core, the target interrupt channel carrying the target event identifier;
[0169] The first processing core is controlled to send an interrupt signal to the second processing core through the target interrupt channel, so that the second processing core reads the target data in the shared memory.
[0170] Optionally, the determining, based on the channel query result, a target interrupt channel between the first processing core and the second processing core from a plurality of interrupt channels between the first processing core and the second processing core performed by the processor 701 includes:
[0171] If the channel query result of the first processing core is that the target event identifier exists in the interrupt channel information of the first processing core, then determining an interrupt channel carrying the target event identifier as a target interrupt channel among multiple interrupt channels between the first processing core and the second processing core;
[0172] If the channel query result is that the target event identifier does not exist in the interrupt channel information of the first processing core, determining a target communication link between the first processing core and the second processing core, the target communication link including at least the first processing core and the second processing core;
[0173] Based on the interrupt channel information of each processing core in the target communication link, the load of each interrupt channel between the first processing core and the second processing core is determined, and based on the load of each interrupt channel, the target interrupt channel between the first processing core and the second processing core is determined.
[0174] Optionally, the target communication link includes a first processing main core and a second processing main core, the first processing core is a first processing main core, the second processing core is a second processing main core, the first processing main core and the second processing main core are in different chips, the first processing main core and the second processing main core are connected through a plurality of interrupt channels, and the processor 701 determines the target interrupt channel between the first processing core and the second processing core based on the load of each of the interrupt channels, including:
[0175] Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0176] Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0177] Based on the first interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
[0178] Optionally, the target communication link includes a first processing slave core, a first processing master core, and a second processing master core, the first processing core is the first processing slave core, the second processing core is the second processing master core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core is connected to the first processing master core through a plurality of interrupt channels, and the processor 701 performs the step of determining the target interrupt channel between the first processing core and the second processing core based on the load of each of the interrupt channels, including:
[0179] Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0180] Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0181] Determining, based on the interrupt channel information of the first processing slave core, a load of each of the interrupt channels between the first processing slave core and the first processing master core;
[0182] Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the first processing slave core and the first processing master core as a second interrupt channel between the first processing slave core and the first processing master core;
[0183] Based on the first interrupt channel and the second interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
[0184] Optionally, the target communication link includes a first processing master core, a second processing master core, and a second processing slave core, the first processing core is the first processing master core, the second processing core is the second processing slave core, the second processing slave core and the second processing master core are in the same chip, the second processing slave core is connected to the second processing master core through a plurality of interrupt channels, and the processor 701 determines the target interrupt channel between the first processing core and the second processing core based on the load of each of the interrupt channels, including:
[0185] Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0186] Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0187] Determining the load of each of the interrupt channels between the second processing master core and the second processing slave core based on the interrupt channel information of the second processing master core;
[0188] Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the second processing master core and the second processing slave core as a third interrupt channel between the second processing master core and the second processing slave core;
[0189] Based on the first interrupt channel and the third interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
[0190] Optionally, the target communication link includes a first processing slave core, a first processing master core, a second processing master core and a second processing slave core, the first processing core is the first processing slave core, the second processing core is the second processing slave core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core and the first processing master core are connected via multiple interrupt channels, the second processing slave core and the second processing master core are in the same chip, the second processing slave core and the second processing master core are connected via multiple interrupt channels, and the processor 701 performs the step of determining the target interrupt channel between the first processing core and the second processing core based on the load of each of the interrupt channels, including:
[0191] Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core;
[0192] Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core;
[0193] Determining, based on the interrupt channel information of the first processing slave core, a load of each of the interrupt channels between the first processing slave core and the first processing master core;
[0194] Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the first processing slave core and the first processing master core as a second interrupt channel between the first processing slave core and the first processing master core;
[0195] Determining the load of each of the interrupt channels between the second processing master core and the second processing slave core based on the interrupt channel information of the second processing master core;
[0196] Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the second processing master core and the second processing slave core as a third interrupt channel between the second processing master core and the second processing slave core;
[0197] Based on the first interrupt channel, the second interrupt channel, and the third interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
[0198] Optionally, the interrupt channel information includes a channel identifier, the target event identifier corresponds to the channel identifier one-to-one, and the controlling of the first processing core to send an interrupt signal to the second processing core through the target interrupt channel executed by the processor 701 so that the second processing core reads the target data in the shared memory includes:
[0199] Determine a channel identifier corresponding to the target event identifier;
[0200] The first processing core is controlled to call a target interrupt channel between the first processing core and the second processing core based on a channel identifier corresponding to the target event identifier, so that the target interrupt channel sends an interrupt signal to the second processing core.
[0201] Optionally, the interrupt channel information further includes the last use time of each interrupt channel and the interrupt channel handle information corresponding to each interrupt channel. The communication method executed by the processor 701 further includes:
[0202] Regularly comparing the last usage time of each of the interruption channels with the current time;
[0203] When the time interval between the last used time and the current time is greater than a preset time threshold, the interrupt channel handle information of the interrupt channel corresponding to the last used time is deleted from the interrupt channel information.
[0204] Optionally, the interrupt channel information further includes an interrupt channel handle number, where the interrupt channel handle number is the number of the interrupt channel handle information, and when the time interval between the last use time and the current time is greater than a preset time threshold, after deleting the interrupt channel handle information of the interrupt channel corresponding to the last use time in the interrupt channel information, the method executed by the processor 701 further includes:
[0205] Based on the deleted interrupt channel handle information, updating the interrupt channel handle number;
[0206] When the number of interrupt channel handles between the first processing core and the second processing core in the interrupt channel information of the first processing core is zero, the interrupt channel information between the first processing core and the second processing core is deleted.
[0207] like Figure 8 As shown, the embodiment of the present invention further provides a structural schematic diagram of a communication system, including a communication management module 801 provided in an embodiment of the present invention, wherein the communication management module 801 is communicatively connected with a plurality of the processing cores 802, and each two of the processing cores 802 communicate with each other through a plurality of interrupt channels, and each two of the processing cores 802 have a shared memory, and each of the processing cores 802 stores interrupt channel information, and the plurality of processing cores 802 include a first processing core 8021 and a second processing core 8022, and the communication method executed in the communication system includes the following steps:
[0208] The first processing core 8021 is used to write the target data into the shared memory between the first processing core 8021 and the second processing core 8022;
[0209] The management module 801 is used to query whether there is a target event identifier between the first processing core 8021 and the second processing core 8022 in the interrupt channel information of the first processing core 8021, and obtain a channel query result of the first processing core 8021;
[0210] The management module 801 is further configured to determine a target interrupt channel between the first processing core 8021 and the second processing core 8022 from among a plurality of interrupt channels between the first processing core 8021 and the second processing core 8022, wherein the target interrupt channel carries the target event identifier;
[0211] The first processing core 8021 is further configured to send an interrupt signal to the second processing core 8022 through a target interrupt channel, so that the second processing core 8022 reads target data in the shared memory.
[0212] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computer program implements the various processes of the communication method or the application-side communication method provided in the embodiment of the present invention, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0213] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned computer program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0214] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.
Claims
1. A communication method, characterized in that: The communication method is applied to a communication management module of a multi-core system, wherein the multi-core system includes a plurality of processing cores, the communication management module is connected to the plurality of processing cores for communication, each two processing cores communicate with each other through a plurality of interrupt channels, each two processing cores have a shared memory, and each processing core stores interrupt channel information, and the method comprises the following steps: After the first processing core writes the target data into the shared memory between the first processing core and the second processing core, querying whether the interrupt channel information of the first processing core contains the target event identifier between the first processing core and the second processing core, and obtaining the channel query result of the first processing core; the first processing core and the second processing core are two different processing cores among the plurality of processing cores; Based on the channel query result, determining a target interrupt channel between the first processing core and the second processing core from a plurality of interrupt channels between the first processing core and the second processing core, the target interrupt channel carrying the target event identifier; The first processing core is controlled to send an interrupt signal to the second processing core through a target interrupt channel, so that the second processing core reads target data in the shared memory.
2. The communication method according to claim 1, characterized in that: The determining, based on the channel query result, a target interrupt channel between the first processing core and the second processing core from a plurality of interrupt channels between the first processing core and the second processing core comprises: If the channel query result of the first processing core is that the target event identifier exists in the interrupt channel information of the first processing core, then determining an interrupt channel carrying the target event identifier as a target interrupt channel among multiple interrupt channels between the first processing core and the second processing core; If the channel query result is that the target event identifier does not exist in the interrupt channel information of the first processing core, determining a target communication link between the first processing core and the second processing core, the target communication link including at least the first processing core and the second processing core; Based on the interrupt channel information of each processing core in the target communication link, the load of each interrupt channel between the first processing core and the second processing core is determined, and based on the load of each interrupt channel, the target interrupt channel between the first processing core and the second processing core is determined.
3. The communication method according to claim 2, characterized in that: The target communication link includes a first processing main core and a second processing main core, the first processing core is a first processing main core, the second processing core is a second processing main core, the first processing main core and the second processing main core are in different chips, the first processing main core and the second processing main core are connected through a plurality of interrupt channels, and the target interrupt channel between the first processing core and the second processing core is determined based on the load of each of the interrupt channels, including: Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core; Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core; Based on the first interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
4. The communication method according to claim 2, characterized in that: The target communication link includes a first processing slave core, a first processing master core, and a second processing master core, the first processing core is a first processing slave core, the second processing core is a second processing master core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core and the first processing master core are connected through a plurality of interrupt channels, and the target interrupt channel between the first processing core and the second processing core is determined based on the load of each of the interrupt channels, including: Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core; Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core; Determining, based on the interrupt channel information of the first processing slave core, a load of each of the interrupt channels between the first processing slave core and the first processing master core; Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the first processing slave core and the first processing master core as a second interrupt channel between the first processing slave core and the first processing master core; Based on the first interrupt channel and the second interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
5. The communication method according to claim 2, characterized in that: The target communication link includes a first processing master core, a second processing master core, and a second processing slave core, the first processing core is the first processing master core, the second processing core is the second processing slave core, the second processing slave core and the second processing master core are in the same chip, the second processing slave core and the second processing master core are connected via a plurality of interrupt channels, and the target interrupt channel between the first processing core and the second processing core is determined based on the load of each of the interrupt channels, including: Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core; Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core; Determining the load of each of the interrupt channels between the second processing master core and the second processing slave core based on the interrupt channel information of the second processing master core; Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the second processing master core and the second processing slave core as a third interrupt channel between the second processing master core and the second processing slave core; Based on the first interrupt channel and the third interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
6. The communication method according to claim 2, characterized in that: The target communication link includes a first processing slave core, a first processing master core, a second processing master core and a second processing slave core, the first processing core is a first processing slave core, the second processing core is a second processing slave core, the first processing slave core and the first processing master core are in the same chip, the first processing slave core and the first processing master core are connected via a plurality of interrupt channels, the second processing slave core and the second processing master core are in the same chip, the second processing slave core and the second processing master core are connected via a plurality of interrupt channels, and determining a target interrupt channel between the first processing core and the second processing core based on the load of each of the interrupt channels includes: Determining the load of each of the interrupt channels between the first processing main core and the second processing main core based on the interrupt channel information of the first processing main core; Determining a first interrupt channel with the smallest load among the plurality of interrupt channels between the first processing main core and the second processing main core; Determining, based on the interrupt channel information of the first processing slave core, a load of each of the interrupt channels between the first processing slave core and the first processing master core; Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the first processing slave core and the first processing master core as a second interrupt channel between the first processing slave core and the first processing master core; Determining the load of each of the interrupt channels between the second processing master core and the second processing slave core based on the interrupt channel information of the second processing master core; Determine an interrupt channel with the smallest load among the plurality of interrupt channels between the second processing master core and the second processing slave core as a third interrupt channel between the second processing master core and the second processing slave core; Based on the first interrupt channel, the second interrupt channel, and the third interrupt channel, the target event identifier is added to obtain a target interrupt channel between the first processing core and the second processing core.
7. The communication method according to claim 1, characterized in that: The interrupt channel information includes a channel identifier, the target event identifier corresponds to the channel identifier one by one, and the controlling the first processing core to send an interrupt signal to the second processing core through the target interrupt channel so that the second processing core reads the target data in the shared memory includes: Determine a channel identifier corresponding to the target event identifier; A target interrupt channel between the first processing core and the second processing core is called based on a channel identifier corresponding to the target event identifier, so that the target interrupt channel sends an interrupt signal to the second processing core.
8. The communication method according to claim 1, wherein: The interrupt channel information also includes the last use time of each interrupt channel and the interrupt channel handle information corresponding to each interrupt channel. The communication method also includes: Regularly comparing the last usage time of each of the interruption channels with the current time; When the time interval between the last used time and the current time is greater than a preset time threshold, the interrupt channel handle information of the interrupt channel corresponding to the last used time is deleted from the interrupt channel information.
9. The communication method according to claim 8, characterized in that: The interrupt channel information also includes an interrupt channel handle number, where the interrupt channel handle number is the number of the interrupt channel handle information. When the time interval between the last use time and the current time is greater than a preset time threshold, after deleting the interrupt channel handle information of the interrupt channel corresponding to the last use time in the interrupt channel information, the method further includes: Based on the deleted interrupt channel handle information, updating the interrupt channel handle number; When the number of interrupt channel handles between the first processing core and the second processing core in the interrupt channel information of the first processing core is zero, the interrupt channel information between the first processing core and the second processing core is deleted.
10. A communication system, comprising a plurality of processing cores and a communication management module according to any one of claims 1 to 9, wherein the communication management module is communicatively connected to the plurality of processing cores, each two of the processing cores communicate with each other through a plurality of interrupt channels, each two of the processing cores have a shared memory, each of the processing cores stores interrupt channel information, the plurality of processing cores include a first processing core and a second processing core, and the method comprises the following steps: The first processing core is used to write the target data into a shared memory between the first processing core and the second processing core; The management module is used to query whether there is a target event identifier between the first processing core and the second processing core in the interrupt channel information of the first processing core, and obtain a channel query result of the first processing core; The management module is further used to determine a target interrupt channel between the first processing core and the second processing core from among a plurality of interrupt channels between the first processing core and the second processing core, wherein the target interrupt channel carries the target event identifier; The first processing core is further configured to send an interrupt signal to the second processing core through a target interrupt channel, so that the second processing core reads target data in the shared memory.
11. A communication device, characterized in that: The communication device comprises: a query module, configured to query, after the first processing core writes target data into a shared memory between the first processing core and the second processing core, whether there is a target event identifier between the first processing core and the second processing core in the interrupt channel information of the first processing core, and obtain a channel query result of the first processing core; the first processing core and the second processing core are two different processing cores among the plurality of processing cores; a determination module, configured to determine, based on the channel query result, a target interrupt channel between the first processing core and the second processing core from among a plurality of interrupt channels between the first processing core and the second processing core, the target interrupt channel carrying the target event identifier; The sending module is used to control the first processing core to send an interrupt signal to the second processing core through the target interrupt channel, so that the second processing core reads the target data in the shared memory.
12. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the communication method according to any one of claims 1 to 9 when executing the computer program.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the communication method according to any one of claims 1 to 9 are implemented.
