Method, device and computer storage medium for configuring mirrored memory
By using the system interrupt switching state in a computer device, the configuration or disconnection of the mirror relationship in the BIOS state is achieved, thereby solving the problem of low flexibility in the mirror memory configuration in the prior art, and realizing dynamic adjustment and reconfiguration without interruption.
Patent Information
- Application Number
- CN202110948065.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-05-16
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2039-05-16
AI Technical Summary
In the prior art, the flexibility of configuring mirror memory is low, and the mirror memory cannot be dynamically adjusted or reconfigured after the computer device is started, resulting in business interruption.
Switch the state of the computer device through the system interrupt, switch from the OS state to the BIOS state, configure or disable the mirror relationship in the BIOS state, and switch back to the OS state after completion, to realize dynamic adjustment and reconfiguration of the mirror memory.
The mirror memory can be dynamically adjusted or reconfigured without restarting the computer device, avoiding business interruptions in the OS state and improving the flexibility of configuring mirror memory.
Smart Images

Figure CN113868151B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing technology, and in particular to a method and device for configuring mirror memory and a computer storage medium. Background Art
[0002] Mirror memory means: setting two independent physical memory spaces to a mirror relationship, configuring a virtual mirror memory space for the two physical memory spaces, and allocating a corresponding memory address range for the mirror memory space so that the computer device can access the mirror memory space through the memory address range. The two physical memory spaces have the same capacity, and the capacity of the mirror memory space is the same as the capacity of one of the physical memory spaces. When the computer device subsequently writes data to the mirror memory space, the data is actually written to the two physical memory spaces at the same time to achieve hot backup of the data.
[0003] In the related art, hardware resources are initialized during the startup of the computer device, such as mirror memory configuration. After the computer device is started, the configured mirror memory cannot be changed, resulting in low flexibility in configuring the mirror memory in the related art. Summary of the invention
[0004] The present application provides a method, device and computer storage medium for configuring mirror memory, which can improve the flexibility of configuring mirror memory. The technical solution is as follows:
[0005] In a first aspect, a method for configuring mirror memory is provided, the method being used for a computer device, the method comprising: obtaining a mirror memory assembly request, wherein the mirror memory assembly request carries a first identifier of a first physical memory space and a second identifier of a second physical memory space; switching a current state of the computer device from an operating system (OS) state to a basic input output system (BIOS) state through a system interrupt; configuring the first physical memory space and the second physical memory space to be in a mirror relationship, and obtaining identifiers of mirror memory spaces corresponding to the first physical memory space and the second physical memory space; switching a current state of the computer device from the BIOS state to the OS state; and allocating a memory address space to the mirror memory space according to the identifier of the mirror memory space.
[0006] In an embodiment of the present application, a BIOS and an OS are installed in a computer device. When the BIOS is running, the computer device is in a BIOS state, and when the OS is running, the computer device is in an OS state. After the computer device is started, if it is currently in an OS state and a mirror memory formation request is obtained, the computer device can switch from the OS state to the BIOS state through a system interrupt, for example, through a system management interrupt (SMI) signal. Then, the mirror relationship is configured in the BIOS state, and after the mirror relationship is configured, it is switched back to the OS state to achieve the reconfiguration of the mirror memory. The entire process does not require restarting the computer device, so that during the process of reconfiguring the mirror memory, the business in the OS state does not need to be interrupted, thereby improving the flexibility of configuring the mirror memory.
[0007] Optionally, before switching the current state of the computer device from the OS state to the BIOS state through a system interrupt, the method further includes: performing an offline operation on a memory address interval corresponding to the first physical memory space.
[0008] In an embodiment of the present application, if a corresponding memory address interval exists in the first physical memory space used to configure the mirror memory, that is, the first physical memory space has been used by the processor, it is necessary to first perform an offline operation on the memory address interval corresponding to the first physical memory space before the mirror relationship can be configured, otherwise the mirror memory cannot be successfully configured.
[0009] Optionally, the method also includes: receiving a mirror memory expansion request, wherein the mirror memory expansion request carries an identifier of the mirror memory space; performing an offline operation on a memory address interval corresponding to the mirror memory space; switching the current state of the computer device from an OS state to a BIOS state through a system interrupt; and releasing the mirror relationship between the first physical memory space and the second physical memory space.
[0010] In an embodiment of the present application, after the computer device is started, if it is currently in the OS state and needs to delete the mirror memory again, the computer device can switch to the BIOS state. Then, the mirror relationship is released in the BIOS state to achieve the reconfiguration of the mirror memory. The whole process does not require restarting the computer device, so that during the process of reconfiguring the mirror memory, the business in the OS state does not need to be interrupted, which improves the flexibility of configuring the mirror memory.
[0011] Optionally, after releasing the mirroring relationship between the first physical memory space and the second physical memory space, it also includes: generating a memory reporting message, the memory reporting message carrying the identifier of the first physical memory space; and allocating a memory address interval to the first physical memory space according to the memory reporting message.
[0012] When the computer device cancels the mirroring relationship in the BIOS state, the first physical memory space after canceling the mirroring relationship can also be reported to the computer device in the OS state, so that the computer device in the OS state can use the first physical memory space again, further improving the flexibility of configuring the mirrored memory.
[0013] In a second aspect, a device for configuring mirrored memory is provided, wherein the device for configuring mirrored memory has the function of implementing the method for configuring mirrored memory in the first aspect. The device for configuring mirrored memory includes at least one module, and the at least one module is used to implement the method for configuring mirrored memory provided in the first aspect.
[0014] In a third aspect, a computer device is provided, wherein the structure of the computer device includes a processor and a memory, wherein the memory is used to store a program for supporting a device for configuring mirrored memory to execute the method for configuring mirrored memory provided in the first aspect, and to store data involved in implementing the method for configuring mirrored memory provided in the first aspect. The processor is configured to execute the program stored in the memory. The operating device of the storage device may also include a communication bus, which is used to establish a connection between the processor and the memory.
[0015] In a fourth aspect, a computer storage medium is provided, wherein instructions are stored in the computer storage medium, and when the instructions are executed on a computer, the computer executes the method for configuring mirrored memory described in the first aspect.
[0016] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the method for configuring mirrored memory as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic diagram of a system for configuring mirrored memory provided by an embodiment of the present application;
[0018] Figure 2 It is a flow chart of a method for configuring mirrored memory provided in an embodiment of the present application;
[0019] Figure 3 It is a schematic diagram of a mapping relationship between a physical memory space and a memory address provided in an embodiment of the present application;
[0020] Figure 4 This is another schematic diagram of the mapping relationship between physical memory space and memory address provided in an embodiment of the present application;
[0021] Figure 5 This is another schematic diagram of the mapping relationship between physical memory space and memory address provided in an embodiment of the present application;
[0022] Figure 6 This is another schematic diagram of the mapping relationship between physical memory space and memory address provided in an embodiment of the present application;
[0023] Figure 7 is a flow chart of another method for configuring mirrored memory provided in an embodiment of the present application;
[0024] Figure 8 This is another schematic diagram of the mapping relationship between physical memory space and memory address provided in an embodiment of the present application;
[0025] Fig. 9 This is another schematic diagram of the mapping relationship between physical memory space and memory address provided in an embodiment of the present application;
[0026] Fig.10 This is another schematic diagram of the mapping relationship between physical memory space and memory address provided in an embodiment of the present application;
[0027] Fig.11 It is a structural diagram of a device for configuring mirrored memory provided in an embodiment of the present application;
[0028] Fig.12 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0030] Before explaining the method for configuring mirror memory provided in the embodiment of the present application, the application scenarios involved in the embodiment of the present application are briefly introduced. Computer devices can currently support two types of mirror memory. One is full mirroring, that is, the computer device divides the entire physical memory space into two parts, and configures the mirror memory through these two parts of physical memory space. In this case, the computer device is equivalent to sacrificing half of the physical memory space to configure the mirror memory. The other is partial mirroring, that is, the computer device uses part of the physical memory space to configure the mirror memory. In this case, the computer device only sacrifices part of the physical memory space in order to configure the mirror memory, and has greater flexibility. The method for configuring mirror memory provided in the embodiment of the present application is mainly used in the second case mentioned above, so that the computer device can dynamically adjust the mirror memory in the OS state.
[0031] Figure 1 Schematic diagram of a system for configuring mirrored memory provided by an embodiment of the present application. Figure 1 As shown, the system 100 includes a management system 101 and a computer device 102. The management system 101 and the computer device 102 are connected to each other wirelessly or wiredly for communication. The computer device can be a server or other equipment.
[0032] The computer device 102 is deployed with BIOS and OS. The computer device can run BIOS or OS. During the startup of the computer device, BIOS runs first to initialize hardware resources, such as configuring mirror memory. Then OS runs to run various services through initialized hardware resources. Among them, when the computer device runs BIOS, the computer device is said to be in BIOS state, and when the computer device runs OS, the computer device is said to be in OS state. The management system 101 can interact with the computer device 102 to implement the management of the computer device 102. For example, the computer device 102 can implement the configuration of mirror memory in the OS state. The specific implementation method will be highlighted in the following embodiments, and will not be described in detail here.
[0033] In addition, the management system 101 can be a device independent of the computer device 102, such as another computer device independent of the computer device 102. The management system 101 can also be a control chip, and integrated in the computer device 102. Among them, the control chip is configured with instructions to implement the management system function. In addition, the management system 101 can provide an access interface to the outside, and the access interface can be software or a web page, so that the operator can access the management system through the software or web page, thereby realizing the control of the computer device.
[0034] Figure 2This is a flowchart of a method for configuring mirrored memory provided by an embodiment of the present application, which is applied in a computer device. Figure 2 As shown, the method comprises the following steps:
[0035] Step 201: Obtain a mirrored memory build request, wherein the mirrored memory build request carries a first identifier of a first physical memory space and a second identifier of a second physical memory space.
[0036] The mirror memory building request in step 201 may be sent by the management system to the computer device, or may be initiated by the computer device itself in the OS state.
[0037] When the mirror memory building request in step 201 is sent by the management system to the computer device, the computer device may receive the mirror memory building request sent by the management system in the following two possible implementations:
[0038] In a first possible implementation, when the management system detects a mirror operation initiation instruction, it sends a mirror memory assembly request to the computer device in the OS state. The mirror operation initiation instruction can be triggered by an operator corresponding to the management system through a preset operation. At this time, the mirror operation initiation instruction can carry a first identifier for the first physical memory space and a second identifier for the second physical memory space.
[0039] The second possible implementation method is that when the computer device is in the OS state and a mirror operation initiation instruction is detected, the physical memory space is invisible to the processor because the computer device is in the OS state. Therefore, the computer device needs to send a mirror operation initiation request to the management system to instruct the management system to send a mirror memory assembly request based on the mirror operation initiation request. The mirror operation initiation request carries the identifier of each memory address interval in the two memory address intervals used to build the mirror memory. When the management system receives the mirror operation initiation request, it determines the physical memory space corresponding to each memory address interval, so as to send a mirror memory assembly request carrying the first identifier of the first physical memory space and the second identifier of the second physical memory space to the computer device. It should be pointed out that in one implementation method of the present application, a computer device in the OS state may also trigger the mirror memory assembly process by itself through a running program, etc., without sending a mirror operation initiation request to the management system, and then the management system sends the mirror memory assembly request. This application does not limit this.
[0040] In a second possible implementation, the mirror operation initiation instruction may also carry an identifier of a memory address interval. In this case, the computer device may divide the memory address interval into two memory address intervals of the same size, so as to send a mirror operation initiation request to the management system according to the identifier of each memory address interval in the two divided memory address intervals. That is, the mirror operation initiation request carries the identifier of each memory address interval in the two divided memory address intervals.
[0041] When the mirror memory building request in step 201 is initiated by the computer device itself in the OS state, the implementation method of the computer device initiating the mirror memory building request can be: when the computer device in the OS state detects a mirror operation initiation instruction, each memory address interval in the two memory address intervals used to build the mirror memory is determined, and then each physical memory space in the two physical memory spaces used to build the mirror memory is determined according to each memory address interval in the two memory address intervals, so as to initiate a mirror memory building request carrying a first identifier of the first physical memory space and a second identifier of the second physical memory space.
[0042] In the embodiment of the present application, the physical memory space may be a physical memory bar, such as a physical dual-inline memory module (DIMM). The physical memory space may also be a physical memory board, or part of the memory space in a physical memory bar. The embodiment of the present application is not specifically limited here.
[0043] Step 202: Switch the current state of the computer device from the OS state to the BIOS state through a system interrupt.
[0044] Since the OS and BIOS have mutually exclusive rights to use the processor of the computer device, in an embodiment of the present application, in order to enable the computer device to adjust the mirror memory while continuing to run the OS, the computer device can switch from the OS state to the BIOS state through a system interrupt after startup, that is, the computer device can switch between running the OS and the BIOS.
[0045] For example, during the process of the computer device running in the OS state, if a system management interrupt signal is triggered in the computer device, the processor in the computer device will save the current business being processed (including various businesses running in the OS state) and wake up another independent operating system BIOS to switch the computer device to the BIOS state. After the computer device in the BIOS state completes the required operations, a return (resume, RSM) instruction will be executed. The RSM instruction triggers the computer device to return to the operating system before the switch, that is, to return to the OS state, and causes the processor to reload the various businesses saved before, and restore the various businesses that were temporarily interrupted. Therefore, in an embodiment of the present application, the system management interrupt signal can be used to enable the computer device to switch from the OS state to the BIOS state, so as to achieve that after switching to the BIOS state, the business running in the OS state is not closed.
[0046] That is, in the embodiment of the present application, the computer device switches between running OS and BIOS, including two switching modes. One switching mode is switching from BIOS state to OS state, which is achieved through a system management interrupt signal, thereby avoiding the need to restart the computer state to switch from OS state to BIOS state. The other switching mode is switching from OS state to BIOS state, which is achieved by actively triggering an RSM instruction.
[0047] In addition, the implementation method of triggering the system management interrupt signal in the computer device can be: the computer device registers a slice clock in the underlying clock chip, and if the current time reaches the specified time point in the slice clock, the computer device will automatically generate a system management interrupt signal. In other words, the computer device can trigger the system management interrupt signal through the slice clock technology.
[0048] Step 203: configure the first physical memory space and the second physical memory space to be in a mirror relationship, and obtain an identifier of the mirror memory space corresponding to the first physical memory space and the second physical memory space.
[0049] For the convenience of subsequent description, the mirror memory space corresponding to the first physical memory space and the second physical memory space is referred to as the first mirror memory space, wherein the mirror memory space is a virtual memory space.
[0050] In addition, in an embodiment of the present application, in order to realize the interaction between the OS and the BIOS on the computer device, the message or request generated by the computer device in a certain state can be placed in a preset storage location. When the computer device is switched to another state, the corresponding operation can be performed according to the stored message or request at the storage location, which is equivalent to the interaction between the OS and the BIOS in the computer device. Therefore, after obtaining the identifier of the first mirror memory space, the computer device can also generate and store a first memory mirror message, and the first memory mirror message carries the identifier of the first mirror memory space.
[0051] In addition, when the computer device obtains the mirror memory formation request through step 201, one or two of the two physical memory spaces used to form the mirror memory may have a corresponding memory address interval, that is, it has been used by the computer device in the OS state. There may also be one or two physical memory spaces that are mirror memories with other physical memory spaces. There may also be one or two physical memory spaces that are physical memory spaces that are re-added in the computer device. Therefore, in an embodiment of the present application, when the computer device obtains the mirror memory formation request, it is necessary to first perform an offline operation on the memory address intervals corresponding to the two physical memory spaces before executing step 202. Among them, performing an offline operation on the memory address interval corresponding to the physical memory space means: migrating the data stored in the memory address interval and releasing the mapping relationship between the physical memory space and the memory address interval. After the mapping relationship is released, the computer device will not be able to access the physical memory space through the memory address interval. Accordingly, the process of configuring a memory address interval for a physical memory space can also be referred to as an online operation.
[0052] Therefore, the offline operation on the memory address intervals corresponding to the two physical memory spaces can be described in the following scenarios.
[0053] The first scenario: one of the two physical memory spaces used to form the mirror memory has a corresponding memory address range. Assume that the first physical memory space has a corresponding memory address range.
[0054] The implementation method of performing the offline operation on the memory address interval corresponding to the first physical memory space may be: switching the computer device from the current BIOS state to the OS state. After switching to the OS state, the computer device performs the offline operation on the memory address interval corresponding to the first physical memory space. Then, the system management interrupt signal is used to switch from the OS state to the BIOS state so as to configure the two physical memory spaces into a mirror relationship through step 203.
[0055] Specifically, if the first physical memory space has a corresponding memory address interval, the computer device can generate and store a first memory offline request before switching from the BIOS state to the OS state, and the first memory offline request carries the identifier of the first physical memory space. Then, after switching from the BIOS state to the OS state, the first memory offline request is obtained, and the offline operation is performed on the memory address interval corresponding to the first physical memory space according to the first memory offline request. The computer device generates and stores a first offline success message, and the first offline success message carries the identifier of the first physical memory space. Accordingly, after switching to the BIOS state, the computer device can obtain the first offline success message, and according to the identifier of the first physical memory space carried in the first offline success message, it is determined that the first physical memory space is not currently occupied by the processor, so the first physical memory space and the second physical memory space can be configured as a mirror relationship.
[0056] The above implementation is only for the first physical memory space of the two physical memory spaces used to configure the mirror memory. If both physical memory spaces meet the first scenario, the memory address ranges corresponding to the two physical memory spaces can be offline through the above implementation to facilitate the subsequent configuration of the mirror memory. Figure 3 This is a schematic diagram of the mapping relationship between a physical memory space and a memory address provided in an embodiment of the present application. There are four physical memory spaces, marked as D1, D2, D3, and D4. Among them, the memory address interval corresponding to D1 is m1, the memory address interval corresponding to D2 is m2, the memory address interval corresponding to D3 is m3, and the memory address interval corresponding to D4 is m4. Assuming that the mirror memory formation request carries the identifiers of D1 and D2, the computer device needs to first perform offline operations on m1 corresponding to D1 and m2 corresponding to D2.
[0057] Figure 4 Schematic diagram of another mapping relationship between physical memory space and memory address provided in an embodiment of the present application. Figure 4 As shown, after the computer device in the OS state performs offline operations on m1 corresponding to D1 and m2 corresponding to D2, the memory address intervals m1 and m2 have no corresponding physical memory space.
[0058] Figure 5 Schematic diagram of another mapping relationship between physical memory space and memory address provided in an embodiment of the present application. Figure 5 As shown, after the computer device in the OS state performs offline operations on m1 corresponding to D1 and m2 corresponding to D2, the computer device in the BIOS state regenerates the mirror memory space D5 for D1 and D2.
[0059] In addition, if the mirror memory building request in step 201 is implemented by the computer device in the OS state sending a mirror operation initiation request to the management system, the computer device can also perform an offline operation on each of the two memory address intervals before sending the mirror operation initiation request to the management system, so that the computer device in the subsequent BIOS state can directly build the mirror memory.
[0060] The second scenario: one or two of the two physical memory spaces that form the mirror memory are mirror memories with other physical memory spaces.
[0061] For the first physical memory space of the two physical memory spaces, if the first physical memory space and the third physical memory space are in a mirror relationship with each other, and the first physical memory space and the third physical memory space correspond to the second mirror memory space, the third physical memory space is a physical memory space other than the first physical memory space and the second physical memory space. The implementation method of the computer device performing an offline operation on the memory address interval corresponding to the first physical memory space can be: the computer device switches from the BIOS state to the OS state, and after switching to the OS state, performs an offline operation on the memory address interval corresponding to the first mirror memory space, and then switches from the OS state to the BIOS state. After switching to the BIOS state, the first physical memory space and the second physical memory space are configured as a mirror relationship.
[0062] Specifically, before the computer device switches from the BIOS state to the OS state, it generates and stores a second memory offline request, and the second memory offline request carries the identifier of the second mirror memory space. Accordingly, after the computer device switches from the BIOS state to the OS state, it obtains the second memory offline request, and performs an offline operation on the memory address interval corresponding to the second mirror memory space according to the second memory offline request; and generates and sends a second offline success message, and the second offline success message carries the identifier of the second physical memory space. Accordingly, after switching to the BIOS state, the computer device can obtain the second offline success message, and according to the second offline success message, cancel the mirror relationship between the first physical memory space and the third physical memory space, and then the first physical memory space and the second physical memory space can be configured as a mirror relationship.
[0063] Similarly, the above implementation is only for one physical memory space. If the two physical memory spaces meet the second scenario, the memory address ranges corresponding to the two physical memory spaces can be offline through the above implementation to facilitate subsequent configuration of the mirror memory.
[0064] In addition, in the second scenario, if the mirror memory formation request in step 201 is implemented by the computer device in the OS state sending a mirror operation initiation request to the management system, the computer device can first perform an offline operation on the memory address interval corresponding to the second mirror memory space before sending the mirror operation initiation request to the management system, so that the computer device in the subsequent BIOS state can directly cancel the mirror relationship between the first physical memory space and the second physical memory space, and form a new mirror memory. This will not be elaborated here.
[0065] The third scenario: one or both of the two physical memory spaces constituting the mirror memory are physical memory spaces newly added in the computer device.
[0066] In the third scenario, for the physical memory space re-added in the computer device, since the memory address range has not been allocated to the re-added physical memory space yet, in the third scenario, for the physical memory space re-added in the computer device, there is no need to perform an offline operation, and the mirror relationship can be directly configured according to step 203.
[0067] It should be noted that for the two physical memory spaces that form the mirror memory, there may be a situation where the two physical memory intervals belong to different scenarios. At this time, you only need to perform corresponding operations according to the corresponding scenarios. You only need to ensure that before the computer device configures the two physical memory spaces into a mirror relationship, there are no corresponding memory address intervals in the two physical memory spaces.
[0068] Step 204: Switch the current state of the computer device from the BIOS state to the OS state.
[0069] As can be seen from step 202, after the computer device completes the corresponding operation in the BIOS state, the RSM instruction can be automatically executed. The RSM instruction triggers the computer device to return to the OS state.
[0070] Step 205: Allocate a memory address space for the mirror memory space according to the identifier of the mirror memory space.
[0071] Based on the implementation of step 203, it can be known that after obtaining the identifier of the first mirror memory space, the computer device generates and stores the first memory mirror message. Therefore, the implementation of step 205 can be: the computer device obtains the first memory mirror message; according to the identifier of the first mirror memory space carried in the first memory mirror message, a memory address range is allocated to the first mirror memory space.
[0072] Figure 6 Schematic diagram of another mapping relationship between physical memory space and memory address provided in an embodiment of the present application. Figure 6 As shown, after the computer device switches to the OS state, it can allocate a memory address space m5 for the mirror memory space D5, and the processor of the computer device can subsequently write data to the two physical memory spaces D1 and D2 simultaneously through m5.
[0073] In addition, when the physical memory space is a physical memory board, if the memory address range corresponding to a physical memory board is offline, the physical memory board will no longer be used, and the physical memory board can be powered off. If a new physical memory board is replaced after powering off, the new physical memory board needs to be powered on again to initialize or self-check the memory board, so as to facilitate the subsequent configuration of mirror memory.
[0074] In addition, before configuring the two physical memory spaces as a mirror relationship, the computer device can also analyze the relevant parameters of the two physical memory spaces. After determining that the two physical memory spaces meet the standards of mirror memory, the step of configuring the two physical memory spaces as a mirror relationship is performed to avoid configuration errors. Among them, the relevant parameters of the physical memory space include parameters such as capacity and frequency.
[0075] In the embodiment of the present application, since the computer device can switch between running BIOS and OS, after the computer device is started, if it is currently in the OS state and needs to reconfigure the mirror memory, the computer device can switch to the BIOS state through the system management interrupt signal. Then, the mirror relationship is configured in the BIOS state, and after the mirror relationship is configured, it is switched back to the OS state to achieve the reconfiguration of the mirror memory. The whole process does not require restarting the computer device, so that during the process of reconfiguring the mirror memory, the business in the OS state does not need to be interrupted, which improves the flexibility of configuring the mirror memory.
[0076] Through the above steps 201 to 204, the computer device can reconfigure the mirror memory in the OS state. In the embodiment of the present application, it is also possible to cancel the configured mirror memory in the OS state. The following embodiment will explain this.
[0077] Figure 7 This is another method flow chart for configuring mirror memory provided by an embodiment of the present application, which is applied in a computer device. Figure 7 As shown, the method comprises the following steps:
[0078] Step 701: Obtain a mirrored memory expansion request, wherein the mirrored memory expansion request carries an identifier of the mirrored memory space.
[0079] The mirror memory expansion request may be sent by the management system to the computer device, or may be initiated by the computer device itself in the OS state.
[0080] When the mirror memory expansion request in step 701 is sent by the management system to the computer device, the computer device may receive the mirror memory expansion request sent by the management system in the following two possible implementations:
[0081] In a first possible implementation, when the management system detects the image expansion instruction, it sends a mirror memory expansion request to the computer device in the OS state. The mirror expansion instruction can be triggered by the operator corresponding to the management system through a preset operation. The mirror expansion instruction can carry the identifier of each of the two physical memory spaces used to expand the image, and the management system can determine the identifier of the first mirror memory space according to the identifier carried in the mirror expansion instruction, so as to send the mirror memory expansion request to the computer device. Of course, the mirror expansion instruction can also directly carry the identifier of the mirror physical memory space corresponding to the two physical memory spaces used to expand the image.
[0082] In a second possible implementation, when the computer device is in the OS state and detects a mirror expansion instruction, the computer device forwards the mirror expansion instruction to the management system to instruct the management system to send a mirror memory expansion request to the computer device, and the mirror operation expansion instruction carries the identifier of the mirror memory address interval corresponding to the two memory address intervals used for expansion. The management system can also determine the identifier of the first mirror memory space according to the identifier carried in the mirror expansion instruction, so as to send the mirror memory expansion request to the computer device.
[0083] In addition, when the mirror memory expansion request in step 701 is initiated by the computer device itself in the OS state, the implementation method of the computer device initiating the mirror memory expansion request can be: when the computer device in the OS state detects the mirror expansion instruction, it determines the identifier of the mirror memory space used for expansion, and then the identifier of the mirror memory space initiates the mirror memory expansion request.
[0084] Step 702: Execute an offline operation on the memory address interval corresponding to the mirror memory space.
[0085] Assuming that the mirror memory to be expanded in step 701 is the first mirror memory corresponding to the first physical memory space and the second physical memory space in step 201, after the computer device performs the offline operation on the memory address interval corresponding to the first mirror memory space according to step 702, it generates and stores a third offline success message, and the third offline success message carries the identifier of the first mirror memory space.
[0086] Step 703: Switch the current state of the computer device from the OS state to the BIOS state through the system management interrupt signal.
[0087] The implementation of step 703 can refer to Figure 2 The implementation method of step 202 in the embodiment will not be elaborated in detail here.
[0088] Step 704: cancel the mirroring relationship between the first physical memory space and the second physical memory space.
[0089] After switching from the current OS state to the BIOS state, the computer device can obtain the third offline success message stored in step 702, and according to the identifier of the first mirror memory space carried in the third offline success message, the mirror relationship between the two physical memory spaces can be released.
[0090] like Figure 6 As shown, when the computer device is in the OS state, the physical memory spaces D1 and D2 are mirrored to each other, the mirrored memory space corresponding to D1 and D2 is D5, and D5 corresponds to the memory address interval m5. At this time, if the identifier of the first mirrored memory space carried by the mirrored memory expansion request in step 701 is D5, as shown in FIG. Figure 8 As shown in FIG. 1 , the computer device in the OS state first performs an offline operation on m5 corresponding to D5. After the offline operation is completed, m5 is removed from the memory address range and is no longer used by the computer device. Figure 8 After the offline operation shown in Fig. 9 As shown, the computer device in the BIOS state releases the mirroring relationship between D1 and D2, and at this time, the virtual D5 corresponding to D1 and D2 will also not exist.
[0091] In addition, after the mirroring relationship is terminated, the computer device needs to switch from the BIOS state to the OS state in order to avoid affecting the normal operation of the currently ongoing business, which will not be elaborated in detail here.
[0092] In addition, the mirror memory that already exists in the OS state can be removed through steps 701 to 704. After the mirror memory is removed, the memory address range can be re-allocated to one or both of the two physical memory spaces through the following steps 705 and 706, so that the computer device in the OS state can reuse one or both of the two physical memory spaces.
[0093] Step 705: Generate a memory reporting message, where the memory reporting message carries an identifier of the first physical memory space.
[0094] After releasing the mirroring relationship between the two physical memory spaces according to step 704, the computer device may generate and store a memory reporting message, the memory reporting message carrying the identifier of the first physical memory space, and then switch from the BIOS state to the OS state, so as to reuse the first physical memory space through the following step 704.
[0095] Step 706: Allocate a memory address interval for the first physical memory space according to the memory reporting message.
[0096] After switching to the OS state, the computer device obtains a memory reporting message and allocates a memory address interval to the first physical memory space according to the memory reporting message.
[0097] The above steps 705 and 706 are only for reusing the first physical memory space of the first physical memory space and the second physical memory space, and do not constitute a limitation on the embodiments of the present application. For example, after the computer device releases the mirroring relationship between the first physical memory space and the second physical memory space, it can also reuse the first physical memory space and the second physical memory space through the above steps 705 and 706.
[0098] like Fig.10 As shown, when the memory report message carries the identifiers of D1 and D2, the computer device can reallocate the memory address intervals for D1 and D2, assuming that they are m6 and m7, after switching from the BIOS state to the OS state. The computer device in the OS state can then reuse D1 and D2.
[0099] In addition, if after releasing the mirroring relationship between the two physical memory spaces, it is determined that the two physical memory spaces are under the same processor, or the two physical memory spaces are a continuous physical memory space, the two physical memory spaces can be merged and directly allocated a total memory address range. This will not be described in detail one by one.
[0100] In the embodiment of the present application, since the computer device can switch between running BIOS and OS, after the computer device is started, if it is currently in the OS state and needs to cancel the configured mirror memory, the computer device can switch to the BIOS state. Then, the mirror relationship is canceled in the BIOS state, and then the mirror relationship is canceled and then switched back to the OS state. The whole process also does not require restarting the computer device, so that during the process of reconfiguring the mirror memory, the business in the OS state does not need to be interrupted, which improves the flexibility of configuring the mirror memory.
[0101] Fig.11 is a schematic diagram of a structure of a device for configuring mirror memory provided in an embodiment of the present application, such as Fig.11 The device 1100 comprises:
[0102] An acquisition module 1110 is used to acquire a mirror memory establishment request, wherein the mirror memory establishment request carries a first identifier of a first physical memory space and a second identifier of a second physical memory space;
[0103] The configuration module 1120 is used to: switch the current state of the computer device from the operating system OS state to the basic input and output system BIOS state through a system interrupt; configure the first physical memory space and the second physical memory space to be in a mirror relationship, obtain the identifier of the mirror memory space corresponding to the first physical memory space and the second physical memory space; switch the current state of the computer device from the BIOS state to the OS state;
[0104] The allocation module 1130 is configured to allocate a memory address space to the mirrored memory space according to the identifier of the mirrored memory space.
[0105] The above device is also used to perform the following Figure 2 and Figure 7 Specifically, the acquisition module 1110 is used to execute Figure 2 Step 201 and Figure 7 Step 701 in; Configuration module 1120 is used to perform Figure 2 Steps 202-204 and Figure 7 Steps 702-705 in; the allocation module 1130 is used to perform Figure 2 Step 205 and Figure 7 Step 706 in .
[0106] In the embodiment of the present application, since the computer device can switch between running BIOS and OS, after the computer device is started, if it is currently in the OS state and needs to reconfigure the mirror memory, the computer device can switch to the BIOS state. Then, the mirror relationship is configured in the BIOS state, and after the mirror relationship is configured, it is switched back to the OS state to achieve the reconfiguration of the mirror memory. The entire process does not require restarting the computer device, so that during the process of reconfiguring the mirror memory, the business in the OS state does not need to be interrupted, which improves the flexibility of configuring the mirror memory.
[0107] It should be noted that: the device for configuring mirror memory provided in the above embodiment only uses the division of the above functional modules as an example when configuring mirror memory. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for configuring mirror memory provided in the above embodiment and the method for configuring mirror memory belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0108] Fig.12 It is a structural diagram of a computer device provided in an embodiment of the present application. Figure 1 The computer device in the system shown can be Fig.12 The computer device shown is implemented. Fig.12 The computer device includes at least one processor 1201 , a communication bus 1202 , a memory 1203 and at least one communication interface 1204 .
[0109] The processor 1201 may be a general-purpose central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0110] The communication bus 1202 may include a pathway for transmitting information between the above-mentioned components.
[0111] The memory 1203 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1203 may exist independently and be connected to the processor 1201 via the communication bus 1202. The memory 1203 may also be integrated with the processor 1201.
[0112] Among them, the memory 1203 is used to store the program code for executing the solution of the present application, and the execution is controlled by the processor 1201. The processor 1201 is used to execute the program code stored in the memory 1203. The program code may include one or more software modules. The computer device involved in the embodiment of the present application can determine the data used to develop the application through the processor 1201 and one or more software modules in the program code in the memory 1203.
[0113] The communication interface 1204 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0114] In a specific implementation, as an embodiment, a computer device may include multiple processors, such as Fig.12 1 and 1205. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0115] The above-mentioned computer device can be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the computer device can be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device or an embedded device. The embodiment of the present application does not limit the type of computer device.
[0116] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0117] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0118] The above-mentioned embodiments are provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for configuring mirrored memory, the method being used in a computer device, characterized in that: The method comprises: Get the image memory assembly request; Switching the current state of the computer device from the operating system OS state to the basic input and output system BIOS state through a system interrupt; According to the mirror memory formation request, configuring the first physical memory space and the second physical memory space into a mirror relationship; Obtaining identifiers of mirrored memory spaces corresponding to the first physical memory space and the second physical memory space; Switching the current state of the computer device from the BIOS state to the OS state; A memory address space is allocated to the mirrored memory space according to the identifier of the mirrored memory space.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining a mirror memory expansion request, wherein the mirror memory expansion request carries an identifier of the mirror memory space; Execute an offline operation on the memory address interval corresponding to the mirror memory space; Switching the current state of the computer device from the OS state to the BIOS state through a system interrupt; The mirroring relationship between the first physical memory space and the second physical memory space is cancelled.
3. The method according to claim 1, characterized in that Before switching the current state of the computer device from the OS state to the BIOS state through the system interrupt, the method further includes: Perform an offline operation on the memory address interval corresponding to the first physical memory space.
4. The method according to claim 2, characterized in that: Before switching the current state of the computer device from the OS state to the BIOS state through the system interrupt, the method further includes: Perform an offline operation on the memory address interval corresponding to the first physical memory space.
5. The method according to claim 2 or 4, characterized in that: After canceling the mirroring relationship between the first physical memory space and the second physical memory space, the method further includes: Generate a memory reporting message, where the memory reporting message carries an identifier of the first physical memory space; A memory address interval is allocated to the first physical memory space according to the memory reporting message.
6. A device for configuring mirrored memory, characterized in that: The device comprises: The acquisition module is used to obtain the image memory assembly request; The configuration module is used to: switch the current state of the computer device from the operating system OS state to the basic input and output system BIOS state through a system interrupt; According to the mirror memory formation request, the first physical memory space and the second physical memory space are configured as a mirror relationship, and identifiers of the mirror memory spaces corresponding to the first physical memory space and the second physical memory space are obtained; Switching the current state of the computer device from the BIOS state to the OS state; An allocation module is used to allocate a memory address space to the mirror memory space according to the identifier of the mirror memory space.
7. The device according to claim 6, characterized in that The acquisition module is further used to acquire a mirror memory expansion request, wherein the mirror memory expansion request carries an identifier of the mirror memory space; The configuration module is also used to: perform an offline operation on the memory address interval corresponding to the mirror memory space; Switching the current state of the computer device from the OS state to the BIOS state through a system interrupt; The mirroring relationship between the first physical memory space and the second physical memory space is cancelled.
8. The device according to claim 6, characterized in that The configuration module is also used to perform an offline operation on the memory address interval corresponding to the first physical memory space before switching the current state of the computer device from the OS state to the BIOS state through the system interrupt.
9. The device according to claim 7, characterized in that The configuration module is also used to perform an offline operation on the memory address interval corresponding to the first physical memory space before switching the current state of the computer device from the OS state to the BIOS state through the system interrupt.
10. The device according to claim 7 or 9, characterized in that The configuration module is further used to generate a memory reporting message, where the memory reporting message carries an identifier of the first physical memory space; The allocation module is further configured to allocate a memory address interval to the first physical memory space according to the memory reporting message.
11. A computer device, characterized in that: The computer device comprises a memory and a processor, the memory stores program codes, and the processor is used to call the program codes in the memory to execute the method according to any one of claims 1 to 5.
12. A computer storage medium, wherein instructions are stored in the computer storage medium, and when the instructions are executed on a computer, the computer is enabled to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
NUMA system memory mirror impage configuration method, removing method, system and major node
CN103649923A
Data storage method and device
CN107704399A