Page table data reading method and device, equipment and storage medium
By introducing a page table cache module into the page table data reading system to cache the page table data on the host side, the problem of low page table data reading efficiency in the prior art is solved, and more efficient data reading speed and efficiency are achieved.
Patent Information
- Application Number
- CN202411985105.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-13
AI Technical Summary
The data reading efficiency of existing page tables is low, resulting in the hardware requiring multiple read operations, occupying the common bus bandwidth, and reducing the data reading speed and efficiency.
The page table cache module is used to cache the page table data on the host side. By receiving the read request initiated by the request module, it determines whether the required data exists in the page table cache module. If it exists, it will be read and returned directly; if it does not exist, the data will be read from the host side through the preset reading interface and the cache module will be updated.
By caching page table data, the number of times the page table data is read from the host side is reduced, the use of common bus bandwidth is reduced, and the speed and efficiency of page table data reading is improved.
Smart Images

Figure CN119988254A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of solid state hard disks, and in particular to a page table data reading method, device, equipment and storage medium. Background Art
[0002] The page table is used to describe the address information of data stored on the host side. A record in the page table corresponds to the storage address of a data block. The page table is stored in a continuous address space on the host side. Data blocks can be stored discretely on the host side. Software and hardware can flexibly manage data blocks through page tables.
[0003] like Figure 1 The first-level page table shown in FIG. 1 is composed of several consecutively stored PBLs (Physical Buffer lists), each of which points to the starting address of a data block. Figure 2 The first-level page table shown is composed of several consecutively stored PBL_lists, each of which points to another page table (i.e., the second-level page table). The second-level page table is composed of several consecutively stored PBLs, each of which points to the starting address of a data block. Figure 3 In the page table data acquisition process shown in the figure, the hardware first accesses the page table information on the host side through PCIe (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus), and then operates the host side data through PCIe after obtaining the page table information. In the first-level page table mode, the hardware needs 2 read operations and 2 data return processes; in the second-level page table mode, the hardware needs 3 read operations and 3 data return processes. If it is a higher-level page table, more acquisition operations are required, which leads to low efficiency in reading page table data. Summary of the invention
[0004] The main purpose of the present invention is to provide a method, device, equipment and storage medium for reading page table data, aiming to solve the technical problem of low efficiency in existing page table data reading.
[0005] A first aspect of the present invention provides a method for reading page table data, the method comprising:
[0006] A read request for the first page table data initiated by a receiving request module;
[0007] Determine whether the first page table data exists in the cache page table in the page table cache module;
[0008] If the first page table data exists in the cache page table in the page table cache module, the first page table data is read from the cache page table in the page table cache module and returned to the request module;
[0009] If the first page table data does not exist in the cache page table in the page table cache module, the first page table data is read from the host side through a preset read interface, and the first page table data is returned to the request module and updated to the cache page table in the page table cache module.
[0010] Optionally, in a first implementation of the first aspect of the present invention, the determining whether the first page table data exists in the cache page table in the page table cache module includes:
[0011] When the cache page table corresponding to the request module is a first-level cache page table, determining whether there is a first-level cache page table corresponding to the request module in the page table cache module;
[0012] If the page table cache module contains a first-level cache page table corresponding to the request module, determining whether the first page table data is within a page table data range in the first-level cache page table corresponding to the request module;
[0013] If the first page table data is within the page table data range in the first-level cache page table corresponding to the request module, determining that the first page table data exists in the cache page table in the page table cache module;
[0014] If the first page table data is not within the page table data range in the first-level cache page table corresponding to the request module, or the first-level cache page table corresponding to the request module does not exist in the page table cache module, it is determined that the first page table data does not exist in the cache page table in the page table cache module.
[0015] Optionally, in a second implementation of the first aspect of the present invention, the determining whether the first page table data exists in the cache page table in the page table cache module includes:
[0016] When the cache page table corresponding to the request module is a multi-level cache page table, determining whether the multi-level cache page table corresponding to the request module exists in the page table cache module;
[0017] If the page table cache module contains a multi-level cache page table corresponding to the request module, determining whether the first page table data is within a page table data range within an N-th level cache page table corresponding to the request module, where N is a positive integer greater than or equal to 1;
[0018] If the first page table data is within the page table data range of the Nth level cache page table corresponding to the request module, continue to determine whether the first page table data is within the page table data range of the N+Kth level cache page table corresponding to the request module, until the last level cache page table;
[0019] If the first page table data is located within the page table data range in the N+Kth level cache page table corresponding to the request module, it is determined that the first page table data exists in the cache page table in the page table cache module, where K is a positive integer greater than or equal to 1;
[0020] If the first page table data is not located within the page table data range within the Nth level or N+K level cache page table corresponding to the request module, or the multi-level cache page table corresponding to the request module does not exist in the page table cache module, it is determined that the first page table data does not exist in the cache page table in the page table cache module.
[0021] Optionally, in a third implementation of the first aspect of the present invention, if the first page table data does not exist in the cache page table in the page table cache module, reading the first page table data from the host side through a preset read interface, returning the first page table data to the request module and updating the cache page table in the page table cache module includes:
[0022] When the cache page table corresponding to the request module is a first-level cache page table or a multi-level cache page table, if the first-level cache page table or the multi-level cache page table corresponding to the request module does not exist in the page table cache module, the first page table data and a plurality of second page table data located after the first page table data are read from the host side through the read interface;
[0023] The read first page table data is returned to the request module, and the first page table data and a number of the second page table data are updated into a first-level cache page table or a multi-level cache page table corresponding to the request module in the page table cache module.
[0024] Optionally, in a fourth implementation of the first aspect of the present invention, if the first page table data does not exist in the cache page table in the page table cache module, reading the first page table data from the host side through a preset read interface, returning the first page table data to the request module and updating the cache page table in the page table cache module further includes:
[0025] When the cache page table corresponding to the request module is a first-level cache page table, if the first-level cache page table corresponding to the request module exists in the page table cache module, and the first page table data is not located within the page table data range in the first-level cache page table corresponding to the request module, then the first page table data and a plurality of third page table data located after the first page table data are read from the host side through the read interface;
[0026] The read first page table data is returned to the request module, and the first page table data and a number of the third page table data are updated into a first-level cache page table corresponding to the request module in the page table cache module.
[0027] Optionally, in a fifth implementation of the first aspect of the present invention, after if the first page table data exists in the cache page table in the page table cache module, reading the first page table data from the cache page table in the page table cache module and returning it to the request module, it further includes:
[0028] When the cache page table corresponding to the request module is a first-level cache page table, if the first page table data exists in the first-level cache page table in the page table cache module, and the first page table data is located within the first page table data range in the first-level cache page table corresponding to the request module, then determine whether the location of the first page table data exceeds the first cache data space range of the first-level cache page table;
[0029] If the location of the first page table data exceeds the first cache data space range of the first-level cache page table, read from the host side through the read interface a number of fourth page table data located after the last page table data in the first-level cache page table where the first page table data is located;
[0030] Update the fourth page table data into the first-level cache page table corresponding to the request module in the page table cache module;
[0031] Among them, based on the location of the first page table data in each cache page table and the number of page table data after the first page table data in each cache page table, the page table data range of each cache page table is divided into a first page table data range and a second page table data range, and the first page table data and the page table data after the first page table data are both located within the first page table data range.
[0032] Optionally, in a sixth implementation of the first aspect of the present invention, if the first page table data does not exist in the cache page table in the page table cache module, reading the first page table data from the host side through a preset read interface, returning the first page table data to the request module and updating the cache page table in the page table cache module further includes:
[0033] When the cache page table corresponding to the request module is a multi-level cache page table, if the multi-level cache page table corresponding to the request module exists in the page table cache module, and the first page table data is not located within the page table data range of the Nth level cache page table in the multi-level cache page table corresponding to the request module, then the first page table data in the Nth level and all the N+Kth level cache page tables in the multi-level cache page table and a number of fifth page table data located after the first page table data are read from the host side through the read interface;
[0034] The read first page table data is returned to the request module, and the first page table data and a number of the fifth page table data are updated to the Nth level and all N+Kth level cache page tables in the multi-level cache page table corresponding to the request module in the page table cache module.
[0035] Optionally, in a seventh implementation manner of the first aspect of the present invention, after if the first page table data exists in the cache page table in the page table cache module, reading the first page table data from the cache page table in the page table cache module and returning it to the request module, it further includes:
[0036] When the cache page table corresponding to the request module is a multi-level cache page table, if the first page table data exists in the multi-level cache page table in the page table cache module, and the first page table data is located in the first page table data range in the N-th level cache page table in the multi-level cache page table corresponding to the request module, then determine whether the location of the first page table data exceeds the second cache data space range of the N-th level cache page table in the multi-level cache page table;
[0037] If the location of the first page table data exceeds the second cache data space range of the Nth level cache page table in the multi-level cache page table, read a number of sixth page table data located after the last page table data in the Nth level cache page table in the multi-level cache page table where the first page table data is located from the host side through the read interface;
[0038] A number of the sixth page table data are updated into the Nth level cache page table in the multi-level cache page table corresponding to the request module in the page table cache module.
[0039] Optionally, in an eighth implementation of the first aspect of the present invention, the page table cache module includes a cache information unit and a cache page table unit, and the data stored in the cache information unit corresponds one-to-one to the data stored in the cache page table unit;
[0040] The cache information unit is used to store some cache management logic information, the cache management logic information includes a first parameter and a second parameter, the first parameter is used to identify whether the corresponding cache management logic information is valid, and the second parameter is used to record the request source that initiates the page table data read request;
[0041] The cache page table unit is used to store several cache page tables, and the cache page tables include a first-level cache page table and / or a multi-level cache page table; the first-level cache page table stores the first page table information of the cache page table at this level, and the first page table information includes a first information header and several page table data; the multi-level cache page table stores the second page table information of all upper-level cache page tables and the third page table information of the cache page table at this level, and the second page table information includes a second information header and the first page table data and the next page table data in the current upper-level cache page table, and the third page table information includes a third information header and several page table data in the cache page table at this level, wherein the first information header is used to describe the information summary of the page table data stored in the current first-level cache page table, and the second information header and the third information header both adopt the same data format as the first information header.
[0042] Optionally, in a ninth implementation of the first aspect of the present invention, determining whether a cache page table corresponding to the request module exists in the page table cache module includes:
[0043] Determining whether a request source that initiates the read request matches a value of the second parameter;
[0044] If the request source carried in the read request matches the value of the second parameter, and the value of the first parameter is valid, it is determined that a cache page table corresponding to the request module exists in the page table cache module;
[0045] The step of determining whether the first page table data is within the page table data range in the cache page table corresponding to the request module comprises:
[0046] Determine a page table data range in the cache page table corresponding to the request module based on the first information header / the second information header / the third information header in the cache page table corresponding to the request module;
[0047] The first page table data is compared with a page table data range in a cache page table corresponding to the request module to determine whether the first page table data is located within or not located in the page table data range in the cache page table corresponding to the request module.
[0048] A second aspect of the present invention further provides a page table data reading device, the page table data reading device comprising:
[0049] A receiving module, used for receiving a read request for the first page table data initiated by the requesting module;
[0050] A judging module, used for judging whether the first page table data exists in the cache page table in the page table cache module;
[0051] A reading module, configured to read the first page table data from the cache page table in the page table cache module and return the first page table data to the requesting module if the first page table data exists in the cache page table in the page table cache module;
[0052] The update module is used to read the first page table data from the host side through a preset read interface if the first page table data does not exist in the cache page table in the page table cache module, return the first page table data to the request module, and update it to the cache page table in the page table cache module.
[0053] A third aspect of the present invention provides a computer device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the computer device executes the above-mentioned page table data reading method.
[0054] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned page table data reading method.
[0055] In the technical solution provided by the present invention, a page table cache module is used to cache the page table data of the host side, and then each hardware (request module) does not need to directly read the page table data from the host side, but first initiates a read request for the page table data to the page table cache module. If the page table cache module pre-caches the page table data requested by the request module, the corresponding page table data is directly read from the page table cache module and returned to the request module. If the page table cache module does not pre-cache the page table data requested by the request module, the page table data requested by the request module is first read from the host side, and then returned to the request module, and updated to the page table cache module at the same time, so that the subsequent request module reads again. The present invention reduces the number of times the page table data is read from the host side by setting the page table cache module to cache the page table data, and correspondingly reduces the occupancy of the public bus bandwidth, effectively improving the page table data reading speed and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A schematic diagram of an embodiment of an existing primary page table structure;
[0057] Figure 2 A schematic diagram of an embodiment of an existing secondary page table structure;
[0058] Figure 3 A schematic diagram of an embodiment of an existing page table data acquisition process;
[0059] Figure 4 A schematic diagram of a first embodiment of a method for reading page table data in an embodiment of the present invention;
[0060] Figure 5 Schematic diagram of a second embodiment of the method for reading page table data in an embodiment of the present invention;
[0061] Figure 6 Schematic diagram of a third embodiment of a method for reading page table data in an embodiment of the present invention;
[0062] Figure 7 This is a schematic diagram of an embodiment of a page table cache module in an embodiment of the present invention;
[0063] Figure 8 A schematic diagram of an embodiment of a first-level cache page table structure in an embodiment of the present invention;
[0064] Fig. 9 A schematic diagram of an embodiment of a secondary cache page table structure in an embodiment of the present invention;
[0065] Fig.10 A schematic diagram of an embodiment of a PBL range in a first-level cache page table in an embodiment of the present invention;
[0066] Fig.11 A schematic diagram of an embodiment of a page table data reading device in an embodiment of the present invention;
[0067] Fig.12 FIG. 1 is a schematic diagram of an embodiment of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0069] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 4 , a first embodiment of the method for reading page table data in an embodiment of the present invention includes:
[0070] 101. A read request for first page table data initiated by a receiving request module;
[0071] In this embodiment, the request module may be any hardware module, such as a DMA (Direct Memory Access) control module, a hardware logic module on a PCIe board, and the like.
[0072] When the request module needs to access a data block, since the request module does not know the physical address corresponding to the data block, it needs to send a read request to the module that manages the page table to request the page table data corresponding to the database, that is, the PBL (Physical Buffer list) data. The page table data is the starting address of the data block. By reading the PBL data, it can be determined where the data block of the host is to be operated.
[0073] This embodiment does not limit the format of the read request initiated by the request module. For example, the read request includes the page table data (PBL data) to be read, that is, the first page table data, and may also include other parameters, such as the request source that initiates the read request, the page table type and page table format of the page table to be read, etc. After receiving the read request, the module that manages the page table parses it to obtain the values of the parameters carried in the request.
[0074] 102. Determine whether the first page table data exists in the cache page table in the page table cache module;
[0075] In this embodiment, in order to facilitate each hardware (i.e., request module) to quickly obtain PBL data, thereby reducing the number of times the PBL data is read from the host side, the new PBL data requested by each request module and not yet cached is cached in the cache page table in the page table cache module. When a read request from a request module is received, it is first checked whether the first page table data that the request module needs to read has been cached in the page table cache.
[0076] This embodiment does not limit the specific format of the page table cache module and the cache page table. The page table cache module includes a plurality of cache page tables, and the cache page tables store a plurality of page table data (i.e., PBL data). The page table cache module supports the management of the first-level cache page table and multi-level cache page tables (such as the second-level cache page table, the third-level cache page table, the fourth-level cache page table, and other levels of cache page tables).
[0077] 103. If the first page table data exists in the cache page table in the page table cache module, read the first page table data from the cache page table in the page table cache module and return it to the request module;
[0078] In this embodiment, if the first page table data requested by the request module is pre-cached in the cache page table in the page table cache module, the data can be directly read from the cache page table in the page table cache module after confirming its existence by searching the cache page table, and the data can be returned to the request module. After the request module receives the first page table data, it can use the first page table data to perform address conversion and access the corresponding data block on the host side.
[0079] 104. If the first page table data does not exist in the cache page table in the page table cache module, read the first page table data from the host side through a preset read interface, return the first page table data to the request module, and update it to the cache page table in the page table cache module.
[0080] In this embodiment, if the first page table data required by the reading module does not exist in the cache page table in the page table cache module, it is necessary to read the first page table data from the host side storage through a preset page table data reading interface and return it to the request module. After receiving the first page table data, the request module can also use the first page table data to perform address conversion and access the corresponding data block on the host side.
[0081] In addition, further, since the first page table data requested by the reading module has not been cached in the cache page table in the page table cache module, in order to facilitate the request module to quickly obtain the first page table data the next time it reads the first page table data again, the first page table data read from the host side is updated to the cache page table in the page table cache module while returning it to the request module.
[0082] In an optional embodiment, in order to further improve the speed at which each request module reads page table data, while reducing the number of reads on the host side, thereby reducing the data transmission bandwidth consumption occupied by data reading, each time the page table data is read from the host side, not only the page table data requested by the current request module is read, but also other page table data that the request module may need to read later is pre-read.
[0083] This embodiment uses a page table cache module to cache the page table data on the host side, so that each hardware (request module) does not need to directly read the page table data from the host side, but first initiates a read request for the page table data to the page table cache module. If the page table cache module pre-caches the page table data requested by the request module, the corresponding page table data is directly read from the page table cache module and returned to the request module. If the page table cache module does not pre-cache the page table data requested by the request module, the page table data requested by the request module is first read from the host side, and then returned to the request module, and updated to the page table cache module at the same time, so that the subsequent request module can read it again. This embodiment reduces the number of times the page table data is read from the host side by setting the page table cache module to cache the page table data, and correspondingly reduces the occupancy of the public bus bandwidth, effectively improving the speed and efficiency of reading the page table data.
[0084] See also Figure 5 , Figure 5 This is the second embodiment of the method for reading page table data in the embodiment of the present invention. Compared with the first embodiment, this embodiment further describes in detail whether there is first page table data in the cache page table in the page table cache module and the update of page table data. In this embodiment, when the cache page table corresponding to the request module is a first-level cache page table, the method for reading page table data includes:
[0085] 201. A request for reading first page table data initiated by a receiving request module;
[0086] 202. When the cache page table corresponding to the request module is a first-level cache page table, determine whether the first-level cache page table corresponding to the request module exists in the page table cache module;
[0087] In this embodiment, in order to quickly determine whether the first page table data requested by the request module exists in the cache page table in the page table cache module, it is not directly determined whether the first page table data requested by the request module exists in the cache page table in the page table cache module, but first determines whether the first-level cache page table corresponding to the request module exists in the page table cache module, that is, the cache page table can be classified according to the request source in the page table cache module, and different request sources use different cache page tables. If there is no first-level cache page table corresponding to the current request module in the page table cache module, it means that the page table cache module does not cache the page table data requested by the request module. By quickly determining the page table data read request of each read module, the request response speed can be improved.
[0088] 203. If the page table cache module contains a first-level cache page table corresponding to the request module, determine whether the first page table data is within a page table data range in the first-level cache page table corresponding to the request module.
[0089] In this embodiment, if there is a first-level cache page table corresponding to the request module in the page table cache module, it only means that there is a first-level cache page table corresponding to the request module in the page table cache module, but it does not mean that the first-level cache page table corresponding to the request module must cache the first page table data currently requested to be read by the request module. Therefore, it is necessary to further determine whether the first page table data currently requested to be read actually exists in the cache page table corresponding to the request module.
[0090] In this embodiment, considering that the cache page table can store a large amount of page table data (i.e., PBL data), in order to avoid the time-consuming judgment by traversing each page table data in the cache page table, the page table data range is used to make a judgment, specifically judging whether the first page table data currently requested to be read is within the page table data range in the cache page table corresponding to the request module. In an optional embodiment, the page table data range in the cache page table can be calculated by the relevant attribute parameters of the cache page table.
[0091] 204. If the first page table data is located within the page table data range in the first-level cache page table corresponding to the request module, determine that the first page table data exists in the cache page table in the page table cache module;
[0092] In this embodiment, through the above two levels of judgment: cache page table judgment + page table data range judgment, it can be quickly determined whether the cache page table in the page table cache module contains the page table data requested by the request module, thereby improving the response speed of the page table data read request.
[0093] In this embodiment, if the first page table data is not located within the page table data range in the first-level cache page table corresponding to the request module, or the first-level cache page table corresponding to the request module does not exist in the page table cache module, it is determined that the first page table data does not exist in the cache page table in the page table cache module.
[0094] 205. If the first page table data exists in the cache page table in the page table cache module, read the first page table data from the cache page table in the page table cache module and return it to the request module;
[0095] 206. If the first page table data does not exist in the cache page table in the page table cache module, read the first page table data from the host side through a preset read interface, return the first page table data to the request module, and update it to the cache page table in the page table cache module.
[0096] In this embodiment, if the first page table data requested by the request module does not exist in the cache page table in the page table cache module, the first page table data is read from the host side through the preset read interface and returned to the request module, and the first page table data read from the host side is updated to the cache page table in the page table cache module. Although this method can ensure that the request module can quickly respond and return the first page table data when it reads the first page table data again next time, if the request module reads other page table data instead of the first page table data next time, it is necessary to read new page table data from the host side again.
[0097] Based on the above situation, in order to further reduce the number of times the page table data is read from the host side, in one embodiment, it is preferred not only to read the page table data requested by the current request module, but also to pre-read other page table data that the request module may need to read later. Based on each situation in which the page table data requested by the request module is in or out of the first-level cache page table in the page table cache module, different page table data reading and updating methods correspond to each other, as described below:
[0098] (1) L1 cache page table miss
[0099] In this case, if the first-level cache page table misses, that is, the first-level cache page table corresponding to the request module does not exist in the page table cache module, the first page table data and several second page table data located after the first page table data are read from the host side through the read interface, and then the read first page table data is returned to the request module, and at the same time, the first page table data and the several second page table data are updated to the first-level cache page table corresponding to the request module in the page table cache module.
[0100] In this case, in the page table cache module, considering that the page table data (PBL data) in the cache page table are stored continuously, and considering that the page table data are continuously operated in most cases, the first page table data read by the current request module is directly used as the starting point, and the corresponding number of page table data (including the first page table data and several second page table data) are read from the host side, and the first page table data is returned to the request module, and the first page table data and the several second page table data are updated to the first-level cache page table corresponding to the request module in the page table cache module.
[0101] In this case, the number of page table data read from the host side is the number of page table data that can be stored in the first-level cache page table corresponding to the request module in the current page table cache module. Since this case is a cache page table miss, that is, the first-level cache page table corresponding to the request module is not created in the page table cache module, the number of page table data that can be stored in the cache page table corresponding to the current request module is the maximum number of page table data that can be stored in the first-level cache page table, that is, the number of page table data that needs to be read from the host side. It should be noted that the maximum amount of page table data that can be stored in the first-level cache page table can be pre-set, which is specifically related to the storage space allocated to each cache page table.
[0102] (2) The first-level cache page table hits, but the page table data range misses
[0103] In this case, if there is a first-level cache page table corresponding to the request module in the page table cache module, and the first page table data is not within the page table data range in the first-level cache page table corresponding to the request module, the first page table data and several third page table data located after the first page table data are read from the host side through the read interface; then the read first page table data is returned to the request module, and the first page table data and the several third page table data are updated to the first-level cache page table corresponding to the request module in the page table cache module.
[0104] In this case, a cache page table hit indicates that the first-level cache page table corresponding to the request module is stored in the page table cache module, and a page table data range miss indicates that the page table data currently requested by the request module is not cached in the cache page table corresponding to the request module. Considering that each page table data (PBL data) in the cache page table is stored continuously, and considering that the page table data is continuously operated in most cases, the first page table data read by the current request module is directly used as the starting point, and the corresponding number of page table data (including the first page table data and several third page table data) is read from the host side, and the first page table data is returned to the request module, and the first page table data and several third page table data are updated to the first-level cache page table corresponding to the request module in the page table cache module.
[0105] In this case, the number of page table data read from the host side is the number of page table data that can be stored in the first-level cache page table corresponding to the request module in the current page table cache module. Since the cache page table hits in this case but the page table data range does not hit, that is, the cache page table corresponding to the request module has been created in the page table cache module, the number of page table data that can be stored in the first-level cache page table corresponding to the current request module is the number of page table data that can actually be stored in the first-level cache page table, that is, the number of page table data that needs to be read from the host side. The number of page table data that can actually be stored in the first-level cache page table can be obtained based on the amount of page table data currently stored in the first-level cache page table and the maximum amount of page table data that can be stored.
[0106] (3) L1 cache page table hit, page table data range hit
[0107] In this case, considering that the page table data is operated continuously in most cases, the location of the first page table data in each cache page table in the page table cache module can be used as a boundary to divide the page table data range of each cache page table into a first page table data range and a second page table data range, wherein the page table data after the location of the first page table data is located in the forward page table data range, and the page table data before the location of the first page table data is located in the reverse page table data range. In addition, the division of the forward page table data range is specifically composed of the location of the first page table data in the cache page table and the valid page table data continuously stored in the cache page table, and the range in the cache page table except the forward page table data range is the reverse page table data range. Each valid page table data is located within the first page table data range. In this case, based on the first page table data read by the request module being located in different page table data ranges, different page table data update methods are adopted.
[0108] 3.1) L1 cache page table hit, reverse page table data range hit
[0109] Since the page table data within the reverse page table data range are all located before the first page table data read by the request module, and in most cases the page table data are continuously operated backwards, therefore, for the situation where the cache page table hits and the reverse page table data range hits, it is preferred not to update the page table data, that is, there is no need to pre-read other page table data on the host side.
[0110] 3.2) L1 cache page table hit, forward page table data range hit
[0111] Since the page table data in the forward page table data range are all located after the first page table data read by the request module, and in most cases the page table data are continuously operated backwards, that is, the request module will most likely read other page table data after the first page table data, so for the case where the cache page table hits and the forward page table data range hits, it is preferred to update the page table data, and the specific update method is as follows:
[0112] First, you need to set the amount of page table data that can be pre-read, that is, pre-set the cache data space range for storing pre-acquired page table data. In order to avoid frequent reading when pre-reading data from the host side, and also to avoid failure to read data from the host side in time, the amount of pre-read page table data should not be too small or too large, and should be set according to the actual situation.
[0113] Secondly, when the cache page table in the page table cache module contains the first page table data, and the first page table data is within the first page table data range in the cache page table corresponding to the request module, it is necessary to first determine whether the location of the first page table data exceeds the preset cache data space range of the cache page table. Specifically, the determination can be made by detecting the interval between the first page table data read by the request module and the first page table data in the cache page table corresponding to the request module. When the interval is greater than the preset value (that is, the cache data space range), the page table data update is triggered. Since the page table data is continuously operated backward in most cases, that is, the request module will subsequently only operate on the page table data after the first page table data in the cache page table, the page table data range between the first page table data and the first page table data in the cache page table can be used to store the page table data pre-read from the host side.
[0114] When the location of the first page table data exceeds the preset cache data space range of the cache page table where it is located, it means that there is a space range in the current cache page table that can store new page table data. Therefore, a number of fourth page table data located after the last page table data in the cache page table where the first page table data is located is read from the host side through the read interface, that is, starting from the address after the last PBL data in the current cache page table, new PBL data (that is, the fourth page table data) is read from the host side, and then the number of fourth page table data is updated to the cache page table corresponding to the request module in the page table cache module.
[0115] In this embodiment, for the situation where the cache page table misses, the cache page table hits and the page table data range misses, when it is necessary to read the page table data requested by the request module from the host side, further pre-read other page table data that the request module may need to read in the future and update it to the cache page table of the page table cache module. For the situation where the cache page table hits and the forward page table data range hits, although the page table data requested by the request module can be directly returned to the request module from the page table cache module, in order to further improve the response speed of the read request of other page table data that may exist in the request module in the future, it is also necessary to read the page table data that the request module may request in the future from the host side, thereby improving the hit rate of the request module in reading PBL data in the future, thereby reducing the number of times the page table data is read from the host side, and correspondingly reducing the occupancy of the public bus bandwidth, thereby improving the speed and efficiency of reading page table data.
[0116] See also Figure 6 , Figure 6This is the third embodiment of the method for reading page table data in the embodiment of the present invention. Compared with the first and second embodiments, this embodiment further describes in detail whether the first page table data exists in the cache page table in the page table cache module and whether the page table data is updated. In this embodiment, when the cache page table corresponding to the request module is a multi-level cache page table, such as a second-level cache page table, a third-level cache page table, a fourth-level cache page table, etc., the page table data reading method includes:
[0117] 301. A read request for first page table data initiated by a receiving request module;
[0118] 302. When the cache page table corresponding to the request module is a multi-level cache page table, determine whether the multi-level cache page table corresponding to the request module exists in the page table cache module;
[0119] This embodiment has the same judgment method for the first-level cache page table as that in the above-mentioned second embodiment. It also does not directly judge whether the first page table data requested by the request module exists in the cache page table in the page table cache module, but first judges whether there is a multi-level cache page table corresponding to the request module in the page table cache module. That is, the cache page table can be classified according to the request source in the page table cache module, and different request sources use different cache page tables. If the page table cache module does not have the multi-level cache page table corresponding to the current request module, it means that the page table cache module does not cache the page table data requested by the request module.
[0120] 303. If the page table cache module contains a multi-level cache page table corresponding to the request module, determine whether the first page table data is within a page table data range in an N-th level cache page table corresponding to the request module, where N is a positive integer greater than or equal to 1.
[0121] In this embodiment, if there is a multi-level cache page table corresponding to the request module in the page table cache module, it only means that there is a multi-level cache page table corresponding to the request module in the page table cache module, but it does not mean that the multi-level cache page table corresponding to the request module must cache the first page table data currently requested to be read by the request module. Therefore, it is necessary to further determine whether the first page table data currently requested to be read actually exists in the multi-cached page table corresponding to the request module.
[0122] In this embodiment, considering that the cache page table can store a large amount of page table data (i.e., PBL data), in order to avoid the time-consuming judgment by traversing each page table data in the cache page table, the page table data range is used for judgment, specifically to judge whether the first page table data currently requested to be read is within the page table data range in the multi-level cache page table corresponding to the request module.
[0123] Considering that the multi-level cache page table contains multiple levels of cache page tables, the page table data range corresponding to each level of cache page table is different. Usually, the page table data range of the upper-level cache page table includes the page table data range of the lower-level cache page table. For example, for the three-level cache page table, assuming that the page table data range of the first-level cache page table is A0-B0, the page table data range of the first-level cache page table is A1-B1, and the page table data range of the first-level cache page table is A2-B2, then A2-B2 is within the range of A1-B1, and A1-B1 is within the range of A0-B0. That is, for the multi-level cache page table, the requested page table data is located in the first-level cache page table but does not mean it is located in the second-level cache page table, the requested page table data is located in the second-level cache page table but does not mean it is located in the third-level cache page table, and similarly, if the requested page table data is not located in the second-level cache page table, it is definitely not located in the third-level cache page table.
[0124] 304. If the first page table data is located within the page table data range of the Nth level cache page table corresponding to the request module, continue to determine whether the first page table data is located within the page table data range of the N+Kth level cache page table corresponding to the request module, until the last level cache page table;
[0125] In this embodiment, based on the characteristics of the above-mentioned multi-level cache page table, it is necessary to judge whether the first page table data of each level of cache page table in the multi-level cache page table is within the page table data range of the corresponding level cache page table, until the last level cache page table.
[0126] For example, taking the four-level cache page table as an example, first determine whether the first page table data is located in the page table data range in the first-level cache page table. If it is located in the page table data range in the first-level cache page table, continue to determine whether the first page table data is located in the page table data range in the second-level cache page table. If not, continue to determine whether the first page table data is located in the page table data range in the third-level cache page table. If not, continue to determine whether the first page table data is located in the page table data range in the fourth-level cache page table.
[0127] 305. If the first page table data is located within the page table data range in the N+Kth level cache page table corresponding to the request module, determine that the first page table data exists in the cache page table in the page table cache module, where K is a positive integer greater than or equal to 1;
[0128] In this embodiment, for a multi-level cache page table, if the first page table data is located within the page table data range in the cache page table of the N+Kth level (such as the second level, the third level, or the fourth level) corresponding to the request module, it is determined that the first page table data exists in the cache page table in the page table cache module. By determining the specific level at which the first page table data is located in the multi-level cache page table, the range of the page table data to be pre-fetched from the host side can be determined.
[0129] In this embodiment, if the first page table data is not located within the page table data range within the Nth level or N+K level cache page table corresponding to the request module, or the multi-level cache page table corresponding to the request module does not exist in the page table cache module, it is determined that the first page table data does not exist in the cache page table in the page table cache module.
[0130] 306. If the first page table data exists in the cache page table in the page table cache module, read the first page table data from the cache page table in the page table cache module and return it to the request module;
[0131] 307. If the first page table data does not exist in the cache page table in the page table cache module, read the first page table data from the host side through a preset read interface, return the first page table data to the request module, and update it to the cache page table in the page table cache module.
[0132] In this embodiment, the specific description of the embodiment of the above steps 306 and 307 can refer to the above first embodiment, so it will not be repeated here.
[0133] Based on the above-mentioned multi-level cache page table situations, in order to further reduce the number of times the page table data is read from the host side, in one embodiment, it is preferred not only to read the page table data requested by the current request module, but also to pre-read other page table data that the request module may need to read later. Based on each situation in which the page table data requested by the request module is in or out of the multi-level cache page table in the page table cache module, different page table data reading and updating methods correspond to each other, as described below:
[0134] (1) Multi-level cache page table miss
[0135] In this case, if the multi-level cache page table misses, that is, the multi-level cache page table corresponding to the request module does not exist in the page table cache module, the first page table data and several second page table data located after the first page table data are read from the host side through the read interface, and then the read first page table data is returned to the request module, and at the same time, the first page table data and the several second page table data are updated to the multi-level cache page table corresponding to the request module in the page table cache module.
[0136] In this case, in the page table cache module, considering that the page table data (PBL data) in the cache page table are stored continuously, and considering that the page table data are continuously operated in most cases, the first page table data read by the current request module is directly used as the starting point, and the corresponding number of page table data (including the first page table data and several second page table data) are read from the host side, and the first page table data is returned to the request module, and the first page table data and the several second page table data are updated to the multi-level cache page table corresponding to the request module in the page table cache module.
[0137] In this case, the number of page table data read from the host side is the number of page table data that can be stored in the multi-level cache page table corresponding to the request module in the current page table cache module. Since this case is a cache page table miss, that is, the multi-level cache page table corresponding to the request module is not created in the page table cache module, the number of page table data that can be stored in the multi-level cache page table corresponding to the current request module is the maximum number of page table data that can be stored in the multi-level cache page table, that is, the number of page table data that needs to be read from the host side. It should be noted that the maximum amount of page table data that can be stored in the multi-level cache page table can be pre-set, which is specifically related to the storage space allocated to each cache page table.
[0138] (2) Multi-level cache page table hit, page table data range miss
[0139] In this case, if there is a multi-level cache page table corresponding to the request module in the page table cache module, and the first page table data is not located within the page table data range of the Nth level cache page table in the multi-level cache page table corresponding to the request module, then the first page table data in the Nth level and all N+Kth level cache page tables in the multi-level cache page table and several fifth page table data located after the first page table data are read from the host side through the read interface; then the read first page table data is returned to the request module, and the first page table data and several fifth page table data are updated to the Nth level and all N+Kth level cache page tables in the multi-level cache page table corresponding to the request module in the page table cache module.
[0140] In this case, a hit in the multi-level cache page table indicates that the multi-level cache page table corresponding to the request module is stored in the page table cache module, and a miss in the page table data range indicates that the page table data currently requested by the request module is not cached in the multi-level cache page table corresponding to the request module. Considering that the page table data (PBL data) in the cache page table are stored continuously, and considering that the page table data are continuously operated in most cases, the first page table data read by the current request module is directly used as the starting point, and the corresponding number of page table data (including the first page table data and several fifth page table data) are read from the host side, and the first page table data is returned to the request module, and the first page table data and several fifth page table data are updated to the Nth level and all N+Kth level cache page tables in the multi-level cache page table corresponding to the request module in the page table cache module.
[0141] In this case, based on the characteristics of the multi-level cache page table described above, if the first page table data requested by the request module is not located within the page table data range of the Nth level cache page table in the multi-level cache page table corresponding to the request module, then the first page table data is definitely not located within the page table data range of all N+Kth level cache page tables in the multi-level cache page table corresponding to the request module. For example, taking the four-level cache page table as an example, if the first page table data is located in the first-level cache page table but not in the second-level cache page table, it can be determined that the first page table data is also not located in the third-level and fourth-level cache page tables. Therefore, when reading the page table data from the host side for updating, not only the page table data in the second-level cache page table is read, but also the page table data in the third-level and fourth-level cache page tables are read.
[0142] (3) Multi-level cache page table hit, page table data range hit
[0143] In this case, considering that the page table data is operated continuously in most cases, the location of the first page table data in each cache page table in the page table cache module can be used as a boundary to divide the page table data range of each cache page table into a first page table data range and a second page table data range, wherein the page table data after the location of the first page table data is located in the forward page table data range, and the page table data before the location of the first page table data is located in the reverse page table data range. In addition, the division of the forward page table data range is specifically composed of the location of the first page table data in the cache page table and the valid page table data continuously stored in the cache page table, and the range in the cache page table except the forward page table data range is the reverse page table data range. Each valid page table data is located within the first page table data range. In this case, based on the first page table data read by the request module being located in different page table data ranges, different page table data update methods are adopted.
[0144] 3.1) Multi-level cache page table hit, reverse page table data range hit
[0145] Since the page table data within the reverse page table data range are all located before the first page table data read by the request module, and in most cases the page table data are continuously operated backwards, therefore, for the situation where the cache page table hits and the reverse page table data range hits, it is preferred not to update the page table data, that is, there is no need to pre-read other page table data on the host side.
[0146] 3.2) Multi-level cache page table hit, forward page table data range hit
[0147] Since the page table data in the forward page table data range are all located after the first page table data read by the request module, and in most cases the page table data are continuously operated backwards, that is, the request module will most likely read other page table data after the first page table data, so for the situation where the multi-level cache page table hits and the forward page table data range hits, it is preferred to update the page table data, and the specific update method is as follows:
[0148] First, you need to set the amount of page table data that can be pre-read, that is, pre-set the cache data space range for storing pre-acquired page table data. In order to avoid frequent reading when pre-reading data from the host side, and also to avoid failure to read data from the host side in time, the amount of pre-read page table data should not be too small or too large, and should be set according to the actual situation.
[0149] Secondly, when the cache page table in the page table cache module contains the first page table data, and the first page table data is within the range of the first page table data in the Nth level cache page table in the multi-level cache page table corresponding to the request module, it is necessary to first determine whether the location of the first page table data exceeds the preset cache data space range of the multi-level cache page table. Specifically, the judgment can be made by detecting the interval between the first page table data read by the request module and the first page table data in the Nth level cache page table in the multi-cache page table corresponding to the request module. When the interval is greater than the preset value (that is, the cache data space range), the page table data update is triggered. Since the page table data is continuously operated backward in most cases, that is, the request module will only operate on the page table data after the first page table data in the multi-cache page table, the page table data range between the first page table data and the first page table data in the Nth level cache page table in the multi-cache page table can be used to store the page table data pre-read from the host side.
[0150] When the location of the first page table data exceeds the preset cache data space range of the multi-level cache page table, it means that there is a space range in the current multi-level cache page table that can store new page table data. Therefore, several sixth page table data located after the last page table data in the multi-level cache page table where the first page table data is located are read from the host side through the read interface, that is, starting from the address after the last PBL data in the current cache page table, new PBL data (that is, the sixth page table data) is read from the host side, and then several sixth page table data are updated to the multi-level cache page table corresponding to the request module in the page table cache module.
[0151] To facilitate a better understanding of the present invention, the specific structure and format of the first-level cache page table of the page table cache module in the embodiment of the present invention are described in detail below.
[0152] See also Figure 7 , Figure 7 The figure is a schematic diagram of an embodiment of a page table cache module in an embodiment of the present invention. In this embodiment, the page table cache module (PBL cache) is composed of a cache information unit (cache_info_reg) and a cache page table unit (PBL cacheram). The cache page table unit is implemented by a random access memory (RAM), and a cache page table is used to store PBL data, while a register is used to store PBL data on the non-host side, thereby reducing area consumption. At the same time, more PBL data can be stored using RAM.
[0153] Each hardware module (ie, request module) is provided with a PBL read interface, through which the hardware module is connected to the page table cache module (PBL cache) and initiates a read request for PBL data. The page table cache module (PBL cache) is provided with a PCIe read interface for reading PBL data from the host side.
[0154] The request parameters carried by the PBL read request initiated by the request module include req_id indicating the request source, req_pbl indicating the request pbl, a req_lvl signal indicating the page table type, and a req_mode signal indicating the page table format.
[0155] Cache information unit (cache_info_reg): It is composed of a set of vld (first parameter) + req_id (second parameter), where vld indicates whether the current cache_info is valid, and req_id records the current request source id.
[0156] Cache page table unit (PBL cache ram): It is internally composed of a set of PBL cache info (cache page table), which is used to store page table information, and a set of vld&req_id corresponds to one PBL cache info.
[0157] PBL cache info is divided into two types according to the format of cache page table: first-level cache page table and multi-level cache page table. A cache page table unit may include several first-level cache page tables and / or several multi-level cache page tables.
[0158] (1) Level 1 cache page table
[0159] like Figure 8 As shown, the parameters in the first-level cache page table are described as follows:
[0160] lvl_type: indicates the page table format, 0x0 is the first-level page table format;
[0161] vld_cnt: indicates the number of valid pbl_data in the current page table;
[0162] cur_ptr: indicates the location where the first pbl_data is stored in the current page table;
[0163] cur_pbl: indicates the PBL value corresponding to the first pbl_data in the current page table;
[0164] Info_header0 is the information header, which consists of lvl_type, vld_cnt, cur_ptr and cur_pbl, and is used to describe the information summary of the currently stored pbl_data.
[0165] pbl_data: indicates cached pbl_data data (page table data), that is, PBL data in this embodiment. pbl_data is the starting address of the data block. The request module knows which data block of the host to operate after getting the PBL data. The primary page table format stores primary page table data information.
[0166] (2) Multi-level cache page table (take the second-level cache page table as an example, other levels of cache page tables are similar)
[0167] like Fig. 9 As shown, the parameters in the secondary cache page table are described as follows:
[0168] lvl_type: indicates the page table format, 0x1 is the first-level page table in the second-level page table format, and 0x2 is the second-level page table in the second-level page table format;
[0169] vld_cnt: indicates the number of valid pbl_data in the current page table;
[0170] cur_ptr: indicates the location where the first pbl_data is stored in the current page table;
[0171] cur_pbl: indicates the PBL value corresponding to the first pbl_data in the current page table;
[0172] pbl_data: represents the cached pbl_data data.
[0173] Info_header1 is the information header, which consists of lvl_type, vld_cnt, cur_ptr and cur_pbl, and is used to describe the information summary of the currently stored first-level page table pbl_data.
[0174] Info_header2 is an information header, which consists of lvl_type, vld_cnt, cur_ptr and cur_pbl, and is used to describe the information summary of the currently stored secondary page table pbl_data.
[0175] The secondary page table format stores the primary page table information and the secondary page table information. The pbl_data stored in the secondary page table information is the secondary page table pbl_data corresponding to the cur_pbl in the primary page table information. In addition to cur_pbl, the primary page table also stores the pbl_data after cur_pbl. The latter pbl_data is used to directly obtain the pbl_data located in the next level page table from the current level page table when reading across the primary page table, thereby improving the cross-page response speed.
[0176] It should be noted that the page table format of the third-level cache page table stores the first-level page table information, the second-level page table information and the third-level page table information, and the page table format of the fourth-level cache page table stores the first-level page table information, the second-level page table information, the third-level page table information and the fourth-level page table information. Each level of page table information contains its corresponding information header and page table data range.
[0177] like Fig.10 The PBL range representation shown in FIG. 1 is a PBL range representation, wherein the parameter pbl_range is used to describe the valid pbl_data range in the current PBL cacheinfo.
[0178] like Fig.10As shown in the figure, the current cur_pbl is A0, cur_ptr is 4, that is, the pbl stored at pbl_data4 is cur_pblA0, and then pbl_data5 / 6 / 7 / 8 / 9 store the PBL values after cur_pbl A1 / A2 / A3 / A4 / A5 in sequence. vld_cnt is 7, indicating that there are a total of 7 pbl_data starting from pbl_data4, and A5 starts to wrap around after reaching the last pbl_data9 of pbl_range0, that is, the last PBL information A6 is stored in pbl_data0, as shown in the figure. Fig.10 As shown by the dotted line in the middle. The pbl_data3 / pbl_data2 / pbl_data1 before pbl_data4 stores the information before PBL A0 PBL B0 / B1 / B2 in sequence, as shown in Fig.10 Shown by the solid line.
[0179] Based on the above Figure 7-10 , the cache page table hit judgment and the PBL data hit judgment in the above-mentioned second embodiment are explained.
[0180] (1) Cache page table hit judgment: determine whether the request source that initiates the read request matches the value of the second parameter in the cache management logic information; if the request source carried in the read request matches the value of the second parameter, and the value of the first parameter in the cache management logic information is valid, it is determined that a cache page table corresponding to the request module exists in the page table cache module.
[0181] Specifically, Figure 7-10 As shown, after receiving the PBL read request, it is determined whether the req_id (that is, the request source) carried in the PBL read request of the read module and the req_id (that is, the second parameter) in the cache_info_reg in the page table cache module are consistent. If they are consistent and the vld (that is, the first parameter) of cache_info_reg is valid (the parameter value is 1), it is considered that the cache page table hits, otherwise it is considered that the cache page table misses.
[0182] (2) PBL data hit judgment: based on the first information header / second information header / third information header in the cache page table corresponding to the request module, determine the page table data range in the cache page table corresponding to the request module; compare the first page table data with the page table data range in the cache page table corresponding to the request module to determine whether the first page table data is located in the page table data range in the cache page table corresponding to the request module.
[0183] In this embodiment, after the cache page table hits, it is necessary to determine whether the PBL data read by the request module is within the pbl_range. Specifically, the page table data range in the cache page table corresponding to the request module can be determined through the first information header / second information header / third information header in the cache page table corresponding to the request module.
[0184] like Figure 8-10 As shown, the first information header (info_header0), the second information header (info_header1), and the third information header (info_header2) all contain parameters lvl_type, vld_cnt, cur_ptr, and cur_pbl. The page table data range starting from the first pbl_data in the current cache page table can be calculated through vld_cnt, cur_ptr, and cur_pbl. For example, Fig.10 In the figure, the current cur_pbl is A0, cur_ptr is 4, that is, the pbl stored at pbl_data4 is cur_pbl A0, and vld_cnt is 7, which means that starting from pbl_data4, there are a total of 7 pbl_data (A0 / A1 / A2 / A3 / A4 / A5 / A6) after pbl_data4, and the number of pbl_data before pbl_data4 can be determined by the maximum number of PBLs that can be cached by the cache page table. For example, the maximum number of PBLs that can be cached by the cache page table is 10 pbl_data, then the number of pbl_data before pbl_data4 is 3, for example Fig.10 The B0 / B1 / B2 shown in the figure can then be used to derive the page table data range (B0 / B1 / B2+A0 / A1 / A2 / A3 / A4 / A5 / A6) in the cache page table.
[0185] There are three situations when requesting whether the PBL data read by the module is within the pbl_range:
[0186] (1) Hitting PBL data within the positive range
[0187] If the read req_pbl is in Fig.10 The pbl_range described by the dotted line in the figure is the PBL data within the hit positive range. Fig.10 Taking the figure as an example, if the req_pbl read at this time is A3, the PBL data in the forward range is hit.
[0188] (2) Hitting PBL data in the reverse range
[0189] If the read req_pbl is in Fig.10 The solid line in the middle describes the PBL_range, which is the PBL data in the hit reverse range. Fig.10Taking the example shown, if the req_pbl read at this time is B2, the PBL data in the reverse range is hit.
[0190] (3) Missing any PBL data in pbl_range
[0191] If the read req_pbl is not within the pbl_range, it means that any PBL data within the pbl_range is missed.
[0192] This embodiment uses info_header to store the pbl_data information summary, and can determine whether the PBL hits the pbl_range by reading the info_header, reducing the time consumed by traversing the pbl_data to determine whether it hits. In addition, this embodiment also determines whether to perform PBL update and pre-fetch subsequent PBL data by determining whether the pbl hits the pbl_range range, thereby effectively improving the hit rate of subsequent PBL data reading.
[0193] The above describes the method for reading page table data in the embodiment of the present invention. The following describes the device for reading page table data in the embodiment of the present invention. Fig.11 , an embodiment of a page table data reading device in an embodiment of the present invention includes:
[0194] A receiving module 301, configured to receive a read request for the first page table data initiated by a request module;
[0195] A determination module 302 is used to determine whether the first page table data exists in the cache page table in the page table cache module;
[0196] A reading module 303, configured to read the first page table data from the cache page table in the page table cache module and return the first page table data to the requesting module if the first page table data exists in the cache page table in the page table cache module;
[0197] The update module 304 is used to read the first page table data from the host side through a preset read interface if the first page table data does not exist in the cache page table in the page table cache module, return the first page table data to the request module and update it to the cache page table in the page table cache module.
[0198] Optionally, in one embodiment, the determining module 302 is specifically configured to:
[0199] When the cache page table corresponding to the request module is a first-level cache page table, determining whether there is a first-level cache page table corresponding to the request module in the page table cache module;
[0200] If the page table cache module contains a first-level cache page table corresponding to the request module, determining whether the first page table data is within a page table data range in the first-level cache page table corresponding to the request module;
[0201] If the first page table data is within the page table data range in the first-level cache page table corresponding to the request module, determining that the first page table data exists in the cache page table in the page table cache module;
[0202] If the first page table data is not within the page table data range in the first-level cache page table corresponding to the request module, or the first-level cache page table corresponding to the request module does not exist in the page table cache module, it is determined that the first page table data does not exist in the cache page table in the page table cache module.
[0203] Optionally, in one embodiment, the determining module 302 is further configured to:
[0204] When the cache page table corresponding to the request module is a multi-level cache page table, determining whether the multi-level cache page table corresponding to the request module exists in the page table cache module;
[0205] If the page table cache module contains a multi-level cache page table corresponding to the request module, determining whether the first page table data is within a page table data range within an N-th level cache page table corresponding to the request module, where N is a positive integer greater than or equal to 1;
[0206] If the first page table data is within the page table data range of the Nth level cache page table corresponding to the request module, continue to determine whether the first page table data is within the page table data range of the N+Kth level cache page table corresponding to the request module, until the last level cache page table;
[0207] If the first page table data is located within the page table data range in the N+Kth level cache page table corresponding to the request module, it is determined that the first page table data exists in the cache page table in the page table cache module, where K is a positive integer greater than or equal to 1;
[0208] If the first page table data is not located within the page table data range within the Nth level or N+K level cache page table corresponding to the request module, or the multi-level cache page table corresponding to the request module does not exist in the page table cache module, it is determined that the first page table data does not exist in the cache page table in the page table cache module.
[0209] Optionally, in one embodiment, the updating module 304 is specifically used for:
[0210] When the cache page table corresponding to the request module is a first-level cache page table or a multi-level cache page table, if the first-level cache page table or the multi-level cache page table corresponding to the request module does not exist in the page table cache module, the first page table data and a plurality of second page table data located after the first page table data are read from the host side through the read interface;
[0211] The read first page table data is returned to the request module, and the first page table data and a number of the second page table data are updated into a first-level cache page table or a multi-level cache page table corresponding to the request module in the page table cache module.
[0212] Optionally, in one embodiment, the updating module 304 is further configured to:
[0213] When the cache page table corresponding to the request module is a first-level cache page table, if the first-level cache page table corresponding to the request module exists in the page table cache module, and the first page table data is not located within the page table data range in the first-level cache page table corresponding to the request module, then the first page table data and a plurality of third page table data located after the first page table data are read from the host side through the read interface;
[0214] The read first page table data is returned to the request module, and the first page table data and a number of the third page table data are updated into a first-level cache page table corresponding to the request module in the page table cache module.
[0215] Optionally, in one embodiment, the updating module 304 is further configured to:
[0216] When the cache page table corresponding to the request module is a first-level cache page table, if the first page table data exists in the first-level cache page table in the page table cache module, and the first page table data is located within the first page table data range in the first-level cache page table corresponding to the request module, then determine whether the location of the first page table data exceeds the first cache data space range of the first-level cache page table;
[0217] If the location of the first page table data exceeds the first cache data space range of the first-level cache page table, read from the host side through the read interface a number of fourth page table data located after the last page table data in the first-level cache page table where the first page table data is located;
[0218] Update the fourth page table data into the first-level cache page table corresponding to the request module in the page table cache module;
[0219] Among them, based on the location of the first page table data in each cache page table and the number of page table data after the first page table data in each cache page table, the page table data range of each cache page table is divided into a first page table data range and a second page table data range, and the first page table data and the page table data after the first page table data are both located within the first page table data range.
[0220] Optionally, in one embodiment, the updating module 304 is further configured to:
[0221] When the cache page table corresponding to the request module is a multi-level cache page table, if the multi-level cache page table corresponding to the request module exists in the page table cache module, and the first page table data is not located within the page table data range of the Nth level cache page table in the multi-level cache page table corresponding to the request module, then the first page table data in the Nth level and all the N+Kth level cache page tables in the multi-level cache page table and a number of fifth page table data located after the first page table data are read from the host side through the read interface;
[0222] The read first page table data is returned to the request module, and the first page table data and a number of the fifth page table data are updated to the Nth level and all N+Kth level cache page tables in the multi-level cache page table corresponding to the request module in the page table cache module.
[0223] Optionally, in one embodiment, the updating module 304 is further configured to:
[0224] When the cache page table corresponding to the request module is a multi-level cache page table, if the first page table data exists in the multi-level cache page table in the page table cache module, and the first page table data is located in the first page table data range in the N-th level cache page table in the multi-level cache page table corresponding to the request module, then determine whether the location of the first page table data exceeds the second cache data space range of the N-th level cache page table in the multi-level cache page table;
[0225] If the location of the first page table data exceeds the second cache data space range of the Nth level cache page table in the multi-level cache page table, read a number of sixth page table data located after the last page table data in the Nth level cache page table in the multi-level cache page table where the first page table data is located from the host side through the read interface;
[0226] A number of the sixth page table data are updated into the Nth level cache page table in the multi-level cache page table corresponding to the request module in the page table cache module.
[0227] Optionally, in one embodiment, the page table cache module includes a cache information unit and a cache page table unit, and the data stored in the cache information unit corresponds one-to-one to the data stored in the cache page table unit;
[0228] The cache information unit is used to store some cache management logic information, the cache management logic information includes a first parameter and a second parameter, the first parameter is used to identify whether the corresponding cache management logic information is valid, and the second parameter is used to record the request source that initiates the page table data read request;
[0229] The cache page table unit is used to store several cache page tables, and the cache page tables include a first-level cache page table and / or a multi-level cache page table; the first-level cache page table stores the first page table information of the cache page table at this level, and the first page table information includes a first information header and several page table data; the multi-level cache page table stores the second page table information of all upper-level cache page tables and the third page table information of the cache page table at this level, and the second page table information includes a second information header and the first page table data and the next page table data in the current upper-level cache page table, and the third page table information includes a third information header and several page table data in the cache page table at this level, wherein the first information header is used to describe the information summary of the page table data stored in the current first-level cache page table, and the second information header and the third information header both adopt the same data format as the first information header.
[0230] Optionally, in one embodiment, the determining module 302 is further configured to:
[0231] Determining whether a request source that initiates the read request matches a value of the second parameter;
[0232] If the request source carried in the read request matches the value of the second parameter, and the value of the first parameter is valid, it is determined that a cache page table corresponding to the request module exists in the page table cache module;
[0233] The determination module 302 is further specifically used for:
[0234] Determine a page table data range in the cache page table corresponding to the request module based on the first information header / the second information header / the third information header in the cache page table corresponding to the request module;
[0235] The first page table data is compared with a page table data range in a cache page table corresponding to the request module to determine whether the first page table data is located within or not located in the page table data range in the cache page table corresponding to the request module.
[0236] Since the embodiments of the device part correspond to the embodiments of the above-mentioned method, please refer to the above-mentioned method embodiments for the introduction of the page table data reading device provided by the present invention. The present invention will not be repeated here, and it has the same beneficial effects as the above-mentioned page table data reading method.
[0237] above Fig.11The page table data reading device in the embodiment of the present invention is described in detail from the perspective of modular functional entities, and the computer device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0238] Fig.12 1 is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. The computer device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and a memory 520, and one or more storage media 530 (for example, one or more mass storage devices) storing application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 can be short-term storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the computer device 500. Furthermore, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the computer device 500.
[0239] The computer device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Fig.12 The illustrated computer device structure does not constitute a limitation on the computer device, and may include more or fewer components than illustrated, or combine certain components, or arrange the components differently.
[0240] The present invention also provides a computer device, the computer device includes a memory and a processor, the memory stores computer-readable instructions, when the computer-readable instructions are executed by the processor, the processor executes the steps of the page table data reading method in the above embodiments. The present invention also provides a computer-readable storage medium, the computer-readable storage medium can be a non-volatile computer-readable storage medium, the computer-readable storage medium can also be a volatile computer-readable storage medium, the computer-readable storage medium stores instructions, when the instructions are executed on the computer, the computer executes the steps of the page table data reading method.
[0241] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0242] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0243] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for reading page table data, characterized in that: The page table data reading method comprises: A read request for the first page table data initiated by a receiving request module; Determine whether the first page table data exists in the cache page table in the page table cache module; If the first page table data exists in the cache page table in the page table cache module, the first page table data is read from the cache page table in the page table cache module and returned to the request module; If the first page table data does not exist in the cache page table in the page table cache module, the first page table data is read from the host side through a preset read interface, and the first page table data is returned to the request module and updated to the cache page table in the page table cache module.
2. The page table data reading method according to claim 1, characterized in that: The determining whether the first page table data exists in the cache page table in the page table cache module comprises: When the cache page table corresponding to the request module is a first-level cache page table, determining whether there is a first-level cache page table corresponding to the request module in the page table cache module; If the page table cache module contains a first-level cache page table corresponding to the request module, determining whether the first page table data is within a page table data range in the first-level cache page table corresponding to the request module; If the first page table data is within the page table data range in the first-level cache page table corresponding to the request module, determining that the first page table data exists in the cache page table in the page table cache module; If the first page table data is not within the page table data range in the first-level cache page table corresponding to the request module, or the first-level cache page table corresponding to the request module does not exist in the page table cache module, it is determined that the first page table data does not exist in the cache page table in the page table cache module.
3. The page table data reading method according to claim 2, characterized in that: The determining whether the first page table data exists in the cache page table in the page table cache module comprises: When the cache page table corresponding to the request module is a multi-level cache page table, determining whether the multi-level cache page table corresponding to the request module exists in the page table cache module; If the page table cache module contains a multi-level cache page table corresponding to the request module, determining whether the first page table data is within a page table data range within an N-th level cache page table corresponding to the request module, where N is a positive integer greater than or equal to 1; If the first page table data is within the page table data range of the Nth level cache page table corresponding to the request module, continue to determine whether the first page table data is within the page table data range of the N+Kth level cache page table corresponding to the request module, until the last level cache page table; If the first page table data is located within the page table data range in the N+Kth level cache page table corresponding to the request module, it is determined that the first page table data exists in the cache page table in the page table cache module, where K is a positive integer greater than or equal to 1; If the first page table data is not located within the page table data range within the Nth level or N+K level cache page table corresponding to the request module, or the multi-level cache page table corresponding to the request module does not exist in the page table cache module, it is determined that the first page table data does not exist in the cache page table in the page table cache module.
4. The page table data reading method according to claim 3, characterized in that: If the first page table data does not exist in the cache page table in the page table cache module, reading the first page table data from the host side through a preset read interface, returning the first page table data to the request module and updating the first page table data to the cache page table in the page table cache module includes: When the cache page table corresponding to the request module is a first-level cache page table or a multi-level cache page table, if the first-level cache page table or the multi-level cache page table corresponding to the request module does not exist in the page table cache module, the first page table data and a plurality of second page table data located after the first page table data are read from the host side through the read interface; The read first page table data is returned to the request module, and the first page table data and a number of the second page table data are updated into a first-level cache page table or a multi-level cache page table corresponding to the request module in the page table cache module.
5. The page table data reading method according to claim 2, characterized in that: If the first page table data does not exist in the cache page table in the page table cache module, reading the first page table data from the host side through a preset read interface, returning the first page table data to the request module and updating the first page table data to the cache page table in the page table cache module also includes: When the cache page table corresponding to the request module is a first-level cache page table, if the first-level cache page table corresponding to the request module exists in the page table cache module, and the first page table data is not located within the page table data range in the first-level cache page table corresponding to the request module, then the first page table data and a plurality of third page table data located after the first page table data are read from the host side through the read interface; The read first page table data is returned to the request module, and the first page table data and a number of the third page table data are updated into a first-level cache page table corresponding to the request module in the page table cache module.
6. The page table data reading method according to claim 2, characterized in that: After the first page table data is read from the cache page table in the page table cache module and returned to the request module if the first page table data exists in the cache page table in the page table cache module, the method further includes: When the cache page table corresponding to the request module is a first-level cache page table, if the first page table data exists in the first-level cache page table in the page table cache module, and the first page table data is located within the first page table data range in the first-level cache page table corresponding to the request module, then determine whether the location of the first page table data exceeds the first cache data space range of the first-level cache page table; If the location of the first page table data exceeds the first cache data space range of the first-level cache page table, read from the host side through the read interface a number of fourth page table data located after the last page table data in the first-level cache page table where the first page table data is located; Update the fourth page table data into the first-level cache page table corresponding to the request module in the page table cache module; Among them, based on the location of the first page table data in each cache page table and the number of page table data after the first page table data in each cache page table, the page table data range of each cache page table is divided into a first page table data range and a second page table data range, and the first page table data and the page table data after the first page table data are both located within the first page table data range.
7. The page table data reading method according to claim 3, characterized in that: If the first page table data does not exist in the cache page table in the page table cache module, reading the first page table data from the host side through a preset read interface, returning the first page table data to the request module and updating the first page table data to the cache page table in the page table cache module also includes: When the cache page table corresponding to the request module is a multi-level cache page table, if the multi-level cache page table corresponding to the request module exists in the page table cache module, and the first page table data is not located within the page table data range of the Nth level cache page table in the multi-level cache page table corresponding to the request module, then the first page table data in the Nth level and all the N+Kth level cache page tables in the multi-level cache page table and a number of fifth page table data located after the first page table data are read from the host side through the read interface; The read first page table data is returned to the request module, and the first page table data and a number of the fifth page table data are updated to the Nth level and all N+Kth level cache page tables in the multi-level cache page table corresponding to the request module in the page table cache module.
8. The page table data reading method according to claim 6, characterized in that: After the first page table data is read from the cache page table in the page table cache module and returned to the request module if the first page table data exists in the cache page table in the page table cache module, the method further includes: When the cache page table corresponding to the request module is a multi-level cache page table, if the first page table data exists in the multi-level cache page table in the page table cache module, and the first page table data is located in the first page table data range in the N-th level cache page table in the multi-level cache page table corresponding to the request module, then determine whether the location of the first page table data exceeds the second cache data space range of the N-th level cache page table in the multi-level cache page table; If the location of the first page table data exceeds the second cache data space range of the Nth level cache page table in the multi-level cache page table, read a number of sixth page table data located after the last page table data in the Nth level cache page table in the multi-level cache page table where the first page table data is located from the host side through the read interface; A number of the sixth page table data are updated into the Nth level cache page table in the multi-level cache page table corresponding to the request module in the page table cache module.
9. The page table data reading method according to claim 3, characterized in that: The page table cache module includes a cache information unit and a cache page table unit, and the data stored in the cache information unit corresponds one to one with the data stored in the cache page table unit; The cache information unit is used to store some cache management logic information, the cache management logic information includes a first parameter and a second parameter, the first parameter is used to identify whether the corresponding cache management logic information is valid, and the second parameter is used to record the request source that initiates the page table data read request; The cache page table unit is used to store several cache page tables, and the cache page tables include a first-level cache page table and / or a multi-level cache page table; the first-level cache page table stores the first page table information of the cache page table at this level, and the first page table information includes a first information header and several page table data; the multi-level cache page table stores the second page table information of all upper-level cache page tables and the third page table information of the cache page table at this level, and the second page table information includes a second information header and the first page table data and the next page table data in the current upper-level cache page table, and the third page table information includes a third information header and several page table data in the cache page table at this level, wherein the first information header is used to describe the information summary of the page table data stored in the current first-level cache page table, and the second information header and the third information header both adopt the same data format as the first information header.
10. The page table data reading method according to claim 9, characterized in that: The determining whether there is a cache page table corresponding to the request module in the page table cache module comprises: Determining whether a request source that initiates the read request matches a value of the second parameter; If the request source carried in the read request matches the value of the second parameter, and the value of the first parameter is valid, it is determined that a cache page table corresponding to the request module exists in the page table cache module; The step of determining whether the first page table data is within the page table data range in the cache page table corresponding to the request module comprises: Determine a page table data range in the cache page table corresponding to the request module based on the first information header / the second information header / the third information header in the cache page table corresponding to the request module; The first page table data is compared with a page table data range in a cache page table corresponding to the request module to determine whether the first page table data is located within or not located in the page table data range in the cache page table corresponding to the request module.
11. A page table data reading device, characterized in that: The page table data reading device comprises: A receiving module, used for receiving a read request for the first page table data initiated by the requesting module; A judging module, used for judging whether the first page table data exists in the cache page table in the page table cache module; a reading module, configured to read the first page table data from the cache page table in the page table cache module and return the first page table data to the requesting module if the first page table data exists in the cache page table in the page table cache module; The update module is used to read the first page table data from the host side through a preset read interface if the first page table data does not exist in the cache page table in the page table cache module, return the first page table data to the request module, and update it to the cache page table in the page table cache module.
12. A computer device, characterized in that: The computer device comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instruction in the memory to enable the computer device to execute the page table data reading method according to any one of claims 1 to 10.
13. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instruction is executed by the processor, the page table data reading method according to any one of claims 1 to 10 is implemented.