Address conversion method and device, electronic equipment and storage medium

By optimizing the address conversion method, querying user information and splicing addresses, the number of descriptors and storage costs are reduced, address conversion efficiency and real-time problems in multi-user scenarios are solved, and more efficient address conversion is achieved.

CN119127737AActive Publication Date: 2024-12-13MOORE THREADS TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411088416.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-12-13
Estimated Expiration
2044-08-08

AI Technical Summary

Technical Problem

In large heterogeneous computing system-level chips, existing address conversion technology leads to excessive storage costs of descriptors, especially in multi-user scenarios, which makes it difficult to effectively reduce the storage costs of descriptors, affecting the efficiency and real-time nature of address conversion.

Method used

By querying user information to obtain the starting storage address of the descriptor set, the position of the destination descriptor is determined using the position index, and the high and low addresses are spliced ​​for address conversion, reducing the number of descriptors used by the user, and optimizing the descriptor storage space Allocation and migration to ensure continuous storage of descriptor sets.

Benefits of technology

It effectively reduces the storage cost of descriptors, improves the efficiency and real-timeness of address conversion, is suitable for multi-user scenarios, reduces access to main memory, and simplifies logical implementation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127737A_ABST
    Figure CN119127737A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of address management, and provides an address conversion method and device, electronic equipment and a storage medium. The method comprises the steps that according to a user identifier, user information is inquired, and the user information comprises an initial storage address of a descriptor set used by a user; obtaining a storage address of a target descriptor in the descriptor set according to the initial storage address and the positioning index of the descriptor set, and querying a high-order address included in the target descriptor based on the storage address; splicing the high-order address and the low-order address to obtain a converted address; wherein the number of the descriptors used by the user is equal to the ratio of the size of the physical space accessed by the user to the size of the physical space described by a single descriptor, and the storage addresses of the plurality of descriptors included in the descriptor set used by the same user are continuous. According to the method, the storage cost of the descriptors can be reduced when the number of the users is large, and the method is more suitable for a multi-user address conversion scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of address management technology, and in particular to an address conversion method, device, electronic device and storage medium. Background Art

[0002] For large heterogeneous computing system-on-chip (SOC), in scenarios such as virtualization, the conversion of address perspectives of different computing units is an important functional requirement. The general address management unit is complex to implement, the address description granularity is very small, and a certain amount of memory is required to store the page table, which results in the need to read the main memory during address conversion, reducing the efficiency of the bus pipeline. In addition, address conversion also requires more complex logic to implement, which reduces the real-time performance of address conversion.

[0003] In actual applications, faster and larger-granular address conversion is required, so some existing technical solutions propose a customized address conversion unit, in which descriptors used to describe physical spaces are stored, the physical spaces described by the descriptors are set in advance, and address conversion is performed by reading the descriptors. This solution sets a large number of descriptors that can describe all physical spaces for each user. When the number of users is large, the total number of descriptors is extremely large, which greatly increases the storage cost of the descriptors.

[0004] Therefore, how to reduce the storage cost of descriptors when the number of users is large to adapt to multi-user address conversion scenarios has become a technical problem that needs to be solved urgently in this field. Summary of the invention

[0005] In view of this, the present disclosure proposes an address conversion method, device, electronic device and storage medium. The method can reduce the storage cost of descriptors when the number of users is large, and is more suitable for multi-user address conversion scenarios.

[0006] According to one aspect of the present disclosure, an address conversion method is provided, the method comprising: querying user information of the user according to a user identifier included in an address conversion request initiated by the user, the user information including a starting storage address of a descriptor set used by the user; obtaining a storage address of a destination descriptor in the descriptor set according to the starting storage address of the descriptor set and a positioning index included in the address conversion request, the positioning index being used to determine a position of the destination descriptor in the descriptor set; querying a high-order address included in the destination descriptor according to the storage address of the destination descriptor; concatenating the high-order address and a low-order address included in the address conversion request to obtain a converted address; wherein the number of descriptors used by the user is equal to the ratio of the size of a physical space accessed by the user to the size of a physical space described by a single descriptor, and the storage addresses of multiple descriptors included in the descriptor set used by the same user are continuous.

[0007] In a possible implementation, the descriptor is stored in a descriptor storage space, and the size of the descriptor storage space is K×T×(1+X)+Y, wherein K is equal to the ratio of the maximum value of the physical space to the size of the physical space described by a single descriptor, and K is a positive integer; T represents the size of the descriptor storage space occupied by a single descriptor, and T is a positive integer; the descriptor storage space of K×T×1 is used by users of all user types, and the descriptor storage space of K×T×X is used by users of the administrator type, the physical space accessed by a user of a single user type is less than the maximum value of the physical space, the sum of the physical spaces accessed by users of all user types is equal to the maximum value of the physical space, the physical spaces accessed by users of different user types do not overlap, the physical space accessed by each user of the administrator type includes the physical space accessed by users of all user types, and the physical space accessed by a single user of the administrator type is equal to the maximum value of the physical space; X is equal to the expected number of users of the administrator type, and X is an integer greater than or equal to 0; Y represents the size of the descriptor storage space used for data migration, and Y is an integer greater than or equal to 0 and is an integer multiple of T.

[0008] In a possible implementation, the used descriptor also includes a used mark, and the method also includes: determining the size of the physical space accessed by the new user according to a request of the newly created user; determining the number of descriptors used by the new user according to the size of the physical space accessed by the new user and the size of the physical space described by a single descriptor; querying whether there is a first space in the descriptor storage space that can continuously store a corresponding number of descriptors and is not used by other users according to the number of descriptors used by the new user; when a first space that meets the conditions is queried, writing the descriptor used by the new user in the first space, and writing the high-order address of the physical space described by the descriptor and the used mark in the descriptor used by the new user; after writing the descriptor used by the new user in the first space, establishing user information of the new user according to the starting storage address of the descriptor set used by the new user, the number of descriptors used by the new user, and the user identifier of the new user.

[0009] In a possible implementation, the start storage address of the descriptor set used by the new user and the end storage address of the descriptor set used by the existing user are continuous.

[0010] In a possible implementation, when a first space that meets the conditions is queried, writing the descriptor used by the new user in the first space includes: when there are multiple first spaces that meet the conditions, querying the maximum number of descriptors allowed to be stored in each first space; when the maximum number of descriptors allowed to be stored in any first space is equal to the number of descriptors used by the new user, writing the descriptor used by the new user in the first space.

[0011] In a possible implementation, the method further includes: querying user information of the user to be deleted according to a user identifier included in a request for deleting the user, and determining a descriptor set used by the user to be deleted; clearing a used mark of each descriptor in the descriptor set used by the user to be deleted, or changing the used mark of each descriptor in the descriptor set used by the user to be deleted to an unused mark; and clearing the user information of the user to be deleted.

[0012] In a possible implementation, the descriptor set is valid when it includes a used mark, and the method further includes: each time a user is deleted, migrating the valid descriptor sets in the descriptor storage space so that all valid descriptor sets in the descriptor storage space are stored continuously; and updating the user information of the user corresponding to each valid descriptor set according to the starting storage address of each valid descriptor set after the migration.

[0013] In a possible implementation, the descriptor set is valid when it includes a used mark, and the method further includes: when the first space that meets the condition is not queried, migrating the valid descriptor sets in the descriptor storage space so that all valid descriptor sets in the descriptor storage space are stored continuously; and updating the user information of the user corresponding to each valid descriptor set according to the starting storage address of each valid descriptor set after the migration.

[0014] In a possible implementation, the migrating valid descriptor sets in the descriptor storage space so that all valid descriptor sets in the descriptor storage space are stored continuously includes: taking the first valid descriptor set in the descriptor storage space as the current descriptor set, and determining whether there is unused space before the starting storage address of the current descriptor set; when there is unused space, determining a migration mode of the current descriptor set according to a size relationship between the unused space and the storage space occupied by the current descriptor set, the migration mode including a direct migration mode and an indirect migration mode, migrating the current descriptor set according to the determined migration mode, taking the next valid descriptor set as the current descriptor set, and re-executing the steps of determining whether there is unused space before the starting storage address of the current descriptor set and subsequent steps; when there is no unused space, taking the next valid descriptor set as the current descriptor set, and re-executing the steps of determining whether there is unused space before the starting storage address of the current descriptor set and subsequent steps.

[0015] According to another aspect of the present disclosure, an address conversion device is provided, the device comprising: a first query module, used to query user information of the user according to a user identifier included in an address conversion request initiated by the user, the user information including a starting storage address of a descriptor set used by the user; a first determination module, used to obtain a storage address of a destination descriptor in the descriptor set according to the starting storage address of the descriptor set and a positioning index included in the address conversion request, the positioning index being used to determine a position of the destination descriptor in the descriptor set; a second query module, used to query a high-order address included in the destination descriptor according to the storage address of the destination descriptor; a splicing module, used to splice the high-order address and the low-order address included in the address conversion request to obtain a converted address; wherein the number of descriptors used by the user is equal to the ratio of the size of the physical space accessed by the user to the size of the physical space described by a single descriptor, and the storage addresses of multiple descriptors included in the descriptor set used by the same user are continuous.

[0016] In a possible implementation, the descriptor is stored in a descriptor storage space, and the size of the descriptor storage space is K×T×(1+X)+Y, wherein K is equal to the ratio of the maximum value of the physical space to the size of the physical space described by a single descriptor, and K is a positive integer; T represents the size of the descriptor storage space occupied by a single descriptor, and T is a positive integer; the descriptor storage space of K×T×1 is used by users of all user types, and the descriptor storage space of K×T×X is used by users of the administrator type, the physical space accessed by a user of a single user type is less than the maximum value of the physical space, the sum of the physical spaces accessed by users of all user types is equal to the maximum value of the physical space, the physical spaces accessed by users of different user types do not overlap, the physical space accessed by each user of the administrator type includes the physical space accessed by users of all user types, and the physical space accessed by a single user of the administrator type is equal to the maximum value of the physical space; X is equal to the expected number of users of the administrator type, and X is an integer greater than or equal to 0; Y represents the size of the descriptor storage space used for data migration, and Y is an integer greater than or equal to 0 and is an integer multiple of T.

[0017] In a possible implementation, the used descriptor also includes a used mark, and the device also includes: a second determination module, which is used to determine the size of the physical space accessed by the new user according to the request of the new user; a third determination module, which is used to determine the number of descriptors used by the new user according to the size of the physical space accessed by the new user and the size of the physical space described by a single descriptor; a third query module, which is used to query whether there is a first space in the descriptor storage space that can continuously store a corresponding number of descriptors and is not used by other users according to the number of descriptors used by the new user; a first writing module, which is used to write the descriptor used by the new user into the first space when a first space that meets the conditions is queried, and write the high-order address of the physical space described by the descriptor and the used mark into the descriptor used by the new user; and a first establishing module, which is used to establish the user information of the new user according to the starting storage address of the descriptor set used by the new user, the number of descriptors used by the new user, and the user identifier of the new user after writing the descriptor used by the new user into the first space.

[0018] In a possible implementation, the start storage address of the descriptor set used by the new user and the end storage address of the descriptor set used by the existing user are continuous.

[0019] In a possible implementation, when a first space that meets the conditions is queried, writing the descriptor used by the new user in the first space includes: when there are multiple first spaces that meet the conditions, querying the maximum number of descriptors allowed to be stored in each first space; when the maximum number of descriptors allowed to be stored in any first space is equal to the number of descriptors used by the new user, writing the descriptor used by the new user in the first space.

[0020] In a possible implementation, the device further includes: a fourth query module, used to query user information of the user to be deleted according to the user identifier included in the request for deleting the user, and determine the descriptor set used by the user to be deleted; a first clearing module, used to clear the used mark of each descriptor in the descriptor set used by the user to be deleted, or to change the used mark of each descriptor in the descriptor set used by the user to be deleted to an unused mark; and a second clearing module, used to clear the user information of the user to be deleted.

[0021] In a possible implementation, the descriptor set is valid when it includes a used mark, and the device further includes: a first migration module, which is used to migrate the valid descriptor sets in the descriptor storage space each time a user is deleted, so that all valid descriptor sets in the descriptor storage space are stored continuously; and a first update module, which is used to update the user information of the user corresponding to each valid descriptor set according to the starting storage address of each valid descriptor set after the migration.

[0022] In a possible implementation, the descriptor set is valid when it includes a used mark, and the device further includes: a second migration module, which is used to migrate the valid descriptor sets in the descriptor storage space when the first space that meets the condition is not queried, so that all valid descriptor sets in the descriptor storage space are stored continuously; and a second updating module, which is used to update the user information of the user corresponding to each valid descriptor set according to the starting storage address of the migrated valid descriptor set.

[0023] In a possible implementation, the migrating valid descriptor sets in the descriptor storage space so that all valid descriptor sets in the descriptor storage space are stored continuously includes: taking the first valid descriptor set in the descriptor storage space as the current descriptor set, and determining whether there is unused space before the starting storage address of the current descriptor set; when there is unused space, determining a migration mode of the current descriptor set according to a size relationship between the unused space and the storage space occupied by the current descriptor set, the migration mode including a direct migration mode and an indirect migration mode, migrating the current descriptor set according to the determined migration mode, taking the next valid descriptor set as the current descriptor set, and re-executing the steps of determining whether there is unused space before the starting storage address of the current descriptor set and subsequent steps; when there is no unused space, taking the next valid descriptor set as the current descriptor set, and re-executing the steps of determining whether there is unused space before the starting storage address of the current descriptor set and subsequent steps.

[0024] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0025] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement the above method when executed by a processor.

[0026] According to another aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0027] According to the address conversion method of the embodiment of the present disclosure, according to the user identifier included in the address conversion request initiated by the user, the user information of the user is queried to obtain the starting storage address of the descriptor set used by the user; since the storage addresses of multiple descriptors included in the descriptor set used by the same user are continuous, the positioning index is used to determine the position of the destination descriptor in the descriptor set, so according to the starting storage address of the descriptor set and the positioning index included in the address conversion request, the storage address of the destination descriptor in the descriptor set can be obtained; according to the storage address of the destination descriptor, the high-order address included in the destination descriptor is queried, and the high-order address and the low-order address included in the address conversion request are spliced ​​to obtain the converted address. Since the number of descriptors used by the user is equal to the ratio of the size of the physical space accessed by the user to the size of the physical space described by a single descriptor, the number of descriptors used by a single user can be reduced. When the number of users is large, the total number of descriptors used by all users can be greatly reduced, thereby reducing the storage cost of the descriptors, which is more suitable for the address conversion scenario of multiple users.

[0028] This method does not need to access the main memory, so it can improve the efficiency of the bus pipeline, can be implemented with simpler logic, and can improve the real-time performance of address conversion.

[0029] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0031] Figure 1a An exemplary application scenario of the address conversion method according to an embodiment of the present disclosure is shown.

[0032] Figure 1b The corresponding relationship between the contents stored in the user information table and the descriptor table according to the embodiment of the present disclosure is shown.

[0033] Figure 2a A schematic diagram showing the process of the address conversion method according to an embodiment of the present disclosure.

[0034] Figure 2b A schematic diagram showing the process of the address conversion method according to an embodiment of the present disclosure.

[0035] Figure 3 A schematic diagram showing a data structure of user information according to an embodiment of the present disclosure.

[0036] Figure 4A schematic diagram showing the data structure of an address to be converted, a destination descriptor, and a converted address according to an embodiment of the present disclosure.

[0037] Figure 5 An example of descriptors stored in a descriptor storage space according to an embodiment of the present disclosure is shown.

[0038] Figure 6a An example of deleting the descriptors stored in the descriptor storage space after the user is deleted according to an embodiment of the present disclosure is shown.

[0039] Figure 6b An example of a live migration descriptor according to an embodiment of the present disclosure is shown.

[0040] Figure 7 A schematic diagram showing the structure of an address conversion device according to an embodiment of the present disclosure.

[0041] Figure 8 A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0042] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0043] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0044] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.

[0045] The following introduces the address conversion method of the address conversion unit customized in the prior art.

[0046] The prior art solution reserves the maximum physical space access capability for each user, that is, each user uses a descriptor set that can describe all physical spaces separately. Each user may correspond to a register group for storing the descriptor set used by the user.

[0047] The starting storage address of the descriptor set used by each user and the number of descriptors included in the descriptor set are fixed. The number of descriptors used by a user depends on the size of the physical space accessed by the user and the address description granularity. This scheme is based on the premise that the size of the physical space accessed by each user is equal to the maximum value of the physical space. Therefore, the number of descriptors used by different users is the same. The address description granularity indicates the size of the physical space that can be described by a single descriptor.

[0048] For any user's address mapping request, the storage address of the target descriptor to be queried can be calculated based on the starting storage address of the descriptor set used by the user and the positioning index included in the address mapping request. The high-order address can be obtained by querying the target descriptor, and the converted address can be obtained by concatenating the high-order address with the low-order address included in the address mapping request.

[0049] The scheme sets the total number of descriptors that can be stored in the register group as follows:

[0050] Total number of descriptors = maximum value of physical space / address description granularity × number of users;

[0051] If the number of users is large and the address description granularity is relatively small, the storage resources of the descriptor will be consumed very much, so that the cost is too high to be implemented.

[0052] For example, in a certain design, the maximum number of users is 120, the maximum physical space is 80GB, and the address description granularity is 128MB, then the total number of descriptors = 80×1024 / 128×120 = 76800. Assuming that each descriptor requires 4B of storage space, the storage space of the register group used to store the descriptors must be at least 300KB.

[0053] There are more and more users who need to support address conversion on SOC, and the physical spaces that different users actually need to access are not consistent. Even when the same user uses different applications, the physical spaces that actually need to be accessed are not consistent. In the case that the cost of the existing technology is too high and the technical effect is inconsistent with the needs of the application scenario, how to reduce the storage cost of the descriptor when the number of users is large to be suitable for the address conversion scenario of multiple users has become a technical problem that needs to be solved urgently in this field.

[0054] In view of this, the present disclosure proposes an address conversion method, device, electronic device and storage medium. The method can reduce the storage cost of descriptors when the number of users is large, and is more suitable for multi-user address conversion scenarios.

[0055] Figure 1a An exemplary application scenario of the address conversion method according to an embodiment of the present disclosure is shown.

[0056] like Figure 1a As shown, the address conversion method of the present disclosure can be performed by an address conversion device. The address conversion device can be set on the SOC. The address conversion device may include a descriptor storage space for storing descriptors and a user information storage space for storing user information. The user information in the user information storage space and the descriptor set used by the user in the descriptor storage space are one-to-one corresponding, Figure 1b The corresponding relationship between the contents stored in the user information storage space and the descriptor storage space according to an embodiment of the present disclosure is shown.

[0057] like Figure 1b As shown, the user information of user 0 corresponds to the descriptor set used by user 0 in the descriptor storage space, the user information of user 1 corresponds to the descriptor set used by user 1 in the descriptor storage space, and the user information of user 2 corresponds to the descriptor set used by user 2 in the descriptor storage space. User information can be arranged closely in the user information storage space, or arranged at certain intervals. Descriptors used by the same user are arranged closely in the descriptor storage space, and descriptor sets used by different users can be arranged closely or at intervals in the descriptor storage space. The embodiments of the present disclosure do not limit the storage method of user information in the user information storage space and the storage method of descriptors in the descriptor storage space.

[0058] The SOC can run multiple virtual machines. Each virtual machine can be used by one user. When a user uses an application in a virtual machine, an address conversion request may be generated. The address conversion request is received by an address conversion device. The address conversion device queries the user information in the user information storage space in response to the address conversion request, queries the descriptor in the descriptor storage space according to the queried user information and the address conversion request, obtains the converted address according to the address information recorded in the queried descriptor and the address mapping request, and thus completes the address conversion.

[0059] The converted address can be sent to other modules (not shown) downstream that need to use the address, and used when other modules read and write data.

[0060] Those skilled in the art should understand that the address translation request in the embodiments of the present disclosure may also be generated by other objects besides the virtual machine, and the embodiments of the present disclosure do not limit the generator of the address translation request.

[0061] Figure 2a and Figure 2b A schematic diagram showing the process of the address conversion method according to an embodiment of the present disclosure.

[0062] like Figure 2a and Figure 2b As shown, in a possible implementation, the present disclosure proposes an address conversion method, the method comprising:

[0063] Step S21, querying the user information of the user according to the user identifier included in the address conversion request initiated by the user, the user information including the starting storage address of the descriptor set used by the user;

[0064] Step S22, obtaining the storage address of the destination descriptor in the descriptor set according to the starting storage address of the descriptor set and the positioning index included in the address conversion request, wherein the positioning index is used to determine the position of the destination descriptor in the descriptor set;

[0065] Step S23, querying the high-order address included in the destination descriptor according to the storage address of the destination descriptor;

[0066] Step S24, concatenating the high-order address and the low-order address included in the address conversion request to obtain a converted address;

[0067] The number of descriptors used by the user is equal to the ratio of the size of the physical space accessed by the user to the size of the physical space described by a single descriptor, and the storage addresses of multiple descriptors included in the descriptor set used by the same user are continuous.

[0068] The address conversion request initiated by the user may include two parts. The first part is the user identification (Identity document, ID), and the user identification of different users is different. The second part is the address to be converted. The address to be converted further includes a low-order address and a positioning index. The low-order address can be directly used as the low-order address in the converted address, and the positioning index is used to determine the position of the destination descriptor (that is, the descriptor storing the high-order address in the converted address) in the descriptor set.

[0069] It should be understood that in the embodiments of the present disclosure, descriptors can be stored in a descriptor storage space, and the size of the descriptor storage space can be preset. In combination with the maximum value of the physical space and the preset address description granularity (that is, the size of the physical space described by a single descriptor), the number of bits of the high-order address and the low-order address can be predetermined. For example, assuming that the maximum value of the physical space is 80GB and the address description granularity is 128MB, the number of descriptors required to fully describe the largest physical space = 80×1024 / 128=640. In the embodiments of the present disclosure, the size of the physical space that the user needs to access can be set according to the actual needs of the user, and is usually less than the maximum value of the physical space. When setting the number of bits of the positioning index, it can be set according to the size of the physical space that the user needs to access is equal to the maximum value of the physical space. Therefore, the positioning index requires at least 10 bits (2 9 <640<2 10 ).

[0070] In one example, the positioning index can be stored in the high bit of the address to be converted, and the low bit address can be stored in the low bit of the address to be converted. In this case, the information stored in the highest 10 bits of the address to be converted is the positioning index. The part other than the positioning index is the low bit address.

[0071] Each user information may store the starting storage address of the descriptor set used by the same user. The number of descriptors used by a user is equal to the ratio of the size of the physical space accessed by the user to the address description granularity. The address description granularity of the descriptor may be pre-set. Assuming that the address description granularity is T, and the size of the physical space that a certain user needs to access is S1 (the units of S1 and T are the same), the number of descriptors used by the user may be equal to S1 / T.

[0072] Figure 3 A schematic diagram showing a data structure of user information according to an embodiment of the present disclosure.

[0073] like Figure 3 As shown, the user information includes 32 bits, of which the starting storage address of the descriptor set used by the user includes 14 bits, which are stored in bits 16 to 29; other bits can store more information related to the user, for example, bits 0 to 9 can be used to store the number of descriptors used by the user, etc. The embodiments of the present disclosure do not limit the specific content of the user information storage.

[0074] When storing user information, the user identifier can be used as an index of the user information. In step S21, the user information of the user can be queried according to the user identifier included in the address conversion request initiated by the user, thereby obtaining the starting storage address of the descriptor set used by the user.

[0075] In step S22, the position of the destination descriptor in the descriptor set can be determined based on the positioning index. The storage addresses of multiple descriptors used by the same user are continuous. Therefore, the storage address of the destination descriptor can be determined by combining the position of the destination descriptor in the descriptor set, the starting storage address of the descriptor set, and the size of the physical space described by a single descriptor.

[0076] Assuming that the address description granularity is T, the starting storage address of the descriptor set used by the user is S2 (the units of S2 and T are the same), when the destination descriptor is the i-th descriptor in the descriptor set, the positioning index may indicate the value of i. Then the storage address of the destination descriptor may be [S2+(i-1)×T, S2+i×T].

[0077] The total number of bits of the converted address is pre-set, and the sum of the number of bits of the high-order address and the number of bits of the low-order address is equal to the total number of bits of the converted address. Therefore, the number of bits of the high-order address can be determined first according to the number of bits of the low-order address included in the address conversion request and the total number of bits of the converted address. In one example, the high-order address can be stored in the high position of the destination descriptor. In this case, in step S23, the destination descriptor can be found according to the storage address of the destination descriptor, and then according to the number of bits of the high-order address, the address stored in the corresponding number of bits queried from the highest position of the destination descriptor is the high-order address included in the destination descriptor. In step S24, the high-order address and the low-order address included in the address conversion request are spliced ​​to obtain the converted address.

[0078] Figure 4 A schematic diagram showing the data structure of an address to be converted, a destination descriptor, and a converted address according to an embodiment of the present disclosure.

[0079] like Figure 4 As shown, the address to be converted includes 36 bits in total, the low-order address includes 27 bits, which are stored at bit 0 to bit 26; the positioning index includes 10 bits, which are stored at bit 27 to bit 36.

[0080] Assuming that the converted address includes 48 bits, when the low-order address includes 27 bits, the number of bits of the high-order address can be equal to 48-27=21. The destination descriptor includes 32 bits, so the address stored in bits 11 to 31 of the destination descriptor is the high-order address. The destination descriptor also records the address description granularity.

[0081] In the converted address obtained by concatenating the low-order address and the high-order address, the low-order address includes 27 bits, which are stored in bits 0 to 26; the high-order address includes 21 bits, which are stored in bits 27 to 47. In this way, the address conversion operation can be realized.

[0082] Those skilled in the art should understand that the data structure of the destination descriptor described above is applicable to any descriptor. The remaining bits in the destination descriptor can be used to store more information related to the destination descriptor, for example, the 0th bit can store a used flag indicating whether the current descriptor has been used, etc. Those skilled in the art should understand that the destination descriptor only needs to include the high-order address, and the embodiments of the present disclosure do not limit the specific content included in the destination descriptor.

[0083] Those skilled in the art should understand that the storage method of the low-order address and the positioning index in the address to be converted, and the storage method of the high-order address in the destination descriptor should not be limited to Figure 4As shown in the method, as long as the low-order address and the positioning index can be accurately found in the address conversion request, and the high-order address can be accurately found in the destination descriptor, the embodiment of the present disclosure does not limit the storage method of the low-order address and the positioning index in the address to be converted, and the storage method of the high-order address in the destination descriptor.

[0084] According to the address conversion method of the embodiment of the present disclosure, according to the user identifier included in the address conversion request initiated by the user, the user information of the user is queried to obtain the starting storage address of the descriptor set used by the user; since the storage addresses of multiple descriptors included in the descriptor set used by the same user are continuous, the positioning index is used to determine the position of the destination descriptor in the descriptor set, so according to the starting storage address of the descriptor set and the positioning index included in the address conversion request, the storage address of the destination descriptor in the descriptor set can be obtained; according to the storage address of the destination descriptor, the high-order address included in the destination descriptor is queried, and the high-order address and the low-order address included in the address conversion request are spliced ​​to obtain the converted address. Since the number of descriptors used by the user is equal to the ratio of the size of the physical space accessed by the user to the size of the physical space described by a single descriptor, the number of descriptors used by a single user can be reduced. When the number of users is large, the total number of descriptors used by all users can be greatly reduced, thereby reducing the storage cost of the descriptors, which is more suitable for the address conversion scenario of multiple users.

[0085] This method does not need to access the main memory, so it can improve the efficiency of the bus pipeline, can be implemented with simpler logic, and can improve the real-time performance of address conversion.

[0086] The following describes how to set the size of the descriptor storage space in an embodiment of the present disclosure.

[0087] In a possible implementation, the descriptor is stored in a descriptor storage space, and the size of the descriptor storage space is K×T×(1+X)+Y, where

[0088] K is equal to the ratio of the maximum value of the physical space to the size of the physical space described by a single descriptor, and K is a positive integer;

[0089] T represents the size of the descriptor storage space occupied by a single descriptor, and T is a positive integer;

[0090] The descriptor storage space of K×T×1 is used by users of all user types, the descriptor storage space of K×T×X is used by users of manager type, the physical space accessed by a user of a single user type is less than the maximum physical space value, the sum of the physical spaces accessed by users of all user types is equal to the maximum physical space value, the physical spaces accessed by users of different user types do not overlap, the physical space accessed by each user of manager type includes the physical space accessed by users of all user types, and the physical space accessed by a single user of manager type is equal to the maximum physical space value;

[0091] X is equal to the expected number of administrator-type users, and X is an integer greater than or equal to 0;

[0092] Y represents the size of the descriptor storage space used for data migration. Y is a number greater than or equal to 0 and is an integer multiple of T.

[0093] For example, the descriptors of the present disclosure may be stored in a descriptor storage space. The total number of descriptors that can be stored in the descriptor storage space may be preset. There may be two types of users, user type and administrator type. Users cannot access the physical space accessed by other users (that is, the physical spaces accessed by users of different user types do not overlap), and administrators can access the physical space accessible to all users. Therefore, the physical space accessed by users of each user type is less than the maximum physical space, and the physical space accessed by users of each administrator type is equal to the maximum physical space.

[0094] The address space where the converted address is located is often determined and equal to the maximum value of the physical space. The address spaces accessed by different users have certain overlap and exclusivity (related to the type of user, and examples of overlap and exclusivity are given later), so the sum of the physical spaces accessed by all users is less than or equal to the maximum value of the physical space. In this case, the present disclosure sets the size of the descriptor storage space in the following manner:

[0095] Descriptor storage space = K × T × (1 + X) + Y;

[0096] K = maximum value of the physical space / size of the physical space described by a single descriptor. K descriptors can fully describe the entire physical space. K is a positive integer.

[0097] The address conversion method disclosed in the present invention serves at least the users of user type. The physical space accessed by a single user is less than the maximum value of the physical space, and the sum of the physical spaces accessed by all users is equal to the maximum value of the physical space, so the maximum value of the total number of descriptors actually used by all users is equal to K. In other words, the descriptor storage space must be able to store at least K×1 descriptors for use by users of all user types. The size of the descriptor storage space occupied by a single descriptor is T, and T is a positive integer, so at least K×T×1 descriptor storage space is required for use by users of all user types.

[0098] Optionally, the address conversion method of the present disclosure can also serve administrator-type users. X represents the expected number of administrators, and X is an integer greater than or equal to 0. When not serving administrator-type users, X can be equal to 0, in which case the storage resources required for the descriptor storage space can be further reduced. When serving administrator-type users, X can be greater than 0, in which case the applicable scenarios of the address conversion method can be expanded. The embodiments of the present disclosure do not limit the specific value of X.

[0099] The administrator can access the physical space that all users need to access, that is, the physical space accessed by a single administrator-type user is equal to the maximum physical space, and the physical space accessed by each administrator-type user includes the physical space accessed by all user-type users. Since the maximum total number of descriptors actually used by all users is equal to K, each administrator can also reserve storage space that can store K descriptors. In this case, when the expected number of administrators is X, the descriptor storage space needs to store K×X more descriptors for administrators to use, that is, K×T×X descriptor storage space is used by administrator-type users.

[0100] It should be understood that the descriptor used by each user is only for the user himself, but the physical space described by the descriptors used by the administrator and any user is overlapping (overlapping), and the physical space described by the descriptors used by different users is different (exclusive).

[0101] Optionally, the address conversion method disclosed in the present invention may also have the function of performing data migration on the descriptor storage space. Y represents the size of the descriptor storage space used for data migration, and Y is an integer greater than or equal to 0 and is an integer multiple of T. When data migration is not required, Y may be equal to 0, and the storage resources required for the descriptor storage space may be further reduced. When the function of data migration is added, Y may be greater than 0, and the utilization rate of the descriptors in the descriptor storage space may be improved.

[0102] Those skilled in the art should understand that if it is desired to migrate as much data as possible each time data is migrated, Y may be equal to K×T; if it is desired to minimize storage resource consumption while retaining the data migration function, Y may be set to a number less than K×T. For example, assuming that the physical space accessed by a single user in an application scenario does not exceed 1 / W of the maximum value of the physical space (W is greater than 1), Y may be equal to 1 / W of the maximum value of the physical space. The embodiments of the present disclosure do not limit the specific value of Y.

[0103] In an example, assuming K=640, X=1, Y=640, T=4 (unit: Bit), the total number of descriptors is reduced to 640×(1+2)+640=2560, and the descriptor storage space is only 2560×4Bit=10KB, which greatly saves the storage resource consumption of storing descriptors.

[0104] Exemplarily, data migration refers to migrating the valid descriptor sets that are not stored continuously in the descriptor storage space to a suitable location so that the valid descriptor sets in the descriptor storage space are stored continuously. In this case, the storage space that can continuously store new descriptors will become larger and can be allocated to users who access a larger address space. Exemplary implementations of data migration are given below.

[0105] During the execution of the address translation method, a new user may start using the virtual machine. The virtual machine may issue a request to create a new user, which may include the user ID, type, and size of the physical space accessed by the new user. The address translation method may allocate descriptor storage space for the new user and create user information according to the request of the new user.

[0106] An exemplary allocation method of descriptor storage space is introduced below.

[0107] In a possible implementation, the used descriptor further includes a used flag, and the method further includes:

[0108] According to the number of descriptors used by the new user, query whether there is a first space in the descriptor storage space that can continuously store a corresponding number of descriptors and is not used by other users;

[0109] When a first space that meets the condition is found, a descriptor used by the new user is written into the first space, and a high-order address and a used flag of the physical space described by the descriptor are written into the descriptor used by the new user;

[0110] After the descriptors used by the new user are written into the first space, user information of the new user is established according to the starting storage address of the descriptor set used by the new user, the number of descriptors used by the new user, and the user identifier of the new user.

[0111] For example, the request of a newly created user may carry the size of the physical space accessed by the user, so the size of the physical space accessed by the new user can be determined based on the request of the newly created user. The number of descriptors used by the new user can be obtained based on the ratio of the size of the physical space accessed by the new user to the size of the physical space described by a single descriptor. For example, when the size of the physical space accessed by the new user is 612MB and the size of the physical space described by a single descriptor is 128MB, the number of descriptors used by the new user can be equal to 612MB / 128MB=4.

[0112] When any descriptor is used by a user, a used flag can be added to the descriptor, and the storage space occupied by the descriptor has been used by the user. Correspondingly, when the user no longer uses the descriptor, the used flag included in the descriptor can be cleared, and the storage space occupied by the descriptor is not used by the user, and new descriptors can continue to be stored. Therefore, whether the used flag is included can be used as a basis for judging whether the storage space occupied by the descriptor is used by the user.

[0113] The used flag can be located at a specific position in the descriptor, such as Figure 4 As shown, it may be located at position 0. The used flag may be "1". The embodiment of the present disclosure does not limit the specific setting method of the used flag.

[0114] Figure 5 An example of descriptors stored in a descriptor storage space according to an embodiment of the present disclosure is shown.

[0115] like Figure 5 As shown, assuming that one storage location of the descriptor storage space can store exactly one descriptor, the contents stored in the 1st to 4th storage locations include a used mark, so the 1st to 4th storage locations have stored descriptors used by the user. The contents stored in the 5th to 9th storage locations do not include a used mark, so the 5th to 9th storage locations are unused.

[0116] In this case, according to the number of descriptors used by the new user, it can be queried whether there is a first space in the descriptor storage space that can continuously store a corresponding number of descriptors and is not used by other users. Figure 5 In the example of , if the number of descriptors used by the new user is 4, the first space may be a space including the 5th to 9th storage locations.

[0117] When the first space that meets the conditions is queried, the descriptor used by the new user is written in the first space, and the high-order address and used mark of the physical space described by the descriptor are written in the descriptor used by the new user. Optionally, when writing the descriptor in the first space, writing can be started from the starting storage address of the first space, so that after writing the descriptor used by the user, the space in the descriptor storage space that can continuously store descriptors and is not used by the user is larger. For example, 4 descriptors used by the new user can be written in the 5th to 8th storage positions of the first space, and the high-order address and used mark of the physical space described by the descriptor are written in each descriptor. Among them, the physical space described by the descriptor used by the new user is different from the physical space described by the descriptor used by the existing user; the physical space described by different descriptors used by the same user is different. The physical space described by different descriptors can be continuous or discontinuous, and the present disclosure does not limit this.

[0118] After the descriptors used by the new user are written into the first space, the user information of the new user can be established according to the starting storage address of the descriptor set used by the new user, the number of descriptors used by the new user, and the user ID of the new user. Figure 5 For example, after writing the descriptors of the new user into the 5th to 8th storage locations, the starting storage address of the descriptor set used by the new user is also the starting storage address of the 5th storage location. According to the starting storage address, the number of descriptors used by the new user (equal to 4) and the user ID of the new user, the user information of the new user can be established. Among them, the user ID of the new user is used as an index of the user information of the new user and may not be included in the user information of the new user. The number of descriptors used by the user will be used when deleting the user and migrating data. Examples of deleting users and migrating data are given later.

[0119] In this way, the descriptor writing and user information establishment of the new user can be completed.

[0120] Those skilled in the art should understand that when creating new user information, the user information may not include the number of descriptors used by the user, and the address conversion method can still complete the address conversion normally. The embodiment of the present disclosure does not limit whether the user information must include the number of descriptors used by the user.

[0121] The address conversion method disclosed in the present invention can dynamically use the descriptor storage space according to the actual needs of each user by introducing user information in conjunction with the descriptor, thereby realizing efficient and flexible use of descriptor storage resources. When the maximum value of the physical space is constant, adding a user only requires adding a piece of user information to store the starting storage address of the descriptor set used by the user, so the actual overhead added by the new user is very small.

[0122] In a possible implementation, the start storage address of the descriptor set used by the new user and the end storage address of the descriptor set used by the existing user are continuous.

[0123] For example, an existing user refers to a user who is still using the virtual machine. The descriptor sets used by such users are still stored in the descriptor storage space, and the descriptor sets include a used mark. The starting storage address of the descriptor set used by the new user and the ending storage address of the descriptor set used by the existing user can be continuous. Figure 5 For example, the end storage address of the descriptor set used by the existing user may be the 4th storage position. If the descriptor set of the new user is stored in the descriptor storage space, the storage may start from the 5th storage position, so that the starting storage address of the descriptor set used by the new user and the end storage address of the descriptor set used by the existing user are continuous.

[0124] In this case, the descriptor sets used by each user are more compact in the descriptor storage space, so that the unused storage space in the descriptor storage space that can continuously store descriptors is larger.

[0125] Those skilled in the art should understand that even if the starting storage address of the descriptor set used by the new user is not continuous with the ending storage address of the descriptor set used by the existing user, when the descriptor storage space is large, it does not affect the storage of the descriptors used by the new user. If the first space cannot be queried, data migration can be performed. The embodiments of the present disclosure do not limit whether the starting storage address of the descriptor set used by the new user and the ending storage address of the descriptor set used by the existing user are continuous.

[0126] In a possible implementation, when a first space that meets the condition is found, writing a descriptor used by the new user into the first space includes:

[0127] When there are multiple first spaces that meet the conditions, query the maximum number of descriptors that each first space is allowed to store;

[0128] When the maximum number of descriptors allowed to be stored in any first space is equal to the number of descriptors used by the new user, the descriptors used by the new user are written into the first space.

[0129] For example, if the starting storage address of the descriptor set used by a new user is not continuous with the ending storage address of the descriptor set used by an existing user, or some descriptor sets are invalid, the unused storage space in the descriptor storage space will be divided into multiple segments. Figure 1bAs shown, unused storage space 1, unused storage space 2, and unused storage space 3 are discontinuous. In this case, when searching for the first space in the descriptor storage space, multiple first spaces that meet the conditions may be found, for example, unused storage space 1 can be used as the first first space, unused storage space 2 can be used as the second first space, and unused storage space 3 can be used as the third first space.

[0130] The sizes of each unused storage space may be different, so the sizes of each first space may be different. It should be understood that if a first space (such as unused storage space 2) stores descriptor sets used by existing users (such as the descriptor set used by user 0 and the descriptor set used by user 2) before and after, and the maximum number of descriptors allowed to be stored in the first space is exactly equal to the number of descriptors used by the new user, then after using the first space to store the descriptors used by the new user (such as user 3), the descriptor set used by user 0, the descriptor set used by user 2, and the descriptor set used by user 3 are stored continuously, which can improve the utilization rate of the descriptor storage space. Therefore, when there are multiple first spaces that meet the conditions, the maximum number of descriptors allowed to be stored in each first space can be queried; when the maximum number of descriptors allowed to be stored in any first space is equal to the number of descriptors used by the new user, the descriptors used by the new user are written into the first space.

[0131] If the maximum number of descriptors allowed to be stored in all first spaces is not equal to the number of descriptors used by the new user, the smallest first space can be selected to write the descriptors used by the new user, so that after the descriptors used by the new user are written, there is more space in the descriptor storage space that can continuously store descriptors and is not used by other users.

[0132] An exemplary method for deleting a user is described below.

[0133] In a possible implementation, the method further includes:

[0134] According to the user identifier included in the request to delete the user, query the user information of the user to be deleted, and determine the descriptor set used by the user to be deleted;

[0135] Clearing the used flag of each descriptor in the descriptor set used by the user to be deleted, or changing the used flag of each descriptor in the descriptor set used by the user to be deleted to an unused flag;

[0136] Clear the user information of the user to be deleted.

[0137] For example, during the execution of the address translation method, some existing users may no longer use the virtual machine. At this time, the descriptor of the user stored in the descriptor storage space and the user information of the user stored in the user information storage space need to be cleared. The virtual machine may issue a request to delete the user, and the request may include the user ID of the user to be deleted.

[0138] The address conversion method can query the user information of the user to be deleted according to the request to delete the user, and determine the position of the descriptor set used by the user to be deleted in the descriptor storage space according to the starting storage address of the descriptor set used by the user recorded in the user information and the number of descriptors used by the user. The descriptor set used by the user to be deleted can be found according to the determined position, and the used mark of each descriptor in the descriptor set used by the user to be deleted can be directly cleared; the used mark of each descriptor in the descriptor set used by the user to be deleted can also be changed to an unused mark, for example, when the used mark is "1", the unused mark can be "0", as long as each descriptor in the descriptor set used by the user to be deleted no longer stores the used mark. In this case, the storage space originally occupied by the descriptor set used by the user to be deleted can be used to store the descriptors used by the new user.

[0139] Accordingly, the user information of the user to be deleted in the user information storage space may be cleared, so that the user information storage space can record the user information of more users.

[0140] The operation of deleting a user may cause the unused storage space in the descriptor storage space to be no longer continuous. If the unused storage space in the descriptor storage space is too fragmented, it may result in that when a user of a new user type is created, the first space that meets the conditions cannot be found in the descriptor storage space. Figure 6a An example of deleting the descriptors stored in the descriptor storage space after the user is deleted according to an embodiment of the present disclosure is shown.

[0141] like Figure 6a As shown, it is assumed that the descriptor sets used by user 1, user 2, user 3, user 4, and user 5 are stored continuously. If user 2 and user 4 are deleted, the storage space occupied by the descriptor sets originally used by user 2 and user 4 is released. If a new user is to be created, but the physical space accessed by the new user is larger than the sum of the physical spaces that can be described by any continuously stored descriptors in the descriptor storage space, there is no way to write the descriptors used by the new user into the descriptor storage space. Therefore, the address conversion method disclosed in the present invention also proposes to migrate the data of the descriptors, so that the space in the descriptor storage space that can continuously store descriptors and is not used by users is larger.

[0142] An exemplary method for data migration is described below.

[0143] In a possible implementation, the descriptor set is valid when it includes a used flag, and the method further includes:

[0144] Each time a user is deleted, the valid descriptor sets in the descriptor storage space are migrated so that all valid descriptor sets in the descriptor storage space are stored continuously;

[0145] According to the starting storage address of each valid descriptor set after the migration, the user information of the user corresponding to the valid descriptor set is updated.

[0146] For example, the storage space for data migration can be set at the end of the descriptor storage space. If the storage space for data migration is relatively small, for example, smaller than the maximum value of the physical space, the number of descriptors that can be migrated at one time will be relatively small. If too many descriptors need to be migrated, it will cause great data migration pressure.

[0147] Therefore, when the storage space for data migration is relatively small, real-time data migration can be adopted. Each time a user is deleted, the valid descriptor set in the descriptor storage space is migrated, so that the valid descriptor set in the descriptor storage space is continuous. Wherein, when the descriptor set includes a used mark, it means that the user to which the descriptor set belongs is still using the virtual machine, and the descriptor set is valid.

[0148] In a possible implementation, migrating valid descriptor sets in the descriptor storage space so that all valid descriptor sets in the descriptor storage space are stored continuously includes:

[0149] The first valid descriptor set in the descriptor storage space is used as the current descriptor set, and it is determined whether there is unused space before the starting storage address of the current descriptor set;

[0150] When there is unused space, a migration mode of the current descriptor set is determined according to a size relationship between the unused space and the storage space occupied by the current descriptor set, the migration mode including a direct migration mode and an indirect migration mode, the current descriptor set is migrated according to the determined migration mode, the next valid descriptor set is used as the current descriptor set, and the steps of determining whether there is unused space before the starting storage address of the current descriptor set and subsequent steps are re-executed;

[0151] When there is no unused space, the next valid descriptor set is used as the current descriptor set, and the steps of determining whether there is unused space before the start storage address of the current descriptor set and subsequent steps are re-executed.

[0152] For example, each time a user is deleted, it is possible to start from the first valid descriptor set in the descriptor storage space and determine whether there is any unused space before the start storage address of the descriptor set. If it is determined that there is unused space, the descriptor set and each subsequent valid descriptor set need to be migrated. If it is determined that there is no unused space, it is continued to determine whether there is any unused space before the start storage address of the next valid descriptor set.

[0153] When it is determined that there is unused space, the migration method can be determined based on the size relationship between the unused space and the storage space occupied by the descriptor set. There are two optional migration methods. If the unused space is greater than or equal to the storage space occupied by the descriptor set, a direct migration method can be used to directly copy the descriptor set to the unused space, delete the used mark in the storage space originally occupied by the descriptor set or replace it with an unused mark, and the migration of the descriptor set can be completed. If the unused space is smaller than the storage space occupied by the descriptor set, an indirect migration method can be used to first copy the descriptor set to the end of the descriptor storage space, and delete the used mark in the storage space originally occupied by the descriptor set or replace it with an unused mark, and then copy the descriptor set copied to the end of the descriptor storage space to the unused space and the storage space originally occupied by the descriptor set, and finally delete the used mark of the descriptor set copied to the end of the descriptor storage space or replace it with an unused mark, and the migration of the descriptor set can be completed.

[0154] Figure 6b An example of a live migration descriptor according to an embodiment of the present disclosure is shown.

[0155] by Figure 6b For example, assuming that user 2 is deleted first and user 4 is deleted later, after deleting user 2, the descriptor sets used by user 1, user 3, user 4, and user 5 are still valid. Since there is no unused space before the starting storage address of the descriptor set used by user 1, and there is unused space before the starting storage address of the descriptor set used by user 3, the descriptor sets used by user 3, user 4, and user 5 need to be migrated. The descriptor sets used by user 3, user 4, and user 5 can be migrated in sequence. When migrating the descriptor sets used by each user, the migration method is determined based on the size relationship between the unused space before the starting storage address of the descriptor set used by the user and the storage space occupied by the descriptor set, and the migration is completed according to the determined migration method.

[0156] After deleting user 4, the descriptor sets used by user 1, user 3, and user 5 are still valid. Since there is no unused space before the starting storage address of the descriptor sets used by user 1 and user 3, and there is unused space before the starting storage address of the descriptor set used by user 5, only the descriptor set used by user 5 needs to be migrated. When migrating the descriptor set used by user 5, the migration method is determined according to the size relationship between the unused space before the starting storage address of the descriptor set used by user 5 and the storage space occupied by the descriptor set, and the migration is completed according to the determined migration method.

[0157] According to the starting storage address of each valid descriptor set after migration, the starting storage address of the user information of the user corresponding to the descriptor set may be updated, wherein the user information of the user corresponding to the descriptor set that has not been migrated may not be updated.

[0158] Those skilled in the art should understand that if multiple descriptor sets to be migrated are stored continuously and the descriptor storage space they occupy is smaller than the descriptor storage space used for data migration, then the multiple descriptor sets can also be migrated together, and the user information of the user to which each descriptor set belongs can be modified after the migration. In this case, the starting storage address of the descriptor set stored in the descriptor storage space in response to the request of the newly created user can be continuous with the ending storage address of the descriptor set used by the existing user, so that the number of migrations of the descriptor set is smaller.

[0159] Real-time data migration can minimize the fragmentation of descriptor storage space and consume less descriptor storage resources. Data migration can be implemented by background applications and has no impact on users.

[0160] Another exemplary method of data migration is described below.

[0161] In a possible implementation, the descriptor set is valid when it includes a used flag, and the method further includes:

[0162] When the first space satisfying the condition is not found in the query, the valid descriptor sets in the descriptor storage space are migrated so that all valid descriptor sets in the descriptor storage space are stored continuously;

[0163] According to the starting storage address of each valid descriptor set after the migration, the user information of the user corresponding to the valid descriptor set is updated.

[0164] For example, data migration requires time cost and data processing cost. The more times the migration is performed, the higher the cost. If you want to save the cost of data migration as much as possible, you can also set the storage space used for data migration to be larger, for example, greater than or equal to the maximum value of the physical space, minimize the number of data migrations, and perform large-scale data migration when the first space that meets the conditions is not found. Compared with real-time data migration, the difference between this data migration method and real-time data migration is mainly the different timing of data migration and the size of the storage space used for data migration. The specific data migration method is similar. For example, starting from the first valid descriptor set in the descriptor storage space, first determine whether there is unused space before the starting storage address of the descriptor set. When there is unused space, determine the migration method based on the size relationship between the unused space and the storage space occupied by the descriptor set, and migrate the descriptor set according to the determined migration method; when there is no unused space, continue to determine whether there is unused space before the starting storage address of the next valid descriptor. Similarly, if multiple descriptor sets to be migrated are stored continuously and the descriptor storage space they occupy is smaller than the descriptor storage space used for data migration, then the multiple descriptor sets can also be migrated together, and after the migration, the user information of the user to which each descriptor set belongs can be modified separately. An exemplary migration method (i.e., an exemplary method of migrating valid descriptor sets in the descriptor storage space so that all valid descriptor sets in the descriptor storage space are stored continuously) has been described above and will not be repeated here.

[0165] In this way, the number of data migrations can be reduced and the cost of data migration can be reduced.

[0166] Those skilled in the art should understand that if K×T×(1+X)=Y, that is, the size of the descriptor storage space used by all users is equal to the size of the descriptor storage space used for data migration, then the ping-pong cache mechanism can also be used to migrate valid descriptors. The descriptor storage space can be divided into two parts. When a new user is created, the descriptors used by the new user and the descriptors used by the existing users are stored in the same part (such as the first part). At this time, the entire space of the other part (such as the second part) is not used and can be used during migration. When migration is required, the descriptors are migrated from the first part to the second part and stored continuously. Thereafter, when a new user is created, the descriptors used by the new user and the descriptors used by the existing users are stored in the same part (the second part). The entire space of the other part (the first part) is not used and can be used during migration. In this way, data migration is made simpler.

[0167] It should be noted that when creating a new user, the first space may be queried in both parts. In this case, the first space queried in the part where the descriptors used by existing users are stored can be selected to store the descriptors used by the new user. That is, when the descriptors used by the existing users are stored in the first part, the first space queried in the first part is selected; when the descriptors used by the existing users are stored in the second part, the first space queried in the second part is selected.

[0168] Those skilled in the art should understand that there are more options for data migration methods, as long as the valid descriptor sets in the descriptor storage space can be migrated so that all valid descriptor sets in the descriptor storage space are stored continuously. The present disclosure does not limit the specific selection of data migration method.

[0169] The present disclosure also provides an address conversion device, Figure 7 A schematic diagram showing the structure of an address conversion device according to an embodiment of the present disclosure.

[0170] like Figure 7 As shown, in a possible implementation, the device includes:

[0171] A first query module 71, configured to query user information of the user according to a user identifier included in an address conversion request initiated by the user, wherein the user information includes a starting storage address of a descriptor set used by the user;

[0172] A first determining module 72, configured to obtain a storage address of a destination descriptor in the descriptor set according to a starting storage address of the descriptor set and a positioning index included in the address conversion request, wherein the positioning index is used to determine a position of the destination descriptor in the descriptor set;

[0173] A second query module 73, configured to query the high-order address included in the destination descriptor according to the storage address of the destination descriptor;

[0174] A splicing module 74, used for splicing the high-order address and the low-order address included in the address conversion request to obtain a converted address;

[0175] The number of descriptors used by the user is equal to the ratio of the size of the physical space accessed by the user to the size of the physical space described by a single descriptor, and the storage addresses of multiple descriptors included in the descriptor set used by the same user are continuous.

[0176] Furthermore, the address management device may also include a descriptor storage space and a user information storage space. The descriptor storage space is used to store descriptors, and the user information storage space is used to store user information.

[0177] In a possible implementation, the descriptor is stored in a descriptor storage space, and the size of the descriptor storage space is K×T×(1+X)+Y, wherein K is equal to the ratio of the maximum value of the physical space to the size of the physical space described by a single descriptor, and K is a positive integer; T represents the size of the descriptor storage space occupied by a single descriptor, and T is a positive integer; the descriptor storage space of K×T×1 is used by users of all user types, and the descriptor storage space of K×T×X is used by users of the administrator type, the physical space accessed by a user of a single user type is less than the maximum value of the physical space, the sum of the physical spaces accessed by users of all user types is equal to the maximum value of the physical space, the physical spaces accessed by users of different user types do not overlap, the physical space accessed by each user of the administrator type includes the physical space accessed by users of all user types, and the physical space accessed by a single user of the administrator type is equal to the maximum value of the physical space; X is equal to the expected number of users of the administrator type, and X is an integer greater than or equal to 0; Y represents the size of the descriptor storage space used for data migration, and Y is an integer greater than or equal to 0 and is an integer multiple of T.

[0178] In a possible implementation, the used descriptor also includes a used mark, and the device also includes: a second determination module, which is used to determine the size of the physical space accessed by the new user according to the request of the new user; a third determination module, which is used to determine the number of descriptors used by the new user according to the size of the physical space accessed by the new user and the size of the physical space described by a single descriptor; a third query module, which is used to query whether there is a first space in the descriptor storage space that can continuously store a corresponding number of descriptors and is not used by other users according to the number of descriptors used by the new user; a first writing module, which is used to write the descriptor used by the new user into the first space when a first space that meets the conditions is queried, and write the high-order address of the physical space described by the descriptor and the used mark into the descriptor used by the new user; and a first establishing module, which is used to establish the user information of the new user according to the starting storage address of the descriptor set used by the new user, the number of descriptors used by the new user, and the user identifier of the new user after writing the descriptor used by the new user into the first space.

[0179] In a possible implementation, the start storage address of the descriptor set used by the new user and the end storage address of the descriptor set used by the existing user are continuous.

[0180] In a possible implementation, when a first space that meets the conditions is queried, writing the descriptor used by the new user in the first space includes: when there are multiple first spaces that meet the conditions, querying the maximum number of descriptors allowed to be stored in each first space; when the maximum number of descriptors allowed to be stored in any first space is equal to the number of descriptors used by the new user, writing the descriptor used by the new user in the first space.

[0181] In a possible implementation, the device further includes: a fourth query module, used to query user information of the user to be deleted according to the user identifier included in the request for deleting the user, and determine the descriptor set used by the user to be deleted; a first clearing module, used to clear the used mark of each descriptor in the descriptor set used by the user to be deleted, or to change the used mark of each descriptor in the descriptor set used by the user to be deleted to an unused mark; and a second clearing module, used to clear the user information of the user to be deleted.

[0182] In a possible implementation, the descriptor set is valid when it includes a used mark, and the device further includes: a first migration module, which is used to migrate the valid descriptor sets in the descriptor storage space each time a user is deleted, so that all valid descriptor sets in the descriptor storage space are stored continuously; and a first update module, which is used to update the user information of the user corresponding to each valid descriptor set according to the starting storage address of each valid descriptor set after the migration.

[0183] In a possible implementation, the descriptor set is valid when it includes a used mark, and the device further includes: a second migration module, which is used to migrate the valid descriptor sets in the descriptor storage space when the first space that meets the condition is not queried, so that all valid descriptor sets in the descriptor storage space are stored continuously; and a second updating module, which is used to update the user information of the user corresponding to each valid descriptor set according to the starting storage address of the migrated valid descriptor set.

[0184] In a possible implementation, the migrating valid descriptor sets in the descriptor storage space so that all valid descriptor sets in the descriptor storage space are stored continuously includes: taking the first valid descriptor set in the descriptor storage space as the current descriptor set, and determining whether there is unused space before the starting storage address of the current descriptor set; when there is unused space, determining a migration mode of the current descriptor set according to a size relationship between the unused space and the storage space occupied by the current descriptor set, the migration mode including a direct migration mode and an indirect migration mode, migrating the current descriptor set according to the determined migration mode, taking the next valid descriptor set as the current descriptor set, and re-executing the steps of determining whether there is unused space before the starting storage address of the current descriptor set and subsequent steps; when there is no unused space, taking the next valid descriptor set as the current descriptor set, and re-executing the steps of determining whether there is unused space before the starting storage address of the current descriptor set and subsequent steps.

[0185] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0186] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0187] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.

[0188] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0189] Figure 8 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server or a terminal device. Figure 8, the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.

[0190] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.

[0191] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.

[0192] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.

[0193] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

[0194] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0195] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.

[0196] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0197] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0198] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0199] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.

[0200] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. An address conversion method, characterized in that: The method comprises: According to the user identifier included in the address conversion request initiated by the user, query the user information of the user, wherein the user information includes the starting storage address of the descriptor set used by the user; Obtaining a storage address of a destination descriptor in the descriptor set according to a starting storage address of the descriptor set and a positioning index included in the address conversion request, wherein the positioning index is used to determine a position of the destination descriptor in the descriptor set; According to the storage address of the destination descriptor, query the high-order address included in the destination descriptor; Concatenate the high-order address and the low-order address included in the address conversion request to obtain a converted address; The number of descriptors used by the user is equal to the ratio of the size of the physical space accessed by the user to the size of the physical space described by a single descriptor, and the storage addresses of multiple descriptors included in the descriptor set used by the same user are continuous.

2. The method according to claim 1, characterized in that The descriptor is stored in a descriptor storage space, the size of which is K×T×(1+X)+Y, where K is equal to the ratio of the maximum value of the physical space to the size of the physical space described by a single descriptor, and K is a positive integer; T represents the size of the descriptor storage space occupied by a single descriptor, and T is a positive integer; The descriptor storage space of K×T×1 is used by users of all user types, the descriptor storage space of K×T×X is used by users of manager type, the physical space accessed by a user of a single user type is less than the maximum physical space value, the sum of the physical spaces accessed by users of all user types is equal to the maximum physical space value, the physical spaces accessed by users of different user types do not overlap, the physical space accessed by each user of manager type includes the physical space accessed by users of all user types, and the physical space accessed by a single user of manager type is equal to the maximum physical space value; X is equal to the expected number of administrator-type users, and X is an integer greater than or equal to 0; Y represents the size of the descriptor storage space used for data migration. Y is an integer greater than or equal to 0 and is an integer multiple of T.

3. The method according to claim 2, characterized in that The used descriptor also includes a used flag, and the method further includes: Determine the size of the physical space accessed by the new user based on the request of the new user; Determining the number of descriptors used by the new user according to the size of the physical space accessed by the new user and the size of the physical space described by a single descriptor; According to the number of descriptors used by the new user, query whether there is a first space in the descriptor storage space that can continuously store a corresponding number of descriptors and is not used by other users; When a first space that meets the condition is found, a descriptor used by the new user is written into the first space, and a high-order address of the physical space described by the descriptor and the used mark are written into the descriptor used by the new user; After the descriptors used by the new user are written into the first space, user information of the new user is established according to the starting storage address of the descriptor set used by the new user, the number of descriptors used by the new user, and the user identifier of the new user.

4. The method according to claim 3, characterized in that The start storage address of the descriptor set used by the new user and the end storage address of the descriptor set used by the existing user are continuous.

5. The method according to claim 3, characterized in that: When a first space that meets the condition is found, writing a descriptor used by the new user into the first space includes: When there are multiple first spaces that meet the conditions, query the maximum number of descriptors that each first space is allowed to store; When the maximum number of descriptors allowed to be stored in any first space is equal to the number of descriptors used by the new user, the descriptors used by the new user are written into the first space.

6. The method according to any one of claims 3 to 5, characterized in that: The method further comprises: According to the user identifier included in the request to delete the user, query the user information of the user to be deleted, and determine the descriptor set used by the user to be deleted; Clearing the used flag of each descriptor in the descriptor set used by the user to be deleted, or changing the used flag of each descriptor in the descriptor set used by the user to be deleted to an unused flag; Clear the user information of the user to be deleted.

7. The method according to claim 4, characterized in that The descriptor set is valid when it includes a used flag, and the method further includes: Each time a user is deleted, a valid descriptor set in the descriptor storage space is migrated so that all valid descriptor sets in the descriptor storage space are stored continuously; According to the starting storage address of each valid descriptor set after the migration, the user information of the user corresponding to the valid descriptor set is updated.

8. The method according to claim 3, characterized in that The descriptor set is valid when it includes a used flag, and the method further includes: When no first space satisfying the condition is found, migrating valid descriptor sets in the descriptor storage space so that all valid descriptor sets in the descriptor storage space are stored continuously; According to the starting storage address of each valid descriptor set after the migration, the user information of the user corresponding to the valid descriptor set is updated.

9. The method according to claim 7 or 8, characterized in that: The migrating the valid descriptor sets in the descriptor storage space so that all valid descriptor sets in the descriptor storage space are stored continuously includes: Taking the first valid descriptor set in the descriptor storage space as the current descriptor set, and determining whether there is unused space before the start storage address of the current descriptor set; When there is unused space, a migration mode of the current descriptor set is determined according to a size relationship between the unused space and the storage space occupied by the current descriptor set, the migration mode including a direct migration mode and an indirect migration mode, the current descriptor set is migrated according to the determined migration mode, the next valid descriptor set is used as the current descriptor set, and the steps of determining whether there is unused space before the starting storage address of the current descriptor set and subsequent steps are re-executed; When there is no unused space, the next valid descriptor set is used as the current descriptor set, and the steps of determining whether there is unused space before the start storage address of the current descriptor set and subsequent steps are re-executed.

10. An address conversion device, characterized in that: The device comprises: A first query module, configured to query user information of the user according to a user identifier included in an address conversion request initiated by the user, wherein the user information includes a starting storage address of a descriptor set used by the user; A first determining module, configured to obtain a storage address of a destination descriptor in the descriptor set according to a starting storage address of the descriptor set and a positioning index included in the address conversion request, wherein the positioning index is used to determine a position of the destination descriptor in the descriptor set; A second query module, used for querying the high-order address included in the destination descriptor according to the storage address of the destination descriptor; A splicing module, used for splicing the high-order address and the low-order address included in the address conversion request to obtain a converted address; The number of descriptors used by the user is equal to the ratio of the size of the physical space accessed by the user to the size of the physical space described by a single descriptor, and the storage addresses of multiple descriptors included in the descriptor set used by the same user are continuous.

11. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the method described in any one of claims 1 to 9 when executing the instructions stored in the memory.

12. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Memory address mapping method and device and chip

    CN115658559A

  • Memory access system and method and medium

    CN115827502A

  • Address mapping method, data processing method, device, equipment and medium

    CN116126749A

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

    CN117743233A

  • Instruction execution method and device, electronic equipment and storage medium

    CN117992123A