CN111897577A - Master-slave distinguishing method and device of CPU (Central processing Unit) and computer terminal equipment - Google Patents

Master-slave distinguishing method and device of CPU (Central processing Unit) and computer terminal equipment Download PDF

Info

Publication number
CN111897577A
CN111897577A CN202010742359.1A CN202010742359A CN111897577A CN 111897577 A CN111897577 A CN 111897577A CN 202010742359 A CN202010742359 A CN 202010742359A CN 111897577 A CN111897577 A CN 111897577A
Authority
CN
China
Prior art keywords
cpu
version number
host
slave
node information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010742359.1A
Other languages
Chinese (zh)
Other versions
CN111897577B (en
Inventor
钟节贤
江虎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Yealink Network Technology Co Ltd
Original Assignee
Xiamen Yealink Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Yealink Network Technology Co Ltd filed Critical Xiamen Yealink Network Technology Co Ltd
Priority to CN202010742359.1A priority Critical patent/CN111897577B/en
Publication of CN111897577A publication Critical patent/CN111897577A/en
Application granted granted Critical
Publication of CN111897577B publication Critical patent/CN111897577B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3877Concurrent instruction execution, e.g. pipeline or look ahead using a slave processor, e.g. coprocessor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a master-slave distinguishing method of a CPU, which comprises the following steps: acquiring node information created by a current CPU kernel; the node information comprises one or more of a local software version number, a local hardware version number, a host software version number and a host hardware version number; when the node information is judged to only contain the local software version number and the local hardware version number, determining that the current CPU is a main CPU; and when the node information at least comprises the software version number of the host and the hardware version number of the host, determining the current CPU as the slave CPU. The invention realizes how to identify the same CPU on different devices, thereby providing the reusability and the development efficiency of software.

Description

Master-slave distinguishing method and device of CPU (Central processing Unit) and computer terminal equipment
Technical Field
The invention relates to the technical field of software, in particular to a master-slave distinguishing method of a CPU, a master-slave distinguishing device of the CPU and computer terminal equipment.
Background
With the increasing demand of the functions of the devices and the increasing complexity of the devices, there may be a plurality of CPUs (Central Processing units/processors) used in one device for performing the interactive work. In order to ensure the stability and reliability of products and software, many companies often try to select a CPU that has been developed before when developing new devices and on the premise of meeting performance requirements. For a device with multiple CPUs, one CPU is often used as a main CPU for external interaction, and the other slave CPUs are mainly used for interaction with the main CPU. In many cases, the slave CPU may be taken to be developed into a new product independently. Therefore, it is important to improve the development efficiency of a CPU as a variety of devices in software.
The prior art generally adopts a combination of software and hardware for processing. For example, several IO ports (input/output ports) are reserved by fixed coordination, and then the CPU is distinguished as different devices by pulling up and down the IO port level. However, the scheme has a great limitation when enough IO ports cannot be reserved sufficiently if the IO ports of a CPU are tenser, and the IO ports are also easy to cause IO port multiplexing function conflicts, for example, an IO port can be used as a general GPIO port (general purpose input/output port) or an I2C port (serial bus interface), and will conflict with an IO port if the CPU needs to use an I2C function at this time.
Disclosure of Invention
The invention aims to provide a CPU master-slave identification method, a CPU master-slave identification device and computer terminal equipment, which are used for solving the problems that the existing software and hardware identification scheme is greatly limited and the IO port multiplexing function conflict is easily caused by the IO port.
In order to achieve the above object, an embodiment of the present invention provides a method for master-slave discrimination of a CPU, including:
acquiring node information created by a current CPU kernel; the node information comprises one or more of a local software version number, a local hardware version number, a host software version number and a host hardware version number;
when the node information is judged to only contain the local software version number and the local hardware version number, determining that the current CPU is a main CPU;
and when the node information at least comprises the software version number of the host and the hardware version number of the host, determining the current CPU as the slave CPU.
In one embodiment, before the acquiring the node information created by the current CPU core, the method further includes:
starting a current CPU in a main CPU mode;
and when the cmdlene variable transmitted to the CPU kernel does not contain host information, creating a local software version number and a local hardware version number under a preset directory.
In one embodiment, after the determining that the current CPU is the main CPU, the method further includes:
and generating a host _ type.bin file according to the software version number and the hardware version number of the main CPU, and storing the host _ type.bin file in an directory of the tftpd server.
In one embodiment, before the acquiring the node information created by the current CPU core, the method further includes:
starting a current CPU in a slave CPU mode;
and when the cmdlene variable transmitted to the CPU kernel is judged to contain host information, a local software version number, a local hardware version number, a host software version number and a host hardware version number are created under a preset directory.
In one embodiment, before creating a local software version number, a local hardware version number, a software version number of the host, and a hardware version number of the host in a preset directory when it is determined that the cmdlene variable transmitted to the CPU core includes host information, the method further includes:
downloading host _ type.bin files of a host end through a tftp server;
and analyzing the host _ type.bin file, and transmitting the analyzed result to the CPU kernel through a cmdline variable.
In one embodiment, the current CPU includes at least two systems, and before the acquiring the node information created by the current CPU core, the method further includes:
starting a current CPU in a slave CPU mode;
downloading host _ type.bin files of a host end through a tftp server;
bin file is analyzed, and the analyzed result is stored in a fixed memory, so that one of the systems reads the analyzed result from the memory.
The embodiment of the present invention further provides a master-slave discrimination device for a CPU, including:
the node information acquisition module is used for acquiring node information created by the current CPU kernel; the node information comprises one or more of a local software version number, a local hardware version number, a host software version number and a host hardware version number;
the first determining module is used for determining that the current CPU is the main CPU when the node information is judged to only contain the local software version number and the local hardware version number;
and the second determining module is used for determining that the current CPU is the slave CPU when the node information at least comprises the software version number of the host and the hardware version number of the host.
In one embodiment, the method further comprises the following steps:
the first starting module is used for starting the current CPU in a main CPU mode before the node information acquisition module acquires the node information created by the current CPU kernel;
and the first node creating module is used for creating a local software version number and a local hardware version number under a preset directory when the cmdlene variable transmitted to the CPU kernel is judged not to contain host information.
In one embodiment, the method further comprises the following steps:
the second starting module is used for starting the current CPU in a slave CPU mode before the node information acquisition module acquires the node information created by the current CPU kernel;
and the second node creating module is used for creating a local software version number, a local hardware version number, a host software version number and a host hardware version number under a preset directory when the cmdline variable transmitted to the CPU inner core is judged to contain host information.
The embodiment of the invention also provides computer terminal equipment which comprises one or more processors and a memory. A memory coupled to the processor for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the master-slave discrimination method of the CPU as described in any of the above embodiments.
Compared with the existing method for distinguishing the master CPU from the slave CPU through software and hardware, the method for distinguishing the master CPU from the slave CPU, the device thereof and the computer terminal equipment in the embodiment of the invention can know whether the CPU is used as the master CPU or the slave CPU through judging the four nodes of switching, hwswitching, host _ switching and host _ hwswitching in the way of distinguishing the same CPU from the master CPU or the slave CPU through software, and the software can multiplex most functions, and only needs to do different processing on the software with different functions. In a word, the invention realizes how the same CPU is identified on different devices, thereby providing the reusability and the development efficiency of software.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart illustrating a method for master-slave discrimination of a CPU according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a connection structure between multiple CPUs according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for master-slave discrimination of a CPU according to another embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method for master-slave discrimination of a CPU according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a master-slave discrimination apparatus of a CPU according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a master-slave identification apparatus of a CPU according to another embodiment of the present invention;
fig. 7 is a schematic structural diagram of a computer terminal device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be understood that the step numbers used herein are for convenience of description only and are not intended as limitations on the order in which the steps are performed.
It is to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
The terms "comprises" and "comprising" indicate the presence of the described features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The term "and/or" refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1, an embodiment of the present invention provides a method for identifying a master and a slave of a CPU, including the following steps:
and S10, acquiring the node information created by the current CPU kernel. The node information comprises one or more of a local software version number, a local hardware version number, a host software version number and a host hardware version number.
In terms of basic structure, the computer terminal equipment can be divided into five parts: an operator, a memory, a controller, input equipment, output equipment, etc. The host computer is the main part of computer, has in the host computer case: mainboard, CPU, memory, power supply, video card, sound card, network card, hard disk, floppy drive, CD-ROM and other hardware. The CPU core is a core chip in the middle of the CPU, is made of single crystal silicon, is used to complete all calculations, receive/store commands, process data, and the like, and is a digital processing core. In this embodiment, taking a distributed system as an example, a Master-Slave device mode (Master-Slave) is adopted, and the relationship between the Master-Slave (Master-Slave) and the process-thread is similar, only one machine is used as a Master (Master), and other machines are used as Slave devices (Slave), and these machines operate simultaneously to form a cluster. The Master serves as a task scheduler and distributes computing tasks to a plurality of Slave devices (Slave), and after all the Slave devices complete the tasks, the Master collects the results. For example, in Hadoop, HDFS adopts a distributed file system based on a Master/Slave Master-Slave architecture, an HDFS cluster includes a single Master node and a plurality of Slave node servers, and the single Master node means that only one logical Master component exists in the HDFS system. A logical Master node may include two physical hosts, i.e., two Master servers and multiple Slave servers. One Master server forms a single NameNode cluster, two Master servers form a double NameNode cluster and are accessed by a plurality of clients simultaneously, and all the machines are common Linux machines and run user-level (user-level) service processes. Regarding the node information, the local (slave) software version number is denoted by switching, the local hardware version number is denoted by hwversion, the host software version number is denoted by host _ switching, and the host hardware version number is denoted by host _ hwversion. And the local hardware version number is burned on the MCU, and burning is performed only once during production, which is equivalent to a unique identifier of a device.
Referring to fig. 2(a), when the external device 1 is developed, the main CPU mainly interacts with the external device 1, and the slave CPU1, the slave CPU2, and the slave CPU3 mainly interact with the main CPU, respectively. Referring to fig. 2(b), when the external device 2 is developed, the original master CPU is switched to the slave CPU1 ', and the original slave CPU1 is switched to the master CPU'. Therefore, as the same CPU, it is necessary to distinguish the types of the CPU when different devices are developed, thereby realizing the code reuse rate and finally improving the software development efficiency.
In this embodiment, after the current CPU is started, the CPU core is started, and the cmdlene variable stored in the uboot is also transferred to the CPU core. The cmdlene variable is a boot parameter that the bootloader passes to the kernel, and contains many configuration information, such as root xxx and console xxx, and the parsing of these parameters is completed by the kernel during the boot process. The cmdlene variable may or may not include host information, which includes the model, host frequency, and size of the memory of the host.
And the CPU kernel creates different node information according to different information in the cmdlene variable. The method specifically comprises the following steps: for a main CPU to be confirmed, after the main CPU is started, two node information of a software version number host _ switching of the host and a hardware version number host _ hwversion of the host are not required to be created, and after the main CPU is confirmed, a host _ type _ bin file is generated by the software version number and the hardware version number of the main CPU and is stored in a tftpd server. For the slave CPU to be confirmed, after it is started, it will acquire host _ type _ bin file from the host side through tftp and analyze it. If it is still not determined whether the slave CPU is the slave CPU according to the analyzed result, two pieces of node information at least including the software version number of the host and the hardware version number of the host are also created according to the analyzed result. Therefore, by analyzing the specific node information created by the current CPU core, it can be determined whether the CPU to be currently confirmed is the master CPU or the slave CPU.
S20, when the node information is judged to only contain the local software version number and the local hardware version number, determining that the current CPU is the main CPU.
If the main CPU determines that the node information does not include the host software version number host _ version or the host hardware version number host _ hwversion, that is, the node information only includes the local software version number switching and the local hardware version number hwversion, it may be determined that the current CPU operates as the main CPU. Therefore, by means of software differentiation, the CPU can be known to be used as a main CPU, and what equipment the equipment is can be judged by the hardware version number on software, so that software can be differentiated and multiplexed.
S30, when the node information at least comprises the software version number of the host and the hardware version number of the host, determining that the current CPU is the slave CPU.
If the host CPU determines that the node information includes the software version number host _ switching of the host and the hardware version number host _ hwversion of the host, that is, the node information at least includes the software version number of the host and the hardware version number of the host, it may be determined that the current CPU operates as a slave CPU, and the software may identify the software version information of the device and the host according to the corresponding host _ switching and host _ hwversion, and perform different processing.
Compared with the existing method for distinguishing the master CPU from the slave CPU through software and hardware, the method for distinguishing the master CPU from the slave CPU in the embodiment of the invention has the advantages that through the software distinguishing method, whether the same CPU is used as the master CPU or the slave CPU, the CPU can be known to be used as the master CPU or the slave CPU only through judging the four nodes of the switching, the hwswitching, the host _ switching and the host _ hwswitching, and the software can multiplex most functions and only needs to perform different processing on the software with different functions. In a word, the invention realizes how the same CPU is identified on different devices, thereby providing the reusability and the development efficiency of software.
Referring to fig. 3, in an embodiment, before the step S10, that is, acquiring the node information created by the current CPU core, the method further includes the following steps:
s40, starting the current CPU in the mode of the main CPU;
s42, when the cmdlene variable transmitted to the CPU kernel does not contain host information, creating a local software version number and a local hardware version number under a preset directory.
And starting the CPU to be confirmed currently as a main CPU, and judging whether the cmdline variable contains host information or not after starting the CPU to be confirmed to the kernel. If yes, the current CPU can be directly determined to be the main CPU. If not, the CPU is further judged to be a main CPU or a slave CPU according to the node information established by the current CPU inner core. Specifically, when the cmdlene variable transmitted to the CPU core is judged not to contain host information, two nodes, namely, a local software version number switching and a local hardware version number hwversion, are created in a preset directory. The predetermined directory may be a/proc directory, and proc is a virtual file system. And if the node information is detected to only contain the local software version number swversion and the local hardware version number hwversion, determining the current CPU as the main CPU. And if the node information is detected to comprise other nodes besides the local software version number change and the local hardware version number hwversion, such as the software version number host _ change of the host and the hardware version number host _ hwversion of the host, determining that the current CPU is not the main CPU.
Therefore, in the embodiment, the starting mode of the current CPU is preset, the current CPU is started in the starting mode of the main CPU, and then the current CPU to be confirmed is judged as the main CPU or the slave CPU together with the node information created by the current CPU kernel, so that the accuracy of identifying the CPU type is improved.
Referring to fig. 3, in one embodiment, after determining that the current CPU is the main CPU in step 20, the method further includes the following steps:
and S44, generating a host _ type.bin file according to the software version number and the hardware version number of the main CPU, and storing the host _ type.bin file in an directory of the tftpd server.
In the present embodiment, the main CPU information is generated by the software version number and the hardware version number of the main CPU having been confirmed, and is saved as host _ type. Bin file is used for obtaining from CPU to be confirmed to further judge the type of the slave CPU to be confirmed. Since only the master CPU has a hardware version number as the slave CPU, and the slave CPU does not, the slave CPU must obtain the host _ type. Specifically, please refer to the right-side slave CPU validation flowchart in fig. 3, after the slave CPU to be validated is started to Uboot, a host _ type.bin file at the host end may be downloaded through tftp, and analyzed, if there is information to obtain an efficiency, it indicates that the current slave CPU is a slave, and if there is no information to obtain an efficiency, further determination is needed. Wherein, Tftp/Tftpd is a simple file transfer protocol. The Uboot is a Bootloader which is commonly used in an embedded system, the Bootloader is a small segment of program executed before an operating system runs, and hardware equipment can be initialized and a mapping table of a memory space can be established through the Bootloader, so that a proper software and hardware environment is established, and preparation is made for finally calling an operating system kernel. The main running task of BootLoader is to read the kernel image from the hard disk into the RAM, and then jump to the entry point of the kernel to run, i.e. start to start the operating system. The system is usually executed from the address 0x00000000 when it is powered on or reset, and what is arranged at this address is usually the Boot Loader program of the system.
Referring to fig. 3, in a certain embodiment, before acquiring the node information created by the current CPU core in step 10, the method further includes the following steps:
s50, starting the current CPU in a slave CPU mode;
s52, when the cmdlene variable transmitted to the CPU kernel is judged to contain host information, a local software version number, a local hardware version number, a host software version number and a host hardware version number are created under a preset directory.
Starting the CPU to be confirmed currently as a slave CPU, and judging whether the cmdline variable contains host information or not after starting the CPU to be confirmed to the kernel. If not, the current CPU can be directly determined not to be the slave CPU. If yes, further judging whether the CPU is used as a main CPU or a slave CPU according to node information created by the current CPU kernel. Specifically, when the cmdlene variable transmitted to the CPU core is judged to contain host information, four nodes, namely, a local software version number switching, a local hardware version number hwversion, a host software version number host _ switching, and a host hardware version number host _ hwversion, are created in a preset directory. The preset directory may be a/proc directory. And if the node information is detected to at least comprise the software version number host _ switching of the host and the hardware version number host _ hwswitching of the host, determining the current CPU as the slave CPU. And if the node information is detected not to contain the software version number host _ switching of the host and the hardware version number host _ hwswitching of the host, determining that the current CPU is not the slave CPU.
Therefore, the present embodiment presets the starting mode of the current CPU, starts the current CPU in the starting mode of the slave CPU, and then jointly determines whether the current CPU to be confirmed is the master CPU or the slave CPU by combining the node information created by the current CPU core, thereby improving the accuracy of identifying the CPU type.
Referring to fig. 3, in a certain embodiment, in step 52, when it is determined that the cmdline variable transmitted to the CPU core includes host information, before creating a local software version number, a local hardware version number, a host software version number, and a host hardware version number in a preset directory, the method further includes the following steps:
s54, downloading host _ type.bin files of a host end through a tftp server;
and S56, analyzing the host _ type.bin file, and transmitting the analyzed result to the CPU kernel through a cmdline variable.
In this embodiment, after the CPU is started to Uboot, the host _ type.bin file on the host side is downloaded by tftp, and then the host _ type.bin file is parsed, and the related information is transferred to the kernel by a cmdline variable. If efficient information is acquired from the analyzed result, for example, the cmdlene variable does not contain host information, the current CPU is taken as a slave; if the host information is contained, whether the CPU is used as a master CPU or a slave CPU is further judged according to the node information established by the current CPU inner core, so that the distinguishing precision is improved.
Referring to fig. 3, in an embodiment, the current CPU includes at least two systems, and before acquiring the node information created by the current CPU core in step 10, the method further includes the following steps:
s50, starting the current CPU in a slave CPU mode;
s54, downloading host _ type.bin files of a host end through a tftp server;
and S58, analyzing the host _ type.bin file, and storing the analyzed result in a fixed memory, so that one of the systems reads the analyzed result from the memory.
In this embodiment, if two systems exist in the current CPU, for example, a liso system of haisi chip hisi, information after host _ type.bin file parsing can be stored in a fixed useless memory DDR, the liso system reads relevant information from the DDR after being started, and the liso side software performs different processing according to host information.
For a better understanding of the present invention, referring to fig. 4, the present invention provides an embodiment comprising the following steps:
step 1, starting up as a main CPU, judging that the cmdline variable transmitted to the CPU kernel does not contain host information after the CPU is started up to the kernel, and creating two nodes of a local software version number swversion and a local hardware version number hwversion under a/proc directory.
And 2, judging that the host-switching or host-hwswitching is not included by the main CPU, and judging that the current CPU is used as the main CPU.
And 3, generating a host _ type.bin file by the software version number and the hardware version number of the main CPU, placing the host _ type.bin file in a directory of the tftpd server, and starting the tftpd server.
And 4, after the CPU is started to be below the Uboot, downloading host _ type.bin files of the host end through tftp, analyzing, and if the information of the efficiency is obtained, indicating that the host is used as a slave. And if the CPU only has a system, analyzing the host _ type.bin file, and transmitting the related information to the kernel through cmdline. If the CPU has two systems, such as the lisi's litos system, the information after parsing can be stored in a fixed useless DDR, and the litos reads the relevant information from the DDR after starting.
Step 5, after the CPU is started to the kernel, judging that the cmdline contains host information, and creating four nodes of switching, hwversion, host _ switching and host _ hwversion under the/proc directory, wherein the four nodes are represented as follows:
and (3) switching: indicating local software version numbers
hwversion: indicating local hardware version number
host _ switching: indicating the software version number of a host
host _ hwversion: indicating the hardware version number of a host
And 6, the slave CPU judges according to the nodes under the proc, the slave CPU is judged to be the slave CPU because the slave CPU comprises host _ swing and host _ hwversion, and the software can identify the software version information of the equipment and the host end according to the corresponding host _ swing and host _ hwversion and carry out different processing.
Through the above design, the same CPU, regardless of being used as a master CPU or a slave CPU, if the cmdline transmitted to the CPU core is judged to contain host information or not, and the master CPU or the slave CPU cannot be determined, it is necessary to further know whether the CPU is used as the master CPU or the slave CPU by judging four nodes of switching, hwswitching, host _ switching, and host _ hwswitching according to the node information created by the core, and the software can multiplex most functions, and only different processing needs to be performed on the software in different functions. Compared with the existing method for distinguishing the main CPU from the slave CPU in a hardware mode, the method and the device can realize the distinguishing of the main CPU and the slave CPU as various devices without using hardware resources, thereby improving the reusability and the development efficiency of software.
Referring to fig. 5, a master-slave discrimination apparatus 100 for a CPU is provided in an embodiment of the present invention. The apparatus 100 includes a node information acquisition module 110, a first determination module 120, and a second determination module 130.
A node information obtaining module 110, configured to obtain node information created by a current CPU core; the node information comprises one or more of a local software version number, a local hardware version number, a host software version number and a host hardware version number.
The first determining module 120 is configured to determine that the current CPU is the main CPU when it is determined that the node information only includes the local software version number and the local hardware version number.
A second determining module 130, configured to determine that the current CPU is a slave CPU when it is determined that the node information at least includes the software version number of the host and the hardware version number of the host.
Referring to fig. 6, in one embodiment, the master-slave identification apparatus 100 of the CPU further includes a first starting module 140 and a first node creating module 150.
The first starting module 140 is configured to start the current CPU in a main CPU mode before the node information acquisition module 110 acquires the node information created by the current CPU core;
the first node creating module 150 is configured to create a local software version number and a local hardware version number in a preset directory when it is determined that the cmdline variable transmitted to the CPU core does not include host information.
Referring to fig. 6, in one embodiment, the master-slave identification apparatus 100 of the CPU further includes a second starting module 160 and a second node creating module 170.
The second starting module 160 is configured to start the current CPU in a slave CPU manner before the node information acquisition module 110 acquires the node information created by the current CPU core;
the second node creating module 170 is configured to create a local software version number, a local hardware version number, a software version number of the host, and a hardware version number of the host in a preset directory when it is determined that the cmdline variable transmitted to the CPU core includes host information.
For the specific definition of the master-slave discrimination apparatus 100 of the CPU, reference may be made to the definition above, and the description thereof is omitted. The respective modules in the master-slave discrimination apparatus 100 of the CPU described above may be entirely or partially realized by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
Referring to fig. 7, an embodiment of the invention provides a computer terminal device, which includes one or more processors and a memory. The memory is coupled to the processor for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the embodiments as described above.
The processor is used for controlling the overall operation of the computer terminal equipment so as to complete all or part of the steps. The memory is used to store various types of data to support the operation at the computer terminal device, which data may include, for example, instructions for any application or method operating on the computer terminal device, as well as application-related data. The Memory may be implemented by any type of volatile or non-volatile Memory device or 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.
In an exemplary embodiment, the computer terminal Device can be implemented by one or more Application Specific 1 integrated circuits (AS 1C), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components, for performing the above-mentioned methods, and achieving technical effects consistent with the above-mentioned methods.
In another exemplary embodiment, a computer readable storage medium is also provided that includes program instructions, which when executed by a processor, implement the steps described above. For example, the computer readable storage medium may be the above-mentioned memory including program instructions that are executable by the processor of the computer terminal device to accomplish the above-mentioned and achieve the technical effects consistent with the above-mentioned method.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.

Claims (10)

1. A master-slave discrimination method of a CPU, comprising:
acquiring node information created by a current CPU kernel; the node information comprises one or more of a local software version number, a local hardware version number, a host software version number and a host hardware version number;
when the node information is judged to only contain the local software version number and the local hardware version number, determining that the current CPU is a main CPU;
and when the node information at least comprises the software version number of the host and the hardware version number of the host, determining the current CPU as the slave CPU.
2. The method for master-slave discrimination of a CPU according to claim 1, wherein before the obtaining node information created by a current CPU core, the method further comprises:
starting a current CPU in a main CPU mode;
and when the cmdlene variable transmitted to the CPU kernel does not contain host information, creating a local software version number and a local hardware version number under a preset directory.
3. The method for master-slave discrimination of a CPU according to claim 2, further comprising, after the determining that the current CPU is the master CPU:
and generating a host _ type.bin file according to the software version number and the hardware version number of the main CPU, and storing the host _ type.bin file in an directory of the tftpd server.
4. The method for master-slave discrimination of a CPU according to claim 1, wherein before the obtaining node information created by a current CPU core, the method further comprises:
starting a current CPU in a slave CPU mode;
and when the cmdlene variable transmitted to the CPU kernel is judged to contain host information, a local software version number, a local hardware version number, a host software version number and a host hardware version number are created under a preset directory.
5. The method for distinguishing between a master and a slave of a CPU according to claim 4, wherein before creating a local software version number, a local hardware version number, a software version number of a host, and a hardware version number of the host in a preset directory when it is determined that the cmdlene variable passed to the CPU core contains host information, further comprising:
downloading host _ type.bin files of a host end through a tftp server;
and analyzing the host _ type.bin file, and transmitting the analyzed result to the CPU kernel through a cmdline variable.
6. The method according to claim 1, wherein the current CPU includes at least two systems, and before the obtaining the node information created by the current CPU core, the method further includes:
starting a current CPU in a slave CPU mode;
downloading host _ type.bin files of a host end through a tftp server;
bin file is analyzed, and the analyzed result is stored in a fixed memory, so that one of the systems reads the analyzed result from the memory.
7. A master-slave discrimination apparatus of a CPU, comprising:
the node information acquisition module is used for acquiring node information created by the current CPU kernel; the node information comprises one or more of a local software version number, a local hardware version number, a host software version number and a host hardware version number;
the first determining module is used for determining that the current CPU is the main CPU when the node information is judged to only contain the local software version number and the local hardware version number;
and the second determining module is used for determining that the current CPU is the slave CPU when the node information at least comprises the software version number of the host and the hardware version number of the host.
8. The CPU master-slave discrimination apparatus according to claim 7, further comprising:
the first starting module is used for starting the current CPU in a main CPU mode before the node information acquisition module acquires the node information created by the current CPU kernel;
and the first node creating module is used for creating a local software version number and a local hardware version number under a preset directory when the cmdlene variable transmitted to the CPU kernel is judged not to contain host information.
9. The CPU master-slave discrimination apparatus according to claim 7, further comprising:
the second starting module is used for starting the current CPU in a slave CPU mode before the node information acquisition module acquires the node information created by the current CPU kernel;
and the second node creating module is used for creating a local software version number, a local hardware version number, a host software version number and a host hardware version number under a preset directory when the cmdline variable transmitted to the CPU inner core is judged to contain host information.
10. A computer terminal device, comprising:
one or more processors;
a memory coupled to the processor for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a master-slave discrimination method of a CPU as claimed in any one of claims 1 to 6.
CN202010742359.1A 2020-07-28 2020-07-28 Master-slave distinguishing method and device for CPU and computer terminal equipment Active CN111897577B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010742359.1A CN111897577B (en) 2020-07-28 2020-07-28 Master-slave distinguishing method and device for CPU and computer terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010742359.1A CN111897577B (en) 2020-07-28 2020-07-28 Master-slave distinguishing method and device for CPU and computer terminal equipment

Publications (2)

Publication Number Publication Date
CN111897577A true CN111897577A (en) 2020-11-06
CN111897577B CN111897577B (en) 2023-10-13

Family

ID=73182299

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010742359.1A Active CN111897577B (en) 2020-07-28 2020-07-28 Master-slave distinguishing method and device for CPU and computer terminal equipment

Country Status (1)

Country Link
CN (1) CN111897577B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123381A (en) * 2014-08-01 2014-10-29 武汉邮电科学研究院 Automatic matching method of hardware board card
CN106407156A (en) * 2016-09-23 2017-02-15 深圳震有科技股份有限公司 A method and a system for BOOTROM guiding multi-core CPU boot
US9928097B1 (en) * 2015-09-14 2018-03-27 VCE IP Holding Company LLC Methods, systems, and computer readable mediums for defining and updating a virtual computing system comprising distributed resource components
CN109447048A (en) * 2018-12-25 2019-03-08 苏州闪驰数控系统集成有限公司 A kind of artificial intelligence early warning system
CN109547536A (en) * 2018-11-01 2019-03-29 福建星网智慧科技股份有限公司 Intelligent gateway device type automatic identification and method for upgrading software version and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104123381A (en) * 2014-08-01 2014-10-29 武汉邮电科学研究院 Automatic matching method of hardware board card
US9928097B1 (en) * 2015-09-14 2018-03-27 VCE IP Holding Company LLC Methods, systems, and computer readable mediums for defining and updating a virtual computing system comprising distributed resource components
CN106407156A (en) * 2016-09-23 2017-02-15 深圳震有科技股份有限公司 A method and a system for BOOTROM guiding multi-core CPU boot
CN109547536A (en) * 2018-11-01 2019-03-29 福建星网智慧科技股份有限公司 Intelligent gateway device type automatic identification and method for upgrading software version and system
CN109447048A (en) * 2018-12-25 2019-03-08 苏州闪驰数控系统集成有限公司 A kind of artificial intelligence early warning system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KONSTANTIN SHVACHKO: "The Hadoop Distributed File System", 《IEEE》, pages 1 - 10 *
王超;王腾;马翔;周学海;: "基于FPGA的机器学习硬件加速研究进展", 计算机学报, no. 06, pages 191 - 212 *

Also Published As

Publication number Publication date
CN111897577B (en) 2023-10-13

Similar Documents

Publication Publication Date Title
US11385908B1 (en) Cloning of firmware configuration settings using rest over IPMI interface
US10860308B1 (en) Peripheral device firmware update using rest over IPMI interface firmware update module
CN107431651B (en) Life cycle management method and equipment for network service
CN108830720B (en) Intelligent contract running method, device, system and computer readable storage medium
US10866801B1 (en) Non-destructive update of discrete components of firmware
US5579509A (en) Apparatus and method for verifying compatibility of system components
US11385993B2 (en) Dynamic integration of command line utilities
CN109634718B (en) Method and system for creating mirror image by cloud platform
US10572242B1 (en) Firmware update using rest over IPMI interface
US10853052B1 (en) Peripheral device firmware update using rest over IPMI interface firmware shell utility
US10996940B1 (en) Secure firmware integrity monitoring using rest over IPMI interface
CN110908753A (en) Intelligent fusion cloud desktop server, client and system
WO2015062217A1 (en) Connection processing method and device for peripheral in virtual desktop system
CN112416377A (en) Boot image manufacturing method and device, electronic equipment and storage medium
CN111262753B (en) Method, system, terminal and storage medium for automatically configuring number of NUMA nodes
CN104123260A (en) BMC read-only memory (ROM) control system and method
CN109120680B (en) Control system, method and related equipment
CN114064216A (en) Virtual machine initialization method, device, terminal equipment and storage medium
CN109614242B (en) Computing capacity sharing method, device, equipment and medium
CN111897577B (en) Master-slave distinguishing method and device for CPU and computer terminal equipment
Rothman et al. Harnessing the UEFI Shell: Moving the platform beyond DOS
US11645616B1 (en) Verifying the integrity of data transmitted between a firmware and a baseboard management controller (BMC)
CN115454896A (en) SMBUS-based SSD MCTP control message verification method and device, computer equipment and storage medium
CN115150268A (en) Network configuration method and device of Kubernetes cluster and electronic equipment
US11593121B1 (en) Remotely disabling execution of firmware components

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant