Hot upgrade method for kernel subsystem, and device and storage medium

By extracting and upgrading the source code of the kernel subsystem, identifying data dependencies and building hot upgrade scripts, the problem of kernel updates in the existing technology needs to be downtime, realizing independent hot upgrades of the kernel subsystem, reducing the risks of service interruptions and uncertainty.

WO2025066588A1PCT designated stage expired Publication Date: 2025-04-03ALIBABA CLOUD COMPUTING CO LTD

Patent Information

Application Number
PCT/CN2024/111329
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-09-28
Filing Date
2024-08-12
Publication Date
2025-04-03

AI Technical Summary

Technical Problem

The existing technology requires downtime when updating the Linux kernel, resulting in service interruption, and the update is expensive and easy to introduce new problems, making it impossible to achieve independent hot upgrades of the eBPF subsystem.

Method used

By extracting the current source code of the kernel subsystem, identifying data dependencies, building a hot upgrade script file, receiving hot upgrade instructions during the kernel operation, and using the script file to hot upgrade the function code and data dependencies.

Benefits of technology

The kernel subsystem is implemented to perform independent thermal upgrades without shutting down, reducing the risk of service interruption and avoiding the risk of uncertainty caused by subsystem upgrades.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024111329_03042025_PF_FP_ABST
    Figure CN2024111329_03042025_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a hot upgrade method for a kernel subsystem, and a device and a storage medium. In the embodiments of the present disclosure, for a kernel subsystem that needs to be subjected to hot upgrading, firstly, on the basis of boundary configuration information, the current source code of the kernel subsystem is extracted from a kernel source file, the current source code is upgraded to obtain function code upgrade data, and at least one data dependency relationship of the kernel subsystem is identified; then, a hot upgrade script file required for hot upgrading of the kernel subsystem is constructed; and finally, in the process of running a kernel, the hot upgrade script file is used to perform hot upgrading on a function code of the kernel subsystem and the data dependency relationship of the kernel subsystem, respectively. Thus, in the case of a kernel not being shut down, independent hot upgrading of a kernel subsystem is realized, the convenience is provided for customizing new characteristics of the kernel subsystem, and various uncertainty risks caused by the upgrading of the whole kernel due to the upgrading of the subsystem can also be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Kernel subsystem hot upgrade method, device and storage medium

[0001] This disclosure claims priority to the Chinese patent application filed with the China Patent Office on September 28, 2023, with application number 202311268459.5 and application name “Core Subsystem Hot Upgrade Method, Device and Storage Medium”, all contents of which are incorporated by reference in this disclosure. Technical Field

[0002] The present disclosure relates to the field of cloud technology, and in particular to a method, device, and storage medium for hot upgrading a kernel subsystem. Background Art

[0003] The Linux kernel is a monolithic kernel composed of numerous tightly coupled subsystems that are not flexibly removable. In contrast to subsystems, kernel modules are flexibly removable. The extended Berkeley Packet Filter (eBPF) is a subsystem within the Linux kernel designed to provide high-performance, programmable packet processing capabilities for applications such as network filtering, security monitoring, and traffic analysis.

[0004] Programmers are constantly adding new features to the eBPF subsystem, which is distributed across different versions of the Linux kernel. For users to use the new features of the eBPF subsystem, they must update the entire Linux kernel while it's down. This not only causes service interruptions, but also is very expensive and prone to introducing new issues. Therefore, a method for independently hot-updating the eBPF subsystem is urgently needed.

[0005] Summary of the Invention

[0006] Various aspects of the present disclosure provide a kernel subsystem hot upgrade method, device, and storage medium for independently hot upgrading the kernel subsystem to solve problems such as service interruption faced by existing kernel upgrades.

[0007] An embodiment of the present disclosure provides a method for hot upgrading a kernel subsystem, comprising: extracting the current source code of the first kernel subsystem from a kernel source file based on boundary configuration information adapted to the first kernel subsystem, and upgrading the current source code of the first kernel subsystem to obtain function code upgrade data; identifying at least one data dependency of the first kernel subsystem based on the initialization function and / or debugging result of the first kernel subsystem; constructing a hot upgrade script file required for hot upgrading the first kernel subsystem according to the function code upgrade data and the at least one data dependency; receiving a hot upgrade instruction for the first kernel subsystem during operation of the kernel, the hot upgrade instruction pointing to the hot upgrade script file; and hot upgrading the current function code and at least one data dependency in the current source code of the first kernel subsystem according to the hot upgrade script file.

[0008] An embodiment of the present disclosure provides a method for hot upgrading a kernel subsystem, comprising: receiving a hot upgrade instruction for a first kernel subsystem during kernel operation, the hot upgrade instruction pointing to a hot upgrade script file; and hot upgrading at least one data dependency of the first kernel subsystem according to the hot upgrade script file; wherein the hot upgrade script file is constructed from at least one data dependency of the first kernel subsystem, and the at least one data dependency of the first kernel subsystem is identified based on an initialization function and / or a debugging structure of the first kernel subsystem.

[0009] An embodiment of the present disclosure provides a kernel subsystem hot upgrade device, comprising: a code upgrade processing module, for extracting the current source code of the first kernel subsystem from the kernel source file based on boundary configuration information adapted to the first kernel subsystem, and upgrading the current source code of the first kernel subsystem to obtain function code upgrade data; a data dependency processing module, for identifying at least one data dependency of the first kernel subsystem based on the initialization function and / or debugging result of the first kernel subsystem; a script file construction module, for constructing a hot upgrade script file required for hot upgrading the first kernel subsystem according to the function code upgrade data and at least one data dependency; a command receiving module, for receiving a hot upgrade instruction for the first kernel subsystem during the operation of the kernel, the hot upgrade instruction pointing to the hot upgrade script file; a hot upgrade module, for hot upgrading the current function code and at least one data dependency in the current source code of the first kernel subsystem according to the hot upgrade script file.

[0010] An embodiment of the present disclosure provides an electronic device, comprising: a memory and a processor; the memory stores a computer program, and the processor is coupled to the memory and is used to execute the computer program to implement the steps in the core subsystem hot upgrade method.

[0011] An embodiment of the present disclosure provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor implements the steps in the core subsystem hot upgrade method.

[0012] An embodiment of the present disclosure provides a computer program product, including a computer program, which implements the steps in the above-mentioned core subsystem hot upgrade method when executed by a processor.

[0013] In the embodiment of the present disclosure, for a kernel subsystem that needs to be hot-upgraded, first, the current source code of the kernel subsystem is extracted from the kernel source file based on the boundary configuration information, and the current source code of the kernel subsystem is upgraded to obtain function code upgrade data, and at least one data dependency of the kernel subsystem is identified; then, a hot upgrade script file required for hot-upgrading the kernel subsystem is constructed; finally, during the operation of the kernel, in response to the hot upgrade instruction for the kernel subsystem, the function code and data dependency of the kernel subsystem are hot-upgraded respectively using the hot upgrade script file. In this way, the independent hot upgrade of the kernel subsystem is realized without shutting down the kernel, which facilitates the customization of new features of the kernel subsystem; in addition, since the entire kernel does not need to be upgraded, various uncertain risks caused by upgrading the entire kernel due to subsystem upgrades can also be avoided. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0015] FIG1a is a flow chart of a method for hot upgrading a core subsystem provided by an embodiment of the present disclosure;

[0016] FIG1b is a schematic diagram of the dependency relationship between the eBPF subsystem and other subsystems in the kernel according to an embodiment of the present disclosure;

[0017] FIG2 is a flow chart of another method for hot upgrading a kernel subsystem provided by an embodiment of the present disclosure;

[0018] FIG3 is a flow chart of another method for hot upgrading a core subsystem provided by an embodiment of the present disclosure;

[0019] FIG4 is a schematic structural diagram of a core subsystem hot upgrade device provided by an embodiment of the present disclosure;

[0020] FIG5 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0021] To make the objectives, technical solutions, and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below in conjunction with the specific embodiments of the present disclosure and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present disclosure.

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

[0023] The Linux kernel is a monolithic kernel composed of numerous tightly coupled subsystems that are not flexibly removable. In contrast to subsystems, kernel modules are flexibly removable. The extended Berkeley Packet Filter (eBPF) is a subsystem within the Linux kernel designed to provide high-performance, programmable packet processing capabilities for applications such as network filtering, security monitoring, and traffic analysis.

[0024] Programmers are constantly adding new features to the eBPF subsystem, which is distributed across different versions of the Linux kernel. For users to use the new features of the eBPF subsystem, they must update the entire Linux kernel while it's down. This not only causes service interruptions, but also is very expensive and prone to introducing new issues. Therefore, a method for independently hot-updating the eBPF subsystem is urgently needed.

[0025] To this end, the embodiments of the present disclosure provide a kernel subsystem hot upgrade method, device and storage medium. In the embodiments of the present disclosure, for the kernel subsystem that needs to be hot upgraded, first, the current source code of the kernel subsystem is extracted from the kernel source file based on the boundary configuration information, and the kernel source file is also the source file corresponding to the kernel; and the current source code of the kernel subsystem is upgraded to obtain function code upgrade data, and at least one data dependency of the kernel subsystem is identified; then, a hot upgrade script file required for hot upgrading the kernel subsystem is constructed; finally, during the operation of the kernel, in response to the hot upgrade instruction for the kernel subsystem, the function code and data dependency of the kernel subsystem are hot upgraded respectively using the hot upgrade script file. In this way, the independent hot upgrade of the kernel subsystem is realized without shutting down the kernel, which provides convenience for customizing the new features of the kernel subsystem; in addition, since the entire kernel does not need to be upgraded, various uncertainty risks caused by upgrading the entire kernel due to subsystem upgrades can also be avoided.

[0026] The technical solutions provided by various embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0027] FIG1a is a flow chart of a method for hot upgrading a core subsystem provided by an embodiment of the present disclosure. Referring to FIG1a, the method may include the following steps:

[0028] 101. Based on boundary configuration information adapted to the first kernel subsystem, extract the current source code of the first kernel subsystem from the kernel source file, and upgrade the current source code of the first kernel subsystem to obtain function code upgrade data.

[0029] 102. Identify at least one data dependency of the first kernel subsystem based on an initialization function and / or a debugging result of the first kernel subsystem.

[0030] 103. Construct a hot upgrade script file required for hot upgrading the first kernel subsystem according to the function code upgrade data and at least one data dependency.

[0031] 104. During the operation of the kernel, a hot upgrade instruction for the first kernel subsystem is received, where the hot upgrade instruction points to a hot upgrade script file.

[0032] 105. Hot-upgrade the current function code and at least one data dependency of the first kernel subsystem according to the hot-upgrade script file.

[0033] In this embodiment, the kernel provides the most basic functions of the operating system and is responsible for managing the system's processes, memory, device drivers, files, and network systems. Kernels include, for example, but are not limited to: macro kernels, micro kernels, or hybrid kernels. Typically, a macro kernel or hybrid kernel contains a large number of kernel subsystems, and these kernel subsystems are tightly coupled. Taking the Linux kernel as an example, the Linux kernel includes various kernel subsystems such as the eBPF subsystem, a file management subsystem for file management, a network management subsystem for network management, and a kernel module management subsystem for kernel module management. Here, the kernel subsystem that needs to be hot-upgraded is referred to as the first kernel subsystem. The first kernel subsystem is, for example, the eBPF subsystem, but is not limited to this.

[0034] In actual applications, the kernel source file includes source code that implements the functions of multiple kernel subsystems. For the first kernel subsystem, first, based on boundary configuration information adapted for the first kernel subsystem, the current source code of the first kernel subsystem is extracted from the kernel source file. This allows for independent code upgrades of the first kernel subsystem and provides a basis for subsequent independent hot upgrades of the first kernel subsystem. The current source code of the first kernel subsystem refers to the program code of the first kernel subsystem currently existing in the kernel source file, i.e., the portion of source code in the kernel source file that needs to be hot upgraded.

[0035] Among them, the boundary configuration information is configured by the user according to the function of the first kernel subsystem, and is determined based on the boundary division requirements of the first kernel subsystem. Boundary configuration information includes, but is not limited to: interface functions, internal functions, external functions, public data, private data, structure members, etc., wherein, through the interface function, indirect calls between internal functions and external functions are realized. Internal functions can be understood as being defined within the first kernel subsystem and can only be called by internal functions or interface functions. The external functions mentioned here can be understood as being defined outside the first kernel subsystem and can be called by external functions and / or internal functions. If a function participates in multiple call paths, as long as the function is directly called by an external function in any of the call paths, then the function is marked as an external function.

[0036] Further optionally, in order to accurately extract the current source code of the first kernel subsystem, based on the boundary configuration information adapted to the first kernel subsystem, an optional implementation method of extracting the current source code of the first kernel subsystem from the kernel source file is: based on the boundary configuration information, obtaining from the kernel source file boundary elements that are simultaneously associated with at least two kernel subsystems including the first kernel subsystem; according to the boundary elements, extracting the current source code of the first kernel subsystem from the kernel source file.

[0037] Specifically, boundary elements include: internal function symbols, external function symbols, structure member symbols, private data symbols, public data symbols, function call relationships, interface function symbols, and function pointer symbols. It's important to note that the various symbols mentioned here can be understood as the kernel symbol table, which creates a dynamically changeable mapping table for developers to access corresponding addresses in the program body through symbols. In other words, when using a function or variable, developers only need to enter the corresponding symbol, without having to know the corresponding address of the symbol.

[0038] In this embodiment, after extracting the current source code of the first kernel subsystem from the kernel source file, the code developer can develop the code based on the current source code of the first kernel subsystem according to the development requirements to upgrade the current source code of the first kernel subsystem, and obtain the function code upgrade data obtained by upgrading the current source code of the first kernel subsystem. In actual applications, the current source code of the first kernel subsystem may include one or more function codes, and the function code is the code that implements the function function. The function code upgrade data includes, for example, but is not limited to: newly added function code, updated function code, etc. It can be understood that, compared with the source code before the upgrade, the source code of the first kernel subsystem after the upgrade may contain newly added function code, deleted function code or updated function code, and the updated function code refers to the function code obtained by modifying the source code before the upgrade.

[0039] In this embodiment, after extracting the current source code of the first kernel subsystem from the kernel source file and upgrading the current source code of the first kernel subsystem, at least one data dependency of the first kernel subsystem can be identified. The data dependency here refers to the data dependency between the first kernel subsystem and other subsystems in the kernel. For example, the functions of other subsystems need to rely on the data support provided by the first kernel subsystem to be realized, or the functions of the first kernel subsystem need to rely on the data support provided by other subsystems to be realized. It should be noted that there may also be a calling relationship between the first kernel subsystem and other subsystems or kernel modules in the kernel, that is, the first kernel subsystem may be called by other subsystems, and the first kernel subsystem may also call other subsystems.

[0040] An initialization function is a special initialization function typically found in various files within the kernel source code. Different subsystems have their own initialization function, which is executed at the beginning of kernel startup to register the data dependencies of their subsystems. For a first kernel subsystem, its initialization function can be executed at the beginning of the first kernel subsystem startup, registering its data dependencies during this process. Based on this information, the initialization function of the first kernel subsystem can be analyzed to determine at least one data dependency of the first kernel subsystem.

[0041] In some cases, in addition to analyzing the initialization function to obtain the data dependencies of the first kernel subsystem, the first kernel subsystem may be debugged and the debugging results may be analyzed to obtain data dependencies not defined in the initialization function.

[0042] After obtaining the function upgrade code and at least one data dependency of the first kernel subsystem, a hot upgrade script file required for hot upgrading the current source code of the first kernel subsystem can be constructed according to the function code upgrade data and the at least one data dependency.

[0043] Exemplarily, when constructing a hot upgrade script file, first script data for function code upgrade is constructed for function code upgrade data, the first script data including function code upgrade data for the first kernel subsystem. When constructing a hot upgrade script file, second script data for data dependency upgrade is constructed for at least one data dependency, the second script data including each data dependency and its corresponding data dependency direction and hot upgrade command.

[0044] In an optional implementation, in order to better perform hot upgrades of data dependencies, for at least one data dependency, when constructing second script data for data dependency upgrades, the data dependency directions corresponding to each data dependency can be analyzed, and based on the data dependency directions, the hot upgrade commands required for hot upgrades of each data dependency can be determined; based on the data dependency directions corresponding to each data dependency, each data dependency can be classified into a first type of data dependency that is dependent on the first kernel subsystem and a second type of data dependency that is dependent on the first kernel subsystem; and the second script data can be constructed based on the first type of data dependency and their respective corresponding hot upgrade commands and the second type of data dependency and their respective corresponding hot upgrade commands.

[0045] Specifically, the data dependency direction corresponding to the data dependency relationship may indicate "the first core subsystem is dependent on other subsystems" or "the first core subsystem is dependent on other subsystems." The first core subsystem being dependent on other subsystems can be understood as meaning that the functions of the other subsystems require data support from the first core subsystem to be implemented. The first core subsystem being dependent on other subsystems can be understood as meaning that the functions of the first core subsystem require data support from other subsystems to be implemented.

[0046] In this embodiment, the hot upgrade commands required for hot upgrading of each data dependency are determined based on the data dependency direction. The hot upgrade commands are used to release the original data dependency and re-register new data dependency. The hot upgrade commands will be different depending on the data dependency direction. These hot upgrade commands can be commands originally supported by the kernel or newly added commands, and there is no limitation on this. For example, if the data dependency direction indicates that "the first kernel subsystem depends on other subsystems", the hot upgrade command is used to release the original data dependency registered by the first kernel subsystem to other subsystems in the kernel source file before the hot upgrade, and re-register new data dependency to other subsystems or kernel modules. If the data dependency direction corresponding to the data dependency indicates that "the first kernel subsystem depends on other subsystems", the hot upgrade command is used to release the original data dependency registered by other subsystems to the first kernel subsystem in the kernel source file, and re-register new data dependency to the first kernel subsystem after the hot upgrade.

[0047] It can be understood that when classifying various data dependencies, the data dependency relationship whose data dependency direction indicates that "the first kernel subsystem depends on other subsystems" is classified as the first type of data dependency relationship that is dependent on the first kernel subsystem; and the data dependency relationship whose data dependency direction indicates that "the first kernel subsystem is dependent on other subsystems" is classified as the second type of data dependency relationship that is dependent on the first kernel subsystem.

[0048] In this embodiment, the constructed second script data may include the first type of data dependency and the corresponding hot upgrade command, and the second type of data dependency and the corresponding hot upgrade command. Thus, when the second script data is executed, each data dependency may be hot upgraded according to the hot upgrade command of each data dependency.

[0049] Based on the above operations, during the operation of the kernel, hot upgrades are allowed for the first kernel subsystem. Specifically, the user can issue a hot upgrade command for the first kernel subsystem through a command window or other means. The hot upgrade command is a newly added command, and the format of the hot upgrade command is not limited. The hot upgrade command points to the hot upgrade script file mentioned above. Based on this, a hot upgrade instruction for the first kernel subsystem can be received, and according to the hot upgrade script file, the current function code and at least one data dependency of the first kernel subsystem can be hot upgraded respectively. Among them, hot upgrading the first kernel subsystem includes hot upgrading the current function code and at least one data dependency in the current source code of the first kernel subsystem respectively.

[0050] Optionally, when hot-upgrading the first kernel subsystem, first, from the hot-upgrade script file, first script data for hot-upgrading the function code and second script data for hot-upgrading the data dependency are parsed. Optionally, the hot-upgrade script file may include a separator for dividing or distinguishing the first script data from the second script data, and the first script data and the second script data can be accurately parsed from the hot-upgrade script file based on the separator. The separator may be any symbol with a dividing function that meets the requirements of the script language used by the hot-upgrade script file, such as "***", " / / / ", etc.

[0051] In this embodiment, when hot-upgrading the first kernel subsystem, the first script data is executed to hot-upgrade the current function code in the current source code of the first kernel subsystem according to the function code upgrade data, which is referred to as hot-upgrading the current function code of the first kernel subsystem. The hot-upgrading process of the current function code of the first kernel subsystem can be implemented in, but not limited to, the following two implementations:

[0052] In an optional embodiment A1, when performing a hot upgrade of the function code of the first kernel subsystem, the first script data can be executed to obtain function code upgrade data related to the interface function and function code upgrade data related to the internal function from the function code upgrade data; based on the function code upgrade data related to the interface function, an upgrade operation is performed on the current interface function in the first kernel subsystem; based on the function code upgrade data related to the internal function, an upgrade operation is performed on the current internal function in the first kernel subsystem; wherein, the upgraded interface function of the first kernel subsystem is used to implement calls between external functions and the upgraded internal functions of the first kernel subsystem.

[0053] It is understood that function code upgrade data related to interface functions includes, but is not limited to, newly added interface functions, updated interface functions, and the like. Compared to the source code before the upgrade, the source code of the first kernel subsystem after the upgrade may contain newly added interface functions and updated interface functions. Updated interface functions are those obtained by modifying the interface functions in the source code before the upgrade.

[0054] Function code upgrade data related to internal functions includes, but is not limited to, newly added internal functions and updated internal functions. It is understood that, compared to the source code before the upgrade, the source code of the first kernel subsystem after the upgrade may contain newly added internal functions or updated internal functions. Updated internal functions are those obtained by modifying the internal functions in the source code before the upgrade.

[0055] Before hot upgrading the interface function, it also includes: obtaining multiple functions on the call path where the current interface function in the first kernel subsystem is located and the process descriptors of the process where the multiple functions are located; based on the process descriptors of the process where the multiple functions are located, detecting whether there is a function with set behavior among the multiple functions; if there is no function with set behavior among the multiple functions, determining that the stack of the first kernel subsystem is safe, and if the stack is safe, executing the interface function in the function code upgrade data, and performing a replacement operation on the current interface function in the first kernel subsystem.

[0056] In an optional embodiment A1, when performing a hot upgrade of the current function code of the first subsystem, the first script data can be executed to obtain the upgraded interface function and the upgraded internal function from the function code upgrade data, and the upgraded interface function is used to implement the call between the external function and the upgraded internal function; then, the upgraded interface function is used to replace the interface function to be upgraded in the current function code of the first kernel subsystem to complete the hot upgrade of the interface function in the current function code; then, since the upgraded interface function is used to implement the call between the external function and the upgraded internal function, when the upgraded interface function is called by the external function, the upgraded internal function will be automatically called to complete the hot upgrade of the internal function in the current function code, and finally complete the overall hot upgrade of the current function code.

[0057] In this embodiment, when the first kernel subsystem is hot-upgraded, the second script data is also executed to hot-upgrade at least one data dependency of the first kernel subsystem.

[0058] Optionally, when performing a data dependency upgrade, the second script data can be executed to obtain the various data dependencies of the first kernel subsystem and their corresponding data dependency directions and hot upgrade commands; the corresponding hot upgrade commands are executed according to the data dependency directions corresponding to the various data dependencies to release the original data dependencies and re-register new data dependencies.

[0059] In an optional implementation, if the data dependencies of the first kernel subsystem are divided into first-class data dependencies and second-class data dependencies, then when upgrading the data dependencies, the second script data can be executed to obtain the first-class data dependencies that the first kernel subsystem depends on and the second-class data dependencies that depend on the first kernel subsystem; for the first-class data dependencies, the corresponding hot upgrade command is executed to release the original data dependencies registered by the first kernel subsystem with other subsystems in the kernel source file before the hot upgrade, and re-register new data dependencies with other subsystems or kernel modules; for the second-class data dependencies, the corresponding hot upgrade command is executed to release the original data dependencies registered by other subsystems in the kernel source file with the first kernel subsystem, and re-register new data dependencies with the first kernel subsystem after the hot upgrade.

[0060] In this embodiment, the first kernel subsystem is implemented as an eBPF subsystem. As shown in FIG1b , the eBPF subsystem depends on at least various other subsystems in the Linux kernel, such as the file management subsystem, the network management subsystem, the kernel module management subsystem, the scheduling subsystem, the kernel diagnostic subsystem, the control groups (cgroup) subsystem, and the memory management subsystem. Among these dependencies, some are data dependencies and some are function call relationships. For example, there is a data dependency relationship between the eBPF subsystem and the file management subsystem, the network management subsystem, and the kernel module management subsystem; there is a function call relationship between the eBPF subsystem and the network management subsystem, the scheduling subsystem, the kernel diagnostic subsystem, the cgroup subsystem, and the memory management subsystem. Based on this, for the first type of data dependency, executing the corresponding hot upgrade command to release the original data dependency registered by the eBPF subsystem with other subsystems in the kernel source file before the hot upgrade, and re-registering new data dependencies with other subsystems or kernel modules, may include at least one of the following:

[0061] The first method is to execute the hot upgrade command corresponding to the file management subsystem to release the original data dependency registered by the eBPF subsystem with the file management subsystem before the hot upgrade, and re-register the new data dependency with the file management subsystem.

[0062] In some optional embodiments, the hot upgrade command corresponding to the file management subsystem may include a file system deletion command and a registration command. The file system deletion command is executed to delete the original file system bpffs registered by the eBPF subsystem with the file management subsystem before the hot upgrade; and the file system registration command is executed to re-register a new file system bpffs with the file management subsystem.

[0063] Specifically, the file management subsystem (fs for short) includes multiple file systems, such as the bpffs file system, the sysfs file system, the procfs file system and more than ten other file systems.

[0064] For example, the bpffs file system, also known as the BPF (Berkeley Packet Filter) file system, is used to run advanced network filtering and packet processing programs in the Linux kernel. The sysfs file system is a memory-based file system that provides kernel information to user programs in the form of files. The procfs file system is a memory-based file system that records process information.

[0065] In some optional embodiments, the hot upgrade command corresponding to the file management subsystem may include a mount point deletion command and a creation command. The mount point deletion command is executed to delete the original mount point path in the file management subsystem for mounting the original file system; the mount point creation command is executed to recreate the mount point path for mounting the new file system to the file management subsystem.

[0066] Specifically, users access the file system bpffs through a mount point path. After registering a new file system bpffs, you need to create a new mount point path for the new file system bpffs, such as / sys / fs / bpf.

[0067] In some optional embodiments, the hot upgrade command corresponding to the file management subsystem may include a BTF (BPF Type Format) path deletion command and a creation command. The BTF path deletion command is executed to delete the original BTF file path registered by the eBPF subsystem to the file management subsystem before the hot upgrade; and the BTF path creation command is executed to recreate a new BTF file path to the file management subsystem that is compatible with the hot-upgraded eBPF subsystem.

[0068] Specifically, BTF files provide the kernel's BTF information. BTF is a metadata format that encodes debugging information related to BPF programs and map structures. When the eBPF subsystem is upgraded and new features are introduced, the BTF information will also change accordingly. The old BTF file path (that is, the original BTF file path) will be removed and a new BTF file path will be created, such as / sys / kernel / btf / vmlinux.

[0069] The second method: execute the hot upgrade command corresponding to the network management subsystem to release the original data dependency registered by the eBPF subsystem to the network management subsystem before the hot upgrade, and re-register the new data dependency with the network management subsystem.

[0070] In some optional embodiments, the eBPF subsystem is mounted on the network namespace of the network management subsystem. Based on this, the hot upgrade command corresponding to the network management subsystem includes an unmount command for the network namespace and a mount command for the network namespace. The unmount command for the network namespace is executed to delete the function code of the eBPF subsystem before the hot upgrade from the network namespace managed by the network management subsystem; the mount command for the network namespace is executed to remount the function code of the eBPF subsystem after the hot upgrade in the network namespace.

[0071] In some optional embodiments, the eBPF subsystem and the network management subsystem have a callback relationship for network device-related event notifications. Based on this, the hot upgrade command corresponding to the network management subsystem includes a first callback interface deletion command and a first callback interface registration command. The first callback interface deletion command is executed to delete the original callback interface for network device event notifications registered by the eBPF subsystem with the network management subsystem before the hot upgrade; and the first callback interface registration command is executed to re-register a new callback interface for network device event notifications with the network management subsystem.

[0072] In some optional embodiments, the eBPF subsystem and the network management subsystem have a callback relationship related to packet processing. Based on this, the hot upgrade command corresponding to the network management subsystem includes a second callback interface deletion command and a second callback interface registration command. The second callback interface deletion command is executed to delete the original callback interface for packet processing that the eBPF subsystem registered with the network management subsystem before the hot upgrade; and the second callback interface registration command is executed to re-register a new callback interface for packet processing with the network management subsystem.

[0073] The network management subsystem can provide a variety of different packet transmission protocols, including, but not limited to, light weight tunnels (lwtunnel) and upper layer protocols (ULP) based on the Transmission Control Protocol (TCP). Based on this, the eBPF subsystem can register a callback interface for processing packets received by the lwtunnel interface with the lwtunnel interface in the network management subsystem; accordingly, the corresponding hot upgrade command includes a second delete command for the callback interface and a second register command for the callback interface. The second delete command for the callback interface is executed to delete the original callback interface for packet processing registered by the eBPF subsystem with the lwtunnel interface in the network management subsystem before the hot upgrade; and the second register command for the callback interface is executed to re-register a new callback interface for packet processing with the lwtunnel interface in the network management subsystem. And / or, the eBPF subsystem registers a callback interface for processing data packets received by the TCP ULP interface with the TCP ULP interface in the network management subsystem; accordingly, the corresponding hot upgrade command includes a second deletion command of the callback interface and a second registration command of the callback interface, then the second deletion command of the callback interface is executed to delete the original callback interface for data packet processing registered by the eBPF subsystem with the TCP ULP interface in the network management subsystem before the hot upgrade; and the second registration command of the callback interface is executed to re-register a new callback interface for data packet processing with the TCP ULP interface in the network management subsystem.

[0074] The third method: execute the hot upgrade command corresponding to the kernel module management subsystem to release the original data dependency registered by the eBPF subsystem with the kernel module management subsystem before the hot upgrade, and re-register the new data dependency with the kernel module management subsystem.

[0075] In some optional embodiments, the hot upgrade command corresponding to the kernel module management subsystem includes an event notification deletion command and an event notification registration command. The event notification deletion command is executed to delete the original event notification message registered by the eBPF subsystem to the kernel module management subsystem before the hot upgrade; and the event notification registration command is executed to re-register a new event notification message to the kernel module management subsystem.

[0076] Specifically, event notification information can be used to notify you of any event, including, but not limited to, installation and uninstallation events for various subsystems, such as the file management subsystem, network management subsystem, and kernel module management subsystem. The original event notification message is the old event notification message from before the hot upgrade; the new event notification message may or may not focus on the same event as the original event notification message.

[0077] In this embodiment, if the first kernel subsystem is the eBPF subsystem, and the eBPF subsystem is dependent on other subsystems such as the file management subsystem, the network management subsystem, and the kernel module management subsystem, then for the second type of data dependency, the corresponding hot upgrade command is executed to release the original data dependency registered by other subsystems to the eBPF subsystem in the kernel source file, and re-register new data dependencies to the hot-upgraded eBPF subsystem.

[0078] For example, if the eBPF subsystem is dependent on the network management subsystem, the hot upgrade command corresponding to the network management subsystem is executed to release the original data dependency registered by the network management subsystem to the eBPF subsystem before the hot upgrade, and re-register the new data dependency to the eBPF subsystem after the hot upgrade.

[0079] In some optional embodiments, the hot upgrade command corresponding to the network management subsystem includes an iterator deletion command and an iterator registration command, and the iterator deletion command is executed to delete at least one original iterator registered by the network management subsystem with the eBPF subsystem before the hot upgrade; the iterator registration command is executed to re-register at least one new iterator with the hot-upgraded eBPF subsystem.

[0080] Optionally, at least one iterator registered with the eBPF subsystem includes, but is not limited to, an eBPF map iterator, an eBPF program iterator, a TCP / UDP (User Data Protocol) network packet iterator, and an IPV6 (Internet Protocol Version 6) routing iterator. The eBPF map iterator is an iterator related to the eBPF map, which is a general data structure that stores different types of data and provides functions such as user-mode and kernel-mode data interaction, data storage, and multi-program data sharing. The eBPF program iterator is an iterator related to the eBPF program.

[0081] The technical solution provided by the embodiment of the present disclosure is aimed at the kernel subsystem that needs to be hot-upgraded. First, the function code upgrade data for upgrading the current source code of the kernel subsystem is obtained, and at least one data dependency of the kernel subsystem is identified; then, the hot upgrade script file required for hot-upgrading the kernel subsystem is constructed; finally, during the operation of the kernel, in response to the hot upgrade instruction of the kernel subsystem, the function code and data dependency of the kernel subsystem are hot-upgraded respectively using the hot upgrade script file. In this way, the independent hot upgrade of the kernel subsystem is realized without shutting down the kernel, which provides convenience for users to customize the new features of the kernel subsystem. In addition, since the entire kernel does not need to be upgraded, various uncertain risks caused by upgrading the entire kernel due to subsystem upgrades can also be avoided.

[0082] FIG2 is a flow chart of another method for hot upgrading a core subsystem provided by an embodiment of the present disclosure. Referring to FIG2 , the method may include the following steps:

[0083] 201. During kernel operation, a hot upgrade instruction for a first kernel subsystem is received, where the hot upgrade instruction points to a hot upgrade script file.

[0084] 202. Hot-upgrade the current function code and at least one data dependency in the current source code of the first kernel subsystem according to the hot-upgrade script file.

[0085] The hot upgrade script file is constructed by function code upgrade data of the first kernel subsystem and at least one data dependency relationship, and the function code upgrade data is obtained by upgrading the current source code of the first kernel subsystem.

[0086] In this embodiment, the implementation method of upgrading the current source code of the first kernel subsystem is not limited, and the method provided in the above embodiment can be adopted, but is not limited thereto. The implementation method of each step in the embodiment of the method can be referred to the relevant description of the above embodiment, and will not be repeated here.

[0087] The technical solution provided by the disclosed embodiments utilizes a hot upgrade script file to hot upgrade the function code and data dependencies of the kernel subsystem in response to a hot upgrade instruction from the kernel subsystem during kernel operation. This allows independent hot upgrades of the kernel subsystem without shutting down the kernel, facilitating user customization of new features of the kernel subsystem. Furthermore, since the entire kernel does not need to be upgraded, the various uncertainties and risks associated with upgrading the entire kernel due to subsystem upgrades can be avoided.

[0088] FIG3 is a flow chart of another method for hot upgrading a core subsystem provided by an embodiment of the present disclosure. Referring to FIG3 , the method may include the following steps:

[0089] 301. During kernel operation, a hot upgrade instruction for a first kernel subsystem is received, where the hot upgrade instruction points to a hot upgrade script file.

[0090] 302. Perform a hot upgrade on at least one data dependency of the first kernel subsystem according to the hot upgrade script file.

[0091] The hot upgrade script file is constructed by at least one data dependency of the first kernel subsystem, and the at least one data dependency of the first kernel subsystem is identified based on the initialization function and / or debugging structure of the first kernel subsystem.

[0092] Further optionally, at least one data dependency of the first kernel subsystem is hot upgraded according to the hot upgrade script file, including: executing the hot upgrade script file to obtain each data dependency of the first kernel subsystem and its corresponding data dependency direction and hot upgrade command; executing the corresponding hot upgrade command according to the data dependency direction corresponding to each data dependency to release the original data dependency and re-register the new data dependency.

[0093] For the implementation of each step in the embodiment of the method, please refer to the relevant description of the above embodiment, which will not be repeated here.

[0094] The technical solution provided by the disclosed embodiments utilizes a hot upgrade script file to hot-update the kernel subsystem's data dependencies during kernel operation, in response to a hot upgrade instruction from the kernel subsystem. This allows independent hot upgrades of the kernel subsystem's data dependencies without shutting down the kernel, facilitating user customization of new features within the kernel subsystem.

[0095] FIG4 is a schematic diagram of the structure of a core subsystem hot upgrade device provided by an embodiment of the present disclosure. Referring to FIG4 , the device may include:

[0096] a code upgrade processing module 41 for extracting the current source code of the first kernel subsystem from the kernel source file based on the boundary configuration information adapted to the first kernel subsystem, and upgrading the current source code of the first kernel subsystem to obtain function code upgrade data;

[0097] a data dependency processing module 42 for identifying at least one data dependency of the first kernel subsystem based on an initialization function and / or a debugging result of the first kernel subsystem;

[0098] A script file construction module 43 is configured to construct a hot upgrade script file required for hot upgrading the first kernel subsystem according to the function code upgrade data and at least one data dependency;

[0099] A command receiving module 44 is configured to receive a hot upgrade instruction for the first kernel subsystem during kernel operation, the hot upgrade instruction pointing to a hot upgrade script file;

[0100] The hot upgrade module 45 is configured to hot upgrade the current function code and at least one data dependency in the current source code of the first kernel subsystem according to the hot upgrade script file.

[0101] Further optionally, the hot upgrade module 45 is specifically used to: parse out first script data for hot upgrading of function codes and second script data for hot upgrading of data dependencies from the hot upgrade script file; execute the first script data to hot upgrade the current function code in the current source code of the first kernel subsystem according to the function code upgrade data; and execute the second script data to hot upgrade at least one data dependency of the first kernel subsystem.

[0102] Further optionally, when the hot upgrade module 45 hot upgrades at least one data dependency of the first kernel subsystem, it is specifically used to: execute the second script data, obtain each data dependency of the first kernel subsystem and its corresponding data dependency direction and hot upgrade command; execute the corresponding hot upgrade command according to the data dependency direction corresponding to each data dependency, so as to release the original data dependency and re-register the new data dependency.

[0103] Further optionally, when the hot upgrade module 45 executes the second script data to obtain the data dependency relationships of the first kernel subsystem and their corresponding data dependency directions and hot upgrade commands, it is specifically configured to:

[0104] Executing the second script data to obtain a first type of data dependency relationship that the first kernel subsystem depends on and a second type of data dependency relationship that depends on the first kernel subsystem;

[0105] Accordingly, the hot upgrade module 45 executes the corresponding hot upgrade command according to the data dependency direction corresponding to each data dependency relationship to release the original data dependency relationship and re-register the new data dependency relationship, specifically for:

[0106] For the first type of data dependency, execute the corresponding hot upgrade command to release the original data dependency registered by the first kernel subsystem to other subsystems in the kernel source file before the hot upgrade, and re-register new data dependencies to other subsystems or kernel modules; for the second type of data dependency, execute the corresponding hot upgrade command to release the original data dependency registered by other subsystems in the kernel source file to the first kernel subsystem, and re-register new data dependencies to the first kernel subsystem after the hot upgrade.

[0107] Further optionally, the first kernel subsystem is an extended Berkeley packet filter eBPF subsystem.

[0108] Further optionally, for the first type of data dependency, executing a corresponding hot upgrade command to release the original data dependency registered by the first kernel subsystem with other subsystems in the kernel source file before the hot upgrade, and re-registering new data dependency with other subsystems or kernel modules, includes at least one of the following:

[0109] Executing a hot upgrade command corresponding to the file management subsystem to release the original data dependency relationship registered by the first kernel subsystem with the file management subsystem before the hot upgrade, and re-registering a new data dependency relationship with the file management subsystem;

[0110] Executing a hot upgrade command corresponding to the network management subsystem to release the original data dependency relationship registered by the first kernel subsystem with the network management subsystem before the hot upgrade, and re-registering a new data dependency relationship with the network management subsystem;

[0111] The hot upgrade command corresponding to the kernel module management subsystem is executed to release the original data dependency relationship registered by the first kernel subsystem with the kernel module management subsystem before the hot upgrade, and re-register a new data dependency relationship with the kernel module management subsystem.

[0112] Further optionally, executing a hot upgrade command corresponding to the file management subsystem to release the original data dependency registered by the first kernel subsystem with the file management subsystem before the hot upgrade and re-registering a new data dependency with the file management subsystem includes at least one of the following:

[0113] Executing a file system deletion command to delete the original file system bpffs registered by the first kernel subsystem with the file management subsystem before the hot upgrade; executing a file system registration command to re-register a new file system bpffs with the file management subsystem;

[0114] Execute the mount point deletion command to delete the original mount point path used to mount the original file system in the file management subsystem; execute the mount point creation command to recreate the mount point path used to mount the new file system in the file management subsystem;

[0115] Execute the BTF path deletion command to delete the original BTF file path registered by the first kernel subsystem to the file management subsystem before the hot upgrade; execute the BTF path creation command to recreate a new BTF file path to the file management subsystem that is compatible with the first kernel subsystem after the hot upgrade.

[0116] Further optionally, executing a hot upgrade command corresponding to the network management subsystem to release the original data dependency relationship registered by the first kernel subsystem with the network management subsystem before the hot upgrade and re-registering a new data dependency relationship with the network management subsystem includes at least one of the following:

[0117] Executing an uninstall command of the network namespace to delete the function code of the first kernel subsystem before the hot upgrade from the network namespace managed by the network management subsystem; executing a mount command of the network namespace to re-mount the function code of the first kernel subsystem after the hot upgrade in the network namespace;

[0118] Executing a first delete command of the callback interface to delete the original callback interface for network device event notification registered by the first kernel subsystem with the network management subsystem before the hot upgrade; executing a first register command of the callback interface to re-register a new callback interface for network device event notification with the network management subsystem;

[0119] Execute the second deletion command of the callback interface to delete the original callback interface for data packet processing registered by the first kernel subsystem to the network management subsystem before the hot upgrade; execute the second registration command of the callback interface to re-register the new callback interface for data packet processing to the network management subsystem.

[0120] Further optionally, executing a hot upgrade command corresponding to the kernel module management subsystem to release the original data dependency relationship registered by the first kernel subsystem with the kernel module management subsystem before the hot upgrade and re-registering a new data dependency relationship with the kernel module management subsystem includes:

[0121] Execute the event notification deletion command to delete the original event notification message registered by the first kernel subsystem to the kernel module management subsystem before the hot upgrade; execute the event notification registration command to re-register a new event notification message to the kernel module management subsystem.

[0122] Further optionally, for the second type of data dependency, executing a corresponding hot upgrade command to release the original data dependency registered by other subsystems with the first kernel subsystem in the kernel source file, and re-registering new data dependency with the hot-upgraded first kernel subsystem, including:

[0123] The hot upgrade command corresponding to the network management subsystem is executed to release the original data dependency relationship registered by the network management subsystem to the first kernel subsystem before the hot upgrade, and re-register a new data dependency relationship to the first kernel subsystem after the hot upgrade.

[0124] Further optionally, executing a hot upgrade command corresponding to the network management subsystem to release the original data dependency relationship registered by the network management subsystem with the first kernel subsystem before the hot upgrade and re-registering a new data dependency relationship with the first kernel subsystem after the hot upgrade includes:

[0125] Execute the iterator deletion command to delete at least one original iterator registered by the network management subsystem to the first kernel subsystem before the hot upgrade; execute the iterator registration command to re-register at least one new iterator to the first kernel subsystem after the hot upgrade.

[0126] Further optionally, when the hot upgrade module 45 hot upgrades the current function code in the current source code of the first kernel subsystem, it is specifically used to: execute the first script data, obtain function code upgrade data related to the interface function and function code upgrade data related to the internal function from the function code upgrade data; perform an upgrade operation on the current interface function in the first kernel subsystem according to the function code upgrade data related to the interface function; perform an upgrade operation on the current internal function in the first kernel subsystem according to the function code upgrade data related to the internal function; wherein, the upgraded interface function of the first kernel subsystem is used to implement calls between external functions and the upgraded internal functions of the first kernel subsystem.

[0127] Further optionally, when the hot upgrade module 45 constructs a hot upgrade script file required for hot upgrading the first kernel subsystem in the kernel source file based on the function code upgrade data and at least one data dependency, it is specifically used to: construct first script data for function code upgrade for the function code upgrade data, the first script data including the function code upgrade data of the first kernel subsystem; and construct second script data for data dependency upgrade for at least one data dependency, the second script data including each data dependency and its corresponding data dependency direction and hot upgrade command.

[0128] Further optionally, when the hot upgrade module 45 constructs the second script data for upgrading the data dependency relationship for at least one data dependency relationship, it is specifically used to: analyze the data dependency direction corresponding to each data dependency relationship, and determine the hot upgrade command required for the hot upgrade of each data dependency relationship based on the data dependency direction; classify each data dependency relationship into a first type of data dependency relationship that is dependent on the first kernel subsystem and a second type of data dependency relationship that is dependent on the first kernel subsystem based on the data dependency direction corresponding to each data dependency relationship; and construct the second script data based on the first type of data dependency relationship and their respective corresponding hot upgrade commands and the second type of data dependency relationship and their respective corresponding hot upgrade commands.

[0129] Further optionally, when the code upgrade processing module 41 extracts the current source code of the first kernel subsystem from the kernel source file based on the boundary configuration information adapted to the first kernel subsystem, it is specifically used to: based on the boundary configuration information, obtain boundary elements from the kernel source file that are simultaneously associated with at least two kernel subsystems including the first kernel subsystem; based on the boundary elements, extract the current source code of the first kernel subsystem from the kernel source file.

[0130] The device shown in FIG4 can execute the method shown in the embodiment shown in FIG1a, and its implementation principle and technical effects are not described in detail here. The specific manner in which each module and unit performs the operation of the device shown in FIG4 in the above embodiment has been described in detail in the embodiment of the method, and will not be elaborated here.

[0131] It should be noted that the execution entity of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution entity of steps 401 to 403 can be device A; for another example, the execution entity of steps 401 and 402 can be device A, and the execution entity of step 403 can be device B; and so on.

[0132] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or may be executed in parallel. The sequence numbers of the operations, such as 401, 402, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to being different types.

[0133] FIG5 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. As shown in FIG5 , the electronic device includes: a memory 51 and a processor 52;

[0134] The memory 51 is used to store computer programs and can be configured to store various other data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on the computing platform, contact data, phone book data, messages, pictures, videos, etc.

[0135] The memory 51 can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random-access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0136] The processor 52 is coupled to the memory 51 and is used to execute the computer program in the memory 51 to perform the steps in the core subsystem hot upgrade method.

[0137] Furthermore, as shown in Figure 5, the electronic device also includes: a communication component 53, a display 54, a power supply component 55, an audio component 56 and other components. Figure 5 only schematically shows some components, which does not mean that the electronic device only includes the components shown in Figure 5. In addition, the components in the dotted box in Figure 5 are optional components, not mandatory components, and the specific product form of the electronic device may depend on the product form. The electronic device of this embodiment can be implemented as a terminal device such as a desktop computer, a laptop computer, a smart phone or an IOT (Internet of things) device, or it can be a server-side device such as a conventional server, a cloud server or a server array. If the electronic device of this embodiment is implemented as a terminal device such as a desktop computer, a laptop computer, a smart phone, etc., it may include the components in the dotted box in Figure 5; if the electronic device of this embodiment is implemented as a server-side device such as a conventional server, a cloud server or a server array, it may not include the components in the dotted box in Figure 5.

[0138] The detailed implementation process of the processor executing each action can be found in the relevant description in the aforementioned method embodiment or device embodiment, and will not be repeated here.

[0139] Accordingly, an embodiment of the present disclosure further provides a computer-readable storage medium storing a computer program, which, when executed, can implement the steps that can be performed by the electronic device in the above method embodiment.

[0140] Accordingly, an embodiment of the present disclosure further provides a computer program product, including a computer program / instruction. When the computer program / instruction is executed by a processor, the processor is enabled to implement the steps in the above method embodiment that can be performed by an electronic device.

[0141] The above-mentioned communication component is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi (Wireless Fidelity), 2G (2Generation, 2nd generation), 3G (3Generation, 3rd generation), 4G (4Generation, 4th generation) / LTE (long Term Evolution, long term evolution), 5G (5Generation, 5th generation) and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wide band (UWB) technology, Bluetooth (BT) technology and other technologies.

[0142] The display includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0143] The power supply assembly provides power to various components of the device in which the power supply assembly is located. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply assembly is located.

[0144] The above-mentioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC), and when the device where the audio component is located is in an operating mode, such as call mode, recording mode, and voice recognition mode, the microphone is configured to receive external audio signals. The received audio signal can be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.

[0145] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0146] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0147] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0148] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0149] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), input / output interfaces, network interfaces, and memory.

[0150] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0151] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be used to store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change RAM (PRAM), static random-access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.

[0152] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0153] The foregoing is merely an embodiment of the present disclosure and is not intended to limit the present disclosure. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure are intended to be included within the scope of the claims of the present disclosure.

Claims

1. A method for hot upgrading a kernel subsystem, wherein: include: Based on the boundary configuration information adapted to the first kernel subsystem, extract the current source code of the first kernel subsystem from the kernel source file, and upgrade the current source code of the first kernel subsystem to obtain function code upgrade data; Based on the initialization function and / or debugging result of the first kernel subsystem, identifying at least one data dependency of the first kernel subsystem; Constructing a hot upgrade script file required for hot upgrading the first kernel subsystem according to the function code upgrade data and the at least one data dependency; During the operation of the kernel, receiving a hot upgrade instruction for the first kernel subsystem, the hot upgrade instruction pointing to the hot upgrade script file; According to the hot upgrade script file, the current function code and at least one data dependency in the current source code of the first kernel subsystem are hot upgraded respectively.

2. The method according to claim 1, wherein: According to the hot upgrade script file, hot upgrade is performed on the current function code and at least one data dependency in the current source code of the first kernel subsystem respectively, including: Parsing the hot upgrade script file to obtain first script data for hot upgrade of function codes and second script data for hot upgrade of data dependency relationships; Executing the first script data to hot-upgrade the current function code in the current source code of the first kernel subsystem according to the function code upgrade data; The second script data is executed to hot-upgrade at least one data dependency of the first kernel subsystem.

3. The method according to claim 2, wherein: Executing the second script data to hot-upgrade at least one data dependency of the first kernel subsystem includes: Execute the second script data to obtain various data dependency relationships of the first kernel subsystem and their corresponding data dependency directions and hot upgrade commands; Execute the corresponding hot upgrade command according to the data dependency direction corresponding to each data dependency relationship to release the original data dependency relationship and re-register the new data dependency relationship.

4. The method according to claim 3, wherein: Executing the second script data to obtain various data dependency relationships of the first kernel subsystem and their corresponding data dependency directions and hot upgrade commands includes: Execute the second script data to obtain a first type of data dependency relationship that the first kernel subsystem depends on and a second type of data dependency relationship that depends on the first kernel subsystem; Accordingly, the corresponding hot upgrade command is executed according to the data dependency direction corresponding to each data dependency relationship to release the original data dependency relationship and re-register the new data dependency relationship, including: For the first type of data dependency, executing a corresponding hot upgrade command to release the original data dependency registered by the first kernel subsystem with other subsystems in the kernel source file before the hot upgrade, and re-registering new data dependency with the other subsystems or kernel modules; For the second type of data dependency, a corresponding hot upgrade command is executed to release the original data dependency registered by other subsystems in the kernel source file to the first kernel subsystem, and re-register the data dependency to the hot upgraded first kernel subsystem. The nuclear subsystem registers new data dependencies.

5. The method according to claim 4, wherein: The first kernel subsystem is an extended Berkeley packet filter eBPF subsystem.

6. The method according to claim 5, wherein: For the first type of data dependency, executing a corresponding hot upgrade command to release the original data dependency registered by the first kernel subsystem with other subsystems in the kernel source file before the hot upgrade, and re-registering new data dependency with the other subsystems or kernel modules, including at least one of the following: Executing a hot upgrade command corresponding to the file management subsystem to release the original data dependency relationship registered by the first kernel subsystem to the file management subsystem before the hot upgrade, and re-registering a new data dependency relationship to the file management subsystem; Executing a hot upgrade command corresponding to the network management subsystem to release the original data dependency relationship registered by the first kernel subsystem to the network management subsystem before the hot upgrade, and re-registering a new data dependency relationship to the network management subsystem; Execute a hot upgrade command corresponding to the kernel module management subsystem to release the original data dependency relationship registered by the first kernel subsystem to the kernel module management subsystem before the hot upgrade, and re-register a new data dependency relationship to the kernel module management subsystem.

7. The method according to claim 6, wherein: Executing a hot upgrade command corresponding to the file management subsystem to release the original data dependency relationship registered by the first kernel subsystem to the file management subsystem before the hot upgrade, and re-registering a new data dependency relationship to the file management subsystem, including at least one of the following: Execute a file system deletion command to delete the original file system bpffs registered by the first kernel subsystem to the file management subsystem before the hot upgrade; execute a file system registration command to re-register a new file system bpffs to the file management subsystem; Execute a mount point deletion command to delete the original mount point path for mounting the original file system in the file management subsystem; execute a mount point creation command to recreate a mount point path for mounting the new file system in the file management subsystem; Execute a BTF path deletion command to delete the original BTF file path registered by the first kernel subsystem to the file management subsystem before the hot upgrade; execute a BTF path creation command to recreate a new BTF file path to the file management subsystem that is compatible with the first kernel subsystem after the hot upgrade.

8. The method according to claim 6, wherein: Executing a hot upgrade command corresponding to the network management subsystem to release the original data dependency relationship registered by the first kernel subsystem to the network management subsystem before the hot upgrade, and re-registering a new data dependency relationship to the network management subsystem, including at least one of the following: Execute an uninstall command of the network namespace to delete the function code of the first kernel subsystem before the hot upgrade from the network namespace managed by the network management subsystem; execute a mount command of the network namespace to re-mount the function code of the first kernel subsystem after the hot upgrade in the network namespace; Execute a first deletion command of the callback interface to delete the original callback interface for network device event notification registered by the first kernel subsystem with the network management subsystem before the hot upgrade; Executing a first registration command of the callback interface to re-register a new callback interface for network device event notification with the network management subsystem; Execute the second deletion command of the callback interface to delete the original callback interface for data packet processing registered by the first kernel subsystem to the network management subsystem before the hot upgrade; execute the second registration command of the callback interface, The new callback interface for data packet processing is re-registered with the network management subsystem.

9. The method according to claim 6, wherein: Executing a hot upgrade command corresponding to the kernel module management subsystem to release the original data dependency relationship registered by the first kernel subsystem to the kernel module management subsystem before the hot upgrade, and re-registering a new data dependency relationship to the kernel module management subsystem, including: Execute an event notification deletion command to delete the original event notification message registered by the first kernel subsystem to the kernel module management subsystem before the hot upgrade; execute an event notification registration command to re-register a new event notification message to the kernel module management subsystem.

10. The method according to claim 5, wherein: For the second type of data dependency, executing a corresponding hot upgrade command to release the original data dependency registered by other subsystems in the kernel source file to the first kernel subsystem, and re-registering a new data dependency to the hot-upgraded first kernel subsystem, including: Execute the hot upgrade command corresponding to the network management subsystem to release the original data dependency relationship registered by the network management subsystem to the first kernel subsystem before the hot upgrade, and re-register the new data dependency relationship to the first kernel subsystem after the hot upgrade.

11. The method according to claim 10, wherein: Executing a hot upgrade command corresponding to the network management subsystem to release the original data dependency relationship registered by the network management subsystem to the first kernel subsystem before the hot upgrade, and re-registering a new data dependency relationship to the first kernel subsystem after the hot upgrade, including: Execute the iterator deletion command to delete at least one original iterator registered by the network management subsystem to the first kernel subsystem before the hot upgrade; execute the iterator registration command to re-register at least one new iterator to the first kernel subsystem after the hot upgrade.

12. The method according to claim 2, wherein: Executing the first script data to hot-upgrade the current function code in the current source code of the first kernel subsystem according to the function code upgrade data includes: Executing the first script data, acquiring function code upgrade data related to the interface function and function code upgrade data related to the internal function from the function code upgrade data; Performing an upgrade operation on the current interface function in the first kernel subsystem according to the function code upgrade data related to the interface function; performing an upgrade operation on the current internal function in the first kernel subsystem according to the function code upgrade data related to the internal function; The upgraded interface function of the first kernel subsystem is used to implement the call between the external function and the upgraded internal function of the first kernel subsystem.

13. The method according to any one of claims 1 to 12, wherein: According to the function code upgrade data and at least one data dependency, a hot upgrade script file required for hot upgrading the first kernel subsystem is constructed, including: Constructing first script data for function code upgrade for the function code upgrade data, wherein the first script data includes the function code upgrade data of the first kernel subsystem; For the at least one data dependency, second script data for upgrading the data dependency is constructed, wherein the second script data includes each data dependency and its corresponding data dependency direction and a hot upgrade command.

14. A method for hot upgrading a kernel subsystem, wherein: include: During the kernel operation, a hot upgrade instruction for a first kernel subsystem of a kernel source file is received. The upgrade instruction points to the hot upgrade script file; According to the hot upgrade script file, hot upgrade the current function code and at least one data dependency in the current source code of the first kernel subsystem respectively; The hot upgrade script file is constructed by function code upgrade data of the first kernel subsystem and the at least one data dependency relationship, and the function code upgrade data is obtained by upgrading the current source code of the first kernel subsystem.

15. A method for hot upgrading a kernel subsystem, wherein: include: During the kernel operation, receiving a hot upgrade instruction for the first kernel subsystem, wherein the hot upgrade instruction points to a hot upgrade script file; According to the hot upgrade script file, hot upgrade is performed on at least one data dependency of the first kernel subsystem respectively; The hot upgrade script file is constructed by using the at least one data dependency of the first kernel subsystem, and the at least one data dependency of the first kernel subsystem is identified based on the initialization function and / or debugging structure of the first kernel subsystem.

16. The method according to claim 15, wherein: Performing a hot upgrade on at least one data dependency of the first kernel subsystem according to the hot upgrade script file includes: Execute the hot upgrade script file to obtain various data dependency relationships of the first kernel subsystem and their corresponding data dependency directions and hot upgrade commands; Execute the corresponding hot upgrade command according to the data dependency direction corresponding to each data dependency relationship to release the original data dependency relationship and re-register the new data dependency relationship.

17. An electronic device, wherein: include: Memory and processor; The memory stores a computer program, and the processor, coupled to the memory, is configured to execute the computer program to implement the steps in the method according to any one of claims 1 to 16.

18. A computer-readable storage medium storing a computer program, wherein: When the computer program is executed by a processor, the processor is caused to implement the steps in the method according to any one of claims 1 to 16.

19. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 16.

Citation Information

Patent Citations

  • Hot upgrading method and device for kernel modules and virtual machine system

    CN108121574A

  • System upgrading method and device, electronic equipment and storage medium

    CN114356370A

  • Internal core subsystem hot upgrading method and device and storage medium

    CN116991449A

  • Port throttling across an operating system restart during a hot upgrade

    US20120096250A1

Cited By

  • Memory management method and device, electronic equipment, medium and computer program product

    CN122044895A

  • Firmware upgrading method and device, electronic equipment and storage medium

    CN122653657A