Kernel Module Hot Upgrades via Read-Write Interface Locking
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The inefficiency of kernel module upgrades due to the need to disable and deactivate numerous service components, leading to prolonged downtime and reduced upgrade efficiency.
Innovation Solution
A hot upgrade method that utilizes a read-write lock to block interface address information in a non-hot-upgradable module, allowing for the replacement of interface address information in a hot-upgradable module without deactivating service components, enabling online software updates.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If service components are disabled and deactivated during kernel module upgrade, then upgrade reliability is improved, but upgrade time and system downtime increase
Solution Approach 1:
The kernel module is divided into a basic module and a hot-upgradable module. The basic module contains critical functions that must remain active, while the hot-upgradable module contains replaceable functionality. This segmentation allows the upgradable portion to be replaced without affecting the entire kernel module or requiring service component shutdown.
Solution Approach 2:
A hot upgrade thread acts as an intermediary mechanism between the old and new hot-upgradable modules. This thread manages the transition by obtaining read-write locks, blocking old interface addresses, and redirecting calls to new interface addresses, enabling seamless updates without service interruption.
2Productivity
If service components remain online during kernel module upgrade, then upgrade efficiency is improved, but system stability may be compromised
Solution Approach 1:
Before the actual upgrade, the system performs preliminary actions including inserting the new hot-upgradable module, obtaining read-write locks on the basic module, and blocking the old interface address information. These preparatory steps ensure that the transition can proceed safely while services remain online.
Solution Approach 2:
The hot-upgradable module is replaced by copying the new module into the running system. The new module contains copied interface address information that is then activated through the hot upgrade thread, allowing the system to switch to the new version without complete reinitialization.
3Reliability
If interface address information is blocked using read-write locks, then hot upgrade safety is improved, but module access complexity increases
Solution Approach 1:
The read-write lock mechanism serves multiple functions: it provides mutual exclusion during module insertion, blocks old interface addresses during upgrade, and manages the transition between old and new modules. This multi-functionality reduces the need for separate control mechanisms for each upgrade phase.
Data Source
AI summary
A hot upgrade method for a kernel module includes: when a hot upgrade request for a kernel module is triggered, calling a hot upgrade thread in a newly inserted hot upgrade updating module, and obtaining, by using the hot upgrade thread, a read-write lock that is pre-inserted into a basic module in the kernel module, to block first interface address information of a hot-upgradable module in the kernel module from being called, where the hot upgrade updating module includes second interface address information corresponding to each of a plurality of function call interfaces; and calling each function to be hot-upgraded by using the hot upgrade thread, and replacing, for a function call interface corresponding to each function, the first interface address information corresponding to the function call interface with the second interface address information by using the hot upgrade thread, to complete hot upgrade for the kernel module.


