Method and device for hot restart of a switching chip, electronic device and storage medium
By adding a hot restart register to the EPLD and controlling the Bootloader logic, the problem of some CPUs not supporting kexec was solved, and the normal operation of the switching chip's service and forwarding functions was achieved without interruption during the hot restart process.
Patent Information
- Application Number
- CN202310433853.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-21
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-04-21
AI Technical Summary
Some CPUs do not support kexec or have limited support for kexec, causing the switching chip to malfunction due to MSI interrupts during the reboot process.
A hot restart register is added to the erasable programmable logic device (EPLD). Its value is read and judged by the bootloader to prevent the CPU reset signal from being transmitted to the switching chip peripherals. During hot restart, peripheral initialization is not performed, and hot restart information is transmitted to the operating system kernel and upper-layer applications through the kernel.
It ensures that the forwarding function of the switching chip remains normal during hot restart, solves the problem of CPU not supporting kexec, and ensures that services are not interrupted.
Smart Images

Figure CN116431390B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic communications, and in particular to a method and apparatus for hot-rebooting a switching chip, an electronic device, and a storage medium. Background Technology
[0002] A warm reboot refers to a type of reboot that ensures uninterrupted service during device restart. In the field of Ethernet switches, it means ensuring uninterrupted forwarding plane services during switch device reboot, and that the software can regain control of the running switching chips after reboot.
[0003] In existing technologies, a common approach is for the CPU to reboot via kexec, a service provided by the system kernel. This approach allows the direct startup of another operating system kernel from within the existing kernel, skipping the boot phase and reducing reboot time. During this reboot process, the CPU does not reset; instead, the reset of peripheral devices is typically controlled by the CPU's reset signal and bypasses the bootloader stage, thus preserving the state of the hardware peripherals.
[0004] However, some CPUs do not support kexec or have limited support for it. For example, with the NXPLS1023A CPU, restarting via kexec will cause the MSI interrupt to malfunction.
[0005] The information disclosed in this background section is intended only to enhance the understanding of the overall background of the invention and should not be construed as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention
[0006] The purpose of this invention is to provide a method, apparatus, electronic device, and storage medium for hot restarting a switching chip, which can solve the problem that some CPUs do not support kexec or have limited support for kexec, and achieve hot restarting that maintains the normal forwarding function of the switching chip.
[0007] To achieve the above objectives, embodiments of the present invention provide a method for hot-rebooting a switching chip.
[0008] In one or more embodiments of the present invention, the method includes: after the erasable programmable logic device (EPLD) receives a CPU reset signal, controlling the bootloader to read the value of the EPLD's hot reset register; determining whether the value of the EPLD's hot reset register is a predefined value; and if so, preventing the EPLD from transmitting the CPU reset signal to the peripherals of the switching chip, and controlling the bootloader not to perform initialization on the peripherals of the switching chip.
[0009] In one or more embodiments of the present invention, the peripherals of the switching chip include a PHY chip and an optical transceiver module.
[0010] In one or more embodiments of the present invention, controlling the Bootloader not to perform initialization on the peripherals of the switching chip specifically includes: controlling the Bootloader not to perform initialization on the peripherals of the switching chip, and resetting the hot reboot register to pass the hot reboot parameters to the boot parameters of the operating system kernel of the switching chip.
[0011] In one or more embodiments of the present invention, the method further includes: starting the operating system kernel according to the startup parameters; and the operating system kernel and the upper-layer application executing corresponding software initialization logic according to the kernel parameters of the operating system kernel.
[0012] In one or more embodiments of the present invention, the operating system kernel and the upper-layer application execute corresponding software initialization logic according to the kernel parameters of the operating system kernel, specifically including: the upper-layer application obtains the startup type by parsing the cmdline file started by the operating system kernel and executes the corresponding software initialization logic.
[0013] In one or more embodiments of the present invention, the method further includes: if the value of the hot restart register is not a predefined value, starting the operating system kernel according to the boot parameters of the operating system kernel of the switching chip; the operating system kernel and the upper-layer application execute corresponding software initialization logic according to the kernel parameters of the operating system kernel.
[0014] In one or more embodiments of the present invention, the method further includes: performing data writing to the restart register before CPU reset.
[0015] In another aspect of the invention, an apparatus for hot-rebooting a switching chip is provided, comprising a loading module, a judgment module, and a processing module.
[0016] The loading module is used to control the bootloader to read the value of the hot restart register in the EPLD when the erasable programmable logic device (EPLD) receives a CPU reset signal.
[0017] The judgment module is used to determine whether the hot restart register of the EPLD is a predefined value.
[0018] The processing module is used to prevent the EPLD from transmitting the CPU reset signal to the peripherals of the switching chip, and to control the Bootloader not to perform initialization on the peripherals of the switching chip.
[0019] In one or more embodiments of the present invention, the processing module is further configured to: control the Bootloader not to perform initialization on the peripherals of the switching chip, and reset the hot reboot register, and pass the hot reboot parameters to the boot parameters of the operating system kernel of the switching chip.
[0020] In one or more embodiments of the present invention, the processing module is further configured to: start the operating system kernel according to the startup parameters; and the operating system kernel and the upper-layer application execute corresponding software initialization logic according to the kernel parameters of the operating system kernel.
[0021] In one or more embodiments of the present invention, the processing module is further configured to: obtain the startup type by parsing the cmdline file started by the operating system kernel, and execute the corresponding software initialization logic.
[0022] In one or more embodiments of the present invention, the determination module is further configured to: if the value of the hot restart register is not a predefined value, start the operating system kernel according to the startup parameters of the operating system kernel of the switching chip; the operating system kernel and the upper-layer application execute corresponding software initialization logic according to the kernel parameters of the operating system kernel.
[0023] In one or more embodiments of the present invention, the loading module is further configured to: perform data writing to the restart register before CPU reset.
[0024] In another aspect of the invention, an electronic device is provided, comprising: at least one processor; and a memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the hot-reboot method of the switching chip as described above.
[0025] In another aspect of the invention, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the method for hot-rebooting a switching chip as described above.
[0026] Compared with the prior art, the method for hot restarting a switching chip according to an embodiment of the present invention solves the problem that some CPUs do not support kexec or have limited support for kexec. By adding a hot restart register to the EPLD, the CPU reset signal is shielded from the switching chip peripherals. By reading the hot restart register and executing different software logic through the bootloader, peripheral initialization is not performed during hot restart. The hot restart information is passed to the operating system kernel and upper-layer applications through kernel parameters, thus achieving a hot restart that maintains the normal forwarding function of the switching chip. Attached Figure Description
[0027] Figure 1 This is a flowchart of a method for hot-rebooting a switching chip according to an embodiment of the present invention;
[0028] Figure 2 This is a detailed flowchart of a method for hot-rebooting a switching chip according to an embodiment of the present invention;
[0029] Figure 3 This is a structural diagram of an apparatus for a method of hot-rebooting a switching chip according to an embodiment of the present invention;
[0030] Figure 4 This is a hardware structure diagram of a computing device for a method of hot-rebooting a switching chip according to an embodiment of the present invention. Detailed Implementation
[0031] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings, but it should be understood that the scope of protection of the present invention is not limited to the specific embodiments.
[0032] Unless otherwise expressly stated, throughout the specification and claims, the term "comprising" or its variations such as "including" or "comprises" shall be understood to include the stated elements or components without excluding other elements or other components.
[0033] The technical solutions provided by the various embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0034] Example 1
[0035] like Figures 1 to 2 As shown, a method for hot-rebooting a switching chip is described in one embodiment of the present invention, which includes the following steps.
[0036] In step S101, after the erasable programmable logic device (EPLD) receives the CPU reset signal, it controls the bootloader to read the value of the EPLD's hot restart register.
[0037] An EPLD (Erasable Programmable Logic Device) is an integrated circuit that includes a series of programmable logic devices, enabling the implementation of desired logic functions within a single chip. In specific applications, an EPLD may be integrated into a switching chip, where it can work with related auxiliary circuitry to control corresponding logic signals and achieve the various logic functions described above.
[0038] In this embodiment, a custom warm reset register, namely the warmreset register, is added to the EPLD, and the reset signal transmitted by the CPU is controlled by setting the value of the warm reset register.
[0039] The bootloader is the first piece of code executed by an embedded system after power-on. It contains the initialization logic for peripherals. The bootloader program can initialize hardware devices, establish a memory space mapping, prepare the environment for calling the operating system kernel, and then enable the operating system kernel to start and run.
[0040] Specifically, during the CPU reset phase, the switching chip performs a CPU reset operation. After the CPU resets, the CPU sends a CPU reset signal to the EPLD. At this time, the EPLD reads the value of the warm restart register to determine how to control the reset signal sent by the CPU. The switching chip also reads the value of the EPLD's warm restart register through the bootloader to determine whether to initialize the switching chip's peripherals.
[0041] In step S102, it is determined whether the value of the EPLD's hot restart register is a predefined value.
[0042] In this embodiment, the predefined value of the warm restart register can be set as needed. For example, the predefined value can be "0", or it can be any non-zero value (e.g., 0xFF). If the predefined value is "0", the judgment here is essentially to determine whether the warm restart register is empty; if the predefined value is any non-zero value, the judgment here is to determine whether the warm restart register is not empty. Of course, the predefined value can be set to one or more specific values, and the judgment here is to determine whether the warm restart register contains one or more of those specific values. This application does not impose any restrictions on this.
[0043] In step S103, if the value of the EPLD's hot restart register is a predefined value, the EPLD is prevented from transmitting the CPU reset signal to the peripherals of the switching chip, and the Bootloader is controlled not to perform initialization on the peripherals of the switching chip.
[0044] When the value in the hot restart register is a predefined value, the EPLD masks the reset signal transmitted by the CPU. That is, after receiving the CPU reset signal, the EPLD does not transmit the CPU reset signal to the peripherals of the switching chip, thereby achieving only the CPU being reset and not the peripherals of the switching chip being reset.
[0045] Depending on the predefined value setting, the switching chip can perform different operations on the hot reset register before CPU reset. For example, if the predefined value is non-zero, data needs to be written to the hot reset register before CPU reset, and the value of the hot reset register needs to be set to non-zero. Alternatively, if the predefined value is "0", data can be left unwritten to the hot reset register before CPU reset, and the hot reset register can be checked for emptiness as needed, and data can be deleted if the hot reset register is not empty.
[0046] In this embodiment, after the CPU is reset, if the Bootloader reads and determines that the value of the hot restart register is a predefined value, then the peripherals of the switching chip are not initialized. The peripherals of the switching chip include PHY chips, optical transceivers, etc.
[0047] During the specific execution process, the Bootloader does not initialize the peripherals of the switching chip, resets the hot reboot register, and passes the hot reboot parameters to the boot parameters of the operating system kernel of the switching chip, wherein the hot reboot parameters represent the reboot type as hot reboot.
[0048] If the predefined value of the warm restart register is set to a non-zero value, resetting the warm restart register here means clearing it to zero. If the predefined value of the warm restart register is set to "0", resetting the warm restart register here means writing a non-zero value (any non-zero value or a specified non-zero value).
[0049] During the operating system kernel startup phase, the switching chip starts the operating system kernel according to the startup parameters of the operating system kernel; the operating system kernel and the upper-layer application execute the corresponding software initialization logic according to the kernel parameters of the operating system kernel.
[0050] Furthermore, upper-layer applications can obtain the boot type by parsing the cmdline file that the operating system kernel starts, and execute the corresponding software initialization logic. The cmdline file is used to guide the kernel startup.
[0051] For example, the cmdline file can contain command-line arguments for a process, including the process's startup path. The parameters passed to the kernel by the bootloader during kernel startup can be obtained by using the command / proc / cmdline.
[0052] like Figure 2 As shown, if the boot type is not a hot reboot, that is, if the value of the hot reboot register is not a predefined value, then after the CPU reset operation is performed, the operating system kernel is directly started according to the boot parameters of the operating system kernel of the switching chip.
[0053] The operating system kernel and upper-layer applications execute the corresponding software initialization logic according to the kernel parameters of the operating system kernel. The upper-layer applications obtain the boot type by parsing the cmdline file started by the operating system kernel and execute the corresponding software initialization logic.
[0054] In the hot restart method of this embodiment, the hardware state of the peripherals of the switching chip remains unchanged during the CPU reset stage, the Bootloader stage, or the operating system kernel startup stage, so that the switching chip can still perform the forwarding function during the hot restart process.
[0055] According to an embodiment of the present invention, a method for hot-rebooting a switching chip solves the problem that some CPUs do not support kexec or have limited support for kexec. By adding a hot-reboot register to the EPLD, the CPU reset signal is shielded from the switching chip peripherals. By reading the hot-reboot register through the bootloader and executing different software logic, peripheral initialization is not performed during hot reboot. The hot-reboot information is passed to the operating system kernel and upper-layer applications through kernel parameters, thus achieving a hot reboot that maintains the normal forwarding function of the switching chip.
[0056] like Figure 3 As shown, an apparatus for hot-rebooting a switching chip according to a specific embodiment of the present invention is described.
[0057] In an embodiment of the present invention, the device for hot restarting the switching chip includes a loading module 301, a judgment module 302, and a processing module 303.
[0058] The loading module 301 is used to control the bootloader to read the value of the hot restart register in the EPLD when the erasable programmable logic device EPLD receives a CPU reset signal.
[0059] The judgment module 302 is used to determine whether the hot restart register of the EPLD is a predefined value.
[0060] The processing module 303 is used to prevent the EPLD from transmitting the CPU reset signal to the peripherals of the switching chip, and to control the Bootloader not to perform initialization on the peripherals of the switching chip.
[0061] The processing module 303 is also configured to: control the Bootloader not to perform initialization on the peripherals of the switching chip, and reset the hot reboot register, and pass the hot reboot parameters to the boot parameters of the operating system kernel of the switching chip.
[0062] The processing module 303 is also configured to: start the operating system kernel according to the startup parameters; and the operating system kernel and the upper-layer application execute corresponding software initialization logic according to the kernel parameters of the operating system kernel.
[0063] The processing module 303 is also used for: the upper-layer application to obtain the startup type by parsing the cmdline file started by the operating system kernel, and to execute the corresponding software initialization logic.
[0064] The judgment module 302 is also used to: if the value of the hot restart register is not a predefined value, start the operating system kernel according to the boot parameters of the operating system kernel of the switching chip; the operating system kernel and the upper layer application execute the corresponding software initialization logic according to the kernel parameters of the operating system kernel.
[0065] The loading module 301 is also used to: perform data writing to the restart register before the CPU is reset.
[0066] Figure 4 A hardware structure diagram of a computing device 40 for hot-rebooting a switching chip, according to an embodiment of this specification, is shown. Figure 4 As shown, the computing device 40 may include at least one processor 401, a memory 402 (e.g., non-volatile memory), a main memory 403, and a communication interface 404, and the at least one processor 401, memory 402, main memory 403, and communication interface 404 are connected together via a bus 405. At least one processor 401 executes at least one computer-readable instruction stored or encoded in the memory 402.
[0067] It should be understood that the computer-executable instructions stored in memory 402, when executed, cause at least one processor 401 to perform the above-described combinations in the various embodiments of this specification. Figure 1-4 The description includes various operations and functions.
[0068] In the embodiments of this specification, computing device 40 may include, but is not limited to: personal computer, server computer, workstation, desktop computer, laptop computer, notebook computer, mobile computing device, smartphone, tablet computer, cellular phone, personal digital assistant (PDA), handheld device, messaging device, wearable computing device, consumer electronic device, etc.
[0069] According to one embodiment, a program product, such as a machine-readable medium, is provided. The machine-readable medium may have instructions (i.e., the elements implemented in software as described above), which, when executed by a machine, cause the machine to perform the above-described combinations of the various embodiments of this specification. Figure 1-4 The various operations and functions described. Specifically, a system or apparatus equipped with a readable storage medium storing software program code that implements the functions of any of the embodiments described above, and enabling the computer or processor of the system or apparatus to read and execute the instructions stored in the readable storage medium.
[0070] According to an embodiment of the present invention, a method for hot-rebooting a switching chip solves the problem that some CPUs do not support kexec or have limited support for kexec. By adding a hot-reboot register to the EPLD, the CPU reset signal is shielded from the switching chip peripherals. By reading the hot-reboot register through the bootloader and executing different software logic, peripheral initialization is not performed during hot reboot. The hot-reboot information is passed to the operating system kernel and upper-layer applications through kernel parameters, thus achieving a hot reboot that maintains the normal forwarding function of the switching chip.
[0071] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0072] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0073] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0074] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0075] The foregoing description of specific exemplary embodiments of the invention is for illustrative and explanatory purposes. These descriptions are not intended to limit the invention to the precise forms disclosed, and it will be apparent that many changes and variations can be made in accordance with the foregoing teachings. The exemplary embodiments were chosen and described in order to explain the specific principles of the invention and its practical application, thereby enabling those skilled in the art to implement and utilize various different exemplary embodiments of the invention, as well as various different choices and variations. The scope of the invention is intended to be defined by the claims and their equivalents.
Claims
1. A method for hot-rebooting a switching chip, characterized in that, The method includes: Before CPU reset, perform data writing to the hot restart register of the erasable programmable logic device (EPLD); After the erasable programmable logic device (EPLD) receives a CPU reset signal, the bootloader is controlled to read the value of the EPLD's hot restart register. Determine whether the value of the EPLD's hot restart register is a predefined value; and, If so, prevent the EPLD from transmitting the CPU reset signal to the peripherals of the switching chip, so as to reset only the CPU and not the peripherals of the switching chip, and control the Bootloader not to perform initialization on the peripherals of the switching chip; The hot reboot register is reset, and the hot reboot parameters are passed to the boot parameters of the operating system kernel of the switching chip, wherein the hot reboot parameters represent that the reboot type is hot reboot; The operating system kernel is started according to the boot parameters. The operating system kernel and the upper-layer application execute the corresponding software initialization logic according to the kernel parameters of the operating system kernel. The upper-layer application obtains the boot type by parsing the cmdline file of the operating system kernel and executes the corresponding software initialization logic.
2. The method for hot-rebooting a switching chip as described in claim 1, characterized in that, The peripherals of the switching chip include a PHY chip and an optical transceiver module.
3. The method for hot-rebooting a switching chip as described in claim 1, characterized in that, The method further includes: If the value of the hot restart register is not a predefined value, the operating system kernel is started according to the boot parameters of the operating system kernel of the switching chip; The operating system kernel and upper-layer applications execute corresponding software initialization logic based on the kernel parameters of the operating system kernel.
4. An apparatus for hot-rebooting a switching chip, used in the method according to any one of claims 1 to 3, characterized in that, The device includes: The loading module is used to control the bootloader to read the value of the hot restart register in the EPLD when the erasable programmable logic device (EPLD) receives a CPU reset signal; The judgment module is used to determine whether the EPLD's hot restart register is a predefined value; and The processing module is used to prevent the EPLD from transmitting the CPU reset signal to the peripherals of the switching chip, and to control the Bootloader not to perform initialization on the peripherals of the switching chip.
5. An electronic device, characterized in that, include: At least one processor; as well as A memory that stores instructions that, when executed by the at least one processor, cause the at least one processor to perform a hot restart method for a switching chip as described in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the hot-reboot method for a switching chip as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Method and device for distinguish cool start and hot start
CN101008900A
Power-on reset device for integrated test system
CN102866755A
