Data migration method, device and system
By splitting data and detecting storage space in the DMA controller, the problem of read bus hang and data overwriting is solved, and efficient data movement is achieved.
Patent Information
- Application Number
- CN201811557736.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-12-19
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-10-01
Smart Images

Figure CN109558348B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a data migration method, a data migration device and a data migration system. Background Art
[0002] Direct Memory Access (DMA) refers to a mechanism for quickly moving data, for example, a mechanism for moving data from an external I / O device to a host computer. A DMA controller is a controller used to complete the data movement.
[0003] At present, the process of DMA controller moving data includes: after receiving the DMA request of the I / O device, the DMA controller replies with a response signal to the I / O device while the DMA controller is in a state of preparing to move data; and divides the data amount in the DMA request used to represent the size of the data to be moved into multiple sub-data amounts. For each sub-data amount, the DMA controller sends a read request to the read bus and a write request to the write bus.
[0004] However, there may be problems with the read bus being hung and / or the write bus being inefficient. Summary of the invention
[0005] Based on this, the present application proposes a data migration method to achieve a bus being hung when responding to a read request and / or prevent data written into a host computer from being overwritten.
[0006] The present application also provides a data migration device and a data migration system based on FPGA to ensure the implementation and application of the above method in practice.
[0007] The technical solution provided by this application is:
[0008] The present application provides a data migration method, which is applied to a DMA controller, wherein the DMA controller migrates the to-be-migrated data of an I / O device to a host computer, including:
[0009] According to a preset splitting rule, the data volume in the DMA request sent by the I / O device is split to obtain multiple sub-data volumes;
[0010] Before responding to the target sub-data volume, determining the number of sub-data volumes currently responded to by the DMA controller; the target sub-data volume is any of the sub-data volumes;
[0011] By detecting whether the data corresponding to the plurality of sub-data volumes are all written into a preset target storage space, detecting whether there is currently available storage space in the preset target storage space; the preset target storage space is a storage space in the host computer for storing data of the I / O device;
[0012] When the number of sub-data amounts currently responded to is not greater than a preset quantity threshold, and / or there is available storage space in the preset target storage space, the data of the target sub-data amount is read into the preset storage space of the DMA controller, and the data of the target sub-data amount is written from the preset storage space to the host computer; the preset quantity threshold represents the total number of sub-data amounts corresponding to the data that can be stored in the preset storage space.
[0013] Preferably, the step of reading the target sub-data volume data into a preset storage space of the DMA controller, and writing the target sub-data volume data from the preset storage space into the host computer comprises:
[0014] Hanging a read request for moving the target sub-data amount of data on an internal bus;
[0015] After the internal bus reads the data of the target sub-data volume into the preset storage space, a write request for moving the data of the target sub-data volume is hung on the internal bus, so that the internal bus writes the data of the target sub-data volume from the preset storage space to the host computer.
[0016] Preferably, after reading the data of the target sub-data volume into the preset storage space of the DMA controller, the method further includes:
[0017] The number of the currently responded sub-data amount is increased by 1.
[0018] Preferably, after writing the target sub-data volume of data from the preset storage space into the host computer, the method further includes:
[0019] The number of the currently responded sub-data amount is reduced by 1.
[0020] Preferably, after writing the target sub-data volume of data from the preset storage space into the host computer, the method further includes:
[0021] After the data corresponding to the plurality of sub-data volumes are all written into the preset target storage space, an interrupt instruction is sent to the host computer; the interrupt instruction is used to instruct the host computer to remove the data in the preset target storage space.
[0022] The present application also discloses a data moving device, which is connected to an internal bus and includes: a packetizing module, a flow control module and a moving module;
[0023] The subpacketization module is used to split the data volume in the DMA request sent by the I / O device according to a preset splitting rule to obtain multiple sub-data volumes;
[0024] The flow control module is used to determine the number of sub-data amounts that have been responded to at present, and determine the level value of the preset indication signal according to whether the number of sub-data amounts that have been responded to at present is greater than a preset number threshold; the preset number threshold represents the total number of sub-data amounts corresponding to data that can be stored in the preset storage space of the moving device;
[0025] The flow control module is further used to determine the level value of the enable signal corresponding to the I / O device by detecting whether there is available storage space in the preset target storage space; the preset target storage space is a preset storage space in the host computer for storing data of the I / O device;
[0026] The subpackaging module is further configured to send preset information to the moving module when a preset condition is met; the preset condition includes: the level value of the preset indication signal indicates that the number of the currently responded sub-data amount is not greater than the preset number threshold, and / or the level value of the enable signal indicates that there is available storage space in the preset target storage space;
[0027] The migration module is used to read the data of the target sub-data volume into the preset storage space of the data migration device when receiving the preset information, and write the data of the target sub-data volume from the preset storage space to the preset target storage space.
[0028] Preferably, the migration module includes: a read queue submodule, a write cache submodule, a write data submodule, a cache submodule and an engine submodule;
[0029] The subpackaging module is further configured to send preset information to the moving module when a preset condition is met, including:
[0030] The subpacketizing module is further configured to send preset first information to the read queue submodule and send preset second information to the write cache submodule when the preset condition is met;
[0031] The migration module is used to read the data of the target sub-data volume into the preset storage space of the data migration device and write the data of the target sub-data volume from the preset storage space to the preset target storage space upon receiving the preset information, including:
[0032] The read queue submodule is used to send a read request to the engine submodule after receiving the preset first information;
[0033] The engine submodule is used to read the data corresponding to the target sub-data volume into the cache submodule according to the read request;
[0034] The read queue submodule is further configured to send the preset second information in the write cache module to the write queue submodule after the cache submodule saves the data of the target sub-data volume;
[0035] The write queue submodule is used to send a write request to the engine submodule after detecting the preset second information;
[0036] The engine submodule is further configured to write the target sub-data volume of data from the cache submodule into the preset target storage space according to the write request.
[0037] Preferably, the engine submodule is further used to send a write response signal to the flow control module after writing the target sub-data volume of data from the cache submodule to the host computer.
[0038] Preferably, the subpacketizing module is further configured to send preset third information to the flow control module when sending preset first information to the read queue submodule and sending preset second information to the write cache submodule; the preset third information includes a flag bit; the flag bit indicates whether the target sub-data volume is the last sub-data volume to be responded to in the data volume of the DMA request;
[0039] The flow control module is further used to determine the level value of the enable signal corresponding to the I / O device by detecting whether there is available storage space in the preset target storage space, including:
[0040] The flow control module is also used to, after receiving the write response signal, set the level value of the enable signal of the I / O device to a first level value in a flag bit in the preset third information corresponding to the write response signal to indicate the last target sub-data amount; otherwise, set the level value of the enable signal of the I / O device to a second level value; the first level value indicates that there is no available storage space in the preset target storage space; the second level value indicates that there is available storage space in the preset target storage space.
[0041] Preferably, the flow control module is also used to send an interrupt instruction to the host computer after receiving the write response signal, when the flag bit in the preset third information indicates the last target sub-data amount to be responded to; the interrupt instruction is used to instruct the host computer to remove the data in the target storage space.
[0042] Preferably, the flow control module is further used to set the level value of the enable signal corresponding to the I / O device from the first level value to the second level value when receiving the target instruction sent by the host computer.
[0043] Preferably, the flow control module is further used to update the number of currently responded sub-data amounts by subtracting 1 from the number of currently responded sub-data amounts when receiving the write response signal.
[0044] The present application also discloses a data migration system, comprising an I / O device, a data migration device based on FPGA and a host computer; the I / O device is connected to the data migration device based on FPGA; the host computer is connected to the data migration device based on FPGA via a bus;
[0045] The I / O device sends a DMA request to the FPGA-based data migration device; the DMA request includes the data amount of the I / O device to be migrated;
[0046] The FPGA-based data moving device is used to move the data to be moved from the I / O device to the host computer; the FPGA-based data moving device is any one of the FPGA-based data moving devices described above.
[0047] The beneficial effects of this application are:
[0048] The data migration method, device and system disclosed in the present application are as follows: the amount of data to be migrated in the DMA request is split according to a preset rule to obtain multiple sub-data amounts; the amount of data in the DMA request sent by the I / O device is split according to the preset splitting rule to obtain multiple sub-data amounts; before responding to the target sub-data amount, the number of sub-data amounts currently responded to by the DMA controller is determined; by detecting whether the data corresponding to the multiple sub-data amounts are all written into the preset target storage space, whether there is currently available storage space in the preset target storage space is detected; when the number of sub-data amounts currently responded is not greater than the preset number threshold, and / or there is available storage space in the preset target storage space, since the preset number threshold is the total number of sub-data amounts corresponding to the data that can be stored in the buffer of the DMA controller, therefore, the number of sub-data amounts currently responded is not greater than the preset number threshold, indicating that after responding to the current target sub-data amount, the buffer of the DMA controller has storage space for storing the data corresponding to the target sub-data amount; the existence of available storage space in the preset target storage space indicates that after the data corresponding to the current target sub-data amount is moved to the preset target storage space, the data stored in the preset target storage space is prevented from being overwritten. Therefore, the present application can solve at least one of the following problems: the bus is hung in response to a read request, and the data in the target storage space corresponding to the I / O device is overwritten. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present application 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 embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0050] Figure 1 A schematic diagram of a flow chart of an embodiment of a data migration method in the present application;
[0051] Figure 2 This is a schematic diagram of the structure of a FPGA-based data migration system in this application;
[0052] Figure 3 This is a structural diagram of a data migration system in this application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] Figure 1 This is a flow chart of an embodiment of a data migration method of the present application, which is applied to a DMA controller and includes the following steps:
[0055] Step 101: After receiving a DMA request sent by an I / O device, if the DMA controller is in a ready state, a response signal is sent to the I / O device.
[0056] In this embodiment, the DMA request includes a data amount, which indicates the size of the data to be moved by the I / O device. In this step, the ready state indicates that the DMA controller can respond to the data amount in the DMA request, and the data amount in the previous DMA request has been responded to. For example, after receiving the DMA request, the DMA controller currently has responded to the data amount in the previous DMA request. At this time, a response signal is sent to the I / O device.
[0057] It should be noted that in this step, only one condition for sending a response signal to the I / O device is given; in actual applications, the specific condition for sending a response signal when a DMA request is received can also be set according to the specific scenario, and this embodiment does not limit the specific content of the condition.
[0058] Step 102: According to a preset splitting rule, the data volume in the DMA request sent by the I / O device is split to obtain multiple sub-data volumes.
[0059] Generally, the communication protocol for DMA controller to move data specifies the amount of data to be moved each time. In this step, the preset splitting rule is to split the amount of data in the DMA request into multiple amounts of data according to the amount of data specified in the protocol. For the convenience of description, each amount of data obtained by splitting is called a sub-data amount. For example, the amount of data in the DMA request is 2.5KB, and the protocol specifies that the amount of data to be moved each time is 1KB; the preset splitting rule is to split the data amount according to 1KB as the splitting standard, and obtain 3 sub-data amounts, namely 1KB, 1KB and 0.5KB.
[0060] In the data moving process, the data of each sub-data volume needs to be moved from the source address to the target address in sequence. In order to ensure that for each sub-data volume, after a read request is sent to the read bus, the buffer of the DMA controller has space for storing the data corresponding to the sub-data volume, in this embodiment, the size of the buffer of the DMA controller is also divided according to the preset splitting rule, and the storage space of the buffer can be divided into the total number of sub-data volumes at most. For example, the DMA buffer is 5KB, and at this time, the total number of sub-data volumes into which the storage space of the buffer is divided is 5.
[0061] In this embodiment, each sub-data volume is responded to in turn, wherein responding to a sub-data volume indicates that the sub-data volume can be processed, that is, the sub-data volume is used as a sub-event to initiate a read / write request to the internal bus. The response process for each sub-data volume is the same, and the specific response process is described by taking any sub-data volume as an example. For the convenience of description, any sub-data volume is referred to as a target sub-data volume. Specifically, the response process for the target sub-data volume may include steps 103 to 109:
[0062] Step 103: Before responding to the target sub-data volume, calculate the current value of the preset variable.
[0063] In this step, the current value of the preset variable indicates the number of sub-data volumes that the DMA controller has currently responded to. For example, if the DMA controller is currently moving 5KB of data, and 5KB is 3 sub-data volumes, the current value of the preset variable is 3. The initial value of the preset variable can be 0. During the initialization process, the current value of the preset variable is the initial value. Of course, the initial value of the preset variable can also be other values, and this embodiment does not limit the initial value of the preset variable.
[0064] Step 104: Determine the level value of the enable signal corresponding to the I / O device according to whether the internal bus has completed the movement of the data corresponding to the data amount in the DMA request.
[0065] In this embodiment, one I / O device corresponds to one enable signal, and the level value of the enable signal corresponding to the I / O device includes a preset first level value and a preset second level value, wherein the preset first level value indicates that the internal bus has completed the movement of data corresponding to the data amount in the DMA request, and at this time, there is no available storage space in the preset target storage space in the cache of the host computer for caching the data of the I / O device; the preset second level value indicates that the internal bus has not completed the movement of data corresponding to the data amount in the DMA request, and at this time, there is available storage space in the preset target storage space. The initial value of the level value of the enable signal corresponding to the I / O device is the preset second level value.
[0066] Specifically, in this embodiment, after the internal bus completes the movement of data corresponding to a sub-data volume, the DMA controller generates a write response signal. In this step, it can be determined whether the total number of write response signals reaches the total number of sub-data volumes obtained by segmentation. If not, the level value of the enable signal corresponding to the I / O device is set to the preset second level value; if reached, the level value of the enable signal corresponding to the I / O device is set to the preset first level value.
[0067] It is also possible to determine whether the data corresponding to multiple sub-data amounts have all been moved, based on whether the target sub-data amount that has currently been moved is the last sub-data amount among the multiple sub-data amounts corresponding to the DMA request. If all the data have been moved, the level value of the enable signal corresponding to the I / O device is set to a preset first level value; otherwise, the level value of the enable signal corresponding to the I / O device is set to a preset second level value.
[0068] Step 105: Determine whether a preset condition is met. If the preset condition is met, execute step 106; otherwise, execute step 105.
[0069] In this step, the preset condition includes a first preset condition and / or a second preset condition. The first preset condition is that the current value of the preset variable is less than the preset variable threshold; the second preset condition is that the level value of the enable signal of the I / O device is a preset second level value. The preset quantity threshold represents the total number of sub-data that the storage space of the DMA controller can respond to.
[0070] Among them, satisfying the first preset condition can ensure that the DMA controller can still respond to the target sub-data volume, that is, after responding to the target sub-data volume, there is data in the buffer for storing the target sub-data volume; so that the internal bus will not be hung when responding to the read request.
[0071] Among them, satisfying the second preset condition can ensure that there is remaining storage space in the storage space corresponding to the I / O device in the host computer, and the remaining storage space is used to store data corresponding to the target sub-data volume to prevent the data stored in the storage space corresponding to the I / O device in the host computer from being overwritten.
[0072] It should be noted that, if in actual applications, it is necessary to ensure that the internal bus is not hung when responding to a read request, and to ensure that the data moved by the I / O device is not overwritten, the preset condition includes a first preset condition and a second preset condition. Specifically, the preset condition includes the first preset condition and / or the second preset condition, which can be set according to actual conditions, and this embodiment does not limit it.
[0073] The purpose of step 105 is to execute step 106 when the number of currently responded sub-data volumes is not greater than a preset number threshold and / or when there is available storage space in the preset target storage space.
[0074] Step 106: Respond to the target sub-data volume.
[0075] The specific response process may include:
[0076] Step A1: Initiate a read request to the internal bus for moving data of a target sub-data volume.
[0077] In this step, a read request is sent to the bus, and the read request includes: a source address and a target sub-data amount. In this embodiment, the DMA controller communicates with the internal bus through the AXI4 protocol.
[0078] Step A2: The data of the target sub-data volume is stored in a preset storage space of the buffer.
[0079] The specific implementation of this step is prior art and will not be described in detail here.
[0080] Step A3: After the data of the target sub-data volume is stored in the buffer, a write request is initiated to the internal bus.
[0081] In this step, the buffer is a preset storage space in the DMA controller. The write request includes: a target address and a sub-data amount.
[0082] In this step, after the data of the target sub-data volume is saved in the buffer, a write request is initiated to the internal bus, so that when the internal bus responds to the write request, the data of the target sub-data volume already exists in the buffer. Then, the internal bus does not need to wait and can directly move the data, thereby improving the efficiency of the internal bus in responding to the write request.
[0083] In this embodiment, in response to the target sub-data volume, the current value of the preset variable is added by 1 to update the current value of the preset variable, so that when this embodiment again determines whether the current value of the preset variable is less than the preset quantity threshold, the current value of the preset variable used is the latest current value.
[0084] In this embodiment, after the data of the target sub-data volume is written into the preset target storage space of the host computer, the current value of the preset variable is updated by subtracting 1 from the current value of the preset variable, so that when this implementation determines whether the current value of the preset variable is less than the preset quantity threshold, the current value of the preset variable used is the latest current value.
[0085] In this embodiment, after the data corresponding to all the sub-data amounts corresponding to the DMA request are written to the host computer, an interrupt instruction is sent to the host computer, and the interrupt instruction is used to instruct the host computer to remove the data in the target storage space; at the same time, this embodiment sets the enable signal corresponding to the I / O device to a preset first level value; the preset first level value indicates that after receiving the DMA request sent by the I / O device, the DMA request will not be responded to temporarily to prevent the data in the target storage space from being overwritten.
[0086] In this embodiment, after the upper computer removes the data in the target storage space, it sends a target instruction to the DMA controller, which indicates that the DMA controller can respond to the amount of data in the DMA request sent by the I / O device. At this time, this embodiment sets the enable signal corresponding to the I / O device to a preset second level value; the preset second level value indicates that after receiving the DMA request sent by the I / O device, the DMA request can be responded to.
[0087] In this embodiment, in order to ensure that the data corresponding to the data volume in the DMA request of the I / O device has been moved, and to prevent the moved data from being overwritten, step 104 can preferably determine whether the current value of the preset variable is less than the preset variable threshold, and determine whether the level value of the enable signal corresponding to the I / O device is the preset second level value.
[0088] Figure 2 This is a structural diagram of an FPGA-based data migration system in the present application, which may include: an I / O device, an FPGA-based data migration device and a host computer, wherein the I / O device is connected to the FPGA-based data migration device, and the host computer is connected to the FPGA-based data migration device through an external bus.
[0089] The FPGA-based data moving device includes an I / O control module, a DMA controller and an internal bus, wherein both the I / O control module and the DMA controller communicate with the internal bus through the AXI4 protocol.
[0090] The DMA controller includes: a packetization module 201, a flow control module 202, and a movement module 203; wherein the movement module 203 includes a read queue submodule 2031, a write cache submodule 2032, a write queue submodule 2033, an engine submodule 3034 and a cache submodule 2035.
[0091] The working process of the FPGA-based data migration device includes the following steps:
[0092] S301, the I / O control module sends a DMA request and a vector to the packetization module 201; the DMA request includes the data amount; the vector includes: an I / O device identifier;
[0093] In this embodiment, when the data in the I / O device needs to be moved to the memory by the DMA controller, the I / O control module sends a DMA request to the DMA controller, and the DMA request includes the amount of data that the I / O device needs to move. For example, the amount of data that the I / O device needs to move is 2.5KB, and the amount of data in the DMA request is 2.5KB. In this embodiment, the I / O device can be a probe of an ultrasonic instrument.
[0094] S302: When the subpackaging module 201 is in a ready state, it sends a response signal to the I / O control module.
[0095] S303, the packet splitting module 201 splits the data volume into multiple sub-data volumes according to the packet length configured by the host computer in the I / O control module.
[0096] For example, if the data volume in the DMA request is 2.5 KB and the packet length configured by the host computer is 0.5 KB, the packetization module 301 divides the data volume into 5 sub-data volumes, and the size of each sub-data volume is 0.5 KB.
[0097] S304, the subpacketizing module 201 obtains the source address and the target address configured by the host computer.
[0098] In this embodiment, the host computer has configured the address of the data to be moved in the I / O device in advance in the I / O control module. For the convenience of description, the address of the data to be moved in the I / O device is referred to as the source address in this embodiment. In addition, in this embodiment, the host computer has also configured the address of the data to be moved in the I / O device in advance in the I / O control module. For the convenience of description, the address to which the data to be moved in the I / O device configured by the host computer needs to be moved is referred to as the target address.
[0099] S305 , the packet sub-module 201 sends preset first information to the read queue sub-module 2031 , sends preset second information to the write cache sub-module 2032 , and sends preset third information to the flow control module 202 .
[0100] In this step, when the first preset condition and the second preset condition are met, the subpackaging module 201 executes the action of this step.
[0101] It should be noted that when the first preset condition and the second preset condition are met at the same time, the subpackaging module 201 executes the action of this step, which is an optimal implementation. In actual applications, it is determined according to the actual situation when which condition is met to execute the action of this step.
[0102] The first preset condition: the level value of the preset indication signal of the flow control module 202 indicates that the current value of the preset variable is less than the preset quantity threshold; wherein the current value of the preset variable indicates the number of sub-data volumes currently being responded to.
[0103] Second preset condition: the enable signal indicating the I / O device identifier in the flow control module 202 is a preset second level value.
[0104] For the first preset condition: the current value of the preset variable can be realized by the queue depth, and the current queue depth value represents the current value of the preset variable. The initial value of the queue depth can be set to 0, and of course, it can also be set to other values. This embodiment does not limit the specific value. As long as the difference between the initial value of the queue depth and the preset quantity threshold is the total number of sub-data volumes converted from the storage space of the cache submodule.
[0105] For example, the packet length configured by the host computer is 0.5KB, and the storage space of the cache submodule is 10KB. The total number of sub-data that can be converted from the storage space of the cache submodule is 20. At this time, the difference between the initial value of the queue depth and the preset number threshold is 20, for example, the initial value is 0, and the preset number threshold is 20; the initial value is 3, and the preset number threshold is 23, and so on.
[0106] For the second preset condition: the enable signal corresponding to the I / O device is the preset second level value, which means: there is available storage space in the preset target storage space for storing the I / O device in the host computer. The initial value of the enable signal corresponding to the I / O device is the preset second level value.
[0107] In this step, the preset first information includes: source address and sub-data volume; the preset second information includes: target address and sub-data volume; the preset third information includes: I / O device identification and a flag bit used to indicate whether the event is completed.
[0108] S306 , each time the flow control module 202 receives a preset third message, the queue depth value of the flow control module 202 is increased by 1.
[0109] S307 , when the read queue submodule 2031 detects the preset first information, it sends a read data request to the engine submodule 2034 through the read address bus; the read data request includes: the preset first information.
[0110] S308 , the engine submodule 2034 converts the read data request interface into a standard AXI4 interface.
[0111] S309 , the engine submodule 2034 hangs the read data request with the standard AXI4 interface on the internal bus.
[0112] After receiving the read data request, the internal bus reads the sub-data amount of data from the source address of the I / O control module according to the source address and the sub-data amount in the read data request, and transmits the read sub-data amount of data to the cache sub-module 2035 through the read data bus. Specifically, the internal bus reads the sub-data amount of data from the source address and transmits the read data to the cache sub-module, which is a prior art and will not be described in detail here.
[0113] S310 , when the read queue submodule 2031 detects that the internal bus transmits the sub-data amount of data to the cache submodule 2035 , the preset second information in the write cache submodule 2032 is sent to the write queue submodule 2033 .
[0114] S311. When receiving the preset second information, the write queue submodule 2033 sends a write request to the engine submodule 2034 through the write address bus; the write request includes a target address and sub-data amount.
[0115] S312 , the engine submodule 2034 converts the interface of the write request into a standard AXI4 interface, and hangs the write request with the AXI4 interface on the internal bus.
[0116] The internal bus writes the sub-data volume data in the cache submodule 2035 to the target storage space corresponding to the target address of the host computer's memory through the write data bus. Specifically, the internal bus writes the sub-data volume data to the target address of the host computer's memory, which is a prior art and will not be repeated here.
[0117] S313 , after the internal bus moves the sub-data volume of data from the cache sub-module 2035 to the target storage space corresponding to the target address, the engine sub-module 2034 sends a write response signal to the flow control module 202 .
[0118] S314. After receiving the write response signal, the flow control module 202 reduces the queue depth value by 1.
[0119] The flow control module 202 receives a write response signal, indicating that the DMA controller has completed the movement of a sub-data volume of data. Therefore, the current value of the preset variable of the DMA controller is reduced by 1, and then the flow control module 202 reduces the queue depth value by 1.
[0120] S315. The flow control module 202 determines the level value of the preset indication signal according to whether the current queue depth value is less than the preset quantity threshold.
[0121] S316: The flow control module 202 determines whether the current flag bit indicates the last sub-data amount in the DMA request.
[0122] In this step, when the flow control module 202 receives the write response signal, it determines whether the flag bit in the preset third information corresponding to the current sub-data volume is a flag bit indicating the end of the event. If so, execute S317.
[0123] It should be noted that this embodiment does not limit the execution order of S315 and S316.
[0124] S317, the flow control module 202 sends an interrupt instruction for the host computer to move the data in the target address; and sets the enable signal corresponding to the I / O device to a preset first level value; the preset first level value indicates that there is no available storage space in the corresponding target storage space of the I / O device in the host computer.
[0125] When the flow control module 202 determines that the flag in the preset third information corresponding to the currently moved data indicates the end of the time, it indicates that the data required to be moved by the DMA request has been moved to the memory of the host computer. In order to prevent the data required to be moved by the DMA request stored in the memory of the host computer from being overwritten, in this step, the flow control module 202 sets the enable signal corresponding to the I / O device identifier to the preset first level value, so that the packetization module 301 temporarily does not respond to the amount of data in the DMA request corresponding to the I / O device, that is, temporarily does not send the preset first information and the preset second information to the moving module 203, and temporarily does not send the preset third information to the flow control module 202.
[0126] S318. When the flow control module 202 receives an instruction indicating that the host computer has retrieved data from the target address, the enable signal corresponding to the I / O device identifier is set to a preset second level value.
[0127] Figure 3 It is a structural diagram of a data migration system in the present application, which may include: an I / O device 301, a data migration device based on FPGA 302 and a host computer 303;
[0128] The I / O device 301 sends a DMA request to the FPGA-based data migration device 302; the DMA request includes the data volume of the data to be migrated by the I / O device 301;
[0129] The FPGA-based data moving device 302 is used to move data from a source address to a preset target storage space corresponding to a target address of a host computer 303; the FPGA-based data moving device 302 is Figure 2 The specific working principle of the FPGA-based data migration device described in the corresponding embodiment will not be described in detail here.
[0130] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referenced to each other. In this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. The words "include", "comprises" and the like in the text are interpreted as inclusive rather than exclusive or exhaustive; that is, the meaning is "including but not limited to". Without departing from the concept of the present invention, deformation, equivalent substitution, improvement, etc. can also be made, which all belong to the scope of protection of the present invention.
[0131] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data migration method, applied to a DMA controller, wherein the DMA controller migrates the data to be migrated of an I / O device to a host computer, characterized in that: include: According to a preset splitting rule, the data volume in the DMA request sent by the I / O device is split to obtain multiple sub-data volumes; Before responding to the target sub-data volume, determining the number of sub-data volumes currently responded to by the DMA controller; the target sub-data volume is any of the sub-data volumes; By detecting whether the data corresponding to the plurality of sub-data volumes are all written into the preset target storage space, detecting whether there is currently available storage space in the preset target storage space; The preset target storage space is a storage space in the host computer for storing data of the I / O device; When the number of the currently responded sub-data volume is not greater than a preset number threshold, and / or there is available storage space in the preset target storage space, reading the data of the target sub-data volume into the preset storage space of the DMA controller, and writing the data of the target sub-data volume from the preset storage space to the host computer; The preset quantity threshold represents the total number of sub-data volumes corresponding to the data that can be stored in the preset storage space; The step of reading the target sub-data volume data into a preset storage space of the DMA controller and writing the target sub-data volume data from the preset storage space into the host computer includes: Hanging a read request for moving the target sub-data amount of data on an internal bus; After the internal bus reads the data of the target sub-data volume into the preset storage space, a write request for moving the data of the target sub-data volume is hung on the internal bus, so that the internal bus writes the data of the target sub-data volume from the preset storage space to the host computer.
2. The method according to claim 1, characterized in that After reading the data of the target sub-data volume into the preset storage space of the DMA controller, the method further includes: The number of the currently responded sub-data amount is increased by 1.
3. The method according to claim 1, characterized in that After writing the target sub-data volume of data from the preset storage space into the host computer, the method further includes: The number of the currently responded sub-data amount is reduced by 1.
4. The method according to claim 1, characterized in that: After writing the target sub-data volume of data from the preset storage space into the host computer, the method further includes: After the data corresponding to the plurality of sub-data volumes are all written into the preset target storage space, an interrupt instruction is sent to the host computer; the interrupt instruction is used to instruct the host computer to remove the data in the preset target storage space.
5. A data moving device, the data moving device being connected to an internal bus, characterized in that: include: Subpackaging module, flow control module and moving module; The subpacketization module is used to split the data volume in the DMA request sent by the I / O device according to a preset splitting rule to obtain multiple sub-data volumes; The flow control module is used to determine the number of sub-data volumes that have been responded to before responding to the target sub-data volume, and determine the level value of the preset indication signal according to whether the number of sub-data volumes that have been responded to is greater than a preset number threshold; the preset number threshold represents the total number of sub-data volumes corresponding to the data that can be stored in the preset storage space of the moving device; the target sub-data volume is any of the sub-data volumes; The flow control module is further used to determine the level value of the enable signal corresponding to the I / O device by detecting whether there is available storage space in the preset target storage space; the preset target storage space is a preset storage space in the host computer for storing data of the I / O device; The subpackaging module is further configured to send preset information to the moving module when a preset condition is met; The preset condition includes: the level value of the preset indication signal indicates that the number of the currently responded sub-data amount is not greater than the preset number threshold, and / or the level value of the enable signal indicates that there is available storage space in the preset target storage space; The migration module is used to read the data of the target sub-data volume into the preset storage space of the data migration device when receiving the preset information, and write the data of the target sub-data volume from the preset storage space to the preset target storage space.
6. The data migration device according to claim 5, characterized in that: The migration module includes: a read queue submodule, a write cache submodule, a write data submodule, a cache submodule and an engine submodule; The subpackaging module is further configured to send preset information to the moving module when a preset condition is met, including: The subpacketizing module is further configured to send preset first information to the read queue submodule and send preset second information to the write cache submodule when the preset condition is met; The migration module is used to read the data of the target sub-data volume into the preset storage space of the data migration device and write the data of the target sub-data volume from the preset storage space to the preset target storage space upon receiving the preset information, including: The read queue submodule is used to send a read request to the engine submodule after receiving the preset first information; The engine submodule is used to read the data corresponding to the target sub-data volume into the cache submodule according to the read request; The read queue submodule is further configured to send the preset second information in the write cache module to the write queue submodule after the cache submodule saves the data of the target subdata volume; The write queue submodule is used to send a write request to the engine submodule after detecting the preset second information; The engine submodule is further configured to write the target sub-data volume of data from the cache submodule into the preset target storage space according to the write request.
7. The data migration device according to claim 6, characterized in that: The engine submodule is further configured to send a write response signal to the flow control module after writing the target sub-data volume of data from the cache submodule to the host computer.
8. The data migration device according to claim 7, characterized in that: The subpacketizing module is further configured to send preset third information to the flow control module when sending preset first information to the read queue submodule and sending preset second information to the write cache submodule; the preset third information includes a flag bit; the flag bit indicates whether the target sub-data volume is the last sub-data volume to be responded to in the data volume of the DMA request; The flow control module is further used to determine the level value of the enable signal corresponding to the I / O device by detecting whether there is available storage space in the preset target storage space, including: The flow control module is also used to, after receiving the write response signal, set the level value of the enable signal of the I / O device to a first level value in a flag bit in the preset third information corresponding to the write response signal to indicate the last target sub-data amount; otherwise, set the level value of the enable signal of the I / O device to a second level value; the first level value indicates that there is no available storage space in the preset target storage space; the second level value indicates that there is available storage space in the preset target storage space.
9. The data migration device according to claim 8, characterized in that: The flow control module is also used to send an interrupt instruction to the host computer after receiving the write response signal, when the flag bit in the preset third information indicates the last target sub-data amount to be responded to; the interrupt instruction is used to instruct the host computer to remove the data in the target storage space.
10. The data migration device according to claim 9, characterized in that: The flow control module is further configured to set the level value of the enable signal corresponding to the I / O device from the first level value to the second level value when receiving the target instruction sent by the host computer.
11. The data migration device according to claim 7, characterized in that: The flow control module is further configured to update the number of currently responded sub-data amounts by subtracting 1 from the number of currently responded sub-data amounts when the write response signal is received.
12. A data migration system, characterized in that: It includes an I / O device, a data moving device based on FPGA and a host computer; the I / O device is connected to the data moving device based on FPGA; the host computer is connected to the data moving device based on FPGA through a bus; The I / O device sends a DMA request to the FPGA-based data migration device; the DMA request includes the data amount of the I / O device to be migrated; The FPGA-based data moving device is used to move the data to be moved from the I / O device to the host computer; the FPGA-based data moving device is the FPGA-based data moving device according to any one of claims 6 to 11.
