CN104239248A - PCI-E (peripheral component interconnect-express) multi-buffer DMA (direct memory access) data transmission method - Google Patents
PCI-E (peripheral component interconnect-express) multi-buffer DMA (direct memory access) data transmission method Download PDFInfo
- Publication number
- CN104239248A CN104239248A CN201410472222.3A CN201410472222A CN104239248A CN 104239248 A CN104239248 A CN 104239248A CN 201410472222 A CN201410472222 A CN 201410472222A CN 104239248 A CN104239248 A CN 104239248A
- Authority
- CN
- China
- Prior art keywords
- data
- memory
- object system
- source systems
- data source
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 230000015654 memory Effects 0.000 title claims abstract description 70
- 239000000872 buffer Substances 0.000 title claims abstract description 39
- 230000005540 biological transmission Effects 0.000 title claims abstract description 34
- 238000000034 method Methods 0.000 title claims abstract description 21
- 230000002093 peripheral effect Effects 0.000 title abstract 2
- 230000003936 working memory Effects 0.000 claims abstract description 14
- 238000010586 diagram Methods 0.000 description 3
Landscapes
- Bus Control (AREA)
Abstract
The invention provides a PCI-E (peripheral component interconnect-express) multi-buffer DMA (direct memory access) data transmission method and relates to the technical field of PCI-E data transmission. The method comprises the following steps: allocating N physical memory to a data source system and N pieces of physical memory to a data destination system, and respectively establishing an idle memory pool and a working memory pool for the N pieces of physical memory in the data source system and the N pieces of physical memory in the data destination system through a double linked list; acquiring the memory, used for data to be written in, from the idle memory pool, and adding the memory in which the data are written into the working memory pool; writing in the physical start address and the size of to-be-operated memory to ring buffers. According to the PCI-E multi-buffer DMA data transmission method provided by the invention, by using the idle memory pool and the working memory pool, the memory copy time and the system call time are reduced; through the ring buffers, the DMA data transmission rate is increased; under the transmission of large data volume, the waiting expenditure of the system is reduced, and the transmission efficiency is improved.
Description
Technical field
The present invention relates to PCI-E technical field of data transmission, specifically a kind of DMA data transmission method of multiple buffer.
Background technology
Traditional PCI-E data transmission method adopts DMA (Direct Memory Access, direct memory access).Concrete grammar all needs distribution one piece of continuous print physical memory in data source and data object system, before starting, in data source systems, user application is responsible for a data copy in physical memory, be responsible for data to transfer to the physical memory of data object system from data source physical memory by dma controller during DMA transmission, in data object system, be copied to user's space by application program after DMA terminates to use, then former 2 pieces of physical memories (physical memory of data source systems and the data object system) data can be used as next time are transmitted.Fig. 1 is traditional data transmission method schematic diagram:
(1) data source systems: user application is in physical memory in data copy to kernel spacing;
(2) DMA transmission;
(3) data object system: user application is copied to user's space data physical memory from kernel spacing and uses.
The method in the system of data source and data object, only has one for the buffer zone of data batchmove in data transmission procedure, and once DMA on cannot carrying out again before a DMA completes, reduces transfer efficiency.
Summary of the invention
The object of the invention is the data transmission efficiency in order to improve PCI-E, alleviating CPU pressure, propose a kind of PCI-E multiple buffer DMA data transmission method.
PCI-E multiple buffer provided by the invention DMA data transmission method, comprises the steps:
Step one, in data source systems and data object system, distribute separately N block physical memory, respectively by doubly linked list, available memory pool and working memory pond are set up to the N block physical memory in two systems; Meanwhile, in two systems, all set up the read-write pointer of more than one buffer circle and its correspondence;
Step 2, user application in data source systems use API obtain internal memory from the available memory pool of data source systems and insert data, the internal memory inserting data is joined in the working memory pond of data source systems, the physical start address and size of inserting the internal memory of data are write the buffer circle of data source systems;
Step 3, user application in data source systems use API to initiate data transfer request; Kernel in data object system chooses free memory from the available memory pool of data object system, and the physical start address of selected internal memory and size are inserted in the buffer circle of data object system, the more write pointer of the buffer circle of new data object system notification data origin system;
After the notice that the buffer circle that kernel in step 4, data source systems receives data object system upgrades, obtain internal memory physical start address and size that data object system will write data, initiate DMA and complete data transmission;
After step 5, data are transmitted, data source systems upgrades the buffer circle read pointer of data source systems and notification data object system;
Step 6, data object system put into the working memory pond of data object system for user application the internal memory of write data.
Multiple buffer of the present invention DMA data transmission method, deletes unnecessary memory copying, dramatically reduces the pressure of CPU; Under the transmission of big data quantity, reduce the wait expense of system, improve transfer efficiency.
Accompanying drawing explanation
Fig. 1 is traditional data transmission method schematic diagram;
Fig. 2 is PCI-E multiple buffer of the present invention data transmission method schematic diagram;
Embodiment
Below in conjunction with drawings and Examples, the present invention is described in further detail.
The object of the invention is the data transmission efficiency in order to improve PCI-E, alleviating CPU pressure, propose a kind of data transmission method of zero-copy.
As shown in Figure 2, PCI-E multiple buffer provided by the invention DMA data transmission method specifically comprises the following steps:
Step one, in data source systems and data object system, distribute separately the physical memory of the suitable size of N block, respectively available memory pool and working memory pond are set up to the N block physical memory in two systems.In two systems, all set up the read-write pointer of single or multiple buffer circle and buffer circle simultaneously.
The size of N as required or practice, be set by the user.Available memory pool and working memory pond adopt doubly linked list to represent.Data source systems and data object system are respectively to having an available memory pool and a working memory pond.Obtain the internal memory for writing data from available memory pool, the internal memory of write data adds working memory pond.Physical start address and the size of the internal memory that will operate is write in buffer circle.
As shown in Figure 2, the buffer circle set up in data source systems and data object system, comprises at least two buffer zones.
Step 2, user application in data source systems, use API (Application Programming Interface, application programming interface) to insert data after the available memory pool of data source systems obtains memory headroom.The internal memory inserting data joins the working memory pond of data source systems.Meanwhile, the physical start address and size of inserting the internal memory of data are write the buffer circle of data source systems.
Step 3, user application in data source systems use API to initiate data transfer request.After kernel in data object system selects idle physical memory block from the available memory pool of data object system, in the buffer circle of data object system, insert physical start address and the size notice of selected internal memory, and the buffer circle write pointer of data object system is upgraded and notification data origin system.
After the notice that the buffer circle that kernel in step 4, data source systems receives data object system upgrades, obtain physical start address and the size that the internal memory of data in data object system, will be write, initiate DMA and complete data transmission.
Kernel in data source systems, according to the physical start address of internal memory in the buffer circle of data source systems and size, reads data from the physical memory of correspondence, and is transferred to data object system.Data object system by the data that receive according to the physical start address of internal memory in the buffer circle of data object system, in write data object system in corresponding physical memory.
After step 5, data are transmitted, data source systems upgrades buffer circle read pointer and notification data object system.
Step 6, object system put into work pool for user program the memory block obtaining data.
In the inventive method, achieve directly the data of user application in data source systems to be transferred in data object system and use, decrease data copy number of times and system call number of times, meanwhile, adopt buffer circle to add speed and the size of DMA transmission data.The inventive method is adopted to do the transmission of PCI-E data, as shown in table 1 with the contrast effect of the existing conventional data transmission scheme in background technology.Test employing 1 DELL2950 server+1 piece of PCI-E accelerator card, successively carries out PC and transmit to the data of accelerator card in units of 2K/8K/16K, respectively to carry out after 5 tests the on average transfer rate obtained.
The contrast table of table 1 Zero-copy data transmission plan of the present invention and traditional scheme
As shown in table 1, and spread out of compared with scheme, adopt the inventive method to have higher transfer rate, be more applicable for the transmission of big data quantity, effectively can reduce the wait expense of system.
Claims (1)
1. a PCI-E multiple buffer DMA data transmission method, is characterized in that, comprise the steps:
Step one, in data source systems and data object system, distribute separately N block physical memory, respectively by doubly linked list, available memory pool and working memory pond are set up to the N block physical memory in two systems; Meanwhile, in two systems, all set up the read-write pointer of more than one buffer circle and its correspondence;
Step 2, user application in data source systems use API obtain internal memory from the available memory pool of data source systems and insert data, the internal memory inserting data is joined in the working memory pond of data source systems, the physical start address and size of inserting the internal memory of data are write the buffer circle of data source systems;
Step 3, user application in data source systems use API to initiate data transfer request; Kernel in data object system chooses free memory from the available memory pool of data object system, and the physical start address of selected internal memory and size are inserted in the buffer circle of data object system, the more write pointer of the buffer circle of new data object system notification data origin system;
After the notice that the buffer circle that kernel in step 4, data source systems receives data object system upgrades, obtain internal memory physical start address and size that data object system will write data, initiate DMA and complete data transmission;
After step 5, data are transmitted, data source systems upgrades the buffer circle read pointer of data source systems and notification data object system;
Step 6, data object system put into the working memory pond of data object system for user application the internal memory of write data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410472222.3A CN104239248B (en) | 2014-09-16 | 2014-09-16 | PCI E multiple buffer DMA data transfer methods |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410472222.3A CN104239248B (en) | 2014-09-16 | 2014-09-16 | PCI E multiple buffer DMA data transfer methods |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104239248A true CN104239248A (en) | 2014-12-24 |
CN104239248B CN104239248B (en) | 2017-06-06 |
Family
ID=52227355
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410472222.3A Expired - Fee Related CN104239248B (en) | 2014-09-16 | 2014-09-16 | PCI E multiple buffer DMA data transfer methods |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104239248B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109101438A (en) * | 2018-07-25 | 2018-12-28 | 百度在线网络技术(北京)有限公司 | Method and apparatus for storing data |
CN110046114A (en) * | 2019-03-06 | 2019-07-23 | 上海熠知电子科技有限公司 | Dma controller and DMA data transfer method based on PCIE agreement |
CN112286688A (en) * | 2020-11-05 | 2021-01-29 | 北京深维科技有限公司 | Memory management and use method, device, equipment and medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060294330A1 (en) * | 2005-06-27 | 2006-12-28 | Stanfill Craig W | Managing memory pages |
CN102467473A (en) * | 2010-11-03 | 2012-05-23 | Tcl集团股份有限公司 | Method and device for transmitting data between user space and kernel |
CN103645994A (en) * | 2013-11-05 | 2014-03-19 | 华为技术有限公司 | Data processing method and device |
-
2014
- 2014-09-16 CN CN201410472222.3A patent/CN104239248B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060294330A1 (en) * | 2005-06-27 | 2006-12-28 | Stanfill Craig W | Managing memory pages |
CN102467473A (en) * | 2010-11-03 | 2012-05-23 | Tcl集团股份有限公司 | Method and device for transmitting data between user space and kernel |
CN103645994A (en) * | 2013-11-05 | 2014-03-19 | 华为技术有限公司 | Data processing method and device |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109101438A (en) * | 2018-07-25 | 2018-12-28 | 百度在线网络技术(北京)有限公司 | Method and apparatus for storing data |
CN110046114A (en) * | 2019-03-06 | 2019-07-23 | 上海熠知电子科技有限公司 | Dma controller and DMA data transfer method based on PCIE agreement |
CN110046114B (en) * | 2019-03-06 | 2020-08-14 | 上海熠知电子科技有限公司 | DMA controller based on PCIE protocol and DMA data transmission method |
CN112286688A (en) * | 2020-11-05 | 2021-01-29 | 北京深维科技有限公司 | Memory management and use method, device, equipment and medium |
CN112286688B (en) * | 2020-11-05 | 2024-01-05 | 北京深维科技有限公司 | Memory management and use method, device, equipment and medium |
Also Published As
Publication number | Publication date |
---|---|
CN104239248B (en) | 2017-06-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11042297B2 (en) | Techniques to configure a solid state drive to operate in a storage mode or a memory mode | |
CN102467473B (en) | Method and device for transmitting data between user space and kernel | |
KR102111741B1 (en) | EMBEDDED MULTIMEDIA CARD(eMMC), AND METHODS FOR OPERATING THE eMMC | |
TWI718969B (en) | Memory device, memory addressing method, and article comprising non-transitory storage medium | |
CN104239249A (en) | PCI-E (peripheral component interconnect-express) zero-copy DMA (direct memory access) data transmission method | |
US9552303B2 (en) | Method and system for maintaining release consistency in shared memory programming | |
CN102566939B (en) | Solid state disk (SSD) and read-modify-write operation data management method thereof | |
US20150347017A1 (en) | Command trapping in an input/output virtualization (iov) host controller (hc) (iov-hc) of a flash-memory-based storage device | |
US20190042153A1 (en) | Mass storage device capable of fine grained read and/or write operations | |
CN106775477B (en) | SSD (solid State disk) master control data transmission management device and method | |
CN104239248A (en) | PCI-E (peripheral component interconnect-express) multi-buffer DMA (direct memory access) data transmission method | |
US9436395B2 (en) | Mechanisms to save user/kernel copy for cross device communications | |
GB2500082A (en) | Delaying the transmission of data from a memory device until the output buffer of the memory device contains the data for the transfer | |
US20140149528A1 (en) | Mpi communication of gpu buffers | |
CN102291298A (en) | Efficient computer network communication method oriented to long message | |
US9904622B2 (en) | Control method for non-volatile memory and associated computer system | |
TWI454928B (en) | Method and system to improve a solid state drive performance by using a programmable bus arbiter and storage medium thereof | |
CN113377288B (en) | Hardware queue management system and method, solid state disk controller and solid state disk | |
US20120307827A1 (en) | Multi-processor apparatus using dedicated buffers for multicast communications | |
CN101720040B (en) | Video decoding optimizing method fusing high speed memory and DMA channel | |
CN103838694B (en) | FPGA high-speed USB interface data reading method | |
US20150177816A1 (en) | Semiconductor integrated circuit apparatus | |
CN105825880B (en) | Access control method, device and circuit for DDR controller | |
US9311225B2 (en) | DMA channels | |
CN105843631B (en) | A method of improving system firmware burn writing speed |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170606 |