CN115543364A - Kernel upgrading method and device - Google Patents
Kernel upgrading method and device Download PDFInfo
- Publication number
- CN115543364A CN115543364A CN202110732551.7A CN202110732551A CN115543364A CN 115543364 A CN115543364 A CN 115543364A CN 202110732551 A CN202110732551 A CN 202110732551A CN 115543364 A CN115543364 A CN 115543364A
- Authority
- CN
- China
- Prior art keywords
- kernel
- storage space
- state information
- reserved storage
- processor
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 98
- 230000015654 memory Effects 0.000 claims description 188
- 238000012545 processing Methods 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 description 44
- 230000001960 triggered effect Effects 0.000 description 8
- 230000006870 function Effects 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 3
- 238000013473 artificial intelligence Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 238000011084 recovery Methods 0.000 description 2
- 230000008439 repair process Effects 0.000 description 2
- 230000003247 decreasing effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4411—Configuring for operating with peripheral devices; Loading of device drivers
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The application discloses a kernel upgrading method and device, and belongs to the technical field of computers. The method comprises the following steps: the processor runs the first kernel, records the device state information of the device managed by the first kernel in the reserved storage space in the first kernel, and receives a kernel upgrading instruction; the processor stops running the first kernel according to the kernel upgrading instruction, runs the second kernel, obtains the equipment state information from the reserved storage space in the second kernel, and initializes the equipment managed by the first kernel based on the equipment state information. According to the method and the device, the time consumption of kernel upgrading is shortened, and the influence on the service realized by the kernel due to longer kernel upgrading time is reduced.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a kernel upgrade method and apparatus.
Background
The kernel is the core of the computer operating system. The kernel is responsible for managing the processes, memory, file systems, network systems, and drivers for hardware devices in the computer, and determines the performance and stability of the computer. In addition, in order to repair defects and security holes of the kernel, provide new functions and performance optimization for the kernel, and the like, the kernel needs to be upgraded at regular intervals.
In the related art, when an old kernel in a computer is upgraded, the old kernel can be used to prepare a necessary environment for the operation of a new kernel, an operation code of the new kernel is loaded into a memory, then the new kernel is operated, the old kernel is quitted, and the new kernel is used to replace the old kernel. The preparation of the necessary environment required by the operation of the new kernel comprises the following steps: the initialization process includes the steps of loading a memory used by a Central Processing Unit (CPU), initializing the memory, a subsystem, hardware equipment, a driver, a file system and a network system in a computer, and the like.
However, the initialization process takes a long time, which results in a long time for kernel upgrade.
Disclosure of Invention
The application provides a kernel upgrading method and device. The method and the device shorten the time consumption of kernel upgrading, and reduce the influence on the service realized by the kernel due to the longer kernel upgrading time. The technical scheme provided by the application is as follows:
in a first aspect, the present application provides a kernel upgrade method, including: the processor runs the first kernel, records the device state information of the device managed by the first kernel in the reserved storage space in the first kernel, and receives a kernel upgrading instruction; the processor stops running the first kernel according to the kernel upgrading instruction, runs the second kernel, obtains the equipment state information from the reserved storage space in the second kernel, and initializes the equipment managed by the first kernel based on the equipment state information.
In the kernel upgrading method, the device state information of the device managed by the first kernel is acquired from the reserved storage space in the second kernel through the processor, and the device managed by the first kernel is initialized based on the device state information, so that the second kernel can directly acquire the device state information from the reserved storage space, the device state information of the device can be acquired without reading the device managed by the first kernel, the time consumption for initializing the kernel is effectively reduced, the time consumption for upgrading the kernel is reduced, and the influence on services (such as services provided to a user by using a virtual machine) realized through the kernel due to longer kernel upgrading time is reduced. And, the more the number of devices managed by the first kernel in the computer device, the more obvious the effect of the kernel upgrade method appears.
In one implementation, the processor obtains device state information from the reserved memory space in the second core, including: and the processor inquires the device state information of any device in the reserved storage space in the second core based on the identification of any device managed by the first core. In addition, the device state information queried in the reserved storage space may be the device state information itself, or may also be a storage address of the device state information, and the device state information itself or the storage address thereof may be determined according to an application requirement during querying the device state information.
In one implementation manner, when the queried device state information is the device state information itself, the implementation process of the processor for initializing the device managed by the first kernel based on the device state information includes: and the processor restores the device state information to the memory used by the second kernel through the second kernel.
In another implementation manner, when the queried device state information is a storage address of the device state information, the processor initializes the device managed by the first kernel based on the device state information, including: the processor sets an access address of any device managed by the first kernel by the second kernel as a storage address of device state information of any device.
Since the storage address of the device state information stores the device state information of the device, the access address to any device is set as the storage address of the device state information of the device, so that the second kernel can access the set state information of the device when accessing the device according to the storage address, and the result of the process is the same as the result of storing the state and the variable of the device at the angle of the second kernel. Therefore, by setting the access address of the second kernel to the device as the storage address of the device state information of the device, the initialization of the device can be realized.
Optionally, the reserved storage space is a reserved memory space, and information stored in the reserved memory space is not lost along with the stop of the first kernel.
In an implementation manner, since the reserved storage space is used for storing information that needs to be used in the kernel upgrading process, the method further includes: the processor acquires storage management information of the reserved storage space from the reserved storage space by the first kernel in the second kernel, wherein the storage management information is used for indicating the use state of the reserved storage space; the processor initializes the reserved storage space based on the memory management information. Optionally, initializing the reserved storage space includes: the processor acquires the storage management information of the first kernel on the reserved storage space, initializes the reserved storage space based on the storage management information, enables the second kernel to inherit the storage management information, and manages the reserved storage space according to the mode that the first kernel manages the reserved storage space.
Optionally, the first kernel managed device includes: the first kernel manages hardware devices and/or device drivers for the hardware devices. For example, when the first kernel is a LINUX kernel, the device driver may include ACPI. The device state information of the device driver includes the namespace of ACPI. The hardware device managed by the first kernel comprises: the first kernel comprises a processor, a memory, a PCI device (such as a network card, a disk, a PCI bridge, an input/output device) and the like which are managed by the ACPI.
In one implementation, the method further comprises: the processor acquires the data processed by the first kernel from the reserved storage space in the second kernel; the processor performs state restoration in the second core based on the data. The processor facilitates the second core to provide services more quickly according to the data by obtaining the data processed by the first core from the first core. Alternatively, the data may be user data or other data accessed by the first kernel, as long as the data is data that is accessed by the first kernel and is also needed for the second kernel to operate. For example, when the computer device is a server on which a virtual machine is created, the data may be data used when providing a service to a user through the virtual machine.
In a second aspect, the present application provides a kernel upgrade apparatus, including: the processing module is used for operating the first kernel, recording the equipment state information of the equipment managed by the first kernel into the reserved storage space in the first kernel and receiving a kernel upgrading instruction; the processing module is further configured to stop running the first kernel according to the kernel upgrade instruction, run the second kernel, obtain the device state information from the reserved storage space in the second kernel, and initialize the device managed by the first kernel based on the device state information.
Optionally, the acquiring, by the processing module, the device state information from the reserved storage space in the second core includes: and inquiring the device state information of any device in the reserved storage space in the second kernel based on the identification of any device managed by the first kernel.
Optionally, the initializing, by the processing module, the device managed by the first kernel based on the device state information includes: and setting the access address of any device managed by the first kernel by the second kernel as the storage address of the device state information of any device.
Optionally, the reserved storage space is a reserved memory space, and information stored in the reserved memory space is not lost along with the stop of the first kernel.
Optionally, the processing module is further configured to: acquiring storage management information of the reserved storage space from the reserved storage space by the first kernel in the second kernel, wherein the storage management information is used for indicating the use state of the reserved storage space; and initializing the reserved storage space based on the memory management information.
Optionally, the first kernel managed device includes: the first kernel manages hardware devices and/or device drivers of the hardware devices.
Optionally, the device driver comprises: advanced configuration and power interface.
Optionally, the processing module is further configured to: acquiring data processed by the first kernel from the reserved storage space in the second kernel; state restoration is performed in the second core based on the data.
In a third aspect, the present application provides a computer device comprising a memory and a processor, the memory storing program instructions, the processor executing the program instructions to perform the method provided in the first aspect of the present application and any possible implementation manner thereof.
In a fourth aspect, the present application provides a computer-readable storage medium, which is a non-transitory computer-readable storage medium, comprising program instructions, which, when executed on a computer device, cause the computer device to perform the method provided in the first aspect of the present application and any one of its possible implementations.
In a fifth aspect, the present application provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method as provided in the first aspect of the present application and any one of its possible implementations.
Drawings
Fig. 1 is a schematic diagram of an application scenario involved in a kernel upgrade method provided in an embodiment of the present application;
fig. 2 is a schematic diagram of an application scenario involved in another kernel upgrade method provided in an embodiment of the present application;
fig. 3 is a flowchart of a kernel upgrade method according to an embodiment of the present application;
fig. 4 is a schematic process diagram of a kernel upgrade method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a kernel upgrade apparatus according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
For ease of understanding, some concepts involved in the embodiments of the present application are explained below.
The operating system is a program that manages computer hardware and software resources, and is also the core and the foundation of the computer system. The operating system itself handles basic transactions such as managing and configuring memory, prioritizing system resources, controlling input and output devices, operating networks, and managing file systems. In this embodiment, the operating system may be LINUX TM ,UNIX TM ,WINDOWS TM And the like.
The kernel is the core of the computer operating system. The kernel is responsible for managing the processes, memory, file systems, network systems, and drivers for hardware devices in the computer, and determines the performance and stability of the computer.
Memory (memory): the memory may be referred to as an internal memory or a main memory, and is used for temporarily storing arithmetic data in the CPU and data exchanged with an external memory such as a hard disk. Because the memory has a faster read-write speed, the memory is usually used as an external memory and a cache of the processor, that is, in the running process of the computing device, data needed to be used by the processor can be read into the memory from the external memory in advance, so that the processor reads the needed data from the memory to ensure the computing speed of the processor.
The embodiment of the application provides a kernel upgrading method. The kernel upgrading method comprises the following steps: the processor runs the first kernel, records the device state information of the device managed by the first kernel in the reserved storage space in the first kernel, receives a kernel upgrading instruction, then stops running the first kernel according to the kernel upgrading instruction, runs the second kernel, obtains the device state information from the reserved storage space in the second kernel, and initializes the device managed by the first kernel based on the device state information.
In the kernel upgrading method, the device state information of the device managed by the first kernel is acquired from the reserved storage space in the second kernel through the processor, and the device managed by the first kernel is initialized based on the device state information, so that the second kernel can directly acquire the device state information from the reserved storage space, and the device state information of the device can be acquired without reading the device managed by the first kernel, thereby effectively reducing the time consumption for initializing the device managed by the first kernel, reducing the time consumption for upgrading the kernel, and further reducing the influence on services (such as services provided to users by using a virtual machine) realized by the kernel due to longer kernel upgrading time.
An implementation scenario related to a kernel upgrading method provided by the embodiment of the application includes a computer device. Fig. 1 illustratively provides a possible architecture diagram for a computer device. As shown in FIG. 1, the computer device 10 may include a processor 101, a memory 102, a communication interface 103, and a bus 104. In the computer device, the number of the processors 101 may be one or more, and fig. 1 illustrates only one of the processors 101. Alternatively, the processor 101 may be a Central Processing Unit (CPU). If the computer device has multiple processors 101, the types of the multiple processors 101 may be different, or may be the same. Optionally, multiple processors of the computer device may also be integrated into a multi-core processor.
Memory 102 stores computer instructions and data, and memory 102 may store the computer instructions and data needed to implement the kernel upgrade method provided herein. The memory 102 may be any one or any combination of the following storage media: nonvolatile memories (e.g., read-Only memories (ROMs), solid State Disks (SSDs), hard disks (HDDs), optical disks, and the like), and volatile memories.
The communication interface 103 may be any one or any combination of the following devices: network interface (such as Ethernet interface), wireless network card, etc.
The communication interface 103 is used for data communication of the computer device with other nodes or other computer devices.
Fig. 1 also illustratively depicts bus 104. The bus 104 may connect the processor 101 with the memory 102 and the communication interface 103. Thus, via bus 104, processor 101 may access memory 102 and may also utilize communication interface 103 to interact with other nodes or other computer devices.
In the present application, the computer device executes the computer instructions in the memory 102, so as to implement the kernel upgrade method provided in the present application. For example, the memory 102 stores instructions for implementing a first core and a second core, the processor 101 can execute the first core by executing the instructions of the first core, and the processor 101 can execute the second core by executing the instructions of the second core. After the processor 101 runs the first kernel, the processor 101 may receive a kernel upgrade instruction indicating to upgrade the first kernel, stop running the first kernel based on the kernel upgrade instruction, and run the second kernel, and the processor 101 may obtain device state information of the device managed by the first kernel from the reserved storage space in the second kernel, and initialize the device managed by the first kernel based on the device state information.
Alternatively, the computer device may be a physical server, a mobile phone, a tablet, a personal computer, a laptop, a mobile phone, a multimedia player, a smart appliance, an artificial intelligence device, a smart wearable device, an e-reader, a smart car device, an internet of things device, or the like. In one implementation, the computer device may be deployed in a cloud platform. At this time, the computer device may be implemented by a physical server deployed in the cloud platform.
The kernel upgrade instruction received by the first kernel may be user-triggered. For example, a manager of a computer device triggers after uploading an upgrade package that upgrades a kernel. Alternatively, the core upgrade instruction may be triggered automatically. For example, the kernel upgrade instruction is automatically triggered by the computer device when a kernel upgrade period is reached, or automatically triggered by the computer device when a kernel upgrade is detected to be needed (e.g., an upgrade package for upgrading the kernel is detected).
When the kernel upgrade instruction is triggered by a user, as shown in fig. 2, implementation scenarios related to the kernel upgrade method further include: a client 20. A user may perform an operation on the client 20 to trigger the kernel upgrade instruction. Accordingly, the computer device 10 is configured to upgrade the kernel according to the kernel upgrade instruction.
Alternatively, the client may be a mobile phone, a tablet, a personal computer, a virtual machine, a container, a laptop, a mobile phone, a multimedia player, a smart appliance, an artificial intelligence device, a smart wearable device, an e-reader, a smart car device, an internet of things device, or the like.
The following describes an implementation process of the kernel upgrade method provided in the embodiment of the present application. As shown in fig. 3, the implementation process of the kernel upgrade method may include the following steps:
During the operation of the computer device, the processor may execute the first kernel to manage processes, a memory, a file system, a network system, a driver of a hardware device, and the like in the computer device using the first kernel.
In the operation process of the first kernel, the processor may manage, through the first kernel, the device of which the first kernel has the management authority, and the management process may generate device state information, and then the processor may record the device state information in the first kernel to the reserved storage space. For example, during the operation of the first kernel, the processor can manage the hardware device and/or the device driver of the hardware device managed by the first kernel through the first kernel.
In one implementation, a first kernel managed device includes: the first kernel manages hardware devices and/or device drivers of the hardware devices. The device driver may be a functional module that manages all hardware devices managed by the first kernel. For example, when the first kernel is a LINUX (an operating system) kernel, the device driver may include an Advanced Configuration and Power Interface (ACPI). The device state information of the device driver includes the namespace of ACPI. The hardware device managed by the first kernel comprises: the first kernel includes a processor, a memory, a Peripheral Component Interconnect (PCI) device (such as a network card, a disk, a PCI bridge, an input/output device), and the like managed by the ACPI. The device state information of the hardware device managed by the first kernel includes device state information of the above hardware device, such as register information of a processor, memory management information of a memory, and configuration space information of a PCI. Alternatively, the device driver may include multiple device drivers respectively configured to perform one-to-one correspondence management on multiple hardware devices managed by the first kernel, which is not specifically limited in this embodiment of the application.
In an embodiment of the present application, the storage space of the computer device includes at least two parts, and the at least two parts include a reserved storage space and another storage space. The reserved storage space is used for storing information required to be used in the kernel upgrading process, such as device state information of devices managed by the kernel. The other storage spaces are used for storing information needed to be used in the operation process of the computer equipment. In an implementation manner, the reserved storage space may be a reserved memory space, and the other storage spaces may be other memory spaces for storing operation codes required for implementing functions of the computer device, operation data of the processor, and the like. Or, the reserved storage space may also be other types of storage spaces configured in advance for storing information required by upgrading the kernel, as long as it is ensured that information stored in the other types of storage spaces can be read by the second kernel in the kernel upgrading process.
In order to ensure that the information stored in the reserved storage space can be used in the memory upgrading process, it is necessary to ensure that the information stored in the reserved storage space is not lost along with the stop of the kernel. And the information stored in the reserved storage space is ensured not to be lost along with the stop operation of the kernel, and the storage space can be preset. In one implementation, the setting process includes: the method comprises the steps of determining the size of a reserved storage space according to application requirements, selecting the storage space with the size from the storage space of a computer, setting the selected storage space to be specially used for storing information needed in the kernel upgrading process, and setting the selected storage space not to be refreshed in the kernel upgrading process so as to ensure that data cannot be lost in the kernel upgrading process. When the reserved memory space is the reserved memory space, the information stored in the reserved memory space can not be lost along with the exit of the kernel by setting the reserved memory space unavailable to the operating system in the kernel upgrading process.
Alternatively, the kernel upgrade instruction may be user-triggered. For example, a manager of the computer device may trigger the kernel upgrade instruction when it is necessary to repair a defect or a security vulnerability of the kernel, provide a new function and performance optimization for the kernel, and the like. Alternatively, the kernel upgrade instruction may be automatically triggered. For example, the kernel upgrade instruction is automatically triggered by the computer device when a kernel upgrade cycle is reached or a need to upgrade the kernel is detected. Wherein, the manager of the computer device can set an upgrade period for the kernel to indicate that the kernel is upgraded each time the upgrade period is reached. Additionally, when the computer device receives upgrade code (e.g., an upgrade code package) for the kernel, it may be determined that the kernel needs to be upgraded.
And step 303, the processor stops running the first kernel according to the kernel upgrading instruction and runs the second kernel.
After receiving the kernel upgrade instruction, the processor may stop running the currently running kernel. In this embodiment of the present application, the currently running kernel is a first kernel, and a kernel obtained by performing kernel upgrade on the first kernel is a second kernel. Optionally, the processor may stop running the first core immediately after receiving the core upgrade instruction, or may stop running the first core at any time after receiving the core upgrade instruction. For example, the first kernel may also stop running after the initialization process of the second kernel is completed, or the first kernel may also stop running at any time after the second kernel is run, which is not specifically limited in the embodiment of the present application.
After receiving the kernel upgrade instruction, the processor may obtain an operation code for implementing a second kernel, load the operation code into the memory, and operate the second kernel by operating the operation code. Before the second kernel is run, the first kernel needs to initialize the processor and the memory, so that the initialized processor and the initialized memory are used for running the running code for realizing the second kernel. The initialization of the memory refers to the initialization of other memory spaces.
And step 304, the processor acquires the storage management information of the reserved storage space of the first kernel from the reserved storage space in the second kernel.
As shown in step 301, the reserved storage space is used to store information that needs to be used in the kernel upgrade process, so the process of upgrading the first kernel may further include: and initializing the reserved storage space. Initializing the reserved storage space includes: the processor acquires the storage management information of the first kernel to the reserved storage space, initializes the reserved storage space based on the storage management information, enables the second kernel to inherit the storage management information, and manages the reserved storage space according to the mode that the first kernel manages the reserved storage space. The storage management information is used for indicating the use state of the reserved storage space. Alternatively, the processor may obtain the storage management information from the reserved storage space.
When the reserved memory space is the reserved memory space, the storage management information is also called memory management information of the reserved memory space, and the memory management information is used for indicating the use state of the reserved memory space. Optionally, the usage status of the reserved memory space includes one or more of the following: and reserving the occupation state of each memory block in the memory space and the information of the user of the occupied memory block. The memory block occupation state is used for indicating that the memory block is in an allocated state or an idle state. The information of the user of the occupied memory block includes: identification information of the user and other descriptive information of the user. For example, the information of the user of a certain memory block includes identification information indicating that the user of the memory block is ACPI. Or, the information of the user of the memory block further includes an identifier of the ACPI managed device.
The memory management information of the first kernel to the reserved memory space can be obtained through the management operation executed by the first kernel to the reserved memory space in the running process of the first kernel. For example, in the running process of the first kernel, the first kernel may manage a hardware device managed by the first kernel and/or a management object such as a device driver of the hardware device, and in the management process, information such as device state information of the management object may be generated, and the information needs to be stored in the reserved memory, and an operation of storing the information in the reserved memory may generate memory management information. In the management process, the first kernel may apply for a memory (for example, a memory for applying for storing command space information of ACPI, or a memory for applying for storing device state information of a hardware device) and release the memory (for example, the memory is released when the memory is not used), for the management object, both the memory application and the memory release may change the memory management information.
In an implementation manner, the management of the reserved memory space by the first kernel may be implemented by a functional module. The following describes an implementation manner of managing the reserved memory space by the first kernel, taking fig. 4 as an example. As shown in fig. 4, the first core 105 includes a memory initialization module 1051, a device initialization module 1052, and a reserved memory management module 1053, and the reserved memory management module 1053 may include: the function of reserving the memory management module 1053 can be cooperatively realized by the memory management unit 1053a, the memory application unit 1053b, the memory release unit 1053c, and the memory inquiry unit 1053 d. Similarly, the second core 106 includes a memory initialization module 1061, a device initialization module 1062, and a reserved memory management module 1063, and the reserved memory management module 1063 may include: the memory management unit 1063a, the memory application unit 1063b, the memory release unit 1063c, and the memory lookup unit 1063d, and the function of reserving the memory management module 1063 may be cooperatively implemented by the memory management unit 1063a, the memory application unit 1063b, the memory release unit 1063c, and the memory lookup unit 1063 d. The functions of each module are respectively as follows:
the memory initialization module is used for pulling up the reserved memory management module. For example, when the first kernel 105 is running, the reserved memory management module 1053 in the first kernel 105 is pulled up, and when the second kernel 106 is running, the reserved memory management module 1063 in the second kernel 106 is pulled up.
The device initialization module is configured to manage devices managed by the first core 105. For example, applying for and releasing a memory for storing device state information for a device, querying device state information of the device, and initializing the device according to the queried device state information.
And the reserved memory management module is used for managing the reserved memory space. And when the device state information is generated, the reserved memory management module is further used for applying for using a reserved memory management interface so as to store the device state information in the reserved memory space through the reserved memory management interface. The functions of the memory management unit, the memory application unit, the memory release unit and the memory query unit are respectively as follows:
the reserved memory management module is configured to, after the first kernel 105 is running, read memory management information of the reserved memory space from the reserved memory space, initialize the reserved memory space based on the memory management information, notify the reserved memory space of a change in the memory management information, and store the memory management information in the reserved memory space. In one implementation, the step 304 may be implemented by the reserved memory management module.
The memory application unit is used for receiving an application request of the equipment initialization module, inquiring memory management information recorded by the reserved memory management module according to the application request so as to find a memory with the size required by the application request in the reserved memory space, storing equipment state information of the equipment in the memory, and updating the memory management information according to a storage result. Correspondingly, the reserved memory management module is further configured to mark the information of the user of the allocated corresponding memory and record the information of the user of the memory according to the update information of the memory application unit.
The memory release unit is used for receiving a release request of the equipment initialization module, executing release operation on the memory released by the release request, and updating the memory management information according to a release result. Correspondingly, the reserved memory management module is further configured to mark the released available memory according to the update information of the memory release unit.
The memory query unit is used for receiving a query request of the device initialization module, querying the memory management information according to the specific characters or the identifiers carried by the query request, obtaining the device state information of the device indicated by the query request, and providing the queried device state information for the device initialization module.
The processor initializes the reserved memory space based on the memory management information, and essentially makes the second kernel inherit the storage management information and manages the reserved memory space according to the mode that the first kernel manages the reserved memory space. Optionally, the initializing the reserved storage space by the processor includes: the processor keeps the reserved storage space used by the second kernel and the address space corresponding to the reserved storage space unchanged with the first kernel, synchronizes the use state of the reserved storage space into the use state of the reserved storage space by the first kernel, and sets the mode of managing the reserved storage space by the second kernel as the mode of managing the reserved storage space by the first kernel. When the reserved storage space is a reserved memory space, step 305 may be implemented by the reserved memory management module of the second core in fig. 4.
The processor keeps the reserved storage space used by the second kernel and the address space corresponding to the reserved storage space unchanged from the first kernel, namely the second kernel keeps the same reserved storage space used by the first kernel and keeps the same mapping relation between the reserved storage space and the address space used by the first kernel. Therefore, for other devices interacting with the kernel, since the reserved storage space and the mapping relation used by the first kernel and the second kernel are the same, after the first kernel is upgraded to the second kernel, the other devices interacting with the kernel can interact with the second kernel in a way of interacting with the first kernel, so that undifferentiated access to the kernel before and after upgrading can be realized, and interaction with the second kernel can be realized without reconfiguration.
By synchronizing the use state of the reserved storage space with the use state of the reserved storage space by the first kernel, after the initialization of the reserved storage space is completed, the use condition of the reserved storage space can be kept to be the same as the use condition of the reserved storage space by the first kernel before the first kernel is upgraded, and the second kernel can continue to work on the basis of the use condition. When the reserved memory space is the reserved memory space, synchronizing the use state of the reserved memory space to the use state of the reserved memory space by the first kernel may be implemented by reloading the memory management information from the reserved memory space to the second kernel as shown in fig. 4.
The mode of managing the reserved storage space by the second kernel is set to be the mode of managing the reserved storage space by the first kernel, so that the mode of managing the reserved storage space by the second kernel is the same as that of managing the reserved storage space by the first kernel, the implementation logic of the reserved storage space does not need to be modified, and the reserved storage space does not sense the upgrade of the kernels.
In one implementation manner, an implementation process of acquiring device state information from a reserved storage space in a second core by a processor includes: the processor inquires the device state information of any device in the reserved storage space in the second core based on the identification of any device managed by the first core. For example, the implementation process of the processor obtaining the device state information of the ACPI from the reserved storage space in the second core includes: and the processor queries the device state information of the ACPI in the reserved storage space in the second core based on the identification of the ACPI. In addition, the device state information queried in the reserved storage space may be the device state information itself, or may also be a storage address of the device state information, and the device state information itself or the storage address thereof may be determined according to an application requirement during querying the device state information. When the reserved storage space is a reserved memory space, step 306 may be implemented by the memory lookup unit of the second core in fig. 4.
Initializing the first kernel-managed device essentially refers to saving the state and variables of the first kernel-managed device. As described above, the device status information queried in the reserved storage space may be the device status information itself, or may be a storage address of the device status information. Optionally, when the queried device state information is the device state information itself, the implementation process of the processor initializing the device managed by the first kernel based on the device state information includes: and the processor restores the device state information to the memory used by the second kernel through the second kernel. When the queried device state information is the storage address of the device state information, the implementation process of the processor for initializing the device managed by the first kernel based on the device state information includes: and the processor sets the access address of the second kernel to any equipment as the storage address of the equipment state information of any equipment. For example, when the queried device state information of the ACPI is the root node address of the ACPI namespace tree, and the processor initializes the ACPI based on the device state information of the ACPI, the second kernel may be set to the access address of the ACPI as the root node address of the ACPI namespace tree. Since the storage address of the device state information stores the device state information of the device, the access address to any device is set as the storage address of the device state information of the device, so that the second kernel can access the set state information of the device when accessing the device according to the storage address, and the result of the process is the same as the result of storing the state and the variable of the device at the angle of the second kernel. Therefore, by setting the access address of the second kernel to the device as the storage address of the device state information of the device, the initialization of the device can be realized. When the reserved storage space is the reserved memory space, the step 307 may be implemented by the device initialization module of the second kernel in fig. 4.
The processor acquires the equipment state information from the reserved storage space in the second kernel and initializes the equipment managed by the first kernel based on the equipment state information, so that the second kernel can acquire the equipment state information of the equipment without reading the equipment managed by the first kernel, the time consumption for initializing the kernel is effectively reduced, and the time consumption for upgrading the kernel is reduced. For example, when the device state information is the command space of the ACPI, by obtaining the command space of the ACPI from the reserved memory, reinitialization of the command space of the complete ACPI is avoided, it is not necessary to reconstruct objects in all ACPI name spaces, and time consumed by the second kernel to initialize the ACPI can be greatly shortened.
In step 308, the processor obtains the data processed by the first kernel from the reserved storage space in the second kernel.
In some implementation scenarios, the processor may also obtain data from the first core that is processed by the first core to facilitate a faster provision of services by the second core based on the data. Alternatively, the data may be user data or other data accessed by the first kernel, as long as the data is data that is accessed by the first kernel and is also needed for the second kernel to operate. For example, when the computer device is a server on which a virtual machine is created, the data may be data used when providing a service to a user through the virtual machine. Moreover, the implementation process of step 308 may refer to the implementation process of step 306, which is not described herein.
In addition, the reserved storage space for storing the data processed by the first core and the reserved storage space for storing the device state information may be located in the same reserved storage space, or may be two reserved storage spaces with unrelated storage logics (for example, two reserved storage spaces isolated from each other). Similarly, the reserved storage space for storing the device state information of multiple devices may be located in the same reserved storage space, or may be multiple reserved storage spaces that store logically unrelated devices, for example, multiple reserved storage spaces may be configured in a computer device, and each reserved storage space is used for storing the device state information of one device.
After the processor acquires the data processed by the first kernel from the reserved storage space, the state recovery can be performed in the second kernel according to the acquired data, so that the service can be provided more quickly according to the inherited data. Moreover, the implementation process of step 309 may refer to the implementation process of step 307, which is not described herein.
It should be noted that, after initializing the device managed by the first kernel, the initialization process of the second kernel further includes initializing a file system, a driver, a network system, and the like, and preparing a user program and pulling up a service process, and the implementation of the process is not described here.
In summary, in the kernel upgrading method provided in this embodiment of the present application, the processor obtains the device state information of the device managed by the first kernel from the reserved storage space in the second kernel, and initializes the device managed by the first kernel based on the device state information, so that the second kernel can directly obtain the device state information from the reserved storage space, and the device state information of the device can be obtained without reading the device managed by the first kernel, thereby effectively reducing time consumption for initializing the kernel, reducing time consumption for upgrading the kernel, and reducing an influence on a service (such as a service provided to a user by using a virtual machine) implemented by the kernel due to a long kernel upgrading time. Moreover, when the number of devices managed by the first kernel in the computer device is larger, the effect of the kernel upgrading method provided by the embodiment of the application is more obvious.
It should be noted that, the order of the steps of the kernel upgrading method provided in the embodiment of the present application may be appropriately adjusted, and the steps may also be correspondingly increased or decreased according to the situation. Any method that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application is covered by the protection scope of the present application, and thus the detailed description thereof is omitted.
The embodiment of the application also provides a kernel upgrading device. As shown in fig. 5, the kernel upgrade apparatus 50 includes:
the processing module 501 is configured to run a first kernel, record device state information of a device managed by the first kernel in a reserved storage space in the first kernel, and receive a kernel upgrade instruction.
The processing module 501 is further configured to stop running the first kernel according to the kernel upgrade instruction, run the second kernel, obtain device state information from the reserved storage space in the second kernel, and initialize the device managed by the first kernel based on the device state information.
Optionally, the processing module 501 obtains the device status information from the reserved storage space in the second core, including: and inquiring the device state information of any device in the reserved storage space in the second kernel based on the identification of any device managed by the first kernel.
Optionally, the processing module 501 initializes the device managed by the first kernel based on the device state information, including: and setting the access address of any device managed by the first kernel by the second kernel as the storage address of the device state information of any device.
Optionally, the reserved storage space is a reserved memory space, and information stored in the reserved memory space is not lost along with the stop of the first kernel.
Optionally, the processing module 501 is further configured to: acquiring storage management information of the reserved storage space from the reserved storage space by the first kernel in the second kernel, wherein the storage management information is used for indicating the use state of the reserved storage space; and initializing the reserved storage space based on the memory management information.
Optionally, the first kernel managed device includes: the first kernel manages hardware devices and/or device drivers for the hardware devices.
Optionally, the device driver comprises: advanced configuration and power interface.
Optionally, the processing module 501 is further configured to: acquiring data processed by the first kernel from the reserved storage space in the second kernel; state restoration is performed in the second core based on the data.
To sum up, in the kernel upgrading apparatus provided in this embodiment of the present application, the processing module obtains the device state information of the device managed by the first kernel from the reserved storage space in the second kernel, and initializes the device managed by the first kernel based on the device state information, so that the second kernel can directly obtain the device state information from the reserved storage space, and the device state information of the device can be obtained without reading the device managed by the first kernel, thereby effectively reducing time consumption for initializing the kernel, reducing time consumption for upgrading the kernel, and reducing an influence on a service (such as a service provided to a user by using a virtual machine) implemented by the kernel due to a long kernel upgrading time. Moreover, when the number of devices managed by the first kernel is larger, the effect of the kernel upgrading method provided by the embodiment of the application is more obvious.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and modules may refer to the corresponding contents in the foregoing method embodiments, and are not described herein again.
The embodiment of the application provides computer equipment. The computer device includes a memory having stored program instructions and a processor executing the program instructions to perform the methods provided herein. For example, the processor runs a first kernel, records device state information of a device managed by the first kernel in a reserved storage space in the first kernel, and receives a kernel upgrading instruction; the processor stops running the first kernel according to the kernel upgrading instruction, runs the second kernel, obtains the equipment state information from the reserved storage space in the second kernel, and initializes the equipment managed by the first kernel based on the equipment state information. Moreover, by executing the computer instructions in the memory, the implementation process of executing the steps of the kernel upgrade method provided by the present application may refer to the corresponding description in the above method embodiments.
Embodiments of the present application further provide a computer-readable storage medium, which is a non-volatile computer-readable storage medium, and the computer-readable storage medium includes program instructions, which, when executed on a computer device, cause the computer device to perform the kernel upgrade method provided in the embodiments of the present application.
The embodiment of the present application further provides a computer program product containing instructions, which, when the computer program product runs on a computer, causes the computer to execute the kernel upgrade method provided by the embodiment of the present application.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk.
In the embodiments of the present application, the terms "first", "second", and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The term "at least one" means one or more, and the term "plurality" means two or more, unless expressly defined otherwise.
The term "and/or" in this application is only one kind of association relationship describing the associated object, and means that there may be three kinds of relationships, for example, a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
The above description is intended only to illustrate the alternative embodiments of the present application, and not to limit the present application, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims (19)
1. A method for kernel upgrade, the method comprising:
the method comprises the steps that a processor runs a first kernel, records device state information of devices managed by the first kernel into a reserved storage space in the first kernel, and receives a kernel upgrading instruction;
the processor stops running the first kernel according to the kernel upgrading instruction, runs a second kernel, obtains the equipment state information from the reserved storage space in the second kernel, and initializes the equipment managed by the first kernel based on the equipment state information.
2. The method of claim 1, wherein the processor obtaining the device state information from the reserved memory space in the second core comprises:
the processor queries the reserved storage space for device state information of any device managed by the first kernel in the second kernel based on the identifier of the any device.
3. The method of claim 1 or 2, wherein the processor initializes the first kernel-managed device based on the device state information, comprising:
and the processor sets the access address of the second kernel to any device managed by the first kernel as the storage address of the device state information of any device.
4. The method according to any one of claims 1 to 3, wherein the reserved storage space is a reserved memory space, and information stored in the reserved memory space is not lost when the first kernel stops operating.
5. The method of any of claims 1 to 4, further comprising:
the processor acquires storage management information of the reserved storage space from the reserved storage space by the first kernel in the second kernel, wherein the storage management information is used for indicating the use state of the reserved storage space;
the processor initializes the reserved storage space based on the memory management information.
6. The method of any of claims 1 to 5, wherein the first kernel managed device comprises: the first kernel manages a hardware device and/or a device driver of the hardware device.
7. The method of claim 6, wherein the device driver comprises: advanced configuration and power interface.
8. The method of any of claims 1 to 7, further comprising:
the processor acquires the data processed by the first kernel from the reserved storage space in the second kernel;
the processor performs state restoration in the second core based on the data.
9. A kernel upgrade apparatus, the apparatus comprising:
the processing module is used for operating a first kernel, recording the device state information of the device managed by the first kernel in a reserved storage space in the first kernel, and receiving a kernel upgrading instruction;
the processing module is further configured to stop running the first kernel according to the kernel upgrade instruction, run a second kernel, obtain the device state information from the reserved storage space in the second kernel, and initialize a device managed by the first kernel based on the device state information.
10. The apparatus of claim 9, wherein the processing module obtains the device state information from the reserved memory space in the second core, and comprises:
and inquiring the device state information of any device in the reserved storage space in the second core based on the identification of the any device managed by the first core.
11. The apparatus of claim 9 or 10, wherein the processing module initializes the first kernel-managed device based on the device state information, comprising:
and setting the access address of the second kernel to any device managed by the first kernel as the storage address of the device state information of any device.
12. The apparatus according to any of claims 9 to 11, wherein the reserved memory space is a reserved memory space, and information stored in the reserved memory space is not lost when the first core stops operating.
13. The apparatus of claim 12, wherein the processing module is further configured to:
acquiring storage management information of the reserved storage space from the reserved storage space by the first kernel in the second kernel, wherein the storage management information is used for indicating the use state of the reserved storage space;
initializing the reserved storage space based on the memory management information.
14. The apparatus according to any of claims 9 to 13, wherein the first kernel managed device comprises: the first kernel manages a hardware device and/or a device driver of the hardware device.
15. The apparatus of claim 14, wherein the device driver comprises: advanced configuration and power interface.
16. The apparatus of any of claims 9 to 15, wherein the processing module is further configured to:
acquiring data processed by the first kernel from the reserved storage space in the second kernel;
performing state restoration in the second core based on the data.
17. A computer device comprising a memory storing program instructions and a processor executing the program instructions to perform the method of any of claims 1 to 8.
18. A computer-readable storage medium comprising program instructions which, when run on a computer device, cause the computer device to perform the method of any of claims 1 to 8.
19. A computer program product which, when run on a computer, causes the computer to perform the method of any one of claims 1 to 8.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110732551.7A CN115543364A (en) | 2021-06-30 | 2021-06-30 | Kernel upgrading method and device |
PCT/CN2022/101603 WO2023274166A1 (en) | 2021-06-30 | 2022-06-27 | Kernel upgrade method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110732551.7A CN115543364A (en) | 2021-06-30 | 2021-06-30 | Kernel upgrading method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115543364A true CN115543364A (en) | 2022-12-30 |
Family
ID=84690071
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110732551.7A Pending CN115543364A (en) | 2021-06-30 | 2021-06-30 | Kernel upgrading method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN115543364A (en) |
WO (1) | WO2023274166A1 (en) |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8862930B2 (en) * | 2010-11-24 | 2014-10-14 | Red Hat, Inc. | Crash recovery memory reservation based on device drivers for an operational kernel |
US9645864B2 (en) * | 2014-02-06 | 2017-05-09 | Intel Corporation | Technologies for operating system transitions in multiple-operating-system environments |
US11243782B2 (en) * | 2016-12-14 | 2022-02-08 | Microsoft Technology Licensing, Llc | Kernel soft reset using non-volatile RAM |
CN108228260A (en) * | 2018-01-02 | 2018-06-29 | 联想(北京)有限公司 | Kernel switching method and electronic equipment |
CN109597677B (en) * | 2018-12-07 | 2020-05-22 | 北京百度网讯科技有限公司 | Method and apparatus for processing information |
CN112052125A (en) * | 2020-09-28 | 2020-12-08 | 联想(北京)有限公司 | Dump processing method and device for operating system kernel and electronic equipment |
-
2021
- 2021-06-30 CN CN202110732551.7A patent/CN115543364A/en active Pending
-
2022
- 2022-06-27 WO PCT/CN2022/101603 patent/WO2023274166A1/en active Application Filing
Also Published As
Publication number | Publication date |
---|---|
WO2023274166A1 (en) | 2023-01-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102799464B (en) | Virtual machine creation method and system, virtual machine reloading method and system | |
US11847329B2 (en) | Techniques for implementing fault domain sets | |
EP3686739B1 (en) | Method and system for enabling agentless backup and restore operations on a container orchestration platform | |
EP3547112B1 (en) | Computing device and computer-implemented method for configuration management via logical architecture awareness | |
CN101650660B (en) | Booting a computer system from central storage | |
US8751785B2 (en) | Memory tagging and preservation during a hot upgrade | |
CN108073423B (en) | Accelerator loading method and system and accelerator loading device | |
US9811347B2 (en) | Managing dependencies for human interface infrastructure (HII) devices | |
US11029932B2 (en) | Hydration of applications | |
US7512719B1 (en) | Sharing a dynamically located memory block between components executing in different processor modes in an extensible firmware interface environment | |
CN113296805A (en) | Method and device for realizing hot upgrade of auxiliary container | |
US10684895B1 (en) | Systems and methods for managing containerized applications in a flexible appliance platform | |
CN111782335A (en) | Extended application mechanism through in-process operating system | |
US10397130B2 (en) | Multi-cloud resource reservations | |
KR102315102B1 (en) | Method, device, apparatus, and medium for booting a virtual machine | |
JP2012079245A (en) | Volume assignment method of virtual machine and computer system using method thereof | |
CN117193936A (en) | Virtual machine management method, device and equipment under super fusion architecture | |
KR102456017B1 (en) | Apparatus and method for file sharing between applications | |
TWI662419B (en) | A network system with local disks for pooled physical resources | |
CN113485789B (en) | Resource allocation method and device and computer architecture | |
US20230161643A1 (en) | Lifecycle management for workloads on heterogeneous infrastructure | |
CN115543364A (en) | Kernel upgrading method and device | |
CN115408064A (en) | Method, server and related equipment for supporting kernel online update | |
US11947501B2 (en) | Two-hierarchy file system | |
US11921582B2 (en) | Out of band method to change boot firmware configuration |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |