A host command writing method, device, system and readable storage medium

By defining the CMB virtual space in the PCIe Memory space on the host side and using the PCIe Switch to complete address mapping, NVMe commands are directly written into the physical space of the SSD controller, which solves the problems of multiple command writing steps and large delays in the existing technology. Improved SSD performance.

CN112711442BActive Publication Date: 2024-09-03BEIJING INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011601763.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-29
Publication Date
2024-09-03
Estimated Expiration
2040-12-29

AI Technical Summary

Technical Problem

The existing technology lacks a host command writing method based on Controller Memory Buffer (CMB), which results in many command writing steps and a large delay, affecting SSD performance.

Method used

By defining the CMB virtual space in the PCIe Memory space on the host side, generating NVMe commands and writing them into the CMB virtual space, using the PCIe Switch to complete the address mapping between the CMB virtual space and the physical space, and writing the commands directly to the SSD controller In the CMB physical space, reduce the action of the SSD controller reading commands from the host.

Benefits of technology

It effectively reduces the command writing steps and delays, improves the performance of SSD, realizes direct command writing operations, and improves the efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112711442B
    Figure CN112711442B
Patent Text Reader

Abstract

The present invention discloses a host command writing method, which adds a CMB virtual space to the PCIe Memory space of the host side, writes the command into the CMB virtual space after generating the command corresponding to NVMe, and adds a PCIe Switch inside the main control side to complete the address translation mapping routing action of the data packet, thereby controlling the PCIe Switch to write the command in the CMB virtual space into the mapped CMB physical space in the main control side SSD controller, so that the host side can directly write the submission command into its own CMB virtual storage space during command writing, reducing the action of the SSD controller reading the command from the host, and can effectively improve the SSD performance. The present invention also discloses a host side device, a main control side device, a system and a readable storage medium, which have corresponding technical effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage technology, and in particular to a host command writing method, device, system and readable storage medium. Background Art

[0002] With the continuous development of storage systems, SSD (Solid State Disk) solid state drives are constantly replacing traditional hard drives. In the traditional NVMe (Non-volatile Memory Express) command interaction, the submission queue implemented in the host memory will require the controller to perform a PCIe (peripheral component interconnect express, a high-speed serial computer expansion bus) read operation to the host memory to obtain the queue content.

[0003] The submission queue implemented based on CMB (Controller Memory Buffer) is a host that writes the commands in the submission queue directly into the internal storage space of the controller. This reduces the action of the controller reading commands from the host and can reduce the delay in command execution.

[0004] However, there is currently no referenceable method for writing host commands based on CMB implementation.

[0005] In summary, how to reduce the command writing steps, reduce the command writing delay, and propose a feasible host command writing method based on CMB is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention

[0006] The purpose of the present invention is to provide a host command writing method, device, system and readable storage medium, and propose a feasible host command writing method based on CMB, which can reduce the command writing steps and reduce the command writing delay.

[0007] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0008] A host command writing method, comprising:

[0009] The main control end controls the PCIe Switch to monitor the CMB virtual space, and determines the command corresponding to the NVMe written into the CMB virtual space; wherein the CMB virtual space is the CMB virtual memory space defined according to the NVMe register group;

[0010] The PCIe Switch is controlled to write the command in the CMB virtual space into the CMB physical space in the SSD controller according to an address mapping relationship between the CMB virtual space and the CMB physical space.

[0011] Optionally, the controlling the PCIe Switch to write the command in the CMB virtual space into the CMB physical space in the SSD controller according to an address mapping relationship between the CMB virtual space and the CMB physical space includes:

[0012] After detecting that there is a command written in the CMB virtual space, the PCIe Switch is controlled to write the command in the CMB virtual space into the CMB physical space in the SSD controller according to an address mapping relationship between the CMB virtual space and the CMB physical space.

[0013] Optionally, after writing the command in the CMB virtual space into the CMB physical space in the SSD controller, the method further includes:

[0014] After the command is written into the CMB physical space, a command completion notification is fed back to the host.

[0015] Optionally, after feeding back a command completion notification to the host end, the method further includes:

[0016] The command is written from the CMB physical space to the address corresponding to the host memory space.

[0017] A main control terminal, comprising:

[0018] Memory for storing computer programs;

[0019] A processor is used to implement the steps of the host command writing method when executing the computer program.

[0020] A host command writing method, comprising:

[0021] The host initializes the NVMe register group in the PCIe Memory space;

[0022] Generate commands corresponding to NVMe;

[0023] The command is written into the CMB virtual space defined in the PCIe Memory space, so that the master control PCIe Switch writes the command into the CMB physical space in the master SSD controller according to the address mapping relationship between the CMB virtual space and the CMB physical space; wherein the CMB virtual space is the CMB virtual memory space defined according to the NVMe register group.

[0024] Optionally, the host command writing method further includes:

[0025] After receiving the command completion notification, the completed command is moved from the send queue in the CMB virtual space to the submit queue in the host memory.

[0026] A host terminal, comprising:

[0027] Memory for storing computer programs;

[0028] A processor is used to implement the steps of the host command writing method when executing the computer program.

[0029] A host command writing system comprises: the master control end and the host end as described above;

[0030] The host end is used to: initialize the NVMe register group in the PCIe Memory space; generate a command corresponding to NVMe; write the command into the CMB virtual space defined in the PCIe Memory space;

[0031] The main control end is used to: control the PCIe Switch to monitor the CMB virtual space, determine the command corresponding to the NVMe written into the CMB virtual space; wherein the CMB virtual space is a CMB virtual memory space defined according to the NVMe register group; control the PCIe Switch to write the command in the CMB virtual space into the CMB physical space in the SSD controller according to the address mapping relationship between the CMB virtual space and the CMB physical space.

[0032] A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the host command writing method are implemented.

[0033] The method provided in the embodiment of the present invention adds a CMB virtual space to the PCIe Memory space of the host side, generates a command corresponding to NVMe, writes the command into the CMB virtual space, and adds a PCIeSwitch inside the main control side to complete the address translation mapping routing action of the data packet, thereby controlling the PCIe Switch to complete the one-to-one mapping of the CMB virtual space of the internal CMB memory and the PCIe memory of the host side, and writes the command in the CMB virtual space into the CMB physical space in the SSD controller of the main control side. In this way, the host side can directly write the submitted command into its own CMB virtual storage space during command writing, thereby reducing the action of the SSD controller reading the command from the host, and can effectively improve the SSD performance.

[0034] Correspondingly, the embodiments of the present invention also provide a host-side device and a master-side device, a system and a readable storage medium corresponding to the above-mentioned host command writing method, which have the above-mentioned technical effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 A signaling diagram of a host command writing method in an embodiment of the present invention;

[0037] Figure 2 A schematic diagram of the distribution and mapping of a host-side PCIe Memory space in an embodiment of the present invention;

[0038] Figure 3 A schematic diagram of command writing of a master control terminal in an embodiment of the present invention;

[0039] Figure 4 This is a schematic diagram of the structure of a host terminal or a main control terminal in an embodiment of the present invention;

[0040] Figure 5 The figure is a schematic diagram of the structure of a host command writing system in an embodiment of the present invention. DETAILED DESCRIPTION

[0041] The core of the present invention is to provide a host command writing method, and propose a feasible host command writing method based on CMB, which can reduce the command writing steps and reduce the command writing delay.

[0042] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0043] Please refer to Figure 1 , Figure 1 A signaling diagram of a host command writing method in an embodiment of the present invention, the method comprising the following steps:

[0044] S111, the host initializes the NVMe register group in the PCIe Memory space;

[0045] The NVMe register group space is set in the PCIe Memory space of the host side (Host) for the definition and access of the NVMe register group.

[0046] Before interacting with NVMe, it is necessary to first load the NVMe driver and complete the initialization of the NVMe registers. The initialization process may mainly include initializing the NVMe submission queue and completion queue, the submission queue doorbell register and the completion queue doorbell register. This is not limited in this embodiment, and the implementation of the relevant technology may be referred to.

[0047] S112, the host generates a command corresponding to NVMe;

[0048] In the interaction with the NVMe register, it is necessary to generate and write commands corresponding to NVMe on the master end (the commands may mainly include admin submission commands and IO submission commands, etc.), and the generation method of NVMe commands is not limited in this embodiment, and the implementation method of related technologies can be referred to, which will not be repeated here.

[0049] S113, the host writes the command into the CMB virtual space defined in the PCIe Memory space;

[0050] like Figure 2 The figure shows a distribution and mapping diagram of a host-side PCIe Memory space, in which the basic spaces BAR (Base Address Register) 0 and BAR2 are defined and used in the host-side PCIe Memory space.

[0051] Among them, BAR0 is used for the definition and access of NVMe register groups, so BAR0 can also be called NVMe register group space. For the relevant implementation process of defining NVMe register groups in BAR0, please refer to the introduction of related technologies, which will not be repeated here. In addition to the definition and access of NVMe register groups, BAR0 also defines the BAR index number of CMB as BAR2 and the supported attribute as supporting the storage of submission queues in CMB.

[0052] BAR2 is used to define the virtual memory space of CMB, so it can also be called CMB virtual space. Among them, the virtual memory space of CMB can store data in the form of virtual addresses, and the real data is stored in the physical address of CMB on the host. In order to realize the loading and interaction of NVMe commands, the virtual memory space of CMB is defined according to the NVMe register group in BAR0.

[0053] The host driver can allocate BAR0 and BAR2 address spaces and configure the MSI-X interrupt table when enumerating PCIe devices to facilitate subsequent command writing calls.

[0054] After the command is generated, the host uses the BAR2CMB virtual space where the CMB is located as the base address of the submission queue and writes the command to the CMB virtual space defined in the PCIe Memory space.

[0055] It should be noted that when the host sends the creation of other queues to the submission queue, it is also in the CMB space.

[0056] S121, the master control end controls the PCIe Switch to monitor the CMB virtual space, and determines the command corresponding to the NVMe written into the CMB virtual space;

[0057] Inside the main control end, the command writing of the CMB virtual space in the host end is monitored by controlling the PCIe Switch, so as to determine the command corresponding to the NVMe written by the host end to the CMB virtual space.

[0058] S122. The host controls the PCIe Switch to write the command in the CMB virtual space into the CMB physical space in the SSD controller according to the address mapping relationship between the CMB virtual space and the CMB physical space.

[0059] When the traditional NVMe (submission) command is obtained, when the NVMe queue is created, the address created by each submission queue uses the queue address actually allocated by the Host (host side) to set the SubQMgr (SubQMgr is mainly used to manage submission queue-related commands in the master control end, complete the acquisition and distribution of submission queue commands, and the command acquisition is based on the head pointer and tail queue pointer configured by SubQMgr to maintain the entire submission queue) Each queue base address, after which when the Host sends a command to the submission queue, SubQMgr uses the base address of each queue to perform a PCIe read command to obtain the command entry from the host side.

[0060] However, in the CMB-based host command writing method provided in this embodiment, when the NVMe driver loads and creates a queue, the host uses the BAR2 memory space where the CMB is located as the base address of the submission queue. When the host sends the creation of other queues to the submission queue, it is also in the CMB space, such as Figure 3 The figure shows a schematic diagram of command writing on the master side. The base address of the SubQMgr submission queue of the master side is directly mapped in the CMB. When the host side sends a command to the submission queue, it directly writes the entries of the submission queue into the CMB virtual space of the master at one time. In this way, the SubMgr of the master side can directly obtain the command from the master CMB memory and distribute it to each CPU for processing through the internal bus.

[0061] The host (controller) controls the PCIe Switch to complete the address mapping routing of the PCIe message data packet and forward it to the CMB physical space in the host SSD controller, and writes it to the CMB master buffer. The CMB master buffer area is allocated in units of a certain size (such as 64KB) from the host's memory space for saved commands. The host directly writes the command into the CMB area, saving one interaction and bandwidth compared with the traditional command interaction method.

[0062] Among them, the PCIe Switch performs address mapping translation (from CMB virtual space to CMB physical space) on the data packet corresponding to the command according to the address mapping relationship between the CMB virtual space and the CMB physical space, and forwards the command from the host side to the corresponding physical space (which may include CMB physical space or other space).

[0063] Furthermore, in order to improve the command writing efficiency, the PCIe Switch can be controlled to write the command in the CMB virtual space to the CMB physical space in the SSD controller immediately after detecting the command writing in the CMB virtual space, so as to improve the response speed of the command writing.

[0064] After the command is written into the CMB physical space, in order to facilitate the host to timely understand the progress of the command writing, the master control end can feedback the command writing completion (ie, command completion notification) to the host.

[0065] After receiving the command completion notification, the host can move the completed command from the send queue in the CMB virtual space to the submit queue in the host memory to speed up command processing and improve the standardization of command management.

[0066] At the same time, after feeding back the completion of command writing to the host, in order to speed up the solidification storage of the command and the command response, the master control end can write the command from the CMB physical space to the corresponding address of the host memory space.

[0067] The command completion notification to the host side and the writing of the command from the CMB physical space to the address corresponding to the host memory space can be controlled and implemented by the CplMgr completion queue management unit of the master control side.

[0068] Based on the above introduction, the technical solution provided by the embodiment of the present invention adds a CMB virtual space to the PCIe Memory space of the host side, and after generating the corresponding command of NVMe, writes the command into the CMB virtual space, and at the same time adds a PCIe Switch inside the main control side to complete the address translation mapping and routing action of the data packet, thereby controlling the PCIe Switch to complete the one-to-one mapping of the CMB virtual space of the internal CMB memory and the PCIe memory of the host side, and writes the command in the CMB virtual space into the CMB physical space in the SSD controller of the main control side, so that the host side can directly write the command into its own CMB virtual storage space during command writing, thereby reducing the action of the SSD controller reading the command from the host, and can effectively improve the SSD performance.

[0069] Corresponding to the above method embodiment, the embodiment of the present invention further provides a master control end. The master control end described below and the host command writing method described above can refer to each other.

[0070] The main control terminal includes:

[0071] Memory for storing computer programs;

[0072] The processor is used to implement the steps of the host command writing method of the above method embodiment when executing a computer program.

[0073] For details, please refer to Figure 4, is a schematic diagram of a specific structure of a master control terminal provided in this embodiment. The master control terminal may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 322 (for example, one or more processors) and a memory 332, and the memory 332 stores one or more computer applications 342 or data 344. Among them, the memory 332 can be a temporary storage or a permanent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data processing device. Furthermore, the central processing unit 322 can be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the master control terminal 301.

[0074] The host control end 301 may further include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input and output interfaces 358 , and / or one or more operating systems 341 .

[0075] The steps in the host command writing method described above can be implemented by the structure of the master control end provided by the embodiment.

[0076] Corresponding to the above method embodiment, the embodiment of the present invention further provides a host end. The host end described below and the host command writing method described above can refer to each other.

[0077] The host side includes:

[0078] Memory for storing computer programs;

[0079] The processor is used to implement the steps of the host command writing method of the above method embodiment when executing a computer program.

[0080] The structure of the host end provided in this embodiment can refer to the introduction of the main control end structure in the above embodiment, that is, Figure 4 The setting of the structure in this embodiment will not be repeated here.

[0081] Corresponding to the above method embodiment, the embodiment of the present invention also provides a host command writing system, which mainly includes a host end and a main control end, such as Figure 5 The figure shows a schematic diagram of the structure of a host command writing system.

[0082] The host and the control end complete the writing and transmission of commands through the PCIe Switch.

[0083] Specifically, the host side is used to: initialize the NVMe register group in the PCIe Memory space; generate commands corresponding to NVMe; write the commands to the CMB virtual space defined in the PCIe Memory space;

[0084] The main control end is used to: control the PCIe Switch to monitor the CMB virtual space, determine the NVMe corresponding commands written to the CMB virtual space; wherein the CMB virtual space is the CMB virtual memory space defined according to the NVMe register group; control the PCIe Switch to write the commands in the CMB virtual space into the CMB physical space in the SSD controller according to the address mapping relationship between the CMB virtual space and the CMB physical space.

[0085] The implementation process of the host side and the master side cooperating to complete the host command writing can refer to the above Figure 1 The introduction of the corresponding embodiments will not be repeated here.

[0086] Corresponding to the above method embodiment, an embodiment of the present invention further provides a readable storage medium. The readable storage medium described below and the host command writing method described above can refer to each other.

[0087] A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the host command writing method of the above method embodiment are implemented.

[0088] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.

[0089] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

Claims

1. A host command writing method, characterized in that: include: The master control end controls the PCIe Switch to monitor the CMB virtual space and determines the command corresponding to the NVMe written into the CMB virtual space; wherein the CMB virtual space is a CMB virtual memory space defined according to the NVMe register group, and stores data in the form of a virtual address, and the real data is stored in the CMB physical address of the master control end; Controlling the PCIe Switch to write the command in the CMB virtual space into the CMB physical space in the SSD controller according to an address mapping relationship between the CMB virtual space and the CMB physical space; Wherein, writing the command in the CMB virtual space into the CMB physical space in the SSD controller includes: writing the command corresponding to the target virtual address in the CMB virtual space into the CMB physical space in the SSD controller; After writing the command in the CMB virtual space into the CMB physical space in the SSD controller, the method further includes: after the command is written into the CMB physical space, feeding back a command completion notification to the host end; After feeding back a command completion notification to the host, the method further includes: writing the command from the CMB physical space to an address corresponding to the host memory space.

2. The host command writing method according to claim 1, characterized in that: The controlling the PCIe Switch to write the command in the CMB virtual space into the CMB physical space in the SSD controller according to the address mapping relationship between the CMB virtual space and the CMB physical space includes: After detecting that there is a command written in the CMB virtual space, the PCIe Switch is controlled to write the command in the CMB virtual space into the CMB physical space in the SSD controller according to an address mapping relationship between the CMB virtual space and the CMB physical space.

3. A master control terminal, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the host command writing method as claimed in any one of claims 1 to 2 when executing the computer program.

4. A host command writing method, characterized in that: include: The host initializes the NVMe register group in the PCIe Memory space; Generate commands corresponding to NVMe; Writing the command into the CMB virtual space defined in the PCIe Memory space, so that the host controls the PCIe Switch to write the command into the CMB physical space in the host SSD controller according to the address mapping relationship between the CMB virtual space and the CMB physical space; wherein the CMB virtual space is the CMB virtual memory space defined according to the NVMe register group; Wherein, writing the command into the CMB virtual space defined in the PCIe Memory space comprises: writing the command into the CMB virtual space defined in the PCIe Memory space in the form of a virtual address; The method further includes: after receiving a command completion notification, moving the completed command from a send queue in the CMB virtual space to a submit queue in the host memory.

5. A host terminal, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the host command writing method as claimed in claim 4 when executing the computer program.

6. A host command writing system, characterized in that: include: The master control terminal as claimed in claim 3 and the host terminal as claimed in claim 5; The host end is used to: initialize the NVMe register group in the PCIe Memory space; generate a command corresponding to NVMe; write the command into the CMB virtual space defined in the PCIe Memory space; The main control end is used to: control the PCIe Switch to monitor the CMB virtual space, determine the command corresponding to the NVMe written into the CMB virtual space; wherein the CMB virtual space is a CMB virtual memory space defined according to the NVMe register group; control the PCIe Switch to write the command in the CMB virtual space into the CMB physical space in the SSD controller according to the address mapping relationship between the CMB virtual space and the CMB physical space.

7. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the host command writing method according to any one of claims 1 to 2 and / or the host command writing method according to claim 4 are implemented.