Data migration method, device, equipment and computer readable storage medium
By judging the difference between the request pointer and the prefetch pointer, reducing the interaction frequency between the processor and the DMA component, the problems of increased processor load and reduced DMA efficiency are solved, and more efficient data transfer and parallel processing capabilities are achieved.
Patent Information
- Application Number
- CN202311368330.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-20
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2043-10-20
AI Technical Summary
During data transfer, the processor needs to frequently query the completion status of the DMA component, resulting in an increase in the processor load and a decrease in the efficiency of the DMA component. Especially in the multi-channel DMA scenario, the interaction frequency between the processor and the DMA component is higher and cannot adapt to a large number of cases. Data migration requirements.
By determining whether the request pointer and the prefetch pointer are the same. If it is different, the DMA request command is read from the processor's command cache area and update the prefetch pointer. It supports issuing multiple request commands at the same time to reduce the interaction between the processor and the DMA component. Frequency, the processor does not need to query the completion status for each request command, but only needs to query the completion pointer update periodically.
It reduces the load pressure of the processor, improves the data transfer efficiency and parallel processing capabilities of the DMA components, reduces the number of time the state polling is completed, and improves the speed of the processor issuing commands.
Smart Images

Figure CN117608468B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a data migration method, device, equipment and computer-readable storage medium. Background Art
[0002] Direct Memory Access (DMA) is an important component of computer systems, and is generally used to assist the processor in completing data movement and reduce the processor's load pressure. This mechanism of moving data directly from one storage unit to another can exist between different peripherals within the same host, or it can rely on the network or bridge chip to achieve data interaction between different hosts.
[0003] In the related art, when moving data, after the processor issues a request command to a DMA component, it needs to continuously query its completion status, and only after the request command is completed can a new request command be issued to the component. This single command loop method cannot adapt to large-scale data movement scenarios. In order to alleviate the accumulation of data movement commands on the processor side, the number of DMA components can be increased, that is, a multi-channel DMA solution, which can improve data movement efficiency to a certain extent.
[0004] However, as the number of DMA channels increases, the processor needs to maintain more DMA component configuration information and poll more completion status, which increases the frequency of interaction between the processor and the DMA component, causing an increasing load on the processor side and reducing the data movement efficiency of the DMA component. Summary of the invention
[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a data migration method, device, equipment and computer-readable storage medium to reduce the interaction frequency between the processor and the DMA component, reduce the load pressure on the processor side, and improve the data migration efficiency of the DMA component.
[0006] In a first aspect, an embodiment of the present disclosure provides a data migration method, which is applied to a data migration component. The method includes:
[0007] Determine whether the request pointer is the same as the prefetch pointer;
[0008] If the request pointer is different from the pre-fetch pointer, a DMA request command is read from a command buffer of the processor according to the remaining capacity of the temporary buffer inside the DMA component, the DMA request command is stored in the temporary buffer, and the pre-fetch pointer is updated according to the sum of the number of the read DMA request commands and the value of the pre-fetch pointer;
[0009] Execute a data moving operation according to the DMA request command;
[0010] When the data moving operation is completed, the completion pointer is updated based on the DMA request command.
[0011] In some embodiments, before performing the data moving operation according to the DMA request command, the method further includes:
[0012] Determining whether the migration state of the data migration component is an idle state;
[0013] The step of performing a data moving operation according to the DMA request command includes:
[0014] If the transfer state is an idle state, a data transfer operation is performed according to the DMA request command.
[0015] In some embodiments, after performing the data moving operation according to the DMA request command, the method further includes:
[0016] Acquire a data movement result, and determine whether the DMA request command is executed abnormally based on the data movement result;
[0017] If it is determined that the DMA request command is executed abnormally, the DMA request command is stored in an error command buffer and an error quantity register is updated;
[0018] When the error number register is updated, a completion pointer is updated based on the DMA request command.
[0019] In a second aspect, an embodiment of the present disclosure provides a data migration method, which is applied to a processor, and the method includes:
[0020] Read request pointer and completion pointer;
[0021] Determining whether the request pointer is the same as the completion pointer;
[0022] If the request pointer is different from the completion pointer, determining the number of unfinished commands and the number of DMA request commands allowed to be newly issued based on the difference between the request pointer and the completion pointer;
[0023] If the number of newly issued DMA request commands allowed is greater than zero, the newly issued DMA request commands are filled in the cache address corresponding to the request pointer, and after the commands are filled, the request pointer is updated according to the number of the newly issued DMA request commands.
[0024] In some embodiments, the method further comprises:
[0025] Read the error number register;
[0026] Determining whether the number of errors in the error number register is zero;
[0027] If the error number is not zero, an abnormal DMA request command is read from the error command buffer, and the abnormal DMA request command is processed, and the steps of reading the error number register and subsequent steps are continued.
[0028] In some embodiments, after determining whether the number of errors in the error number register is zero, the method further includes:
[0029] If the error number is zero, then read the request pointer and the completion pointer;
[0030] Determining whether the request pointer is the same as the completion pointer;
[0031] If the request pointer is not the same as the completion pointer, the steps of reading the error number register and the subsequent steps are continued until it is determined that the request pointer is the same as the completion pointer.
[0032] In a third aspect, an embodiment of the present disclosure provides a data migration device, which is applied to a data migration component, and the device includes:
[0033] A first judging module, used for judging whether the request pointer is the same as the prefetch pointer;
[0034] A reading module, configured to read a DMA request command from a command buffer area of a processor according to a remaining capacity of a temporary buffer inside a DMA component if the request pointer is different from the prefetch pointer, store the DMA request command in a temporary buffer, and update the prefetch pointer according to the sum of the number of the read DMA request commands and the value of the prefetch pointer;
[0035] An execution module, used for executing a data moving operation according to the DMA request command;
[0036] The first updating module is used to update the completion pointer based on the DMA request command after the data moving operation is completed.
[0037] In a fourth aspect, an embodiment of the present disclosure provides a data migration device, applied to a processor, the device comprising:
[0038] A first reading module, used for reading a request pointer and a completion pointer;
[0039] A first judging module, used for judging whether the request pointer is the same as the completion pointer;
[0040] A determination module, configured to determine the number of uncompleted commands and the number of DMA request commands allowed to be newly issued based on a difference between the request pointer and the completion pointer if the request pointer is different from the completion pointer;
[0041] The second judgment module is used to fill the newly issued DMA request commands in the cache address corresponding to the request pointer if the number of newly issued DMA request commands allowed is greater than zero, and update the request pointer according to the number of newly issued DMA request commands after the commands are filled.
[0042] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, including:
[0043] Memory;
[0044] Processor; and
[0045] Computer programs;
[0046] The computer program is stored in the memory and is configured to be executed by the processor to implement the method as described in the first aspect.
[0047] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the method as described in the first aspect.
[0048] In a seventh aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the method described in the first aspect is implemented.
[0049] The data moving method, apparatus, device and computer-readable storage medium provided by the embodiments of the present disclosure determine whether a request pointer is the same as a prefetch pointer. If the request pointer is not the same as the prefetch pointer, a DMA request command is read from a command buffer of a processor according to the remaining capacity of a temporary cache inside a DMA component, the DMA request command is stored in a temporary cache, the prefetch pointer is updated according to the sum of the number of the read DMA request commands and the value of the prefetch pointer, the DMA request command is taken out from the temporary cache, and a data moving operation is performed according to the DMA request command. When the data moving operation is completed, a completion pointer is updated based on the DMA request command. Compared with the prior art, the present invention can support the simultaneous issuance of multiple request commands through the circular pointer mechanism of the request pointer, pre-fetch pointer, and completion pointer. The processor stores the request command in the command buffer of the processor, and the subsequent DMA component can obtain the request command from the command buffer of the processor, thereby reducing the interaction frequency between the processor and the DMA component. The completion pointer is updated based on the DMA request command. The processor does not need to query the completion status for each request command, but only needs to query the update status of the completion pointer regularly, thereby releasing the load pressure of the processor, further improving the performance of DMA, and supporting multi-channel DMA to improve the parallel processing capability of DMA. Each channel in the multi-channel DMA uses the same circular pointer for DMA status interaction, which can greatly improve the speed of the processor issuing commands and reduce the number of completion status polling. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0051] 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0052] Figure 1 A flow chart of a data migration method provided by an embodiment of the present disclosure;
[0053] Figure 2 A schematic diagram of a DMA loop pointer interaction mechanism provided in an embodiment of the present disclosure;
[0054] Figure 3 A flow chart of a data migration method provided by another embodiment of the present disclosure;
[0055] Figure 4 A flow chart of a data migration method provided by another embodiment of the present disclosure;
[0056] Figure 5 A flow chart of a data migration method provided by another embodiment of the present disclosure;
[0057] Figure 6 A schematic diagram of the structure of a data migration device provided in an embodiment of the present disclosure;
[0058] Figure 7 A schematic diagram of the structure of a data migration device provided in an embodiment of the present disclosure;
[0059] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0060] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0061] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0062] Direct Memory Access (DMA) is an important component of computer systems, and is generally used to assist the processor in completing data movement and reduce the processor's load pressure. This mechanism of moving data directly from one storage unit to another can exist between different peripherals within the same host, or it can rely on the network or bridge chip to achieve data interaction between different hosts.
[0063] In the related art, when moving data, after the processor issues a request command to a DMA component, it needs to continuously query its completion status, and only after the request command is completed can a new request command be issued to the component. This single command loop method cannot adapt to large-scale data movement scenarios. In order to alleviate the accumulation of data movement commands on the processor side, the number of DMA components can be increased, that is, a multi-channel DMA solution, which can improve data movement efficiency to a certain extent.
[0064] However, as the number of DMA channels increases, the processor needs to maintain more DMA component configuration information and poll more completion status, which makes the interaction frequency between the processor and the DMA component higher, causing the processor load to increase, resulting in a decrease in the data transfer efficiency of the DMA component. To address this problem, the present disclosure provides a data transfer method, which is described below in conjunction with a specific embodiment.
[0065] Figure 1 A flow chart of a data migration method provided in an embodiment of the present disclosure. The execution subject of the method is a data migration component. The data migration component can be a DMA component or other data migration components. The method can be applied to a scenario of data migration or to a scenario of data migration based on a DMA request command. It is understandable that the data migration method provided in an embodiment of the present disclosure can also be applied in other scenarios.
[0066] The framework of the DMA component generally consists of three parts: configuration unit, source data unit, and destination data unit. The configuration unit is responsible for receiving the data movement request command issued by the processor and recording the completion status for the processor to query; the source data unit reads data from the source device according to the command parsed by the configuration unit; the destination data unit sends the data read by the source data unit to the terminal device.
[0067] Below Figure 1 The data migration method shown in the figure is introduced, and the method is applied to the data migration component. The specific steps of the method are as follows:
[0068] S101. Determine whether the request pointer is the same as the prefetch pointer.
[0069] The data moving component may be a DMA component or other data moving components, which is not limited here. In this embodiment, the data moving component is taken as an example of a DMA component. Figure 2 As shown, the request pointer, prefetch pointer, and completion pointer together constitute the DMA loop pointer. The request pointer is used to indicate the location where the new request command is about to be issued, the prefetch pointer is used to indicate the location of the command to be prefetched, and the completion pointer is used to indicate the location of the command to be completed. According to the pointer, the address of the DMA command stored in the command buffer of the processor can be converted. The DMA component determines whether the request pointer is the same as the prefetch pointer. Specifically, the DMA component reads the request pointer and the prefetch pointer, and then determines whether the request pointer is the same as the prefetch pointer.
[0070] S102. If the request pointer is different from the prefetch pointer, read the DMA request command from the command buffer of the processor according to the remaining capacity of the temporary cache inside the DMA component, store the DMA request command in the temporary cache, and update the prefetch pointer according to the sum of the number of the read DMA request commands and the value of the prefetch pointer.
[0071] If the DMA component determines that the request pointer is different from the pre-fetch pointer, it means that there is a request command to be processed. The DMA component can read the DMA request command from the command buffer of the processor according to the internal cache of the DMA component, store the DMA request command in a temporary cache, and add the current pre-fetch pointer value to the number of DMA request commands read to obtain a new pre-fetch pointer according to the number of DMA request commands read. Figure 2 As shown, the DMA component can read command 1 from the processor's command buffer, i.e., the processor DMA request command area, store command 1 in the internal buffer, and update the prefetch pointer to the prefetch pointer register. In some embodiments, if the DMA component determines that the request pointer is the same as the prefetch pointer, it means that there is no request command to be processed, and no processing is required. Figure 2 As shown, the processor first stores the request commands to be processed in the command buffer area of the processor, for example, command 1, command 2, ..., command n are stored in the command buffer area of the processor, that is, the processor DMA request command area, the DMA component reads the DMA request command from the command buffer area of the processor, stores the DMA request command into the internal cache, and updates it to the prefetch pointer. The processor can send multiple request commands to be processed at the same time, reduce the interaction frequency between the processor and the DMA component, and release the load pressure of the processor.
[0072] S103, taking out a DMA request command from the temporary buffer, and executing a data moving operation according to the DMA request command.
[0073] After storing the DMA request command in the temporary buffer, the DMA component takes out the DMA request command from the temporary buffer and performs a data moving operation according to the DMA request command.
[0074] S104: When the data move operation is completed, update a completion pointer based on the DMA request command.
[0075] Further, when the data move operation is completed, the DMA component updates the completion pointer based on the DMA request command. Specifically, after each data move is completed, the DMA component adds 1 to the completion pointer and updates it to the completion pointer register, indicating that a DMA request command has been completed. The processor does not need to constantly query the completion status of the DMA request command, thereby reducing the load pressure of the processor.
[0076] The disclosed embodiment determines whether a request pointer is the same as a prefetch pointer. If the request pointer is not the same as the prefetch pointer, a DMA request command is read from a command buffer of a processor according to the remaining capacity of a temporary buffer inside a DMA component, the DMA request command is stored in a temporary buffer, the prefetch pointer is updated according to the sum of the number of the read DMA request commands and the value of the prefetch pointer, the DMA request command is taken out from the temporary buffer, and a data move operation is performed according to the DMA request command. When the data move operation is completed, a completion pointer is updated based on the DMA request command. Compared with the prior art, the present invention can support the simultaneous issuance of multiple request commands through the circular pointer mechanism of the request pointer, pre-fetch pointer, and completion pointer. The processor stores the request command in the command buffer of the processor, and the subsequent DMA component can obtain the request command from the command buffer of the processor, thereby reducing the interaction frequency between the processor and the DMA component. The completion pointer is updated based on the DMA request command. The processor does not need to query the completion status for each request command, but only needs to query the update status of the completion pointer regularly, thereby releasing the load pressure of the processor, further improving the performance of DMA, and supporting multi-channel DMA to improve the parallel processing capability of DMA. Each channel in the multi-channel DMA uses the same circular pointer for DMA status interaction, which can greatly improve the speed of the processor issuing commands and reduce the number of completion status polling.
[0077] Figure 3 A flow chart of a data migration method provided by another embodiment of the present disclosure, the method is applied to a data migration component, such as Figure 3 As shown, the method includes the following steps:
[0078] S301. Determine whether the request pointer is the same as the prefetch pointer.
[0079] Specifically, the implementation process and principle of S301 and S101 are the same, and will not be repeated here.
[0080] S302. If the request pointer is different from the prefetch pointer, read the DMA request command from the command buffer of the processor according to the remaining capacity of the temporary cache inside the DMA component, store the DMA request command in the temporary cache, and update the prefetch pointer according to the sum of the number of the read DMA request commands and the value of the prefetch pointer.
[0081] Specifically, the implementation process and principle of S302 and S102 are the same, and will not be repeated here.
[0082] S303: Determine whether the migration state of the data migration component is an idle state.
[0083] In this embodiment, the data moving component is taken as a DMA component as an example. The DMA component determines whether the current moving state is an idle state.
[0084] S304: If the migration state is an idle state, a data migration operation is performed according to the DMA request command.
[0085] If the moving state is determined to be an idle state, a data moving operation is performed according to the DMA request command. In some embodiments, if the moving state is determined to be a non-idle state, it means that the data moving operation of the previous DMA request command has not been completed and needs to be waited.
[0086] S305 , obtaining a data movement result, and determining whether the DMA request command is executed abnormally based on the data movement result.
[0087] In this embodiment, the DMA component obtains the data transfer result, and further determines whether the DMA request command is executed abnormally according to the data transfer result. In some embodiments, if the data transfer result is abnormal, it is determined that the DMA request command is executed abnormally; if the data transfer result is normal, it is determined that the DMA request command is executed normally.
[0088] S306: If it is determined that the DMA request command is executed abnormally, the DMA request command is stored in an error command buffer, and an error number register is updated.
[0089] In this embodiment, if the DMA component determines that the DMA request command is executed abnormally, the DMA request command is stored in the error command cache and the error number register is updated. Specifically, if the data move operation detects an abnormality and cannot be completed, the DMA component stores the abnormal DMA request command in the error command cache and updates the error number register by adding 1 to the error number. Optionally, the DMA component can feed back the abnormality of the DMA request command execution to the processor, and process the abnormal DMA request command through the exception handling interface provided by the processor to improve system stability.
[0090] S307: After the error number register is updated, update the completion pointer based on the DMA request command.
[0091] Further, when the error number register is updated, the DMA component updates the completion pointer.
[0092] S308: If it is determined that the DMA request command is executed normally, then after the data move operation is completed, the completion pointer is updated based on the DMA request command.
[0093] If it is determined that the DMA request command is executed normally, then when the data move operation is completed, the DMA component updates the completion pointer based on the DMA request command. Specifically, the DMA component updates the completion pointer based on the DMA request command, indicating that the DMA request command has been completed, and the processor does not need to continuously query the completion status of the DMA request command, thereby reducing the load pressure of the processor.
[0094] The disclosed embodiment determines whether the request pointer is the same as the prefetch pointer. If the request pointer is not the same as the prefetch pointer, the DMA request command is read from the command buffer of the processor according to the remaining capacity of the internal cache, the DMA request command is stored in the internal cache, and the prefetch pointer is updated. Then, it is determined whether the moving state of the data moving component is an idle state. If the moving state is an idle state, the data moving operation is performed according to the DMA request command. Further, the data moving result is obtained, and based on the data moving result, it is determined whether the DMA request command is executed abnormally. If it is determined that the DMA request command is executed abnormally, the DMA request command is stored in the error command cache, and the error number register is updated. Then, when the error number register is updated, the completion pointer is updated based on the DMA request command. Compared with the prior art, the disclosed embodiment can support issuing multiple request commands at the same time through the circular pointer mechanism of request pointer, prefetch pointer and completion pointer, reduce the interaction frequency between the processor and DMA component, and update the completion pointer based on the DMA request command. The processor does not need to query the completion status of each request command, but only needs to periodically query the update status of the completion pointer and the error number register, thereby relieving the load pressure of the processor and further improving the performance of DMA. It also supports multi-channel DMA and improves the parallel processing capability of DMA.
[0095] Figure 4 A flow chart of a data migration method provided in an embodiment of the present disclosure. The execution subject of the method is a processor. The method can be applied to a scenario of data migration, and can also be applied to a scenario of data migration based on a DMA request command. It is understandable that the data migration method provided in an embodiment of the present disclosure can also be applied in other scenarios.
[0096] Below Figure 4 The data migration method shown in the figure is introduced, and the method is applied to a processor. The specific steps of the method are as follows:
[0097] S401, read the request pointer and the completion pointer.
[0098] like Figure 2As shown, the request pointer, prefetch pointer and completion pointer together constitute the DMA cycle pointer. The request pointer is used to indicate the location where the new request command is about to be issued, the prefetch pointer is used to indicate the location of the command to be prefetched, and the completion pointer is used to indicate the location of the command to be completed. According to the pointer, the address of the DMA command stored in the processor's command buffer can be converted.
[0099] The relationship between the request pointer and the completion pointer is used to provide the processor with a basis for determining whether the DMA is completed.
[0100] When the two are equal, it means that the DMA component has executed all the commands issued by the processor.
[0101] When the two are not equal, request pointer - completion pointer = difference. When the difference is positive, the difference is the number of unfinished commands, and (loop pointer depth - difference - 1) is the number of newly issued DMA request commands allowed; when the difference is negative, (loop pointer depth + difference) is the number of unfinished commands, and (absolute value of the difference - 1) is the number of newly issued DMA request commands allowed.
[0102] S402: Determine whether the request pointer is the same as the completion pointer.
[0103] After reading the values of the request pointer and the completion pointer registers, the processor determines whether the request pointer and the completion pointer are the same.
[0104] S403: If the request pointer is different from the completion pointer, determine the number of unfinished commands and the number of DMA request commands allowed to be newly issued based on the difference between the request pointer and the completion pointer.
[0105] If it is determined that the request pointer is different from the completion pointer, it means that the DMA request command has not been fully completed. Based on the difference between the request pointer and the completion pointer, the number of unfinished commands and the number of newly issued DMA request commands are determined.
[0106] Optionally, the number of newly issued DMA request commands allowed = (total depth of loop pointers - number of uncompleted commands - 1).
[0107] In some embodiments, if it is determined that the request pointer is the same as the completion pointer, it means that all pending request commands have been executed and there are no pending request commands.
[0108] S404: If the number of newly issued DMA request commands allowed is greater than zero, then fill the newly issued DMA request commands in the cache address corresponding to the request pointer, and after the commands are filled, update the request pointer according to the number of the newly issued DMA request commands.
[0109] If the number of newly issued DMA request commands allowed is greater than zero, the processor fills the newly issued DMA request commands in the cache address corresponding to the request pointer. After the commands are filled, the request pointer is updated according to the sum of the number of newly issued DMA request commands and the value of the request pointer.
[0110] The embodiment of the present disclosure reads the request pointer and the completion pointer to determine whether the request pointer and the completion pointer are the same. If the request pointer and the completion pointer are not the same, then based on the difference between the request pointer and the completion pointer, the number of unfinished commands and the number of DMA request commands allowed to be newly issued are determined. If the number of DMA request commands allowed to be newly issued is greater than zero, the newly issued DMA request command is filled in the cache address corresponding to the request pointer. After the command is filled, the request pointer is updated according to the number of the newly issued DMA request commands. Compared with the prior art, the present disclosure can support the simultaneous issuance of multiple request commands through the circular pointer mechanism of the request pointer, pre-fetch pointer, and completion pointer, and store the request commands in the command buffer area of the processor. The subsequent DMA component can obtain the request command from the command buffer area of the processor, reduce the interaction frequency between the processor and the DMA component, release the load pressure of the processor, and further improve the performance of DMA, and support multi-channel DMA to improve the parallel processing capability of DMA. Each channel in the multi-channel DMA uses the same circular pointer for DMA status interaction, which can greatly improve the speed of the processor issuing commands and reduce the number of completion status polling.
[0111] Figure 5 A flow chart of a data migration method provided by another embodiment of the present disclosure, the method is applied to a processor, such as Figure 5 As shown, the method includes the following steps:
[0112] S501. Read the request pointer and the completion pointer.
[0113] Specifically, the implementation process and principle of S501 and S401 are the same, and will not be repeated here.
[0114] S502, determine whether the request pointer is the same as the completion pointer, if so, execute S511, otherwise execute S503.
[0115] Specifically, the implementation process and principle of S502 and S402 are the same, and will not be repeated here.
[0116] S503: If the request pointer is different from the completion pointer, determine the number of unfinished commands and the number of DMA request commands allowed to be newly issued based on the difference between the request pointer and the completion pointer.
[0117] Specifically, the implementation process and principle of S503 and S403 are the same, and will not be repeated here.
[0118] S504: If the number of newly issued DMA request commands allowed is greater than zero, then fill the newly issued DMA request commands in the cache address corresponding to the request pointer, and after the commands are filled, update the request pointer according to the number of the newly issued DMA request commands.
[0119] Specifically, the implementation process and principle of S504 and S404 are the same, and will not be repeated here.
[0120] S505: Read the error number register.
[0121] In this embodiment, the processor reads the error number register, which records the number of errors in the DMA request command, that is, the number of abnormal DMA request commands.
[0122] S506: Determine whether the error number in the error number register is zero, if so, execute S508, otherwise execute S507.
[0123] In this embodiment, the processor determines whether the error number in the error number register is zero.
[0124] S507: If the error number is not zero, read the abnormal DMA request command from the error command buffer, process the abnormal DMA request command, and continue to execute the steps of reading the error number register and subsequent steps.
[0125] In this embodiment, if it is determined that the error number is not zero, an abnormal DMA request command is read from the error command cache, and the abnormal DMA request command is processed, and S505 and steps after S505 are continued. Each time the processor reads once, an abnormal DMA request command is read from the error command cache, and the abnormal DMA request command is processed. At the same time, the error number recorded in the error number register is reduced by 1, and so on, until it is 0. Optionally, the abnormal DMA request command can be processed by taking processing measures such as command retransmission or abnormal alarm, which helps to improve the stability of the system.
[0126] In some embodiments, when the processor processes the abnormal DMA request command, the abnormal DMA request command can be stored again in the command buffer of the processor, and the DMA component will re-read the abnormal DMA request command from the command buffer of the processor, and then perform a data move operation on the abnormal DMA request command. In some embodiments, the abnormal DMA request command can also be processed based on the exception handling interface to improve system stability.
[0127] S508: If the error number is zero, read the request pointer and the completion pointer.
[0128] If it is determined that the error number is zero, the processor reads the request pointer and the completion pointer.
[0129] S509, determine whether the request pointer is the same as the completion pointer, if so, execute S511, otherwise execute S505.
[0130] After reading the request pointer and the completion pointer, the processor determines whether the request pointer and the completion pointer are the same. If the request pointer and the completion pointer are not the same, the processor continues to execute the steps of reading the error number register and the following steps until the request pointer and the completion pointer are determined to be the same. If the request pointer and the completion pointer are determined to be different, the processor continues to execute S505 and the steps after S505; if the request pointer and the completion pointer are determined to be the same, the processor executes S510.
[0131] S510, end.
[0132] If the request pointer is the same as the completion pointer, the current process ends, and the request pointer and completion pointer and subsequent steps continue to be read to start a new execution process.
[0133] The disclosed embodiment reads the request pointer and the completion pointer to determine whether the request pointer and the completion pointer are the same. If the request pointer and the completion pointer are not the same, then based on the difference between the request pointer and the completion pointer, the number of unfinished commands and the number of DMA request commands allowed to be newly issued are determined. If the number of DMA request commands allowed to be newly issued is greater than zero, the newly issued DMA request commands are filled in the cache address corresponding to the request pointer. After the command is filled, the request pointer is updated according to the number of the newly issued DMA request commands. Further, the error number register is read to determine whether the error number in the error number register is zero. If the error number is not zero, the abnormal DMA request command is read from the error command cache, and the abnormal DMA request command is processed, and the reading of the error number register and subsequent steps are continued; if the error number is zero, the request pointer and the completion pointer are read to determine whether the request pointer and the completion pointer are the same. If the request pointer and the completion pointer are not the same, the reading of the error number register and subsequent steps are continued until it is determined that the request pointer and the completion pointer are the same. Compared with the prior art, the embodiments of the present disclosure can support the simultaneous issuance of multiple request commands through the circular pointer mechanism of the request pointer, pre-fetch pointer, and completion pointer, reduce the interaction frequency between the processor and the DMA component, release the load pressure of the processor, and further improve the performance of DMA, and support multi-channel DMA to improve the parallel processing capability of DMA. In addition, the present disclosure determines whether the number of errors in the error number register is zero. If the number of errors is not zero, the abnormal DMA request command is read from the error command cache, and the abnormal DMA request command is processed. The exception can be processed, and the stability of the system can be improved by taking processing measures such as command retransmission or abnormal alarm.
[0134] Figure 6 The data migration device provided in the embodiment of the present disclosure is a schematic diagram of the structure of the data migration device. The data migration device may be the data migration component described in the above embodiment, or the data migration device may be a component or assembly in the data migration component. The data migration device provided in the embodiment of the present disclosure may execute the processing flow provided in the data migration method embodiment, such as Figure 6As shown, the data moving device 60 includes: a first judgment module 61, a reading module 62, an execution module 63, and a first update module 64; wherein the first judgment module 61 is used to judge whether the request pointer is the same as the prefetch pointer; the reading module 62 is used to read the DMA request command from the command buffer area of the processor according to the remaining capacity of the temporary cache inside the DMA component if the request pointer is not the same, store the DMA request command in the temporary cache, and update the prefetch pointer according to the sum of the number of the read DMA request commands and the value of the prefetch pointer; the execution module 63 is used to take out the DMA request command from the temporary cache, and execute the data moving operation according to the DMA request command; the first update module 64 is used to update the completion pointer based on the DMA request command after the data moving operation is completed.
[0135] Optionally, before the execution module 63 executes the data migration operation according to the DMA request command, the data migration device 60 further includes: a second judgment module 65; the second judgment module 65 is used to judge whether the migration state of the data migration component is an idle state;
[0136] When the execution module 63 executes the data moving operation according to the DMA request command, it is specifically used to: if the moving state is an idle state, execute the data moving operation according to the DMA request command.
[0137] Optionally, after the execution module 63 executes the data moving operation according to the DMA request command, the data moving device 60 also includes: a third judgment module 66, a storage module 67, and a second update module 68; the third judgment module 66 is used to obtain the data moving result, and judge whether the DMA request command is executed abnormally based on the data moving result; the storage module 67 is used to store the DMA request command in the error command cache and update the error number register if it is judged that the DMA request command is executed abnormally; the second update module 68 is used to update the completion pointer based on the DMA request command after the error number register is updated.
[0138] Figure 6 The data migration device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.
[0139] Figure 7 The data migration device provided in the embodiment of the present disclosure is a schematic diagram of the structure of the data migration device. The data migration device may be a processor as described in the above embodiment, or the data migration device may be a component or assembly in the processor. The data migration device provided in the embodiment of the present disclosure may execute the processing flow provided in the data migration method embodiment, such as Figure 7As shown, the data moving device 70 includes: a first reading module 71, a first judging module 72, a determining module 73, and a second judging module 74; wherein, the first reading module 71 is used to read the request pointer and the completion pointer; the first judging module 72 is used to judge whether the request pointer is the same as the completion pointer; the determining module 73 is used to determine the number of unfinished commands and the number of newly issued DMA request commands based on the difference between the request pointer and the completion pointer if the request pointer is not the same; the second judging module 74 is used to fill the newly issued DMA request commands in the cache address corresponding to the request pointer if the number of newly issued DMA request commands allowed is greater than zero, and update the request pointer according to the number of newly issued DMA request commands after the commands are filled.
[0140] Optionally, the data moving device 70 also includes: a second reading module 75, a third judgment module 76, and a first processing module 77; the second reading module 75 is used to read the error number register; the third judgment module 76 is used to judge whether the error number in the error number register is zero; the first processing module 77 is used to read the abnormal DMA request command from the error command cache if the error number is not zero, and process the abnormal DMA request command, and continue to execute the steps of reading the error number register and subsequent steps.
[0141] Optionally, after the third judgment module 76 determines whether the number of errors in the error number register is zero, the data moving device 70 also includes: a third reading module 78 and a second processing module 79; the third reading module 78 is used to read the request pointer and the completion pointer if the error number is zero, and determine whether the request pointer is the same as the completion pointer; the second processing module 79 is used to continue to read the error number register and subsequent steps if the request pointer is different from the completion pointer, until it is determined that the request pointer is the same as the completion pointer.
[0142] Figure 7 The data migration device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.
[0143] Figure 8 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 8 , which shows a structural schematic diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0144] like Figure 8As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603 to implement the data migration method of the embodiment described in the present disclosure. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0145] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0146] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the data migration method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0147] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0148] In addition, an embodiment of the present disclosure further provides a vehicle, comprising: a memory; a processor; and a computer program; wherein the computer program is stored in the memory and is configured to be executed by the processor to implement the data migration method as described above.
[0149] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0150] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0151] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0152] Determine whether the request pointer is the same as the prefetch pointer;
[0153] If the request pointer is different from the pre-fetch pointer, a DMA request command is read from a command buffer of the processor according to the remaining capacity of the temporary buffer inside the DMA component, the DMA request command is stored in the temporary buffer, and the pre-fetch pointer is updated according to the sum of the number of the read DMA request commands and the value of the pre-fetch pointer;
[0154] Taking out the DMA request command from the temporary buffer, and performing a data moving operation according to the DMA request command;
[0155] When the data moving operation is completed, the completion pointer is updated based on the DMA request command.
[0156] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0157] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0158] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0159] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0160] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0161] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0162] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0163] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0164] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A data migration method, characterized in that: Applied to a data migration component, the method includes: Determine whether the request pointer and the prefetch pointer are the same; If the request pointer is different from the pre-fetch pointer, a DMA request command is read from a command buffer of the processor according to the remaining capacity of the temporary buffer inside the DMA component, the DMA request command is stored in the temporary buffer, and the pre-fetch pointer is updated according to the sum of the number of the read DMA request commands and the value of the pre-fetch pointer; Taking out the DMA request command from the temporary buffer, and performing a data moving operation according to the DMA request command; When the data moving operation is completed, updating a completion pointer based on the DMA request command; The request pointer, prefetch pointer, and completion pointer together constitute the DMA cycle pointer. The request pointer is used to indicate the location where the new request command is about to be issued, the prefetch pointer is used to indicate the location of the command to be prefetched, and the completion pointer is used to indicate the location of the command to be completed. According to the pointer, the address of the DMA command stored in the processor's command buffer is converted.
2. The method according to claim 1, characterized in that: Before executing the data moving operation according to the DMA request command, the method further includes: Determining whether the migration state of the data migration component is an idle state; The step of performing a data moving operation according to the DMA request command includes: If the transfer state is an idle state, a data transfer operation is performed according to the DMA request command.
3. The method according to claim 1, characterized in that After executing the data moving operation according to the DMA request command, the method further includes: Acquire a data movement result, and determine whether the DMA request command is executed abnormally based on the data movement result; If it is determined that the DMA request command is executed abnormally, the DMA request command is stored in an error command buffer and an error quantity register is updated; When the error number register is updated, a completion pointer is updated based on the DMA request command.
4. A data migration method, characterized in that: Applied to a processor, the method comprises: Read request pointer and completion pointer; Determining whether the request pointer is the same as the completion pointer; If the request pointer is different from the completion pointer, determining the number of unfinished commands and the number of DMA request commands allowed to be newly issued based on the difference between the request pointer and the completion pointer; If the number of newly issued DMA request commands allowed is greater than zero, then the newly issued DMA request commands are filled in the cache address corresponding to the request pointer, and after the commands are filled, the request pointer is updated according to the number of the newly issued DMA request commands; The request pointer, prefetch pointer, and completion pointer together constitute the DMA cycle pointer. The request pointer is used to indicate the location where the new request command is about to be issued, the prefetch pointer is used to indicate the location of the command to be prefetched, and the completion pointer is used to indicate the location of the command to be completed. According to the pointer, the address of the DMA command stored in the processor's command buffer is converted.
5. The method according to claim 4, characterized in that The method further comprises: Read the error number register; Determining whether the number of errors in the error number register is zero; If the error number is not zero, an abnormal DMA request command is read from the error command buffer, and the abnormal DMA request command is processed, and the steps of reading the error number register and subsequent steps are continued.
6. The method according to claim 5, characterized in that After determining whether the number of errors in the error number register is zero, the method further includes: If the error number is zero, then read the request pointer and the completion pointer; Determining whether the request pointer is the same as the completion pointer; If the request pointer is not the same as the completion pointer, the steps of reading the error number register and the subsequent steps are continued until it is determined that the request pointer is the same as the completion pointer.
7. A data migration device, characterized in that: Applied to a data migration component, the device comprises: A first judging module, used for judging whether the request pointer is the same as the prefetch pointer; A reading module, configured to read a DMA request command from a command buffer area of a processor according to a remaining capacity of a temporary buffer inside a DMA component if the request pointer is different from the prefetch pointer, store the DMA request command in a temporary buffer, and update the prefetch pointer according to the sum of the number of the read DMA request commands and the value of the prefetch pointer; An execution module is used to take out a DMA request command from a temporary buffer and execute a data moving operation according to the DMA request command; A first updating module, configured to update a completion pointer based on the DMA request command when the data moving operation is completed; The request pointer, prefetch pointer, and completion pointer together constitute the DMA cycle pointer. The request pointer is used to indicate the location where the new request command is about to be issued, the prefetch pointer is used to indicate the location of the command to be prefetched, and the completion pointer is used to indicate the location of the command to be completed. According to the pointer, the address of the DMA command stored in the processor's command buffer is converted.
8. A data migration device, characterized in that: Applied to a processor, the device comprises: A first reading module, used for reading a request pointer and a completion pointer; A first judging module, used for judging whether the request pointer is the same as the completion pointer; A determination module, configured to determine the number of uncompleted commands and the number of DMA request commands allowed to be newly issued based on a difference between the request pointer and the completion pointer if the request pointer is different from the completion pointer; A second judgment module is used for filling the newly issued DMA request commands in the cache address corresponding to the request pointer if the number of newly issued DMA request commands allowed is greater than zero, and updating the request pointer according to the number of newly issued DMA request commands after the commands are filled; The request pointer, prefetch pointer, and completion pointer together constitute the DMA cycle pointer. The request pointer is used to indicate the location where the new request command is about to be issued, the prefetch pointer is used to indicate the location of the command to be prefetched, and the completion pointer is used to indicate the location of the command to be completed. According to the pointer, the address of the DMA command stored in the processor's command buffer is converted.
9. An electronic device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Data access method, computing device and computer system
CN112749111A
Instruction moving method, system, equipment and medium
CN114816566A
Data transmission method and device, electronic equipment and storage medium
CN115622954A
Prefetching method and device, prefetching training method and device and storage medium
CN115934170A
Efficient remote pointer sharing for enhanced access to key-value stores
US20160203102A1
