File transmission method, electronic equipment and computer readable medium
By locking and copying data blocks in the page cache of the DPU accelerator card to the host page cache, the problem of large memory overhead in the traditional solution is solved and efficient file transfer is achieved.
Patent Information
- Application Number
- CN202310199039.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-23
- Publication Date
- 2024-08-23
AI Technical Summary
When transferring virtual machine image files between the DPU accelerator card of the cloud platform and the host, the traditional solution requires double memory space and memory copies, resulting in low data transfer efficiency.
By locking the data block to be uploaded or downloaded in the page cache of the DPU accelerator card and copying it to the host's page cache, the allocation of user-mode cache space and memory copying are avoided, and the DMA engine is directly used for data transmission.
It saves memory resources, improves data transmission efficiency, reduces memory copy operations, and improves file transfer performance.
Smart Images

Figure CN118540316A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular to a file transmission method, an electronic device, and a computer-readable medium. Background Art
[0002] In cloud platform scenarios where management offload and input / output (IO) offload are completed by a data processing unit (DPU) accelerator card, in order to fully utilize the local disk of the server, it is necessary to support saving virtual machine image files on the local disk of the server host. A common practice is to encapsulate upload commands and download commands on the data channel between the host and the DPU accelerator card. However, since virtual machine image files are generally very large, ranging from several GB to hundreds of GB, the traditional solution for uploading or downloading virtual machine image files between the DPU accelerator card and the host requires consumption of double memory, including double page cache and double user state cache space, which increases memory overhead; and requires a memory copy, which has low data transmission efficiency. Summary of the invention
[0003] Embodiments of the present application provide a file transmission method, an electronic device, and a computer-readable medium.
[0004] In a first aspect, an embodiment of the present application provides a file transfer method, which is applied to a DPU acceleration card, the method comprising: receiving a file upload request, opening the file to be uploaded; locking the i-th data block in the file to be uploaded in the page cache of the DPU acceleration card; wherein i is an integer greater than or equal to 1; sending a first notification message to the host; wherein the first notification message is used to notify the host to upload the file; receiving the input and output virtual address corresponding to the i-th data block sent by the host, and copying the i-th data block locked in the page cache of the DPU acceleration card to the page cache of the host according to the input and output virtual address corresponding to the i-th data block and the block size of the i-th data block; when the i-th data block is the last data block in the file to be uploaded, closing the file to be uploaded; sending a second notification message to the host; wherein the second notification message is used to notify the host to close the first target file.
[0005] In a second aspect, an embodiment of the present application provides a file transfer method, which is applied to a host, and the method includes: receiving a first notification message sent by a data processor DPU acceleration card; wherein the first notification message is used to notify the host to upload a file; creating a first target file, expanding the storage space of the first target file on the local disk of the host, and locking the i-th data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host; wherein i is an integer greater than or equal to 1; translating the second physical address corresponding to the i-th data block to be uploaded into the input and output virtual address corresponding to the i-th data block to be uploaded, and sending the input and output virtual address corresponding to the i-th data block to be uploaded to the DPU acceleration card; when the i-th data block to be uploaded is the last data block to be uploaded, receiving a second notification message sent by the DPU acceleration card, and closing the target file; wherein the second notification message is used to notify the host to close the target file.
[0006] In a third aspect, an embodiment of the present application provides a file transfer method, which is applied to a DPU accelerator card, the method comprising: receiving a file download request, creating a second target file; expanding the storage space of the second target file on the local disk of the DPU accelerator card, and locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card; wherein j is an integer greater than or equal to 1; sending a third notification message to the host; wherein the third notification message is used to notify the host to download the file; receiving the input and output virtual addresses corresponding to the jth data block to be downloaded sent by the host, and copying the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the input and output virtual addresses corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded; when the jth data block to be downloaded is the last data block to be downloaded, closing the second target file; sending a fourth notification message to the host; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
[0007] In a fourth aspect, an embodiment of the present application provides a file transfer method, which is applied to a host, and the method includes: receiving a third notification message sent by a data processor DPU acceleration card, and opening the file to be downloaded; wherein the third notification message is used to notify the host to download the file; locking the j-th data block in the file to be downloaded in the page cache of the host; wherein j is an integer greater than or equal to 1; translating the fourth physical address corresponding to the j-th data block into the input and output virtual address corresponding to the j-th data block, and sending the input and output virtual address corresponding to the j-th data block to the DPU acceleration card; when the j-th data block is the last data block in the file to be downloaded, receiving a fourth notification message sent by the DPU acceleration card, and closing the file to be downloaded; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
[0008] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: at least one first processor; a first memory, wherein at least one first program is stored on the first memory, and when the at least one first program is executed by the at least one first processor, the following steps are implemented: receiving a file upload request, opening the file to be uploaded; locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card; wherein i is an integer greater than or equal to 1; sending a first notification message to the host; wherein the first notification message is used to notify the host to upload the file; receiving the input and output virtual address corresponding to the i-th data block sent by the host; the electronic device also includes: a first memory directly accesses a DMA engine, which is used to copy the i-th data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the input and output virtual address corresponding to the i-th data block and the block size of the i-th data block; when the at least one first program is executed by the at least one first processor, the following steps are also implemented: when the i-th data block is the last data block in the file to be uploaded, closing the file to be uploaded; sending a second notification message to the host; wherein the second notification message is used to notify the host to close the first target file.
[0009] In a sixth aspect, an embodiment of the present application provides a computer-readable medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: receiving a file upload request, opening the file to be uploaded; locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card; wherein i is an integer greater than or equal to 1; sending a first notification message to the host; wherein the first notification message is used to notify the host to upload the file; receiving the input and output virtual addresses corresponding to the i-th data block sent by the host; when the i-th data block is the last data block in the file to be uploaded, closing the file to be uploaded; sending a second notification message to the host; wherein the second notification message is used to notify the host to close the first target file.
[0010] In a seventh aspect, an embodiment of the present application provides an electronic device, comprising: at least one second processor; a second memory, wherein at least one second program is stored in the second memory, and when the at least one second program is executed by the at least one second processor, the following steps are implemented: receiving a file download request and creating a second target file; expanding the storage space of the second target file on the local disk of the DPU accelerator card, and locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card; wherein j is an integer greater than or equal to 1; sending a third notification message to the host; wherein the third notification message is used to notify the host to download the file; receiving the third notification message sent by the host The electronic device further comprises: a second memory directly accessing a DMA engine, for copying the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the input-output virtual address corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded; when the at least one second program is executed by the at least one second processor, the following steps are also implemented: when the jth data block to be downloaded is the last data block to be downloaded, closing the second target file; sending a fourth notification message to the host; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
[0011] In an eighth aspect, an embodiment of the present application provides a computer-readable medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: receiving a file download request, creating a second target file; expanding the storage space of the second target file on the local disk of the DPU accelerator card, and locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card; wherein j is an integer greater than or equal to 1; sending a third notification message to the host; wherein the third notification message is used to notify the host to download the file; receiving the input and output virtual addresses corresponding to the jth data block to be downloaded sent by the host; when the jth data block to be downloaded is the last data block to be downloaded, closing the second target file; sending a fourth notification message to the host; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
[0012] In a ninth aspect, an embodiment of the present application provides an electronic device, comprising: at least one third processor; a third memory, wherein at least one third program is stored in the third memory, and when the at least one third program is executed by the at least one third processor, any one of the above-mentioned file transfer methods is implemented.
[0013] In a tenth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processor, any one of the above-mentioned file transfer methods is implemented.
[0014] The file transmission method applied to the DPU accelerator card provided in the embodiment of the present application locks the data blocks in the file to be uploaded into the page cache of the DPU accelerator card, and copies the data blocks in the page cache of the DPU accelerator card to the page cache of the host, thereby uploading the file to be uploaded from the DPU accelerator card to the host. During the upload process, there is no need to allocate user-state cache space, thus saving memory resources and no need for memory copying, thereby improving data transmission efficiency.
[0015] The file transfer method applied to the host provided in the embodiment of the present application expands the storage space of the created first target file on the local disk of the host, locks the data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host, and sends the input and output virtual addresses corresponding to the data block to be uploaded to the DPU acceleration card to upload the file to be uploaded from the DPU acceleration card to the host. During the upload process, there is no need to allocate user-state cache space, which saves memory resources and does not require memory copying, thereby improving data transmission efficiency.
[0016] The file transfer method applied to the DPU accelerator card provided in the embodiment of the present application expands the storage space of the created second target file on the local disk of the DPU accelerator card, locks the data blocks to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card, and copies the data blocks to be downloaded in the page cache of the host to the page cache of the DPU accelerator card, thereby downloading the file to be downloaded from the host to the DPU accelerator card. During the download process, there is no need to allocate user-state cache space, thus saving memory resources and no need for memory copying, thereby improving data transmission efficiency.
[0017] The file transfer method applied to the host provided in the embodiment of the present application locks the data blocks in the file to be downloaded in the page cache of the host, and sends the input and output virtual addresses corresponding to the data blocks to the DPU acceleration card, thereby downloading the file to be downloaded from the host to the DPU acceleration card. During the download process, there is no need to allocate user-mode cache space, which saves memory resources and does not require memory copying, thereby improving data transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A schematic diagram of an application scenario for transmitting a virtual machine image file between a host and a DPU accelerator card provided in an embodiment of the present application;
[0019] Figure 2 A flowchart of a file transmission method applied to a DPU accelerator card provided in one embodiment of the present application;
[0020] Figure 3 A flowchart of a file transmission method applied to a host provided by another embodiment of the present application;
[0021] Figure 4 A flowchart of a file transmission method applied to a DPU accelerator card provided in another embodiment of the present application;
[0022] Figure 5 A flowchart of a file transmission method applied to a host provided by another embodiment of the present application;
[0023] Figure 6 A block diagram of an electronic device according to another embodiment of the present application;
[0024] Figure 7 A block diagram of an electronic device according to another embodiment of the present application;
[0025] Figure 8 A block diagram of the composition of an electronic device provided in accordance with another embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the technical solution of the present application, the file transmission method, electronic device, and computer-readable medium provided by the present application are described in detail below in conjunction with the accompanying drawings.
[0027] Example embodiments will be described more fully below with reference to the accompanying drawings, but the example embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. On the contrary, the purpose of providing these embodiments is to make this application thorough and complete and to enable those skilled in the art to fully understand the scope of this application.
[0028] In the absence of conflict, the embodiments of the present application and the features therein may be combined with each other.
[0029] As used herein, the term "and / or" includes any and all combinations of at least one of the associated listed items.
[0030] The terms used herein are only used to describe specific embodiments and are not intended to limit the present application. As used herein, the singular forms "a", "an" and "the" are also intended to include the plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "comprising" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of at least one other feature, whole, step, operation, element, component and / or its group is not excluded.
[0031] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this application, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined herein.
[0032] In some application scenarios, it is necessary to transfer virtual machine image files between the DPU accelerator card and the host, such as Figure 1 As shown in the figure, in the cloud platform scenario of management offload and IO offload, when the virtual disk of the virtual machine uses the virtual image on the local disk of the host as the backend storage, the virtual machine image file needs to be transferred between the host and the DPU accelerator card. Specifically, when the virtual machine is created, the virtual machine image file needs to be uploaded from the control node to the host 1 via the DPU accelerator card; when the local image virtual machine is migrated, the virtual machine image file needs to be downloaded from the host 1 to the DPU accelerator card 1, then transferred from the DPU accelerator card 1 to the DPU accelerator card 2, and finally uploaded from the DPU accelerator card 2 to the host 2.
[0033] Although the file transfer method provided in the embodiment of the present application is proposed based on the problems existing in the uploading and downloading processes of virtual machine image files, the file transfer method provided in the embodiment of the present application is also applicable to other files that need to be transferred between the host and the DPU accelerator card.
[0034] Figure 2 A flowchart of a file transfer method applied to a DPU accelerator card provided in one embodiment of the present application.
[0035] First, refer to Figure 2 An embodiment of the present application provides a file transmission method, which is applied to a DPU accelerator card. The method includes:
[0036] Step 200, receiving a file upload request, opening the file to be uploaded; locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card; wherein i is an integer greater than or equal to 1.
[0037] In some exemplary embodiments, the file to be uploaded is sliced according to the maximum size of the data block that can be moved at one time to obtain at least two data blocks. For example, if the maximum size of the data block that can be moved at one time is A, then the size of the i-th data block should be less than or equal to A.
[0038] In some exemplary embodiments, locking the i-th data block in the page cache of the DPU accelerator card means moving the i-th data block from the local disk of the DPU accelerator card to the page cache of the DPU accelerator card, and prohibiting the page cache of the DPU accelerator card and the local disk of the DPU accelerator card from exchanging.
[0039] In some exemplary embodiments, locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card includes: mapping the i-th data block to the user state address space of the DPU accelerator card to obtain a first virtual address of the i-th data block in the user state address space of the DPU accelerator card; translating the first virtual address into a first physical address of the memory of the DPU accelerator card; and locking the local disk space of the DPU accelerator card corresponding to the first physical address in the page cache of the DPU accelerator card.
[0040] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the first physical address is the storage space of the i-th data block in the local disk of the DPU accelerator card.
[0041] In some exemplary embodiments, the i-th data block may be mapped to the user-state address space of the DPU accelerator card through the mmap function to obtain the first virtual address of the i-th data block in the user-state address space of the DPU accelerator card.
[0042] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the first physical address may be locked in the page cache of the DPU accelerator card through the get_user_pages function family.
[0043] Step 201, sending a first notification message to a host; wherein the first notification message is used to notify the host to upload a file.
[0044] In some exemplary embodiments, the first notification message includes at least: the name and size of the file to be uploaded.
[0045] Step 202, receiving an input / output virtual address (IOVA) corresponding to the ith data block sent by the host, and copying the ith data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the IOVA corresponding to the ith data block and the block size of the ith data block.
[0046] In some exemplary embodiments, copying the i-th data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the IOVA corresponding to the i-th data block and the block size of the i-th data block includes: copying the i-th data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the first physical address, the IOVA corresponding to the i-th data block, and the block size of the i-th data block.
[0047] Step 203, when the i-th data block is the last data block in the file to be uploaded, close the file to be uploaded; send a second notification message to the host; wherein the second notification message is used to notify the host to close the first target file.
[0048] In some exemplary embodiments, when the i-th data block is not the last data block in the file to be uploaded, the method further includes: adding 1 to i and continuing to execute the step of locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card.
[0049] The file transmission method applied to the DPU accelerator card provided in the embodiment of the present application locks the data blocks in the file to be uploaded into the page cache of the DPU accelerator card, and copies the data blocks in the page cache of the DPU accelerator card to the page cache of the host, thereby uploading the file to be uploaded from the DPU accelerator card to the host. During the upload process, there is no need to allocate user-state cache space, thus saving memory resources and no need for memory copying, thereby improving data transmission efficiency.
[0050] Figure 3 A flowchart of a file transfer method applied to a host provided in another embodiment of the present application.
[0051] Second, refer to Figure 3 Another embodiment of the present application provides a file transmission method, applied to a host, the method comprising:
[0052] Step 300, receiving a first notification message sent by a data processor DPU acceleration card; wherein the first notification message is used to notify a host to upload a file.
[0053] In some exemplary embodiments, the first notification message includes at least: the name and size of the file to be uploaded.
[0054] Step 301, create a first target file, expand the storage space of the first target file on the local disk of the host, and lock the i-th data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host; wherein i is an integer greater than or equal to 1.
[0055] In some exemplary embodiments, the storage space of the first target file on the local disk of the host can be expanded to a storage space of the same size as the file to be uploaded. Thus, after i is incremented by 1 each time, the step of locking the i-th data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host should be started.
[0056] In some exemplary embodiments, the storage space of the first target file on the local disk of the host can be expanded to the sum of the current storage space and the storage space of the i-th data block to be uploaded based on the current storage space. In this way, after i is increased by 1 each time, the step of expanding the storage space of the first target file on the local disk of the host should be executed.
[0057] In some exemplary embodiments, the ftruncate function may be used to expand the storage space of the first target file on the local disk of the host.
[0058] In some exemplary embodiments, locking the i-th data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host includes: mapping the i-th data block to be uploaded to the user state address space of the host, and obtaining a second virtual address of the i-th data block to be uploaded in the user state address space of the host; translating the second virtual address into a second physical address of the host's memory; and locking the local disk space of the host corresponding to the second physical address in the page cache of the host.
[0059] In some exemplary embodiments, the local disk space of the host corresponding to the second physical address is the storage space of the i-th data block to be uploaded in the local disk of the host.
[0060] In some exemplary embodiments, the i-th data block to be uploaded may be mapped to the user-mode address space of the host through the mmap function to obtain the second virtual address of the i-th data block to be uploaded in the user-mode address space of the host.
[0061] In some exemplary embodiments, the local disk space of the host corresponding to the second physical address may be locked in the page cache of the host through the get_user_pages function family.
[0062] Step 302: translate the second physical address corresponding to the i-th data block to be uploaded into the IOVA corresponding to the i-th data block to be uploaded, and send the IOVA corresponding to the i-th data block to be uploaded to the DPU accelerator card.
[0063] In some exemplary embodiments, the
[0064] Step 303: When the i-th data block to be uploaded is the last data block to be uploaded, a second notification message sent by the DPU accelerator card is received, and the target file is closed; wherein the second notification message is used to notify the host to close the target file.
[0065] In some exemplary embodiments, when the i-th data block to be uploaded is not the last data block to be uploaded, the method further includes: adding 1 to i, and continuing to execute the step of locking the i-th data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host.
[0066] In some exemplary embodiments, when the i-th data block to be uploaded is not the last data block to be uploaded, the method further includes: adding 1 to i and continuing to execute the step of expanding the storage space of the first target file on the local disk of the host.
[0067] The file transfer method applied to the host provided in the embodiment of the present application expands the storage space of the created first target file on the local disk of the host, locks the data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host, and sends the input and output virtual addresses corresponding to the data block to be uploaded to the DPU acceleration card to upload the file to be uploaded from the DPU acceleration card to the host. During the upload process, there is no need to allocate user-state cache space, which saves memory resources and does not require memory copying, thereby improving data transmission efficiency.
[0068] Figure 4 A flowchart of a file transfer method applied to a DPU acceleration card provided in another embodiment of the present application.
[0069] Thirdly, refer to Figure 4An embodiment of the present application provides a file transmission method, which is applied to a data processor DPU accelerator card. The method includes:
[0070] Step 400, receiving a file download request, creating a second target file; expanding the storage space of the second target file on the local disk of the DPU accelerator card, and locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card; wherein j is an integer greater than or equal to 1.
[0071] In some exemplary embodiments, after receiving a file download request, the method further includes: obtaining the name and size of the file to be downloaded from the host; accordingly, expanding the storage space of the second target file on the local disk of the DPU accelerator card includes: expanding the storage space of the second target file on the local disk of the DPU accelerator card according to the size of the file to be downloaded.
[0072] In some exemplary embodiments, obtaining the name and size of the file to be downloaded from the host includes: sending a query request to the host, the query request being used to query the name and size of the file to be downloaded; and receiving the name and size of the file to be downloaded sent by the host.
[0073] In some exemplary embodiments, the ftruncate function may be used to expand the storage space of the second target file on the local disk of the DPU accelerator card.
[0074] In some exemplary embodiments, the storage space of the second target file on the local disk of the DPU accelerator card may be expanded to a storage space of the same size as the file to be downloaded. Thus, after each addition of j plus 1, the step of locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card should be executed.
[0075] In some exemplary embodiments, the storage space of the second target file on the local disk of the DPU accelerator card can be expanded to the sum of the current storage space and the storage space of the jth data block to be downloaded based on the current storage space. In this way, after j is increased by 1 each time, the step of expanding the storage space of the second target file on the local disk of the DPU accelerator card should be executed.
[0076] In some exemplary embodiments, locking the j-th data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card includes: mapping the j-th data block to be downloaded to the user state address space of the DPU accelerator card, and obtaining a third virtual address of the j-th data block to be downloaded in the user state address space of the DPU accelerator card; translating the third virtual address into a third physical address of the memory of the DPU accelerator card; and locking the local disk space of the DPU accelerator card corresponding to the third physical address in the page cache of the DPU accelerator card.
[0077] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the third physical address is, that is, the storage space of the j-th data block in the local disk of the DPU accelerator card.
[0078] In some exemplary embodiments, the j-th data block may be mapped to the user-state address space of the DPU accelerator card through the mmap function to obtain the third virtual address of the j-th data block in the user-state address space of the DPU accelerator card.
[0079] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the third physical address may be locked in the page cache of the DPU accelerator card through the get_user_pages function family.
[0080] Step 401, sending a third notification message to the host; wherein the third notification message is used to notify the host to download the file.
[0081] Step 402, receiving the IOVA corresponding to the j-th data block to be downloaded sent by the host, and copying the j-th data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the IOVA corresponding to the j-th data block to be downloaded and the block size of the j-th data block to be downloaded.
[0082] In some exemplary embodiments, copying the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the IOVA corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded includes: copying the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the third physical address, the IOVA corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded.
[0083] Step 403, when the j-th data block to be downloaded is the last data block to be downloaded, close the second target file; and send a fourth notification message to the host; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
[0084] In some exemplary embodiments, when the j-th data block to be downloaded is not the last data block to be downloaded, the method further includes: adding 1 to j, and continuing to execute the step of locking the j-th data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card.
[0085] In some exemplary embodiments, when the j-th data block to be downloaded is not the last data block to be downloaded, the method further includes: adding 1 to j, and continuing to execute the step of expanding the storage space of the second target file on the local disk of the DPU accelerator card.
[0086] The file transfer method applied to the DPU accelerator card provided in the embodiment of the present application expands the storage space of the created second target file on the local disk of the DPU accelerator card, locks the data blocks to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card, and copies the data blocks to be downloaded in the page cache of the host to the page cache of the DPU accelerator card, thereby downloading the file to be downloaded from the host to the DPU accelerator card. During the download process, there is no need to allocate user-state cache space, thus saving memory resources and no need for memory copying, thereby improving data transmission efficiency.
[0087] Figure 5 A flowchart of a file transfer method applied to a host provided in another embodiment of the present application.
[0088] Fourthly, refer to Figure 5 Another embodiment of the present application provides a file transmission method, applied to a host, the method comprising:
[0089] Step 500, receiving a third notification message sent by a data processor DPU acceleration card, and opening the file to be downloaded; wherein the third notification message is used to notify the host to download the file.
[0090] Step 501: lock the jth data block in the file to be downloaded in the page cache of the host; wherein j is an integer greater than or equal to 1.
[0091] In some exemplary embodiments, the file to be downloaded is sliced according to the maximum size of the data block that can be moved at one time to obtain at least two data blocks. For example, if the maximum size of the data block that can be moved at one time is A, then the size of the jth data block should be less than or equal to A.
[0092] In some exemplary embodiments, locking the jth data block in the page cache of the DPU accelerator card means moving the jth data block from the local disk of the DPU accelerator card to the page cache of the DPU accelerator card, and prohibiting the page cache of the DPU accelerator card and the local disk of the DPU accelerator card from exchanging.
[0093] In some exemplary embodiments, locking the j-th data block in the file to be downloaded in the page cache of the host includes: mapping the j-th data block to the user state address space of the host to obtain a fourth virtual address of the j-th data block in the user state address space of the host; translating the fourth virtual address into a fourth physical address of the host's memory; and locking the local disk space of the host corresponding to the fourth physical address in the page cache of the host.
[0094] In some exemplary embodiments, the local disk space of the host corresponding to the fourth physical address is the storage space of the j-th data block in the local disk of the host.
[0095] In some exemplary embodiments, the j-th data block may be mapped to the user-mode address space of the host through the mmap function to obtain the fourth virtual address of the j-th data block in the user-mode address space of the host.
[0096] In some exemplary embodiments, the local disk space of the host corresponding to the fourth physical address may be locked in the page cache of the host through the get_user_pages function family.
[0097] Step 502: translate the fourth physical address corresponding to the j-th data block into the IOVA corresponding to the j-th data block, and send the IOVA corresponding to the j-th data block to the DPU accelerator card.
[0098] Step 503: When the jth data block is the last data block in the file to be downloaded, a fourth notification message sent by the DPU acceleration card is received to close the file to be downloaded; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
[0099] In some exemplary embodiments, when the jth data block is not the last data block of the file to be downloaded, the method further includes: adding 1 to j and continuing to execute the step of locking the jth data block in the file to be downloaded in the page cache of the host.
[0100] The file transfer method applied to the host provided in the embodiment of the present application locks the data blocks in the file to be downloaded in the page cache of the host, and sends the input and output virtual addresses corresponding to the data blocks to the DPU acceleration card, thereby downloading the file to be downloaded from the host to the DPU acceleration card. During the download process, there is no need to allocate user-mode cache space, which saves memory resources and does not require memory copying, thereby improving data transmission efficiency.
[0101] Fifth, refer to Figure 6An embodiment of the present application provides an electronic device, comprising: at least one first processor 601; a first memory 602, wherein at least one first program is stored in the first memory 602, and when the at least one first program is executed by the at least one first processor 601, the following steps are implemented: receiving a file upload request and opening the file to be uploaded; locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card; wherein i is an integer greater than or equal to 1; sending a first notification message to a host; wherein the first notification message is used to notify the host to upload the file; receiving the input and output virtual addresses corresponding to the i-th data block sent by the host.
[0102] The electronic device also includes: a first memory direct access (DMA) engine 603, which is used to copy the i-th data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the input and output virtual address corresponding to the i-th data block and the block size of the i-th data block.
[0103] When at least one first program is executed by at least one first processor 601, the following steps are also implemented: when the i-th data block is the last data block in the file to be uploaded, close the file to be uploaded; send a second notification message to the host; wherein the second notification message is used to notify the host to close the first target file.
[0104] In some exemplary embodiments, the file to be uploaded is sliced according to the maximum size of the data block that can be moved at one time to obtain at least two data blocks. For example, if the maximum size of the data block that can be moved at one time is A, then the size of the i-th data block should be less than or equal to A.
[0105] In some exemplary embodiments, locking the i-th data block in the page cache of the DPU accelerator card means moving the i-th data block from the local disk of the DPU accelerator card to the page cache of the DPU accelerator card, and prohibiting the page cache of the DPU accelerator card and the local disk of the DPU accelerator card from exchanging.
[0106] In some exemplary embodiments, when at least one first program is executed by at least one first processor 601, the following method is specifically adopted to lock the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card: map the i-th data block to the user state address space of the DPU accelerator card to obtain the first virtual address of the i-th data block in the user state address space of the DPU accelerator card; translate the first virtual address into the first physical address of the memory of the DPU accelerator card; and lock the local disk space of the DPU accelerator card corresponding to the first physical address in the page cache of the DPU accelerator card.
[0107] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the first physical address is the storage space of the i-th data block in the local disk of the DPU accelerator card.
[0108] In some exemplary embodiments, the i-th data block may be mapped to the user-state address space of the DPU accelerator card through the mmap function to obtain the first virtual address of the i-th data block in the user-state address space of the DPU accelerator card.
[0109] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the first physical address may be locked in the page cache of the DPU accelerator card through the get_user_pages function family.
[0110] In some exemplary embodiments, the first notification message includes at least: the name and size of the file to be uploaded.
[0111] In some exemplary embodiments, when at least one first program is executed by at least one first processor 601, the following method is specifically adopted to copy the i-th data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the IOVA corresponding to the i-th data block and the block size of the i-th data block: according to the first physical address, the IOVA corresponding to the i-th data block and the block size of the i-th data block, the i-th data block locked in the page cache of the DPU accelerator card is copied to the page cache of the host.
[0112] In some exemplary embodiments, when at least one first program is executed by at least one first processor 601, the following steps are also implemented: when the i-th data block is not the last data block in the file to be uploaded, i is increased by 1, and the step of locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card is continued.
[0113] In some exemplary embodiments, the electronic device further includes: one or more first I / O interfaces 604 connected between the first processor 601 , the first memory 602 and the first DMA engine 603 , and configured to implement information interaction between the first processor 601 , the first memory 602 and the first DMA engine 603 .
[0114] Among them, the first processor 601 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the first memory 602 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the first I / O interface (read-write interface) 604 is connected between the first processor 601, the first memory 602 and the first DMA engine 603, and can realize information interaction between the first processor 601, the first memory 602, and the first DMA engine 603, including but not limited to a data bus (Bus), etc.
[0115] In some embodiments, the first processor 601 , the first memory 602 , the first DMA engine 603 , and the first I / O interface 604 are connected to each other through a first bus 605 , and further connected to other components of the computing device.
[0116] In a sixth aspect, an embodiment of the present application provides a computer-readable medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: receiving a file upload request, opening the file to be uploaded; locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card; wherein i is an integer greater than or equal to 1; sending a first notification message to the host; wherein the first notification message is used to notify the host to upload the file; receiving the input and output virtual addresses corresponding to the i-th data block sent by the host; when the i-th data block is the last data block in the file to be uploaded, closing the file to be uploaded; sending a second notification message to the host; wherein the second notification message is used to notify the host to close the first target file.
[0117] In some exemplary embodiments, the file to be uploaded is sliced according to the maximum size of the data block that can be moved at one time to obtain at least two data blocks. For example, if the maximum size of the data block that can be moved at one time is A, then the size of the i-th data block should be less than or equal to A.
[0118] In some exemplary embodiments, locking the i-th data block in the page cache of the DPU accelerator card means moving the i-th data block from the local disk of the DPU accelerator card to the page cache of the DPU accelerator card, and prohibiting the page cache of the DPU accelerator card and the local disk of the DPU accelerator card from exchanging.
[0119] In some exemplary embodiments, when the computer program is executed by the processor, the following method is specifically used to lock the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card: map the i-th data block to the user state address space of the DPU accelerator card to obtain the first virtual address of the i-th data block in the user state address space of the DPU accelerator card; translate the first virtual address into the first physical address of the memory of the DPU accelerator card; and lock the local disk space of the DPU accelerator card corresponding to the first physical address in the page cache of the DPU accelerator card.
[0120] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the first physical address is the storage space of the i-th data block in the local disk of the DPU accelerator card.
[0121] In some exemplary embodiments, the i-th data block may be mapped to the user-state address space of the DPU accelerator card through the mmap function to obtain the first virtual address of the i-th data block in the user-state address space of the DPU accelerator card.
[0122] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the first physical address may be locked in the page cache of the DPU accelerator card through the get_user_pages function family.
[0123] In some exemplary embodiments, the first notification message includes at least: the name and size of the file to be uploaded.
[0124] In some exemplary embodiments, when the computer program is executed by the processor, the following method is specifically used to copy the i-th data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the IOVA corresponding to the i-th data block and the block size of the i-th data block: according to the first physical address, the IOVA corresponding to the i-th data block and the block size of the i-th data block, the i-th data block locked in the page cache of the DPU accelerator card is copied to the page cache of the host.
[0125] In some exemplary embodiments, when the computer program is executed by the processor, it also implements: when the i-th data block is not the last data block in the file to be uploaded, i is increased by 1, and the step of locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card is continued.
[0126] Seventh, refer to Figure 7, an embodiment of the present application provides an electronic device, comprising: at least one second processor 701; a second memory 702, wherein at least one second program is stored on the second memory 702, and when the at least one second program is executed by the at least one second processor 701, the following steps are implemented: receiving a file download request and creating a second target file; expanding the storage space of the second target file on the local disk of the DPU accelerator card, and locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card; wherein j is an integer greater than or equal to 1; sending a third notification message to the host; wherein the third notification message is used to notify the host to download the file; receiving the input and output virtual addresses corresponding to the jth data block to be downloaded sent by the host.
[0127] The electronic device also includes: a second memory direct access DMA engine 703, which is used to copy the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the input and output virtual addresses corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded.
[0128] When at least one second program is executed by at least one second processor 701, the following steps are also implemented: when the j-th data block to be downloaded is the last data block to be downloaded, closing the second target file; sending a fourth notification message to the host; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
[0129] In some exemplary embodiments, when at least one second program is executed by at least one second processor 701, it is also implemented: obtaining the name and size of the file to be downloaded from the host; accordingly, when at least one second program is executed by at least one second processor 701, the storage space of the second target file on the local disk of the DPU accelerator card is expanded in the following manner: the storage space of the second target file on the local disk of the DPU accelerator card is expanded according to the size of the file to be downloaded.
[0130] In some exemplary embodiments, when at least one second program is executed by at least one second processor 701, the following method is specifically adopted to obtain the name and size of the file to be downloaded from the host: send a query request to the host, the query request is used to query the name and size of the file to be downloaded; receive the name and size of the file to be downloaded sent by the host.
[0131] In some exemplary embodiments, the ftruncate function may be used to expand the storage space of the second target file on the local disk of the DPU accelerator card.
[0132] In some exemplary embodiments, the storage space of the second target file on the local disk of the DPU accelerator card may be expanded to a storage space of the same size as the file to be downloaded. Thus, after each addition of j plus 1, the step of locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card should be executed.
[0133] In some exemplary embodiments, the storage space of the second target file on the local disk of the DPU accelerator card can be expanded to the sum of the current storage space and the storage space of the jth data block to be downloaded based on the current storage space. In this way, after j is increased by 1 each time, the step of expanding the storage space of the second target file on the local disk of the DPU accelerator card should be executed.
[0134] In some exemplary embodiments, when at least one second program is executed by at least one second processor 701, the following method is specifically adopted to lock the j-th data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card: map the j-th data block to be downloaded to the user state address space of the DPU accelerator card, and obtain the third virtual address of the j-th data block to be downloaded in the user state address space of the DPU accelerator card; translate the third virtual address into a third physical address of the memory of the DPU accelerator card; and lock the local disk space of the DPU accelerator card corresponding to the third physical address in the page cache of the DPU accelerator card.
[0135] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the third physical address is, that is, the storage space of the j-th data block in the local disk of the DPU accelerator card.
[0136] In some exemplary embodiments, the j-th data block may be mapped to the user-state address space of the DPU accelerator card through the mmap function to obtain the third virtual address of the j-th data block in the user-state address space of the DPU accelerator card.
[0137] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the third physical address may be locked in the page cache of the DPU accelerator card through the get_user_pages function family.
[0138] In some exemplary embodiments, when at least one second program is executed by at least one second processor 701, the following method is specifically adopted to copy the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the IOVA corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded: according to the third physical address, the IOVA corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded, the jth data block to be downloaded locked in the page cache of the host is copied to the page cache of the DPU accelerator card.
[0139] In some exemplary embodiments, when at least one second program is executed by at least one second processor 701, it is also implemented that: when the j-th data block to be downloaded is not the last data block to be downloaded, j is increased by 1, and the step of locking the j-th data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card is continued.
[0140] In some exemplary embodiments, when at least one second program is executed by at least one second processor 701, it is also implemented that: when the j-th data block to be downloaded is not the last data block to be downloaded, j is increased by 1, and the step of expanding the storage space of the second target file on the local disk of the DPU accelerator card is continued.
[0141] In some exemplary embodiments, the electronic device further includes: one or more second I / O interfaces 704 connected between the second processor 701 , the second memory 702 and the second DMA engine 703 , and configured to implement information interaction between the second processor 701 , the second memory 702 and the second DMA engine 703 .
[0142] Among them, the second processor 701 is a device with data processing capabilities, including but not limited to a central processing unit (CPU) and the like; the second memory 702 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the second I / O interface (read-write interface) 704 is connected between the second processor 701, the second memory 702 and the second DMA engine 703, and can realize information interaction between the second processor 701, the second memory 702 and the second DMA engine 703, including but not limited to a data bus (Bus) and the like.
[0143] In some embodiments, the second processor 701 , the second memory 702 , the second DMA engine 703 , and the second I / O interface 704 are connected to each other through a second bus 705 , and further connected to other components of the computing device.
[0144] In an eighth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, and the computer program implements the following steps when executed by a processor: receiving a file download request and creating a second target file; expanding the storage space of the second target file on the local disk of the DPU accelerator card, and locking the j-th data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card; wherein j is an integer greater than or equal to 1; sending a third notification message to the host; wherein the third notification message is used to notify the host to download the file; receiving the input and output virtual addresses corresponding to the j-th data block to be downloaded sent by the host; when the j-th data block to be downloaded is the last data block to be downloaded, closing the second target file; sending a fourth notification message to the host; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
[0145] In some exemplary embodiments, when the computer program is executed by the processor, it also implements: obtaining the name and size of the file to be downloaded from the host; accordingly, when the computer program is executed by the processor, the storage space of the second target file on the local disk of the DPU accelerator card is expanded in the following manner: the storage space of the second target file on the local disk of the DPU accelerator card is expanded according to the size of the file to be downloaded.
[0146] In some exemplary embodiments, when the computer program is executed by the processor, the name and size of the file to be downloaded is obtained from the host in the following manner: a query request is sent to the host, where the query request is used to query the name and size of the file to be downloaded; and the name and size of the file to be downloaded sent by the host are received.
[0147] In some exemplary embodiments, the ftruncate function may be used to expand the storage space of the second target file on the local disk of the DPU accelerator card.
[0148] In some exemplary embodiments, the storage space of the second target file on the local disk of the DPU accelerator card may be expanded to a storage space of the same size as the file to be downloaded. Thus, after each addition of j plus 1, the step of locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card should be executed.
[0149] In some exemplary embodiments, the storage space of the second target file on the local disk of the DPU accelerator card can be expanded to the sum of the current storage space and the storage space of the jth data block to be downloaded based on the current storage space. In this way, after j is increased by 1 each time, the step of expanding the storage space of the second target file on the local disk of the DPU accelerator card should be executed.
[0150] In some exemplary embodiments, when the computer program is executed by the processor, the following method is specifically used to lock the j-th data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card: map the j-th data block to be downloaded to the user state address space of the DPU accelerator card, and obtain the third virtual address of the j-th data block to be downloaded in the user state address space of the DPU accelerator card; translate the third virtual address into a third physical address of the memory of the DPU accelerator card; and lock the local disk space of the DPU accelerator card corresponding to the third physical address in the page cache of the DPU accelerator card.
[0151] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the third physical address is, that is, the storage space of the j-th data block in the local disk of the DPU accelerator card.
[0152] In some exemplary embodiments, the j-th data block may be mapped to the user-state address space of the DPU accelerator card through the mmap function to obtain the third virtual address of the j-th data block in the user-state address space of the DPU accelerator card.
[0153] In some exemplary embodiments, the local disk space of the DPU accelerator card corresponding to the third physical address may be locked in the page cache of the DPU accelerator card through the get_user_pages function family.
[0154] In some exemplary embodiments, when the computer program is executed by the processor, the following method is specifically used to copy the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the IOVA corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded: according to the third physical address, the IOVA corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded, the jth data block to be downloaded locked in the page cache of the host is copied to the page cache of the DPU accelerator card.
[0155] In some exemplary embodiments, when the computer program is executed by the processor, it also implements: when the j-th data block to be downloaded is not the last data block to be downloaded, j is increased by 1, and the step of locking the j-th data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card is continued.
[0156] In some exemplary embodiments, when the computer program is executed by the processor, it also implements: when the j-th data block to be downloaded is not the last data block to be downloaded, j is increased by 1, and the step of expanding the storage space of the second target file on the local disk of the DPU accelerator card is continued.
[0157] Ninth aspect, refer to Figure 8 An embodiment of the present application provides an electronic device, comprising: at least one third processor 801; a third memory 802, wherein at least one third program is stored in the third memory 802, and when the at least one third program is executed by the at least one third processor 801, any one of the above-mentioned file transfer methods is implemented.
[0158] In some exemplary embodiments, the electronic device further includes: one or more third I / O interfaces 803 connected between the third processor 801 and the third memory 802 , and configured to implement information interaction between the third processor 801 and the third memory 802 .
[0159] Among them, the third processor 801 is a device with data processing capabilities, including but not limited to a central processing unit (CPU) and the like; the third memory 802 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the third I / O interface (read-write interface) 803 is connected between the third processor 801 and the third memory 802, and can realize information interaction between the third processor 801 and the third memory 802, including but not limited to a data bus (Bus) and the like.
[0160] In some embodiments, the third processor 801, the third memory 802, and the third I / O interface 803 are connected to each other through a third bus 804, and further connected to other components of the computing device.
[0161] In a tenth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, and when the computer program is executed by a processor, any one of the above-mentioned file transfer methods is implemented.
[0162] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0163] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present application as set forth in the appended claims.
Claims
1. A file transfer method, applied to a data processor DPU accelerator card, the method comprising: Receive a file upload request and open the file to be uploaded; Locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card; wherein i is an integer greater than or equal to 1; Sending a first notification message to the host; wherein the first notification message is used to notify the host to upload a file; receiving an input / output virtual address corresponding to the ith data block sent by the host, and copying the ith data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the input / output virtual address corresponding to the ith data block and the block size of the ith data block; When the i-th data block is the last data block in the file to be uploaded, close the file to be uploaded; send a second notification message to the host; wherein the second notification message is used to notify the host to close the first target file.
2. The file transmission method according to claim 1, wherein when the i-th data block is not the last data block in the file to be uploaded, the method further comprises: Add 1 to i and continue to execute the step of locking the i-th data block in the file to be uploaded in the page cache of the DPU acceleration card.
3. The file transmission method according to any one of claims 1 to 2, wherein: The step of locking the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card includes: Mapping the i-th data block to the user state address space of the DPU accelerator card to obtain a first virtual address of the i-th data block in the user state address space of the DPU accelerator card; Translate the first virtual address into a first physical address of the memory of the DPU accelerator card; Locking the local disk space of the DPU accelerator card corresponding to the first physical address in the page cache of the DPU accelerator card; The step of copying the i-th data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the input / output virtual address corresponding to the i-th data block and the block size of the i-th data block includes: copying the i-th data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the first physical address, the input / output virtual address corresponding to the i-th data block and the block size of the i-th data block.
4. The file transmission method according to any one of claims 1 to 2, wherein: The first notification message includes at least: the name and size of the file to be uploaded.
5. A file transfer method, applied to a host, comprising: Receive a first notification message sent by a data processor DPU accelerator card; wherein the first notification message is used to notify the host to upload a file; Creating a first target file, expanding the storage space of the first target file on the local disk of the host, and locking the i-th data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host; wherein i is an integer greater than or equal to 1; Translate the second physical address corresponding to the i-th data block to be uploaded into the input / output virtual address corresponding to the i-th data block to be uploaded, and send the input / output virtual address corresponding to the i-th data block to be uploaded to the DPU accelerator card; When the i-th data block to be uploaded is the last data block to be uploaded, a second notification message sent by the DPU acceleration card is received, and the target file is closed; wherein the second notification message is used to notify the host to close the target file.
6. The file transmission method according to claim 5, in the case where the i-th data block to be uploaded is not the last data block to be uploaded, the method further comprises: Add 1 to i, and continue to execute the step of locking the i-th data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host.
7. The file transmission method according to any one of claims 5 to 6, wherein: The step of locking the i-th data block to be uploaded in the first target file after the storage space is expanded in the page cache of the host comprises: Mapping the i-th data block to be uploaded to the user state address space of the host to obtain a second virtual address of the i-th data block to be uploaded in the user state address space of the host; The second virtual address is translated into a second physical address of the host's memory; and the local disk space of the host corresponding to the second physical address is locked in the page cache of the host.
8. The file transmission method according to any one of claims 5 to 6, wherein: The first notification message includes at least: the name and size of the file to be uploaded.
9. A file transfer method, applied to a data processor DPU accelerator card, the method comprising: Receiving a file download request, creating a second target file; Expanding the storage space of the second target file on the local disk of the DPU accelerator card, and locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card; wherein j is an integer greater than or equal to 1; Sending a third notification message to the host; wherein the third notification message is used to notify the host to download the file; receiving an input / output virtual address corresponding to the j-th data block to be downloaded sent by the host, and copying the j-th data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the input / output virtual address corresponding to the j-th data block to be downloaded and the block size of the j-th data block to be downloaded; When the j-th data block to be downloaded is the last data block to be downloaded, close the second target file; send a fourth notification message to the host; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
10. The file transmission method according to claim 9, in the case that the j-th data block to be downloaded is not the last data block to be downloaded, the method further comprises: Add 1 to j, and continue to execute the step of locking the j-th data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU acceleration card.
11. The file transmission method according to any one of claims 9 to 10, wherein: The step of locking the jth data block to be downloaded in the second target file after the storage space is expanded in the page cache of the DPU accelerator card comprises: Mapping the j-th data block to be downloaded to the user state address space of the DPU accelerator card to obtain a third virtual address of the j-th data block to be downloaded in the user state address space of the DPU accelerator card; Translate the third virtual address into a third physical address of the memory of the DPU accelerator card; Locking the local disk space of the DPU accelerator card corresponding to the third physical address in the page cache of the DPU accelerator card; The copying of the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the input-output virtual address corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded includes: copying the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the third physical address, the input-output virtual address corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded.
12. The file transmission method according to any one of claims 9 to 10, after receiving the file download request, the method further comprises: Get the name and size of the file to be downloaded from the host; The expanding the storage space of the second target file on the local disk of the DPU accelerator card includes: expanding the storage space of the second target file on the local disk of the DPU accelerator card according to the size of the file to be downloaded.
13. A file transfer method, applied to a host, the method comprising: Receive a third notification message sent by a data processor DPU acceleration card, and open the file to be downloaded; wherein the third notification message is used to notify the host to download the file; Locking the jth data block in the file to be downloaded in the page cache of the host; wherein j is an integer greater than or equal to 1; Translate the fourth physical address corresponding to the j-th data block into an input / output virtual address corresponding to the j-th data block, and send the input / output virtual address corresponding to the j-th data block to the DPU accelerator card; When the j-th data block is the last data block in the file to be downloaded, a fourth notification message sent by the DPU acceleration card is received, and the file to be downloaded is closed; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
14. The file transmission method according to claim 13, in the case where the j-th data block is not the last data block of the file to be downloaded, the method further comprises: Add 1 to j, and continue to execute the step of locking the j-th data block in the file to be downloaded in the page cache of the host.
15. The file transmission method according to any one of claims 13 to 14, wherein: The step of locking the jth data block in the file to be downloaded in the page cache of the host comprises: Mapping the j-th data block to the user state address space of the host to obtain a fourth virtual address of the j-th data block in the user state address space of the host; The fourth virtual address is translated into a fourth physical address of the memory of the host; and the local disk space of the host corresponding to the fourth physical address is locked in the page cache of the host.
16. An electronic device comprising: at least one first processor; A first memory, wherein at least one first program is stored in the first memory, and when the at least one first program is executed by the at least one first processor, the following steps are implemented: Upon receiving a file upload request, the file to be uploaded is opened; the i-th data block in the file to be uploaded is locked in the page cache of the DPU accelerator card; wherein i is an integer greater than or equal to 1; Sending a first notification message to the host; wherein the first notification message is used to notify the host to upload a file; Receiving an input / output virtual address corresponding to the i-th data block sent by the host; The electronic device further includes: a first memory direct access DMA engine, configured to copy the i-th data block locked in the page cache of the DPU accelerator card to the page cache of the host according to the input / output virtual address corresponding to the i-th data block and the block size of the i-th data block; When the at least one first program is executed by the at least one first processor, the following steps are also implemented: When the i-th data block is the last data block in the file to be uploaded, close the file to be uploaded; send a second notification message to the host; wherein the second notification message is used to notify the host to close the first target file.
17. A computer readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented: Receive a file upload request, open the file to be uploaded; lock the i-th data block in the file to be uploaded in the page cache of the DPU accelerator card; wherein, i is an integer greater than or equal to 1; Sending a first notification message to the host; wherein the first notification message is used to notify the host to upload a file; Receiving an input / output virtual address corresponding to the i-th data block sent by the host; When the i-th data block is the last data block in the file to be uploaded, close the file to be uploaded; send a second notification message to the host; wherein the second notification message is used to notify the host to close the first target file.
18. An electronic device, comprising: at least one second processor; A second memory, wherein at least one second program is stored in the second memory, and when the at least one second program is executed by the at least one second processor, the following steps are implemented: Upon receiving a file download request, a second target file is created; the storage space of the second target file on the local disk of the DPU accelerator card is expanded, and the jth data block to be downloaded in the second target file after the storage space is expanded is locked in the page cache of the DPU accelerator card; wherein j is an integer greater than or equal to 1; Sending a third notification message to the host; wherein the third notification message is used to notify the host to download the file; Receiving the input and output virtual addresses corresponding to the j-th data block to be downloaded sent by the host; The electronic device further comprises: a second memory direct access DMA engine, configured to copy the jth data block to be downloaded locked in the page cache of the host to the page cache of the DPU accelerator card according to the input / output virtual address corresponding to the jth data block to be downloaded and the block size of the jth data block to be downloaded; When the at least one second program is executed by the at least one second processor, the following steps are also implemented: When the j-th data block to be downloaded is the last data block to be downloaded, close the second target file; send a fourth notification message to the host; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
19. A computer readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented: A file download request is received, and a second target file is created; the storage space of the second target file on the local disk of the DPU accelerator card is expanded, and the jth data block to be downloaded in the second target file after the storage space is expanded is locked in the page cache of the DPU accelerator card; wherein, j is an integer greater than or equal to 1; Sending a third notification message to the host; wherein the third notification message is used to notify the host to download the file; Receiving the input and output virtual addresses corresponding to the j-th data block to be downloaded sent by the host; When the j-th data block to be downloaded is the last data block to be downloaded, close the second target file; send a fourth notification message to the host; wherein the fourth notification message is used to notify the host to close the file to be downloaded.
20. An electronic device, comprising: at least one third processor; A third memory, wherein at least one third program is stored in the third memory, and when the at least one third program is executed by the at least one third processor, the file transfer method described in any one of claims 5 to 8 or the file transfer method described in any one of claims 13 to 15 is implemented.
21. A computer-readable medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the file transmission method according to any one of claims 5 to 8 or the file transmission method according to any one of claims 13 to 15 is implemented.
