Data access method and device, processor, system on chip and electronic equipment

By introducing metadata address space in the cache, using the first physical address to obtain the second physical address, and reading metadata from memory, the problem of poor data access in the prior art is solved, and flexible and efficient data is achieved access.

CN118964223APending Publication Date: 2024-11-15DAMO (SHANGHAI) TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410982209.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-19
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

In the prior art, in memory data protection design, there is a problem of poor data access effect, especially when storing metadata in external storage devices, flexibility and performance are limited.

Method used

By introducing the address space of metadata to be accessed in the cache, obtaining the second physical address based on the first physical address, and reading the metadata from the memory, the efficiency of data access is improved, and the dependence on external storage and continuous physics are avoided. Restrictions on address segments.

Benefits of technology

It improves the flexibility and efficiency of data access, solves the problem of poor data access effect, realizes the storage and access of metadata of arbitrary length in ordinary memory, and reduces the address conversion process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964223A_ABST
    Figure CN118964223A_ABST
Patent Text Reader

Abstract

The invention discloses a data access method and device, a processor, a system on chip and electronic equipment. The method comprises the steps that after an access instruction for accessing to-be-accessed data is received, a first physical address of the to-be-accessed data is determined based on the access instruction, and the first physical address is used for representing an access address of a first storage area where the to-be-accessed data is stored in a memory; based on the first physical address, a second physical address of the to-be-accessed metadata is obtained from the cache, the second physical address is used for representing an access address of a second storage area where the to-be-accessed metadata is stored in the memory, and the to-be-accessed metadata is used for representing attributes of the to-be-accessed data; and reading the to-be-accessed metadata from the memory based on the second physical address. The technical problem that the data access effect is poor in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of processors, and in particular, to a data access method, device, processor, system on chip, and electronic device. Background Art

[0002] Currently, in the design scheme involving memory data protection, it is necessary to design a method for storing metadata in an external storage device. There are several schemes, including using the metadata area provided by specific memory module technology, a combination of software and hardware, and a scheme that divides metadata segments using virtual memory. However, each of these schemes has its own advantages and disadvantages, such as dependence on the memory controller, possible waste of memory space or performance disadvantages, resulting in poor data access effects.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present application provide a data access method, device, processor, system on chip, and electronic device to at least solve the technical problem of poor data access effect in the related art.

[0005] According to one aspect of an embodiment of the present application, a data access method is provided, which is applied to a processor, and includes: after receiving an access instruction to access data to be accessed, determining a first physical address of the data to be accessed based on the access instruction, wherein the first physical address is used to represent an access address of a first storage area in a memory storing the data to be accessed; based on the first physical address, obtaining a second physical address of metadata to be accessed from a cache, wherein the second physical address is used to represent an access address of a second storage area in the memory storing the metadata to be accessed, and the metadata to be accessed is used to represent attributes of the data to be accessed; and reading the metadata to be accessed from the memory based on the second physical address.

[0006] According to another aspect of an embodiment of the present application, a data access device is also provided, including: a memory for storing different data and metadata corresponding to different data; a loading and storage unit connected to the memory and including a cache, the loading and storage unit being used to determine a first physical address of the data to be accessed based on the access instruction after receiving an access instruction to access the data to be accessed, obtain a second physical address of the metadata to be accessed from the cache based on the first physical address, and read the metadata to be accessed from the memory based on the second physical address, wherein the first physical address is used to represent an access address of a first storage area in the memory storing the data to be accessed, the second physical address is used to represent an access address of a second storage area in the memory storing the metadata, and the metadata to be accessed is used to represent attributes of the data to be accessed.

[0007] According to another aspect of an embodiment of the present application, a processor is provided, including: the device of the above embodiment.

[0008] According to another aspect of an embodiment of the present application, a system on chip is also provided, including: the processor of the above embodiment.

[0009] According to another aspect of the embodiments of the present application, an electronic device is further provided, including: a memory storing an executable program; and a processor for running the program, wherein the method of each embodiment of the present application is executed when the program is running.

[0010] According to another aspect of an embodiment of the present application, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute the methods in each embodiment of the present application.

[0011] According to another aspect of the embodiments of the present application, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present application is implemented.

[0012] According to another aspect of an embodiment of the present application, a computer program product is also provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method in each embodiment of the present application is implemented.

[0013] According to another aspect of the embodiments of the present application, a computer program is also provided, and when the computer program is executed by a processor, the methods in the various embodiments of the present application are implemented.

[0014] In an embodiment of the present application, after receiving an access instruction to access data to be accessed, a first physical address of the data to be accessed is determined based on the access instruction, wherein the first physical address is used to represent an access address of a first storage area in the memory storing the data to be accessed; based on the first physical address, a second physical address of metadata to be accessed is obtained from the cache, wherein the second physical address is used to represent an access address of a second storage area in the memory storing the metadata to be accessed, and the metadata to be accessed is used to represent the attributes of the data to be accessed; the metadata to be accessed is read from the memory based on the second physical address, thereby achieving the purpose of improving the effect of data access; it is easy to notice that in the present application, by introducing the concept of an address space of metadata to be accessed in the cache, the second physical address of the metadata to be accessed can be obtained from the address space according to the first physical address, and the metadata to be accessed can be read from the memory based on the second physical address, and the process does not need to rely on external storage, and ordinary memory can also be used to complete the storage of metadata to be accessed of any length, and when storing, there is no need to store the access metadata in a continuous physical address segment, nor is there a need to provide a reserved memory module to store the metadata to be accessed. During the data access process, the second physical address of the metadata to be accessed can be directly queried based on the first physical address. Address conversion is not involved in this process, and the data access process is more flexible, thereby improving the efficiency of data access and solving the technical problem of poor data access effect in related technologies.

[0015] It is easy to notice that the above general description and the following detailed description are only for the purpose of exemplifying and explaining the present application, and do not constitute a limitation of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0017] Figure 1 is a hardware structure block diagram of a RISC-V system for implementing a data access method according to an embodiment of the present application;

[0018] Figure 2 is a schematic diagram of a system on chip according to an embodiment of the present application;

[0019] Figure 3 is a flow chart of a data access method according to an embodiment of the present application;

[0020] Figure 4 is a schematic diagram of a data access structure according to an embodiment of the present application;

[0021] Figure 5is another schematic diagram of a data access structure according to an embodiment of the present application;

[0022] Figure 6 is another schematic diagram of a data access structure according to an embodiment of the present application;

[0023] Figure 7 is another schematic diagram of a data access structure according to an embodiment of the present application;

[0024] Figure 8 is a schematic diagram of a data access device according to an embodiment of the present application;

[0025] Fig. 9 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application 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 interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:

[0029] Metadata: refers to the data stored additionally for each piece of ordinary data of a specific granularity, usually used to mark some attributes of the corresponding ordinary data, such as access rights, data type, etc.

[0030] Cache structure: refers to a technology used in computer systems to improve data access speed by storing recently or frequently accessed data in the cache to reduce the number of accesses to the slow main memory.

[0031] Memory Tagging: It is a technology used to enhance the security of memory access. It implements fine-grained permission control on memory access by adding tag information to the memory address.

[0032] Fine-grained access control: It is a security mechanism that can finely divide data or resources, thereby achieving detailed control over the access rights of each user or process.

[0033] Double Data Rate, DDR5 for short, is a mainstream computer memory standard that provides higher bandwidth and lower power consumption for desktop computers, servers, and high-performance computers.

[0034] DDR5 metadata: refers to the metadata in DDR5 memory, which is used to describe and manage data information stored in DDR5 memory.

[0035] Low Power Double Data Rate 5 (LPDDR5): Suitable for mobile devices and embedded systems, with lower power consumption and higher performance.

[0036] Error-Correcting Code (ECC): is a coding technology used to detect and correct errors that occur during data transmission. It is commonly used in memory and storage systems to improve data reliability and stability.

[0037] Currently, in many designs involving memory data protection, such as memory tagging, it is necessary to design a method to store metadata in an external storage device. The current solutions have their own advantages and disadvantages:

[0038] The first solution utilizes the metadata area provided in specific memory module technologies (such as DDR5, LPDDR5, etc.). This solution relies on the memory controller, an external IP, and is not flexible enough in some cases.

[0039] The second solution is a combination of software and hardware. When the system is initialized, the software allocates a fixed-size common data area, and indexes in the data area during runtime. This solution reserves memory at startup, which has the potential problem of wasting memory space.

[0040] The third solution uses virtual memory to divide a part of the virtual address space into metadata segments, and then the operating system allocates ordinary data areas as metadata areas as needed during runtime. This solution is more flexible in use, but because it requires virtual address translation of metadata, it requires occupying virtual address translation resources in the memory management unit (Memory Management Unit, referred to as MMU), such as the page table buffer (Translation Lookaside Buffer, referred to as TLB), which has an inherent performance disadvantage.

[0041] This application designs a solution that is different from the above solutions, which does not require continuous physical address segments, does not require special memory modules for reserved metadata segments, and does not require virtual address conversion. It has the advantages of more flexible use, wider hardware adaptation solutions, and less impact on performance, thereby solving the problem of poor data access effect in related technologies.

[0042] According to an embodiment of the present application, a data access method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0043] The method embodiments provided in the embodiments of the present application can be executed in a RISC-V system, a RISC-V chip or a similar device. Figure 1 1 is a hardware structure block diagram of a RISC-V system for implementing a data access method according to an embodiment of the present application. Figure 1 As shown, the RISC-V system 100 can be divided from the bottom layer to the upper layer into a reduced instruction set architecture 101 (including a basic instruction set 101-1 and an extended instruction set 101-2), a hardware layer 102 (including a processor 102-1, a peripheral hardware circuit 102-2, etc.), an interface layer 103, an operating system layer 104 (supporting multiple operating systems 104-1, 104-2, ..., 104-n, such as Linux, FreeSBD, RT-Tread, etc.), a middleware and library layer 105 (including a system library 105-1, an API 105-2 and a middleware service 105-3) and an application layer 106 (including multiple user programs and services 106-1, 106-2, ..., 106-n). The RISC-V system 100 also includes a tool chain 107 from the underlying hardware to the application layer. The tool chain may include a compiler and assembler 107-1, a linker 107-2, a debugger 107-3, a simulator and emulator 107-4, an integrated development environment 107-5, a hardware description language tool 107-6, a performance analysis tool 107-7, and a version control system 107-8, etc.

[0044] The instruction set architecture 101 defines the basic operations and instruction sets supported by the processor 102-1, including a basic instruction set and an extended instruction set, wherein the basic instruction set represents a basic integer instruction set, such as RV32I and RV64I, and the extended instruction set can be floating point, atomic operations, compressed instructions, etc.

[0045] The interface layer 103 includes the specific design of the processor, such as pipeline design, cache structure, execution unit, branch prediction, etc. This layer is the process of mapping abstract instructions to physical hardware.

[0046] The operating system layer 104 is located at the hardware level and provides a hardware abstraction layer and management mechanism, so that applications can interact with the hardware through system calls. The operating system is responsible for managing processor resources, memory, device drivers, task scheduling, etc.

[0047] The middleware and library layer 105 provides a rich set of services and interfaces to help applications run more efficiently. For example, the standard library provides functions such as file operations and mathematical calculations, while the middleware can provide complex services such as network communication and graphical user interfaces.

[0048] The application layer 106 uses the functions and services provided by the lower layer to implement specific application logic. These applications can be command line tools, graphical interface applications, server-side services, etc.

[0049] The tool chain 107 is a key component that connects the underlying hardware to the upper-level software. Various tools in the tool chain 107 function at different levels to support the entire process from hardware design to software development, ensuring the consistency and effectiveness of the entire system design.

[0050] It should be noted that the layered design of the RISC-V architecture allows decoupling between different layers, so that each layer can be developed and optimized independently.

[0051] In an optional embodiment, Figure 2 is a schematic diagram of a system on chip according to an embodiment of the present application, Figure 2 Shown using the above Figure 1 The schematic diagram of the RISC-V architecture system on chip (System On Chip, SOC) is shown in FIG. Figure 2As shown, the SOC contains at least one RISC-V core 202 (only one is shown in the figure), and the RISC-V core 202 is connected to peripheral devices through a bus 204, including but not limited to ROM 206, RAM 208, timer 210, UART (Universal Asynchronous Receiver / Transmitter) 212, GPIO (General Purpose Input / Output) 214, SPI (Serial Peripheral Interface Bus) 216, etc.

[0052] Under the above operating environment, this application provides Figure 3 The data access method shown. Figure 3 : is a flow chart of a data access method according to an embodiment of the present application. The method comprises:

[0053] Step S302: after receiving an access instruction to access the data to be accessed, determining a first physical address of the data to be accessed based on the access instruction.

[0054] The first physical address is used to represent an access address of a first storage area in the memory storing data to be accessed.

[0055] The access instruction mentioned above may be a command issued by a program to instruct a computer system to read or write certain specific data. The access instruction may be a read instruction or a write instruction.

[0056] The aforementioned data to be accessed may be data that needs to be processed or is being processed, and the data may be stored in a memory, a hard disk or other storage media.

[0057] The first physical address mentioned above can be used to locate the exact location of the to-be-accessed data stored in the memory, and the first physical address can be an address mapping based on the memory bank.

[0058] The first storage area mentioned above refers to a specific area in the memory where the data to be accessed is stored. The area may contain one or more data units. The first storage area constitutes the data to be accessed.

[0059] In an optional embodiment, in a computer system, when the CPU needs to access certain data in the memory, it will first send an access instruction to the memory controller to indicate the location and operation (read or write) of the data to be accessed. After receiving the access instruction, the memory controller can determine the first physical address of the data to be accessed according to the access instruction, that is, the access address of the first storage area in the memory where the data is stored.

[0060] Step S304: Based on the first physical address, obtain a second physical address of the metadata to be accessed from the cache.

[0061] The second physical address is used to represent an access address of a second storage area in the memory storing metadata to be accessed, and the metadata to be accessed is used to represent attributes of the data to be accessed.

[0062] The cache described above is used to store some frequently accessed data in a fast-access storage device to reduce the number of accesses to the slower main memory.

[0063] The metadata to be accessed may be data describing data, and the metadata to be accessed may be a tag, and the tag may be a file size, a creation date, etc., which is not limited here.

[0064] The second physical address may be another physical address found in the cache according to the first physical address, and the second physical address points to a memory area storing metadata.

[0065] The access address of the second storage area mentioned above refers to the access address of the memory area pointed to by the second physical address, and is used to locate the memory location storing the metadata to be accessed.

[0066] In an optional embodiment, the second physical address of the metadata to be accessed can be obtained by accessing the first physical address, and the second physical address is used to indicate the location of the metadata to be accessed in the memory. By introducing the concept of metadata address space, the second physical address of the metadata to be accessed can be quickly found through the first physical address, which can reduce the access delay of the second physical address, thereby improving the access efficiency of the metadata to be accessed.

[0067] Step S306: Read the metadata to be accessed from the memory based on the second physical address.

[0068] The above-mentioned memory may be a random access memory of a computer, which may be used to store programs and data so that the CPU may quickly access them. The above-mentioned memory may also be other types of storage devices, which are not limited here.

[0069] In an optional embodiment, the second storage area corresponding to the second physical address in the memory can be found through the address bus, so as to read the metadata to be accessed from the second storage area, and read the metadata to be accessed from the memory through the second physical address. The second physical address is stored in the cache in advance, and the second physical address of the metadata to be accessed can be quickly obtained from the cache according to the first physical address, thereby improving the access efficiency of the second physical address, and further improving the access efficiency of the metadata to be accessed from the memory based on the second physical address.

[0070] Through the above steps, after receiving an access instruction to access the data to be accessed, a first physical address of the data to be accessed is determined based on the access instruction, wherein the first physical address is used to represent the access address of a first storage area in the memory storing the data to be accessed; based on the first physical address, a second physical address of metadata to be accessed is obtained from the cache, wherein the second physical address is used to represent the access address of a second storage area in the memory storing the metadata to be accessed, and the metadata to be accessed is used to represent the attributes of the data to be accessed; based on the second physical address, the metadata to be accessed is read from the memory, thereby achieving the purpose of improving the effect of data access; it is easy to notice that in the present application, by introducing the concept of the address space of the metadata to be accessed in the cache, the second physical address of the metadata to be accessed can be obtained from the address space according to the first physical address, and the metadata to be accessed can be read from the memory based on the second physical address, and the process does not need to rely on external storage, and ordinary memory can also be used to complete the storage of metadata to be accessed of any length, and when storing, there is no need to store the access metadata in a continuous physical address segment, and there is no need to provide a reserved memory module to store the metadata to be accessed. During the data access process, the second physical address of the metadata to be accessed can be directly queried based on the first physical address. Address conversion is not involved in this process, and the data access process is more flexible, thereby improving the efficiency of data access and solving the technical problem of poor data access effect in related technologies.

[0071] In the above embodiment of the present application, based on the first physical address, the second physical address of the metadata to be accessed is obtained from the cache, including: converting the first physical address into a target cache address, wherein the target cache address is used to represent the access address of a third storage area in the cache where the second physical address is stored; and obtaining the second physical address from the cache based on the target cache address.

[0072] The above-mentioned conversion process of converting the first physical address into the target cache address may involve some calculation processes, for example, using a hash function, a modulus operation, etc. to map the first physical address to a specific location in the cache.

[0073] In a cache system, the first physical address is the address used by a user or program to access data. By converting the first physical address to a target cache address and storing commonly used data through the cache, that is, storing the above-mentioned second physical address through the cache, access to the main memory can be reduced to speed up the subsequent reading of data. After obtaining the target cache address according to the first physical address conversion, the second physical address can be obtained from the cache through the target cache address. Since the cache can quickly provide the second physical address, the efficiency of data access can be improved.

[0074] In an optional embodiment, the first physical address may be converted into a target cache address first, and if the second physical address can be queried according to the target cache address, the metadata to be accessed may be directly read from the memory based on the second physical address. If the second physical address is not queried according to the target cache address, the second physical address may be queried in other ways, for example, the second physical address corresponding to the target cache address may be queried in a preset mapping table.

[0075] In the above embodiment of the present application, determining the first physical address of the data to be accessed based on the access instruction includes: parsing the access instruction to obtain the virtual address of the data to be accessed; and performing address conversion on the virtual address to obtain the first physical address.

[0076] The above-mentioned virtual address may be the address of the application corresponding to the data to be accessed. The virtual address may be the address logically used by the application, representing the location of the data to be accessed in the application.

[0077] In an optional embodiment, in order to determine the first physical address of the data to be accessed, the access instruction needs to be parsed first to obtain the virtual address of the data to be accessed. The virtual address is the address used by the application program, and the corresponding physical address can only be found after address conversion.

[0078] The above-mentioned address conversion can be implemented by a memory management unit (Memory Management Unit, MMU for short), and the MMU can convert a virtual address into a physical address.

[0079] In an optional embodiment, the virtual address can be converted by page table lookup and address mapping to obtain the first physical address. Optionally, through page table lookup, the MMU finds the page table entry corresponding to the virtual address and determines the corresponding physical page frame number. Then, according to the address mapping relationship, the physical page frame number and the page offset are combined into a physical address to obtain the first physical address of the data to be accessed.

[0080] Determining the first physical address of the data to be accessed based on the access instruction is a process of obtaining the virtual address by parsing the access instruction and then converting the virtual address to the physical address through the address translation mechanism. This process is a key part of memory management in computer systems to ensure that the data in the memory can be accessed correctly.

[0081] In the above embodiment of the present application, the first storage area is used to represent the first data segment storing the data to be accessed in the memory; determining the first physical address of the data to be accessed based on the access instruction includes: parsing the access instruction to obtain the first segment address and the first offset address of the first data segment, wherein the first segment address is used to represent the access address of the first data segment, and the first offset address is used to represent the offset between the access address storing the data to be accessed in the first data segment and the starting address of the first data segment; generating the first physical address based on the first segment address and the first offset address.

[0082] The first data segment is in the first storage area of ​​the memory, and the data to be accessed is organized into data segments. A data segment is a logical unit for storing related data.

[0083] The first segment address mentioned above points to the starting position of the first data segment and is used to represent the access address of the first data segment.

[0084] The first offset address is used to indicate how many positions the accessed data needs to move forward based on the first segment address to reach the accessed data. The first offset address is substantially an additional distance relative to the first segment address.

[0085] In an optional embodiment, the exact physical address of the to-be-accessed data in the memory, ie, the first physical address mentioned above, may be calculated in combination with the first segment address and the first offset address.

[0086] There is a storage area in the memory used to represent the first data segment in the memory where the data to be accessed is stored. When an access instruction is received, the first physical address of the data to be accessed needs to be determined. In order to determine the first physical address, it is first necessary to parse the access instruction to obtain the first segment address and the first offset address of the first data segment. The first segment address is used to determine the access address of the first data segment, and the first offset address is used to determine the offset between the access address of the data to be accessed and the starting address of the first data segment. By combining the first segment address and the first offset address, the first physical address of the data to be accessed can be generated. This process is to ensure that the location where the data to be accessed is stored in the memory can be accurately found and that data access operations can be performed effectively. This method can help the system manage data in the memory more efficiently and improve the efficiency and accuracy of data access.

[0087] It should be noted that the first segment address and the first offset address of the above-mentioned first data segment can be stored in the same area, and the first segment address and the first offset address of the above-mentioned first data segment can also be stored in different areas. The storage method of the first segment address and the first offset address is not limited here, and the first segment address and the first offset address can be stored in the required storage method according to actual needs.

[0088] In the above embodiment of the present application, the second storage area is used to represent the second data segment in the memory storing the metadata to be accessed; based on the second physical address, the metadata to be accessed is read from the memory, including: parsing the second physical address to obtain the second segment address and the second offset address of the second data segment, wherein the second segment address is used to represent the access address of the second data segment, and the second offset address is used to represent the offset between the access address in the second data segment storing the metadata to be accessed and the starting address of the second data segment; based on the second segment address, the second data segment is read from the memory; based on the second offset address, the metadata to be accessed is read from the second data segment.

[0089] The second physical address mentioned above refers to a specific address in the computer memory. In a computer system, a physical address is a unique identifier of a memory unit. The second physical address can be parsed into two parts: a second segment address and a second offset address.

[0090] The second segment address mentioned above refers to the access address of the second data segment. The data segment is an area in the memory, generally containing the code or data of the program. The second segment address is an identifier of the starting point of the data segment, which is used to locate the starting position of the data segment.

[0091] The second offset address is used to identify the relative position of the metadata to be accessed in the second data segment. The offset address represents the "distance" from the start position of the data segment to the required data. This offset is usually an integer and is used for navigation within the data segment.

[0092] After obtaining the second segment address, the computer system reads the entire second data segment from the memory according to the address. This process may be implemented by a memory access instruction, such as executing a read memory operation in the CPU. When the second data segment is loaded into the appropriate memory location, the system can use the second offset address to locate and access the required metadata in the data segment.

[0093] In an optional embodiment, the second segment address and the second offset address of the second data segment are obtained by parsing. The second segment address is used to determine the storage location of the second data segment in the memory, and the second offset address is used to determine the specific location of the metadata to be accessed in the second data segment. Then, based on the second segment address, the content of the second data segment is read from the memory. Finally, based on the second offset address, the content of the metadata to be accessed is read from the second data segment. This process can help the computer system accurately locate and access the data stored in the memory, thereby realizing the reading and processing of the data. By parsing the physical address, the system can effectively manage the data in the memory and improve the efficiency and accuracy of data access.

[0094] It should be noted that the second segment address and the second offset address of the second data segment mentioned above can be stored in the same area, and the second segment address and the second offset address of the second data segment mentioned above can also be stored in different areas. The storage method of the second segment address and the second offset address is not limited here, and the second segment address and the second offset address can be stored in the required storage method according to actual needs.

[0095] In the above embodiment of the present application, when the second physical address is not stored in the cache, the method also includes: based on the target cache address, querying and obtaining the second physical address from a preset mapping table stored in the memory, wherein the preset mapping table is used to characterize the mapping relationship between different cache addresses and different physical addresses, and the target cache address is used to characterize the access address of the third storage area in the cache where the second physical address is stored; caching the second physical address in the cache.

[0096] The above-mentioned situation where the second physical address is not stored in the cache is used to indicate that the required second physical address is not pre-stored in the specific cache area, wherein the specific cache area may be a CPU cache or other types of cache.

[0097] The above-mentioned preset mapping table may be a mapping relationship between different cache addresses and different physical addresses pre-set in the form of a mapping table.

[0098] The target cache address mentioned above is actually an access address pointing to another storage area storing the second physical address, and this area is called the third storage area.

[0099] In an optional embodiment, when the necessary second physical address is missing from the cache, the second physical address can be obtained by querying a preset mapping table in the memory, and the second physical address can be cached in the cache to improve data access speed and efficiency. In the above manner, even if the required second physical address is not stored in the cache, the system can still obtain the address from the preset mapping table and cache it in the cache, so that the second physical address can be quickly obtained from the cache later, thereby achieving fast access and improving system performance. This method can effectively reduce the delay in data access and improve the response speed and efficiency of the system.

[0100] In the above embodiment of the present application, based on the target cache address, a second physical address is obtained by querying from a preset mapping table stored in the memory, including: determining a tree structure corresponding to the preset mapping table, wherein the tree structure includes multiple nodes, and different nodes are used to represent different cache addresses; starting from the root node of the tree structure, traversing the nodes in the tree structure except the root node to determine the target node corresponding to the target cache address; reading the physical address stored in the target node to obtain the second physical address.

[0101] The tree structure of the preset mapping table mentioned above means that the preset mapping table is a data structure, usually existing in the form of a tree. The tree structure of the preset mapping table includes multiple nodes, and different nodes represent a range or specific address of a cache address.

[0102] The tree structure mentioned above can be a radix tree or a compressed prefix tree structure (Radix), which is a data structure used to store strings. It is a multi-branch tree, and each node contains a character and a pointer to a child node. Radix trees are usually used to efficiently store and search for a large number of strings, and common prefixes can be used to reduce storage space and improve query efficiency.

[0103] The root node mentioned above may be the starting point of the tree structure, which is the top of the tree structure.

[0104] The above-mentioned traversal of the tree structure means starting from the root node and gradually visiting each node in the tree until a specific node corresponding to the target cache address is found. This process usually follows a certain traversal algorithm, such as depth-first search or breadth-first search. The specific traversal method is not limited here, and other traversal methods can also be used.

[0105] During the traversal process, the target node that can uniquely determine the target cache address can be found by comparing the address range represented by the node with the target cache address. In the tree structure, different nodes store the physical addresses corresponding to the cache addresses. After finding the target node, the stored physical address can be read from the target node to obtain the above-mentioned second physical address.

[0106] Optionally, in the process of obtaining the second physical address through the physical address stored in the target node, in order to improve performance or implement specific functions, address conversion may be performed in multiple levels or mapping tables. The second physical address mentioned above can be an address obtained after mapping the physical address stored in the target node one or more times.

[0107] The above-mentioned preset mapping table and tree structure are used to quickly find the physical address corresponding to the target cache address. By building a tree structure, the cache addresses can be classified and organized in an orderly manner so as to be searched and accessed more efficiently. This method can improve the efficiency and accuracy of cache address mapping, thereby improving the performance and response speed of the system.

[0108] In an optional embodiment, the preset mapping table is a data structure for address conversion, and its purpose is to map virtual addresses to physical addresses. The tree structure is an efficient data organization method and can be used to implement the preset mapping table. By using the tree structure, the target node can be quickly located, thereby achieving effective management of the cache address. The tree structure of the preset mapping table contains multiple nodes, and different nodes represent a cache address. The root node of the tree is the starting point of the entire mapping table, and the other nodes contain specific cache address information. When searching for the target cache address, you can start from the root node and traverse the tree structure step by step downward according to the preset mapping rules until you find the target node corresponding to the target cache address. After finding the target node, you can read the physical address stored in the node to obtain the second physical address. This process can achieve fast address conversion and improve the access speed and performance of the system.

[0109] The target node can be quickly located through the efficient address conversion mechanism of the tree structure in the preset mapping table, and the effective management of the cache address can be achieved, thereby improving the access speed and performance of the system.

[0110] In the above embodiment of the present application, caching the second physical address in the cache includes: determining the remaining storage space of the cache; caching the second physical address in the cache when the remaining storage space is greater than or equal to a preset threshold; eliminating the target physical address in the cache and caching the second physical address in the cache when the remaining storage space is less than the preset threshold, wherein the storage time of the target physical address in the cache is greater than the storage time of other physical addresses in the cache, and the other physical addresses are used to represent physical addresses in the cache other than the target physical address.

[0111] The target physical address mentioned above refers to a physical address that has been stored in the cache for a relatively long time, and the other physical addresses refer to other physical addresses in the cache except the target physical address that is about to be eliminated.

[0112] In an optional embodiment, the remaining storage space of the cache can be determined to check how much unused storage space is left in the current cache, and by managing the cache, it can be understood whether there is enough space to store the new physical address. If it is found that the remaining storage space is greater than or equal to a preset threshold, it means that the cache still has enough space to add the new physical address, and the new second physical address can be directly added to the cache without performing other operations. If the remaining storage space is less than the preset threshold, it means that the cache space is insufficient and some measures need to be taken to make room. In order to make room, some target physical addresses that have been stored in the cache for a long time can be eliminated. After the target physical address is eliminated, the system uses the freed space to store the new second physical address.

[0113] In another optional embodiment, after determining the target physical address, it is also possible to determine whether the target physical address is a physical address in the important list. The physical address in the important list may be a relatively important and frequently used physical address. If the target physical address is a physical address in the important list, it is necessary to determine other physical addresses with a longer storage time other than the target physical address, and use other physical addresses with a longer storage time as new target physical addresses. Until there is a target physical address that is not in the important list, the target physical address is eliminated and the second physical address is cached in the cache.

[0114] In the above embodiment of the present application, caching the second physical address in the cache includes: determining whether the metadata to be accessed is read successfully; and caching the second physical address in the cache if the metadata to be accessed is read successfully.

[0115] The above confirmation of whether the metadata to be accessed is read successfully may refer to whether the information contained in the metadata to be accessed can be correctly extracted and parsed. For example, whether the various fields and attributes in the metadata to be accessed can be correctly read, and whether they can be correctly interpreted and understood. The above confirmation of whether the metadata to be accessed is read successfully may also refer to whether the tree structure of the metadata to be accessed is successfully traversed.

[0116] By confirming whether the metadata to be accessed is read successfully, it can be ensured that the metadata to be accessed corresponding to the second physical address is correct, so that the second physical address is cached so that the metadata to be accessed can be retrieved later through the second physical address. If the metadata to be accessed is read incorrectly, it means that there are some problems with the metadata to be accessed itself. At this time, there is no need to cache the second physical address, which will waste cache space. In the case of incorrect reading of the metadata to be accessed, the user can trace the cause of the incorrect reading in order to eliminate the cause and ensure that the metadata to be accessed is correct, so that the second physical address can be stored normally.

[0117] In an optional embodiment, if the metadata to be accessed is read successfully, the corresponding second physical address can be cached in the cache. The purpose of this is to improve the performance and efficiency of the system, because the second physical address can be directly obtained from the cache when the metadata is accessed next time without having to perform a read operation again.

[0118] The function of the above-mentioned cache is to temporarily store frequently accessed data in a high-speed memory to speed up access to the data. By caching the second physical address in the cache, the number of accesses to the disk can be reduced, thereby improving the response speed and performance of the system. This can reduce the read and write operations of the system, reduce the burden on the system, and improve the overall efficiency of the system. By caching the second physical address of the metadata to be accessed in the cache, the performance and efficiency of the system can be improved, the number of accesses to the disk can be reduced, and the access speed of data can be accelerated, thereby improving the overall performance of the system.

[0119] In the present application, the data to be accessed may be regular data to be accessed, and the metadata to be accessed may be a tag of the data to be accessed. By introducing the concept of tag address space, the special address space of the tag can be addressed through the tag address space, and the tag can be obtained by accessing the tag address in the tag address space. The tag can be stored in a normal data area or in a special data area, such as the metadata area of ​​DDR. The physical address space and the tag address space are different address spaces. The physical address and tag address of a piece of data may be equal or different. In most expected usage scenarios, the two are equal.

[0120] When the CPU accesses data, it first obtains the first physical address of the data to be accessed through address translation. This physical address is the storage location of the data in the memory. After obtaining the first physical address, the CPU needs to use the first physical address to obtain metadata related to the data from the tag address space. Metadata usually includes attribute information of the data, such as type, size, permissions, etc. In order to obtain this metadata, the CPU needs to query the tag translation cache in the tag address space.

[0121] The tag translation cache stores the mapping relationship between the tag address and the second physical address. When the CPU uses the first physical address to query the tag translation cache, if there is a corresponding entry in the cache, the second physical address can be obtained directly from the cache. This second physical address represents the access address of the second storage area that stores the metadata to be accessed. If there is no hit in the tag translation cache, the CPU needs to initiate a table lookup operation to query the tag address mapping table, which is the preset mapping table mentioned above. This preset mapping table is usually a Radix tree structure, and the second physical address is finally obtained through multi-level queries. After obtaining the second physical address, the CPU can use the second physical address to access the storage area and obtain the required metadata. This address can be a physical address or the address of a special data area, such as the metadata area of ​​DDR.

[0122] When the CPU obtains the second physical address from the mapping table and accesses the metadata, the mapping relationship between the address and the metadata will be cached in the tag translation cache. If the cache is full, an old entry may be replaced.

[0123] By introducing the tag address space and tag translation cache, the efficiency of data access can be improved and the access delay to metadata can be reduced. At the same time, through the multi-level query of the tag address mapping table, the storage location of metadata can be flexibly managed to adapt to different memory architectures and access requirements. The core of this application is to use the tag address space and tag translation cache to achieve efficient access and management of data metadata and improve system performance.

[0124] The above solution introduces the concept of tag address space. By storing tags in a special address space and performing address translation when the CPU accesses data, fast access to tags can be achieved. This solution does not rely on external storage technology, has no dependence on external IP, does not interfere with ECC, and can use ordinary memory to store tags of arbitrary length. At the same time, the physical address can be used as the input of the tag space, without the need for additional TLB queries, and the memory bandwidth is similar to the existing solution, and tag cache can be used for mitigation. Overall, this solution is simple and efficient, and can meet the needs of fast access to tags.

[0125] It should be noted that the format of the above-mentioned tag translation cache is not restricted. The tag translation cache and tag map tableptr may not be placed in the load-store unit (Load-Store Unit, referred to as LSU). Depending on the design of the specific micro-architecture, it may exist in any other suitable place. The corresponding cache query actions and table lookup actions are not limited to being initiated by the LSU, but may be initiated by any other suitable unit. In this application, the format of the tag mapping table is not limited, and any structure of the table itself that can specify the location of the tag and the format of the table entries can be applied.

[0126] In this application, tags of arbitrary length are stored in ordinary memory, without relying on external storage technology and external addresses, and without preserving continuous memory, and discrete memory pages can be used. Physical addresses are used as input to the tag space, and no additional TLB queries are required. At the same time, the memory bandwidth required for tag queries is similar, which can be alleviated by tag cache.

[0127] Figure 4 is a schematic diagram of a data access structure according to an embodiment of the present application, such as Figure 4As shown, 1. a first physical address of the data to be accessed can be determined according to the access instruction, 3. the data to be accessed can be obtained in the memory according to 2. the first physical address, 4. the physical address of the metadata to be accessed can be used to find the physical address of the metadata to be accessed, and 5. the second physical address of the metadata to be accessed can be obtained in the cache, 6. the metadata to be accessed can be read from the memory according to 5. the second physical address, and 7. the tag is checked to determine whether there is a tag of the metadata to be accessed in the cache. If the second physical address is not stored in the cache, 4a. the second physical address can be found by table lookup, that is, the second physical address can be queried from a preset mapping table stored in the memory according to the target cache address, that is, the physical address of the metadata to be accessed can be found using the physical address of the data to be accessed (Look up tag PA using dataPA), the cache includes a tag mapping table lookup buffer (Tag Map Table Lookup Buffer) and a tag mapping table pointer (Tag Map Table Ptr), and if the second physical address is not stored in the cache, the second physical address can be found by table lookup (Table walk on miss), the target cache address can be determined in the tag mapping table search buffer, and the second physical address can be queried according to the target cache address through the tag mapping table pointer. Figure 4 The tag segment may include tag segments, which may be used to store more tag information, thereby achieving more efficient address mapping and cache management.

[0128] In an optional embodiment, the present application also provides other solutions similar to the above solution, such as the first solution, the second solution, and the third solution as shown below. The following solutions are explained with the data to be accessed as data and the metadata to be accessed as tags.

[0129] The first solution is the solution based on the metadata area (Metadata) in the memory module used by the Application Data Integrity (ADI) of the processor architecture (SPARC) and the Memory Tagging Extension (MTE) of the processor architecture based on the reduced instruction set computer (ARM).

[0130] Both SPARC's ADI and ARM's MTE use the extra storage space provided in a specific memory module to store metadata for common data, which is called tags. ADI stores 4 bits of tags per 64 bytes, and MTE stores 4 bits of tags per 16 bytes. ADI mainly works with DDR4. MTE can work with DDR5 and LPDDR5.

[0131] When the core of the processor (Central Processing Unit Core, referred to as CPU) performs memory access operations, that is, loading operations (load) and storing operations (store), the CPU will use a certain 4 bits in the high order of the pointer used to access the data as a basis, read the label corresponding to the accessed data from the above storage space, and match it with the 4-bit label in the pointer. If the match is successful, it means that the access is legal, otherwise the access is illegal.

[0132] Figure 5 is another data access structure diagram according to an embodiment of the present application, such as Figure 5 As shown, the CPU receives a read or store instruction and the front-end part decodes it to determine the type of data and operation that needs to be accessed. After the front-end part of the CPU decodes the instruction, it determines the virtual address of the data, which is the address used in the program. The virtual address can be converted into 1. a data physical address through the memory management unit. The virtual address can be mapped to a physical address to access the actual memory unit. The LSU uses 2. the converted data physical address (Data PAddr) to access the memory hierarchy to obtain 3. data and tags. At the same time, the tag part of the address is used to quickly search in the cache. This process is called 4. checking the tag to determine whether the required data is already stored in the cache. If the data is stored in the cache, the LSU can directly load or store the data from the cache. If the data is not in the cache, the data is loaded from the memory hierarchy (Mem.Hierarchy) and updated to the cache. At the same time, the Tag information is updated to reflect the new cache status.

[0133] The above-mentioned LSU is responsible for performing data load and store operations from memory to CPU registers or from CPU registers to memory.

[0134] The design advantage of the first solution is that the input used for accessing the tag is the physical address of the accessed data, and the CPU does not need to perform additional address generation operations for accessing the tag. If the memory bus supports it, the tag can be transmitted back at the same time as the accessed data, without occupying additional memory operation bandwidth.

[0135] The second solution is a virtual memory-based solution of the Reduced Instruction Set Computer Version 5 (RISC-V). RISC-V proposes to use the normal data area to store these tags. A portion of the virtual address space is allocated as the tag space. When the CPU core performs memory access operations, the high bits of the pointer used to access the data are still used as the basis. However, the CPU needs to use the virtual address of the accessed data as an index to calculate the virtual address of the tag corresponding to the block of data in the tag space, translate the address, read the tag back from the memory (normal data area), and then match it.

[0136] Since tags are ordinary data, accessing tags not only requires additional TLB query resources, but also requires access to the data cache. Therefore, reading tags will result in additional data cache accesses, occupying data cache bandwidth. Depending on the length of the tag, the additional data cache bandwidth may be between (8-bit tag / 128-bit data=)6% and (16-bit tag / 128-bit data=)13%. The data here are only examples and are not specifically limited.

[0137] In order to alleviate the occupation of cache bandwidth, an additional tag cache is introduced into the micro-architecture to cache some tags. Parallel search of the tag cache and the data cache can solve the problem of occupying the data cache bandwidth. However, since the tags exist in both the tag cache and the data cache at this time, the micro-architecture needs to handle synchronization operations. It is necessary to introduce additional hardware logic, that is, the overhead of area or latency.

[0138] Figure 6 is another data access structure diagram according to an embodiment of the present application, such as Figure 6As shown, the front end of the processor starts working, obtains and decodes the instruction to be executed, and obtains 1. Data virtual address (DataVA). The memory management unit (MMU) can generate 3. Tag virtual address (Gen TagVA) from 2. Virtual address used in the instruction, and convert the virtual address into 4. Data physical address (Data PA) and tag physical address (Tag PA). It can be queried in memory according to 5. Data physical address to locate 6. Data in memory, and can be queried in memory according to 7. Tag physical address to locate 8. Tag in memory. The physical address can be obtained by decoding the front-end part in the memory hierarchy (Mem.Hierarchy), and the memory is accessed to load or store data. In the memory hierarchy, the data is first found in the cache, which is usually much faster than accessing the main memory. A check tag is performed in the cache to compare the tag physical address (Tag PA) of the physical address with the tag field of the cache line to determine whether the required data is already stored in the cache. If a cache hit is found in the check tag operation, the data is loaded directly from the cache to the processor. If a cache miss is found, the data needs to be loaded from the main memory and the cache is updated. The load storage unit (LSU) is responsible for loading data from the memory to the processor's register, or storing data from the register to the memory. Once the data is loaded into the register, the processor can execute the instruction and perform the next step as needed. Finally, if the instruction needs to write the result back to the memory, the LSU will perform a storage operation to write the data back to the memory. The tag page is the tag part in the cache, which can be used to quickly determine whether the cache line contains the required data.

[0139] The design advantage of the second solution is that the tag length is not limited by the hardware storage unit. If there is enough memory, any length can be specified. It is friendly to the memory management of the operating system. Since the tag is ordinary data, any memory management of the operating system is still applicable.

[0140] The third solution is to use software to divide fixed physical memory. Under the premise of using ordinary data areas and not using virtual memory, a part of the ordinary data area can be separately divided as a tag storage area during system initialization. When the CPU core accesses memory, after the virtual address translation is completed, the CPU uses the translated physical address to calculate the physical address of the tag corresponding to the accessed data in the tag storage area, and then uses this physical address to read the tag back from the memory to complete the match. The advantage of this solution is that the tag length is not limited by the hardware storage unit. There is no need for virtual address translation, so no additional TLB query is required. The tag storage space is transparent to user mode.

[0141] Figure 7is another data access structure diagram according to an embodiment of the present application, such as Figure 7 As shown, the index part of the physical address can be used, and the processor can find the corresponding cache line in the memory hierarchy. A check tag operation can be performed in the load-store unit to compare the tag part of the physical address with the tag field of the cache line to determine whether the data is in the cache. If the check tag operation finds a cache hit, the load-store unit can load the data from the main memory and may update the cache, including updating the tag field of the cache line. The load-store unit performs a storage operation and writes the data from the register to the memory. If necessary, the data in the memory and the cache are updated. After completing the data loading or storage, the processor continues to execute the next instruction.

[0142] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0143] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0145] According to an embodiment of the present application, a data access device for implementing the above data access method is also provided. Figure 8 is a schematic diagram of a data access device according to an embodiment of the present application, such as Figure 8As shown, the device 800 includes: a determination module 802 , an acquisition module 804 , and a reading module 806 .

[0146] Among them, the determination module is used to determine the first physical address of the data to be accessed based on the access instruction after receiving an access instruction to access the data to be accessed, wherein the first physical address is used to represent the access address of a first storage area in the memory storing the data to be accessed; the acquisition module is used to obtain the second physical address of the metadata to be accessed from the cache based on the first physical address, wherein the second physical address is used to represent the access address of a second storage area in the memory storing the metadata to be accessed, and the metadata to be accessed is used to represent the attributes of the data to be accessed; the reading module is used to read the metadata to be accessed from the memory based on the second physical address.

[0147] It should be noted here that the above-mentioned determination module 802, acquisition module 804, and reading module 806 correspond to steps S302 to S306 in the above-mentioned embodiment, and the three modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the contents disclosed in the above-mentioned embodiment. It should be noted that the above-mentioned modules or units may be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above-mentioned modules may also be part of a device and may be run in the RISC-V system 100 provided in the above-mentioned embodiment.

[0148] In the above embodiment of the present application, the acquisition module is used to convert the first physical address into a target cache address, wherein the target cache address is used to represent the access address of the third storage area in the cache storing the second physical address; and the second physical address is obtained from the cache based on the target cache address.

[0149] In the above-mentioned embodiment of the present application, the determination module is used to parse the access instruction to obtain the virtual address of the data to be accessed; and perform address conversion on the virtual address to obtain the first physical address.

[0150] In the above embodiment of the present application, the first storage area is used to represent the first data segment storing the data to be accessed in the memory; the determination module is used to parse the access instruction to obtain the first segment address and the first offset address of the first data segment, wherein the first segment address is used to represent the access address of the first data segment, and the first offset address is used to represent the offset between the access address storing the data to be accessed in the first data segment and the starting address of the first data segment; based on the first segment address and the first offset address, a first physical address is generated.

[0151] In the above embodiment of the present application, the second storage area is used to represent the second data segment storing metadata to be accessed in the memory; the reading module is used to parse the second physical address to obtain the second segment address and the second offset address of the second data segment, wherein the second segment address is used to represent the access address of the second data segment, and the second offset address is used to represent the offset between the access address storing metadata to be accessed in the second data segment and the starting address of the second data segment; based on the second segment address, the second data segment is read from the memory; based on the second offset address, the metadata to be accessed is read from the second data segment.

[0152] In the above embodiments of the present application, the device further includes: a query module and a cache module.

[0153] Among them, the query module is used to query and obtain the second physical address from a preset mapping table stored in the memory based on the target cache address, wherein the preset mapping table is used to characterize the mapping relationship between different cache addresses and different physical addresses, and the target cache address is used to characterize the access address of the third storage area in the cache where the second physical address is stored; the cache module is used to cache the second physical address into the cache.

[0154] In the above embodiment of the present application, the query module is used to determine the tree structure corresponding to the preset mapping table, wherein the tree structure includes multiple nodes, and different nodes are used to represent different cache addresses; starting from the root node of the tree structure, the nodes other than the root node in the tree structure are traversed to determine the target node corresponding to the target cache address; the physical address stored in the target node is read to obtain the second physical address.

[0155] In the above embodiment of the present application, the cache module is used to determine the remaining storage space of the cache; when the remaining storage space is greater than or equal to a preset threshold, the second physical address is cached in the cache; when the remaining storage space is less than the preset threshold, the target physical address in the cache is eliminated and the second physical address is cached in the cache, wherein the storage time of the target physical address in the cache is greater than the storage time of other physical addresses in the cache, and the other physical addresses are used to represent physical addresses in the cache other than the target physical address.

[0156] In the above embodiment of the present application, the cache module is used to determine whether the metadata to be accessed is read successfully; if the metadata to be accessed is read successfully, the second physical address is cached in the cache.

[0157] It should be noted that the preferred implementation scheme involved in the above embodiments of the present application is the same as the scheme provided in the above embodiments, as well as the application scenario and implementation process, but is not limited to the scheme provided in the above embodiments.

[0158] The embodiment of the present application may provide an electronic device, which may be any electronic device in a group of electronic devices. Optionally, in this embodiment, the electronic device may also be replaced by a terminal device such as a mobile terminal.

[0159] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.

[0160] In this embodiment, the electronic device can execute the program code in the method.

[0161] Optionally, Fig. 9 is a structural block diagram of an electronic device according to an embodiment of the present application. Fig. 9 As shown, the electronic device A may include: one or more (only one is shown in the figure) processors 102, a memory 104, a storage controller, and a peripheral interface, wherein the peripheral interface is connected to a radio frequency module, an audio module, and a display.

[0162] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the methods in the above embodiments. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal A via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0163] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: after receiving an access instruction to access the data to be accessed, determine the first physical address of the data to be accessed based on the access instruction, wherein the first physical address is used to represent the access address of a first storage area in the memory storing the data to be accessed; based on the first physical address, obtain the second physical address of the metadata to be accessed from the cache, wherein the second physical address is used to represent the access address of a second storage area in the memory storing the metadata to be accessed, and the metadata to be accessed is used to represent the attributes of the data to be accessed; based on the second physical address, read the metadata to be accessed from the memory.

[0164] Optionally, the processor may also execute program code of the following steps: converting the first physical address into a target cache address, wherein the target cache address is used to represent an access address of a third storage area in the cache storing the second physical address; and obtaining the second physical address from the cache based on the target cache address.

[0165] Optionally, the processor may also execute program codes of the following steps: parsing the access instruction to obtain a virtual address of the data to be accessed; and performing address conversion on the virtual address to obtain a first physical address.

[0166] Optionally, the processor may also execute the following program code: parsing the access instruction to obtain the first segment address and the first offset address of the first data segment, wherein the first segment address is used to represent the access address of the first data segment, and the first offset address is used to represent the offset between the access address of the data to be accessed stored in the first data segment and the starting address of the first data segment; and generating a first physical address based on the first segment address and the first offset address.

[0167] Optionally, the processor may also execute the program code of the following steps: parsing the second physical address to obtain a second segment address and a second offset address of the second data segment, wherein the second segment address is used to represent an access address of the second data segment, and the second offset address is used to represent an offset between an access address storing metadata to be accessed in the second data segment and a starting address of the second data segment; based on the second segment address, reading the second data segment from the memory; based on the second offset address, reading metadata to be accessed from the second data segment.

[0168] Optionally, the processor may also execute the program code of the following steps: based on the target cache address, querying and obtaining a second physical address from a preset mapping table stored in the memory, wherein the preset mapping table is used to characterize the mapping relationship between different cache addresses and different physical addresses, and the target cache address is used to characterize the access address of a third storage area in the cache storing the second physical address; caching the second physical address in the cache.

[0169] Optionally, the processor may also execute the program code of the following steps: determining a tree structure corresponding to a preset mapping table, wherein the tree structure comprises a plurality of nodes and different nodes are used to represent different cache addresses; starting from the root node of the tree structure, traversing the nodes in the tree structure except the root node to determine a target node corresponding to the target cache address; and reading the physical address stored in the target node to obtain a second physical address.

[0170] Optionally, the processor may also execute program code of the following steps: determining the remaining storage space of the cache; caching the second physical address into the cache when the remaining storage space is greater than or equal to a preset threshold; eliminating the target physical address in the cache and caching the second physical address into the cache when the remaining storage space is less than a preset threshold, wherein the storage time of the target physical address in the cache is greater than the storage time of other physical addresses in the cache, and the other physical addresses are used to represent physical addresses in the cache other than the target physical address.

[0171] Optionally, the processor may further execute program code of the following steps: determining whether the metadata to be accessed is read successfully; and if the metadata to be accessed is read successfully, caching the second physical address into the cache.

[0172] Through the above steps, after receiving an access instruction to access the data to be accessed, a first physical address of the data to be accessed is determined based on the access instruction, wherein the first physical address is used to represent the access address of a first storage area in the memory storing the data to be accessed; based on the first physical address, a second physical address of metadata to be accessed is obtained from the cache, wherein the second physical address is used to represent the access address of a second storage area in the memory storing the metadata to be accessed, and the metadata to be accessed is used to represent the attributes of the data to be accessed; based on the second physical address, the metadata to be accessed is read from the memory, thereby achieving the purpose of improving the effect of data access; it is easy to notice that in the present application, by introducing the concept of the address space of the metadata to be accessed in the cache, the second physical address of the metadata to be accessed can be obtained from the address space according to the first physical address, and the metadata to be accessed can be read from the memory based on the second physical address, and the process does not need to rely on external storage, and ordinary memory can also be used to complete the storage of metadata to be accessed of any length, and when storing, there is no need to store the access metadata in a continuous physical address segment, and there is no need to provide a reserved memory module to store the metadata to be accessed. During the data access process, the second physical address of the metadata to be accessed can be directly queried based on the first physical address. Address conversion is not involved in this process, and the data access process is more flexible, thereby improving the efficiency of data access and solving the technical problem of poor data access effect in related technologies.

[0173] Those skilled in the art will understand that Fig. 9 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Fig. 9 It does not limit the structure of the above electronic device. For example, the electronic device A may also include Fig. 9 More or fewer components (such as network interfaces, display devices, etc.) shown in the figure, or having Fig. 9 Different configurations are shown.

[0174] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0175] The embodiment of the present application further provides a computer-readable storage medium. Optionally, in this embodiment, the computer-readable storage medium can be used to store the program code executed by the method provided in the above embodiment.

[0176] Optionally, in this embodiment, the storage medium may be located in any electronic device in a group of electronic devices in a computer network, or in any mobile terminal in a group of mobile terminals.

[0177] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: after receiving an access instruction to access data to be accessed, determining a first physical address of the data to be accessed based on the access instruction, wherein the first physical address is used to represent an access address of a first storage area in the memory storing the data to be accessed; based on the first physical address, obtaining a second physical address of metadata to be accessed from a cache, wherein the second physical address is used to represent an access address of a second storage area in the memory storing the metadata to be accessed, and the metadata to be accessed is used to represent attributes of the data to be accessed; and reading the metadata to be accessed from the memory based on the second physical address.

[0178] Optionally, the computer-readable storage medium is also configured to store program code for performing the following steps: converting the first physical address into a target cache address, wherein the target cache address is used to represent an access address of a third storage area in the cache storing a second physical address; and obtaining the second physical address from the cache based on the target cache address.

[0179] Optionally, the computer-readable storage medium is further configured to store program codes for executing the following steps: parsing the access instruction to obtain a virtual address of the data to be accessed; and performing address conversion on the virtual address to obtain a first physical address.

[0180] Optionally, the computer-readable storage medium is also configured to store program code for executing the following steps: parsing the access instruction to obtain a first segment address and a first offset address of the first data segment, wherein the first segment address is used to represent the access address of the first data segment, and the first offset address is used to represent the offset between the access address of the data to be accessed stored in the first data segment and the starting address of the first data segment; generating a first physical address based on the first segment address and the first offset address.

[0181] Optionally, the computer-readable storage medium is also configured to store program code for performing the following steps: parsing the second physical address to obtain a second segment address and a second offset address of the second data segment, wherein the second segment address is used to represent an access address of the second data segment, and the second offset address is used to represent an offset between an access address storing metadata to be accessed in the second data segment and a starting address of the second data segment; based on the second segment address, reading the second data segment from the memory; based on the second offset address, reading the metadata to be accessed from the second data segment.

[0182] Optionally, the computer-readable storage medium is also configured to store program code for performing the following steps: based on the target cache address, querying a second physical address from a preset mapping table stored in the memory, wherein the preset mapping table is used to characterize the mapping relationship between different cache addresses and different physical addresses, and the target cache address is used to characterize an access address of a third storage area in the cache storing the second physical address; caching the second physical address in the cache.

[0183] Optionally, the computer-readable storage medium is also configured to store program code for performing the following steps: determining a tree structure corresponding to a preset mapping table, wherein the tree structure includes multiple nodes, and different nodes are used to represent different cache addresses; starting from the root node of the tree structure, traversing the nodes in the tree structure except the root node to determine the target node corresponding to the target cache address; reading the physical address stored in the target node to obtain a second physical address.

[0184] Optionally, the computer-readable storage medium is also configured to store program code for performing the following steps: determining the remaining storage space of the cache; caching the second physical address into the cache when the remaining storage space is greater than or equal to a preset threshold; eliminating the target physical address in the cache and caching the second physical address into the cache when the remaining storage space is less than a preset threshold, wherein the storage time of the target physical address in the cache is greater than the storage time of other physical addresses in the cache, and the other physical addresses are used to represent physical addresses in the cache other than the target physical address.

[0185] Optionally, the computer-readable storage medium is further configured to store program code for executing the following steps: determining whether the metadata to be accessed is read successfully; and if the metadata to be accessed is read successfully, caching the second physical address into the cache.

[0186] Through the above steps, after receiving an access instruction to access the data to be accessed, a first physical address of the data to be accessed is determined based on the access instruction, wherein the first physical address is used to represent the access address of a first storage area in the memory storing the data to be accessed; based on the first physical address, a second physical address of metadata to be accessed is obtained from the cache, wherein the second physical address is used to represent the access address of a second storage area in the memory storing the metadata to be accessed, and the metadata to be accessed is used to represent the attributes of the data to be accessed; based on the second physical address, the metadata to be accessed is read from the memory, thereby achieving the purpose of improving the effect of data access; it is easy to notice that in the present application, by introducing the concept of the address space of the metadata to be accessed in the cache, the second physical address of the metadata to be accessed can be obtained from the address space according to the first physical address, and the metadata to be accessed can be read from the memory based on the second physical address, and the process does not need to rely on external storage, and ordinary memory can also be used to complete the storage of metadata to be accessed of any length, and when storing, there is no need to store the access metadata in a continuous physical address segment, and there is no need to provide a reserved memory module to store the metadata to be accessed. During the data access process, the second physical address of the metadata to be accessed can be directly queried based on the first physical address. Address conversion is not involved in this process, and the data access process is more flexible, thereby improving the efficiency of data access and solving the technical problem of poor data access effect in related technologies.

[0187] The embodiment of the present application further provides a computer program product. Optionally, in this embodiment, the computer program product may include a computer program, and the computer program implements the method provided in the embodiment when executed by a processor.

[0188] The embodiments of the present application also provide a computer program product. Optionally, the computer program product may include a non-volatile computer-readable storage medium, which may be used to store a computer program, and when the computer program is executed by a processor, the method provided in the embodiments is implemented.

[0189] The embodiment of the present application further provides a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, the method provided in the above embodiment is implemented.

[0190] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0191] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0192] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0193] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0194] 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 application, in essence, 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, and the computer software product is stored in a storage medium, including a number of instructions to enable 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 application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0195] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A data access method, characterized in that: Applicable to processors, including: After receiving an access instruction to access the data to be accessed, determining a first physical address of the data to be accessed based on the access instruction, wherein the first physical address is used to represent an access address of a first storage area in a memory storing the data to be accessed; Based on the first physical address, obtaining a second physical address of the metadata to be accessed from the cache, wherein the second physical address is used to represent an access address of a second storage area in the memory storing the metadata to be accessed, and the metadata to be accessed is used to represent an attribute of the data to be accessed; The metadata to be accessed is read from the memory based on the second physical address.

2. The method according to claim 1, characterized in that The acquiring, based on the first physical address, a second physical address of metadata to be accessed from a cache includes: Converting the first physical address into a target cache address, wherein the target cache address is used to represent an access address of a third storage area in the cache storing the second physical address; The second physical address is obtained from the cache based on the target cache address.

3. The method according to claim 1, characterized in that The determining the first physical address of the to-be-accessed data based on the access instruction comprises: Parsing the access instruction to obtain the virtual address of the data to be accessed; Perform address conversion on the virtual address to obtain the first physical address.

4. The method according to claim 1, characterized in that: The first storage area is used to represent a first data segment in the memory storing the data to be accessed; The determining the first physical address of the to-be-accessed data based on the access instruction comprises: Parsing the access instruction to obtain a first segment address and a first offset address of the first data segment, wherein the first segment address is used to represent the access address of the first data segment, and the first offset address is used to represent the offset between the access address of the first data segment storing the data to be accessed and the starting address of the first data segment; The first physical address is generated based on the first segment address and the first offset address.

5. The method according to claim 1, characterized in that The second storage area is used to represent a second data segment in which the metadata to be accessed is stored in the memory; The reading the metadata to be accessed from the memory based on the second physical address includes: Parsing the second physical address to obtain a second segment address and a second offset address of the second data segment, wherein the second segment address is used to represent an access address of the second data segment, and the second offset address is used to represent an offset between an access address storing the metadata to be accessed in the second data segment and a starting address of the second data segment; Based on the second segment address, reading the second data segment from the memory; Based on the second offset address, the metadata to be accessed is read from the second data segment.

6. The method according to any one of claims 1 to 5, characterized in that In a case where the second physical address is not stored in the cache, the method further includes: Based on the target cache address, querying from a preset mapping table stored in the memory to obtain the second physical address, wherein the preset mapping table is used to represent the mapping relationship between different cache addresses and different physical addresses, and the target cache address is used to represent the access address of the third storage area in the cache storing the second physical address; The second physical address is cached in the cache.

7. The method according to claim 6, characterized in that The step of querying the preset mapping table stored in the memory to obtain the second physical address based on the target cache address includes: Determine a tree structure corresponding to the preset mapping table, wherein the tree structure includes a plurality of nodes, and different nodes are used to represent different cache addresses; Starting from the root node of the tree structure, traversing the nodes in the tree structure except the root node to determine a target node corresponding to the target cache address; The physical address stored in the target node is read to obtain the second physical address.

8. The method according to claim 6, characterized in that The step of caching the second physical address into the cache comprises: Determining remaining storage space of the cache; When the remaining storage space is greater than or equal to a preset threshold, caching the second physical address into the cache; When the remaining storage space is less than a preset threshold, the target physical address in the cache is eliminated and the second physical address is cached in the cache, wherein the storage time of the target physical address in the cache is greater than the storage time of other physical addresses in the cache, and the other physical addresses are used to represent physical addresses in the cache other than the target physical address.

9. The method according to claim 6, characterized in that The step of caching the second physical address into the cache comprises: Determine whether the metadata to be accessed is read successfully; When the metadata to be accessed is read successfully, the second physical address is cached in the cache.

10. A data access device, characterized in that: include: A memory, used to store different data and metadata corresponding to the different data; A load storage unit is connected to the memory and includes a cache. The load storage unit is used to determine a first physical address of the data to be accessed based on the access instruction after receiving an access instruction to access the data to be accessed, obtain a second physical address of metadata to be accessed from the cache based on the first physical address, and read the metadata to be accessed from the memory based on the second physical address, wherein the first physical address is used to represent an access address of a first storage area in the memory storing the data to be accessed, the second physical address is used to represent an access address of a second storage area in the memory storing the metadata, and the metadata to be accessed is used to represent attributes of the data to be accessed.

11. A processor, characterized in that: include: The device of claim 10.

12. A system on chip, characterized in that: include: The processor of claim 11.

13. An electronic device, characterized in that: include: A memory storing an executable program; A processor, configured to run the program, wherein the program executes the method according to any one of claims 1 to 9 when running.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is run, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 9.

15. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Data processing method and device, storage medium and electronic equipment

    CN119357197A

  • Memory access method, processor, system on chip, and computing device

    WO2026214321A1