Data access method and device, equipment and storage medium
By performing preset checks and serial number management on user access requests, the failure and correct responses are preferred, the problem of waste of computing resources under out-of-order access is solved, and the response speed and resource utilization efficiency are improved.
Patent Information
- Application Number
- CN202411461086.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-01-14
AI Technical Summary
In the out-of-order access scenario, the existing technology requires a large number of computing resources to be re-arranged and reorganized, resulting in frequent occupation and release of computing resources and waste of resources.
The user access request is checked through preset check conditions, the user identification and inspection results are stored, the sequence number is used to indicate the request ranking, and the failure response and correct response are returned first, reducing the use and release of computing resources.
In the out-of-order access scenario, frequent occupation and release of computing resources are avoided, response speed and system resource utilization efficiency are improved, and waste of computing resources is reduced.
Smart Images

Figure CN119311225A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data access method, device, equipment and storage medium. Background Art
[0002] With the widespread application of cloud computing and big data technologies, the number of users is large and the access modes are diverse, and data access often presents disorder. Especially today when virtualization technology is widely used, multiple virtual machines may access the same physical storage device at the same time, making the data access order unpredictable.
[0003] In the prior art, responses corresponding to access requests are usually returned by reordering and reorganizing data. However, this method usually requires a large amount of computing resources, including processor time and memory space, which may be frequently occupied and released in out-of-order access scenarios, resulting in a waste of computing resources. Summary of the invention
[0004] Based on the above problems, the present application provides a data access method, apparatus, device and storage medium, the purpose of which is to avoid frequent occupation and release of computing resources in out-of-order access scenarios and reduce the waste of computing resources.
[0005] This application discloses the following technical solutions:
[0006] In a first aspect, the present application provides a data access method, comprising:
[0007] According to preset inspection conditions, access inspection is performed on the access addresses and access information in the obtained multiple user access requests, and the inspection results corresponding to the multiple user access requests are determined to implement access control and improve data security;
[0008] The user identifiers and corresponding inspection results in multiple user access requests are stored in a record table, and the serial numbers corresponding to the multiple user access request identifiers are assigned; the serial numbers are used to represent the order of the user access requests corresponding to the user identifiers, so that the responses corresponding to the user access requests are returned in sequence by querying the record table, thereby ensuring data integrity and security and avoiding data confusion or loss;
[0009] Determine the first user access request with a failed check result and a minimum sequence number from the record table, generate a failure response and return it to the user, so as to return the response with failed check first and improve the response speed;
[0010] When it is determined that there is no user access request with a failed check result and a minimum sequence number in the record table, a second user access request with a correct check result and a minimum sequence number is determined, and the correct response corresponding to the second user access request is obtained and returned to the user, so as to achieve the situation in which there is no need to frequently occupy and release computing resources in an out-of-order access scenario, and only the correct responses are returned in sequence through the record table, thereby reducing the waste of computing resources.
[0011] Optionally, in the method described above, the serial numbers corresponding to the multiple user access request identifiers include:
[0012] For each user access request in the multiple user access requests, perform the following steps:
[0013] Determine the cumulative number of times the user identifier in the user access request appears in the record table;
[0014] The serial number corresponding to the user access request is determined according to the cumulative number, so that when processing concurrent requests, the processing order of the requests can be ensured according to the serial number, so as to improve the response speed and avoid delays.
[0015] Optionally, in the method described above, the user access request includes data length, and the method further includes:
[0016] Temporarily storing the correct response to be returned in the cache area can effectively reduce the overhead of repeated calculations and data processing, improve the utilization efficiency of system resources, and provide a response quickly when a user request arrives, reducing the response return time and delay, thereby improving the user experience; the correct response to be returned includes at least one of the following:
[0017] The correct response to the user access request whose check result is correct and whose sequence number is not the minimum value, or,
[0018] A correct response carrying the unreturned data corresponding to the user access request with the smallest serial number; wherein the sum of the data lengths of the returned data and the unreturned data corresponding to the user access request with the smallest serial number is equal to the data length, so that when the response data has not been fully returned, part of the cached data can be returned first, while continuing to process the remaining data, thereby improving the response speed.
[0019] Optionally, the method as described above further includes:
[0020] When responses to the first user access request and the second user access request are returned, releasing the table entries corresponding to the first user access request and the second user access request;
[0021] Decrement the sequence numbers corresponding to the remaining user access requests in the record table that have the same user identifier as the first user access request by one;
[0022] By reducing the serial numbers corresponding to the remaining user access requests in the record table having the same user identifier as the second user access request by one, the accuracy of the serial numbers in the record table can be ensured, so that the response with the smallest serial number is returned to the user, thereby improving the response speed.
[0023] Optionally, the method described above, according to a preset inspection condition, performs an access inspection on the access addresses and access information in the obtained multiple user access requests to determine the inspection results corresponding to each of the multiple user access requests, including:
[0024] When it is determined that multiple conditions in the preset inspection conditions are met, the inspection result is successful;
[0025] When it is determined that at least one of the multiple conditions is not met, the inspection result is a failure. Multiple inspections greatly improve the accuracy of the inspection results and avoid data leakage.
[0026] Optionally, in the method as described above, the preset check condition includes one or more of an address range check, an access type check, a permission level check, and a bus privilege check of a transmission protocol;
[0027] Among them, the address range check is to determine the address group corresponding to the access address in the user access request; the access type check is to check whether the access data type satisfies the read and / or write enable preset in the control register; the permission level check is to check whether the permission level bit in the user access request meets the security level of the memory; the bus privilege check of the transmission protocol is to check whether the user access request satisfies the bus rules, which helps to protect the system's sensitive information and resources, prevent data from being illegally tampered with or destroyed, and improve data integrity and security.
[0028] Optionally, in the method described above, the permission level checking method includes:
[0029] Get the permission level bit in the user access request;
[0030] Map the permission level bits to security levels according to preset rules;
[0031] If the security level corresponding to the user access request is higher than or equal to the security level of the storage device, the permission level check corresponding to the user access request passes;
[0032] or,
[0033] If the security level corresponding to the user access request is lower than the security level of the memory, the permission level check corresponding to the user access request will fail, so as to realize mapping the permission level based on the original data. The number of permission levels can be set, avoiding the configuration of passwords in the prior art to increase the access bit width, thereby improving the efficiency of permission control.
[0034] In a second aspect, the present application provides a data access device, comprising:
[0035] A checking module, used to perform access checks on access addresses and access information in multiple user access requests acquired according to preset checking conditions, and determine the check results corresponding to each of the multiple user access requests;
[0036] A storage module, used to store the user identifiers and corresponding inspection results in the multiple user access requests into a record table, and to assign serial numbers corresponding to the multiple user access request identifiers; the serial numbers are used to represent the order of the user access requests corresponding to the user identifiers;
[0037] A first response module, used to determine from the record table the first user access request with a check result of failure and a sequence number of the minimum value, generate a failure response and return it to the user;
[0038] The second response module is used to determine the second user access request with a correct check result and the smallest serial number when it is determined that there is no user access request with a failed check result and the smallest serial number in the record table, obtain the correct response corresponding to the second user access request and return it to the user.
[0039] In a third aspect, the present application provides an electronic device, the device comprising: a processor, and a memory communicatively connected to the processor;
[0040] Memory stores computer-executable instructions;
[0041] The processor executes the computer-executable instructions stored in the memory to implement the data access method described in any of the above embodiments.
[0042] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the data access method described in any of the above embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0044] Figure 1 A flowchart of an embodiment of a data access method provided by the present application;
[0045] Figure 2 A flowchart of an embodiment of access checking provided by the present application;
[0046] Figure 3 A flowchart of another embodiment of a data access method provided by the present application;
[0047] Figure 4 A flowchart of another embodiment of a data access method provided by the present application;
[0048] Figure 5 A schematic diagram of the read access response return process provided for this application;
[0049] Figure 6 A structural diagram of an embodiment of a data access device provided by the present application;
[0050] Figure 7 A schematic structural diagram of an embodiment of an electronic device provided in the present application. DETAILED DESCRIPTION
[0051] As described above, currently in out-of-order access scenarios, data access usually returns a response to the access request by rearranging and reorganizing the data. However, this method usually requires a large amount of computing resources.
[0052] After research, the inventors have proposed a data access method, apparatus, device and storage medium to avoid frequent occupation and release of computing resources in out-of-order access scenarios and reduce waste of computing resources.
[0053] 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 are within the scope of protection of this application.
[0054] See also Figure 1 , which is a flow chart of an embodiment of a data access method provided by the present application. Figure 1 As shown, the method includes:
[0055] S101: performing access checks on access addresses and access information in multiple user access requests according to preset check conditions, and determining check results corresponding to each of the multiple user access requests.
[0056] In this embodiment, multiple user access requests are obtained, wherein the user access requests include access addresses and access information. The access addresses and access information in the user access requests are subjected to address range check, access type check, permission level check, and bus privilege check of the transmission protocol. If all of the above check conditions are passed, the check result corresponding to the user access request is correct; if any of the above check conditions is not passed, the check result corresponding to the user access request is failed.
[0057] S102: storing the user identifiers in the multiple user access requests and the corresponding check results in a record table, and assigning serial numbers corresponding to the multiple user access request identifiers; the serial numbers are used to indicate the order of the user access requests corresponding to the user identifiers.
[0058] In this embodiment, the user identifiers in the multiple user access requests and the inspection results corresponding to each user access request are stored in a record table, and the user access requests are serially identified according to the cumulative number of times the user identifiers in the user access requests appear in the record table.
[0059] S103: Determine from the record table the first user access request with a check result of failure and a minimum sequence number, generate a failure response and return it to the user.
[0060] In this embodiment, according to the records in the record table, it is determined that the check result is a failure, and the sequence number is the minimum value corresponding to the user access request, a corresponding failure response is generated and the failure response is directly returned to the user. The sequence number is the minimum value means that the sequence number of the user access request corresponding to each user identifier is the minimum value.
[0061] S104: When it is determined that there is no user access request with a failed check result and a minimum sequence number in the record table, a second user access request with a correct check result and a minimum sequence number is determined, and a correct response corresponding to the second user access request is obtained and returned to the user.
[0062] In this embodiment, when a user access request with a failed check result and a minimum sequence number in the record table is returned, the user access request with a correct check result and a minimum sequence number is determined from the record table, the correct response corresponding to the user access request is obtained and returned to the user.
[0063] For example, there are 3 user access requests with the same user ID. Among them, the check result corresponding to the first user access request with sequence number 0 is failure, the check result corresponding to the second user access request with sequence number 1 is correct, and the check result corresponding to the third user access request with sequence number 2 is failure. The failure response corresponding to the first user access request with sequence number 0 is returned first. At this time, the remaining second user access request with sequence number 1 and the third user access request with sequence number 2, since the sequence number corresponding to the second user access request is the smallest, the correct response corresponding to the second user access request is returned. At this time, the failure response corresponding to the remaining third user access request with sequence number 2 is returned last.
[0064] For example, if there is one user access request with a correct check result and user ID Id1, the corresponding sequence number is 0, and two user access requests with failed check results and user ID Id2, the corresponding sequence numbers are 0 and 1, then the failed response corresponding to the user access request with sequence number 0 and user ID Id2 is returned first; the remaining failed responses of the user access request with sequence number 1 and user ID Id2 and the correct response of the user access request with sequence number 0 and user ID Id1 are the remaining. At this time, the user access request with sequence number 1 and user ID Id2 is the user access request with a failed check result and the smallest sequence number, so the failed response corresponding to the user access request with sequence number 1 and user ID Id2 is returned, and finally the correct response corresponding to the user access request with sequence number 0 and user ID Id1 is returned.
[0065] In this embodiment, according to the preset inspection conditions, the access addresses and access information in the obtained multiple user access requests are access checked, and the inspection results corresponding to the multiple user access requests are determined to achieve access control and improve data security. The user identifiers in the multiple user access requests and the corresponding inspection results are stored in the record table, and the serial numbers corresponding to the multiple user access request identifiers are used to characterize the order of the user access requests corresponding to the user identifiers, so as to return the responses corresponding to the user access requests in sequence by querying the record table, thereby ensuring data integrity and security and avoiding data confusion or loss. From the record table, the first user access request with a failed inspection result and a minimum serial number is determined, and a failed response is generated and returned to the user, so as to achieve the priority return of the response of the failed inspection and improve the response speed. When it is determined that there is no user access request with a failed inspection result and a minimum serial number in the record table, a second user access request with a correct inspection result and a minimum serial number is determined, and the correct response corresponding to the second user access request is obtained and returned to the user, so as to achieve that in the disordered access scenario, there is no need to frequently occupy and release computing resources, and only the correct response is returned in sequence through the record table, thereby reducing the waste of computing resources.
[0066] Further, based on the above embodiment, a specific implementation of "performing access checks on the access addresses and access information in the obtained multiple user access requests according to preset check conditions, and determining the check results corresponding to the multiple user access requests" in S101 includes:
[0067] When it is determined that multiple conditions in the preset inspection conditions are met, the inspection result is successful.
[0068] In this embodiment, access checks are performed on multiple conditions in the preset check conditions in sequence, and when it is determined that all conditions are satisfied, the check result corresponding to the user access request is determined to be successful.
[0069] When it is determined that at least one of the multiple conditions is not satisfied, the check result is failure.
[0070] In this embodiment, during the access check process, if any condition is not satisfied, the check result corresponding to the user access request is determined to be failed. It is understandable that during the process of sequentially checking multiple conditions in the preset check conditions, if one check fails, the remaining unchecked check items may not be checked again.
[0071] In this embodiment, when it is determined that multiple conditions in the preset inspection conditions are satisfied, the inspection result is successful; when it is determined that at least one of the multiple conditions is not satisfied, the inspection result is failed. The accuracy of the inspection result is greatly improved through multiple inspections, avoiding data leakage.
[0072] Further, based on the above embodiment, the preset check condition includes one or more of an address range check, an access type check, a permission level check, and a bus privilege check of the transmission protocol.
[0073] The address range check is to determine the address group corresponding to the access address in the user access request. Figure 2 As shown, the access check group corresponding to the user access request is checked according to the access address in the user access request, and the user is controlled according to the access address group corresponding to the access check group. Specifically, the address boundary corresponding to each access check group is set; and a default group is added to put all user access requests that do not fall into the configured access check group into the default group.
[0074] The access type check is to check whether the access data type satisfies the read and / or write enable preset by the control register. Specifically, in this embodiment, the read access and the write access are checked separately, and the control register is used to control whether the read access check and the write access check are enabled. For example, if the control register only enables the read access check, only read access can be performed, and write access cannot be performed.
[0075] The permission level check is to check whether the permission level bit in the user access request meets the security level of the memory. Specifically, the specific bit data in the user access request is mapped to the security level, and the user who accesses the low security level can access the storage of the lower security level, but cannot access the storage of the higher security level.
[0076] The bus privilege check of the transmission protocol is to check whether the user access request meets the bus rules. Specifically, the bus privilege check may include checking whether the user request comes from a legitimate user or device, whether the address specified in the request is within the valid address range of the bus, etc.
[0077] When all the above checks are successful, the check result corresponding to the user access request is successful. When any of the above checks fails, the check result corresponding to the user access request is failed.
[0078] In this embodiment, the preset check conditions include one or more of address range check, access type check, permission level check, and bus privilege check of the transmission protocol, which helps to protect sensitive information and resources of the system, prevent data from being illegally tampered with or destroyed, and improve data integrity and security.
[0079] Furthermore, in the above embodiment, a specific implementation of the permission level check includes:
[0080] Get the permission level bits in the user access request.
[0081] In this embodiment, for example, the lower 5 bits of the access information in the user access request are used as the permission level bits.
[0082] The permission level bits are mapped to security levels according to preset rules.
[0083] In this embodiment, for example, the lower 5 bits of the access information are mapped to a 3-bit security level. The lower 5 bits of the access information are 32 data in total, 00000 to 11111; the 3-bit security level, that is, 000 to 111, has a total of 8 security levels. The preset rules are configured according to user needs.
[0084] If the security level corresponding to the user access request is higher than or equal to the security level of the memory, the permission level check corresponding to the user access request passes.
[0085] In this embodiment, the mapped user access security level is compared with the security level of the memory. When the user access security level is higher than or equal to the security level of the memory, the permission level check of the user access request passes, and the user can access the data in the memory. The security level of the memory is the storage space set according to the confidentiality level of the memory.
[0086] or,
[0087] If the security level corresponding to the user access request is lower than the security level of the memory, the permission level check corresponding to the user access request fails.
[0088] In this embodiment, when the user access security level is lower than the security level of the memory, the permission level check of the user access request fails, and the user cannot access the data in the memory.
[0089] In this embodiment, the permission level bits in the user access request are obtained, and the permission level bits are mapped to security levels according to preset rules. When it is determined that the security level corresponding to the user access request is higher than or equal to the security level of the memory, the permission level check corresponding to the user access request passes; when it is determined that the security level corresponding to the user access request is lower than the security level of the memory, the permission level check corresponding to the user access request fails, so as to realize mapping permission levels based on the original data, and the number of permission levels can be set, which avoids the configuration of passwords in the prior art to increase the access bit width, thereby improving the efficiency of permission control.
[0090] See also Figure 3 , which is a flow chart of another embodiment of a data access method provided by the present application. Based on the above embodiment, different from Figure 1 , Figure 3 A specific implementation method of "storing the user identifiers in the multiple user access requests and the corresponding inspection results in the record table, and assigning the serial numbers corresponding to the multiple user access request identifiers" in S102 is shown. Figure 3 Introduced in S1021-S1023.
[0091] S1021: storing the user identifications in the multiple user access requests and the corresponding inspection results in a record table.
[0092] In this embodiment, the user identifiers in the obtained multiple user access requests and the check results corresponding to each user access request are stored in a record table. For example, the record table may be shown in Table 1 below.
[0093] Table 1: Recording table
[0094] Alloc Pass_flag Addr_id Len Outstanding 1 1 Id1 2 0 1 0 Id2 4 1 0 1 Id3 0 1 1 1 Id3 0 0
[0095] Among them, Alloc is used to indicate whether the table entry is occupied.
[0096] Pass_flag is used to indicate whether the access check is successful; if the check is successful, it is 1; if the check fails, it is 0. Addr_id is used to indicate the user ID carried in this access.
[0097] Len is used to represent the length of this access.
[0098] Outstanding is used to represent the access sequence with the same user ID; for example, the first access sequence number is 0, the second access sequence number is 1, and then increases in sequence.
[0099] For each of the multiple user access requests, S1022 and S1023 are executed.
[0100] S1022: Determine the cumulative number of times the user identifier in the user access request appears in the record table.
[0101] In this embodiment, for one user access request among multiple user access requests, for example, the user identifier of the user access request is Id1, the cumulative number of occurrences of the user identifier is determined in the record table.
[0102] S1023: Determine the serial number corresponding to the user access request according to the accumulated number of times.
[0103] In this embodiment, for example, for a user access request with a user identifier of Id1, if the cumulative number of times Id1 appears is 2, then the sequence number corresponding to this access request is 2.
[0104] Combination Figure 3 As shown, before executing S1021-S1023, refer to the previous embodiment and execute S101 to implement the check of the user access request; after executing S1021-S1023, refer to the previous embodiment and execute S103-S104 to implement the response return of the user access request.
[0105] In this embodiment, user identifiers in multiple user access requests and corresponding inspection results are stored in a record table; for each user access request in the multiple user access requests, the cumulative number of times the user identifier in the user access request appears in the record table is determined, and the serial number corresponding to the user access request is determined based on the cumulative number, so that when processing concurrent requests, the processing order of the requests can be ensured according to the serial number, so as to improve the response speed and avoid delays.
[0106] See also Figure 4 , which is a flow chart of another embodiment of a data access method provided by the present application. Based on the above embodiment, the user access request includes the data length, and the method may further include:
[0107] S105: Temporarily store the correct response to be returned in the cache.
[0108] The correct response to be returned includes at least one of the following:
[0109] The correct response to the user access request whose check result is correct and whose sequence number is not the minimum value, or,
[0110] A correct response carrying the unreturned data corresponding to the user access request with the smallest sequence number; wherein the sum of the data lengths of the returned data and the unreturned data corresponding to the user access request with the smallest sequence number is equal to the data length.
[0111] In this embodiment, for the correct responses to be returned that cannot be immediately returned to the client from the downstream, they are temporarily stored in the cache. The correct responses to be returned include the correct responses corresponding to the user access requests whose inspection results are correct and whose sequence numbers are not the minimum value; for example, there are two access requests in the record table whose user identifier is Id1 and whose inspection results are correct, and whose corresponding sequence numbers are 0 and 1, respectively; the correct response corresponding to the access request with sequence number 0 should be returned first. At this time, the correct response corresponding to the access request with sequence number 1 obtained from the downstream cannot be returned immediately, so the correct response is temporarily stored in the cache. If the correct response corresponding to the access request with sequence number 0 has been returned, the corresponding table entry is released, and the correct response corresponding to the access request with sequence number 1 is obtained from the cache and returned to the user.
[0112] In this embodiment, by temporarily storing the correct response to be returned in the cache area, the overhead of repeated calculations and data processing can be effectively reduced, the utilization efficiency of system resources can be improved, and the response can be quickly provided when the user request arrives, reducing the response return time and delay, thereby improving the user experience. For the user access request with the smallest sequence number, even if its response data has not been fully returned, part of the cached data can be returned first, while the remaining data continues to be processed, thereby improving the response speed.
[0113] Furthermore, based on the above embodiment, the method further includes:
[0114] When the responses to the first user access request and the second user access request are returned, the entries corresponding to the first user access request and the second user access request are released.
[0115] In this embodiment, when a failure response corresponding to the first user access request and a correct response corresponding to the second user access request are returned, the corresponding table entries are released to reduce the occupation of the table entries.
[0116] According to the sequence number corresponding to the user access request in the record table, the corresponding correct response is returned in sequence.
[0117] A specific implementation method includes:
[0118] The serial numbers corresponding to the remaining user access requests in the record table that have the same user identifier as the first user access request are reduced by one.
[0119] The serial numbers corresponding to the remaining user access requests in the record table that have the same user identifier as the second user access request are reduced by one.
[0120] In this embodiment, for example, the record table records 4 access request information of the user ID Id1, and the serial numbers corresponding to these 4 access requests are 0, 1, 2, and 3. When the correct response to the access request corresponding to serial number 0 has been returned, after the entry corresponding to the access request is released, the serial numbers 1, 2, and 3 corresponding to the remaining 3 access requests are reduced by 1, that is, the serial numbers corresponding to the remaining 3 access requests after update are 0, 1, and 2. At this time, the correct response returned is the correct response to the access request corresponding to serial number 0. By analogy, the correct responses corresponding to the access request corresponding to serial number 0 are returned in sequence.
[0121] As another implementation of this embodiment, returning corresponding correct responses in sequence according to the sequence numbers corresponding to the user access requests in the record table may include:
[0122] According to the serial numbers corresponding to the user access requests in the record table, the correct responses corresponding to the smallest serial number among the access requests that have not yet returned responses are returned in sequence.
[0123] For example, the record table records 4 access request information of user ID 1, and the serial numbers corresponding to these 4 access requests are 0, 1, 2, and 3. When the correct response to the access request corresponding to serial number 0 has been returned, the table entry corresponding to the access request is released, and the serial numbers corresponding to the remaining 3 access requests that have not returned responses are 1, 2, and 3. At this time, the next correct response returned is the correct response to the access request corresponding to serial number 1.
[0124] In this embodiment, when the responses to the first user access request and the second user access request are returned, the table entries corresponding to the first user access request and the second user access request are released to realize the recovery of the occupied memory or storage space, thereby optimizing resource utilization, helping to reduce the memory occupation of the system and improving the operating efficiency of the system. Then, the sequence numbers corresponding to the remaining user access requests with the same user identifier as the first user access request in the record table are reduced by one, and the sequence numbers corresponding to the remaining user access requests with the same user identifier as the second user access request in the record table are reduced by one, so as to ensure the accuracy of the sequence numbers in the record table, so as to return the response with the minimum sequence number to the user, thereby improving the response speed.
[0125] like Figure 5 As shown, this figure is a schematic diagram of the read access response return process.
[0126] At the first moment, when a user access request 1 with a user identifier of 0 and a data length of 3 is received, the returned correct response includes the returned data rdata0_0 and rdata0_1, and the unreturned data are rdata0_2 and rdata0_3.
[0127] At the second moment, when a user access request 2 with a user identifier of 1 and a data length of 2 is received, a failure response with a data length of 2 is returned, and the data in the returned failure response includes rdata1_0, rdata1_1 and rdata1_2; while returning the failure response, the unreturned data rdata0_2 of the user access request 1 received from the downstream is temporarily stored in the cache area, and after determining that the return of the failure response to the user access request 2 is completed, the correct response corresponding to the unreturned data rdata0_2 of the user access request 1 is returned to the user.
[0128] At the third moment, when a user access request 3 with a user identifier of 2 and a data length of 1 is received, the returned correct response includes the returned data rdata2_0, and the unreturned data is rdata2_1.
[0129] At the fourth moment, when a user access request 4 with a user identifier of 3 and a data length of 3 is received, a failure response with a data length of 3 is returned, and the data in the returned failure response includes rdata3_0, rdata3_1, rdata3_2 and rdata3_3; while returning the failure response, the unreturned data rdata0_3 of the user access request 1 and the unreturned data rdata2_1 of the user access request 3 received from the downstream are temporarily stored in the cache area, and after determining that the return of the failure response to the user access request 4 is completed, the correct response corresponding to the unreturned data rdata0_3 of the user access request 1 is first returned to the user, and then the correct response corresponding to the unreturned data rdata2_1 of the user access request 3 is returned to the user.
[0130] See also Figure 6 , which is a schematic diagram of the structure of an embodiment of a data access device provided by the present application. Figure 6 As shown, the device 60 includes: an inspection module 61, a storage module 62, a first response module 63 and a second response module 64.
[0131] The inspection module 61 is used to perform access inspection on the access addresses and access information in the obtained multiple user access requests according to the preset inspection conditions, and determine the inspection results corresponding to each of the multiple user access requests. The storage module 62 is used to store the user identifiers and the corresponding inspection results in the multiple user access requests into the record table, and the serial numbers corresponding to the multiple user access request identifiers; the serial numbers are used to characterize the order of the user access requests corresponding to the user identifiers. The first response module 63 determines from the record table the first user access request with a failed inspection result and a minimum serial number, generates a failed response and returns it to the user. When the second response module 64 determines that there is no user access request with a failed inspection result and a minimum serial number in the record table, it determines the second user access request with a correct inspection result and a minimum serial number, obtains the correct response corresponding to the second user access request and returns it to the user.
[0132] Further, based on the above embodiment, the storage module 62 is specifically used to perform the following steps for each user access request among multiple user access requests: determine the cumulative number of times the user identifier in the user access request appears in the record table; determine the serial number corresponding to the user access request based on the cumulative number.
[0133] Further, based on the above embodiment, the user access request includes a data length, and the storage module 62 can also be used to temporarily store the correct response to be returned in a cache area; the correct response to be returned includes at least one of the following: a correct response corresponding to a user access request whose inspection result is correct and whose sequence number is not the minimum value, or a correct response carrying non-returned data corresponding to a user access request with a sequence number of the minimum value; wherein the sum of the data lengths of the returned data and the non-returned data corresponding to the user access request with the minimum sequence number is equal to the data length.
[0134] Further, based on the above embodiment, the first response module 63 is also used to release the table entry corresponding to the first user access request when the response to the first user access request is returned; and reduce the serial numbers corresponding to the remaining user access requests with the same user identifier as the first user access request in the record table by one.
[0135] The second response module 64 is further configured to release the table entry corresponding to the second user access request when a response to the second user access request is returned; and to reduce the sequence numbers corresponding to the remaining user access requests having the same user identifier as the second user access request in the record table by one.
[0136] Further, based on the above embodiment, the inspection module 61 is specifically used to determine that when multiple conditions in the preset inspection conditions are met, the inspection result is successful; when it is determined that at least one of the multiple conditions is not met, the inspection result is failed.
[0137] Further, based on the above embodiments, the preset check conditions in the check module 61 include one or more of an address range check, an access type check, a permission level check, and a bus privilege check of the transmission protocol; wherein the address range check is to determine the address group corresponding to the access address in the user access request; the access type check is to check whether the access data type satisfies the read and / or write enable preset in the control register; the permission level check is to check whether the permission level bit in the user access request satisfies the security level of the memory; the bus privilege check of the transmission protocol is to check whether the user access request satisfies the bus rules.
[0138] Further, based on the above embodiment, the checking module 61 can also be used to obtain the permission level bit in the user access request; map the permission level bit to the security level according to preset rules; if the security level corresponding to the user access request is higher than or equal to the security level of the memory, the permission level check corresponding to the user access request passes; or, if the security level corresponding to the user access request is lower than the security level of the memory, the permission level check corresponding to the user access request fails.
[0139] See also Figure 7 , which is a schematic diagram of the structure of an embodiment of an electronic device provided by the present application. The electronic device 70 may include: a processor 71 and a memory 72.
[0140] The processor 71 is communicatively connected with the memory 72 , and the memory 72 is used to store computer-executable instructions; the processor 71 is configured to execute the technical solution in any of the aforementioned method embodiments by executing the computer-executable instructions stored in the memory 72 .
[0141] Optionally, the memory 72 may be independent or integrated with the processor 71. Optionally, when the memory 72 is a device independent of the processor 71, the electronic device 70 may further include: a bus for connecting the above devices.
[0142] The electronic device is used to execute the technical solution in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.
[0143] An embodiment of the present application also provides a computer-readable storage medium, which stores computer execution instructions. When the computer execution instructions are executed by a processor, they are used to implement the method described above. The implementation principles and technical effects are similar and will not be repeated here.
[0144] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0145] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data access method, characterized in that: include: Performing access checks on access addresses and access information in multiple user access requests obtained according to preset check conditions, and determining check results corresponding to each of the multiple user access requests; The user identifiers in the multiple user access requests and the corresponding inspection results are stored in a record table, and the serial numbers corresponding to the multiple user access request identifiers are assigned; The serial number is used to represent the order of the user access request corresponding to the user identifier; Determine from the record table the first user access request whose check result is a failure and whose sequence number is the minimum value, generate a failure response and return it to the user; When it is determined that the user access request with the failed check result and the minimum sequence number does not exist in the record table, a second user access request with the correct check result and the minimum sequence number is determined, and a correct response corresponding to the second user access request is obtained and returned to the user.
2. The method according to claim 1, characterized in that The serial numbers corresponding to the multiple user access request identifiers include: For each user access request in the multiple user access requests, perform the following steps: Determine the cumulative number of times the user identifier in the user access request appears in the record table; The serial number corresponding to the user access request is determined according to the accumulated number of times.
3. The method according to claim 1, characterized in that The user access request includes a data length, and the method further includes: Temporarily store the correct response to be returned in the cache; the correct response to be returned includes at least one of the following: The check result is correct and the sequence number is not the minimum value, corresponding to the correct response of the user access request, or, A correct response carrying the non-returned data corresponding to the user access request with the sequence number being the minimum value; wherein the sum of the data lengths of the returned data corresponding to the user access request with the sequence number being the minimum value and the non-returned data is equal to the data length.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When responses to the first user access request and the second user access request are returned, releasing the table entries corresponding to the first user access request and the second user access request; Decrement the sequence numbers corresponding to the remaining user access requests in the record table that have the same user identifier as the first user access request by one; The sequence numbers corresponding to the remaining user access requests in the record table that have the same user identifier as the second user access request are reduced by one.
5. The method according to claim 1, characterized in that The step of performing access checks on access addresses and access information in the obtained multiple user access requests according to the preset check conditions, and determining the check results corresponding to the multiple user access requests respectively, includes: When it is determined that multiple conditions in the preset inspection conditions are met, the inspection result is successful; When it is determined that at least one of the multiple conditions is not satisfied, the check result is failure.
6. The method according to claim 5, characterized in that The preset check condition includes one or more of an address range check, an access type check, an authority level check, and a bus privilege check of a transmission protocol; Among them, the address range check is to determine the address group corresponding to the access address in the user access request; the access type check is to check whether the access data type satisfies the read and / or write enable preset in the control register; the permission level check is to check whether the permission level bit in the user access request satisfies the security level of the memory; the bus privilege check of the transmission protocol is to check whether the user access request satisfies the bus rules.
7. The method according to claim 6, characterized in that The permission level checking methods include: Obtaining the permission level bit in the user access request; Mapping the permission level bits to security levels according to preset rules; If the security level corresponding to the user access request is higher than or equal to the security level of the storage device, the permission level check corresponding to the user access request passes; or, If the security level corresponding to the user access request is lower than the security level of the memory, the permission level check corresponding to the user access request fails.
8. A data access device, characterized in that: include: A checking module, configured to perform access checks on access addresses and access information in multiple user access requests acquired according to preset checking conditions, and determine the check results corresponding to each of the multiple user access requests; A storage module, used for storing the user identifiers in the multiple user access requests and the corresponding inspection results into a record table, and assigning serial numbers corresponding to the multiple user access request identifiers; The serial number is used to represent the order of the user access request corresponding to the user identifier; A first response module, configured to determine from the record table the first user access request for which the check result is a failure and the sequence number is the minimum value, generate a failure response and return it to the user; The second response module is used to determine the second user access request with the check result being correct and the serial number being the smallest value when it is determined that there is no user access request with the check result being failed and the serial number being the smallest value in the record table, obtain the correct response corresponding to the second user access request and return it to the user.
9. An electronic device, characterized in that: The device comprises: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.