Hardware Fault Handling Method and Electronic Device

By constructing a relationship table containing the association relationship between hardware information and address information, the problem of lack of unique identification of fault hardware information in hardware failure information is solved, and the faulty hardware is directly determined at the operating system level, shortening the maintenance time.

CN114780271BActive Publication Date: 2025-06-20LENOVO (BEIJING) LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210315783.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-28
Publication Date
2025-06-20
Estimated Expiration
2042-03-28

AI Technical Summary

Technical Problem

In the prior art, hardware failure information does not contain hardware information that can uniquely identify the faulty hardware, which makes it impossible for the operating system to directly determine the faulty hardware. Maintenance personnel need to obtain the underlying information by themselves, which increases the difficulty and time of maintenance.

Method used

By pre-constructing a relationship table, the table contains hardware information and second address information of each hardware of the electronic device, as well as an association relationship between the hardware information and the second address information. In response to the hardware failure, the fault information and relationship table generated by the machine exception check mechanism are obtained, and the hardware information of the faulty hardware is determined based on the correspondence relationship between the first address information and the second address information and the association relationship between the second address information and the hardware information.

Benefits of technology

The faulty hardware can be directly determined at the operating system level, reducing the difficulty of maintenance personnel to obtain underlying information and shortening maintenance time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114780271B_ABST
    Figure CN114780271B_ABST
Patent Text Reader

Abstract

The present application discloses a hardware fault handling method and an electronic device. The method includes: in response to a hardware fault occurring in the electronic device and triggering a machine anomaly inspection mechanism, obtaining fault information generated by the machine anomaly detection mechanism for describing the hardware fault; retrieving a pre-constructed relationship table; and obtaining hardware information of the faulty hardware based on the correspondence between the first address information and the second address information, and the association between the second address information and the hardware information. Using this method, the hardware information of the faulty hardware can be directly obtained at the operating system level, enabling maintenance personnel to quickly troubleshoot faults, which is beneficial to shortening the repair time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of electronic devices, and particularly to a hardware fault handling method and an electronic device. Background Art

[0002] A machine exception checking mechanism (Machine Check Error, MCE) is usually preset in the processor cores of electronic devices. When the processor detects a hardware fault, it triggers the MCE to detect the hardware fault and stores the generated fault information in a special module register (MSR), which is convenient for maintenance personnel to perform fault analysis and handling. However, the fault information usually does not contain the hardware information that can uniquely identify the faulty hardware. At the operating system level, it is impossible to directly determine which hardware has a fault based on the fault information. Maintenance personnel usually need to obtain the underlying information by themselves to analyze which hardware has a fault, which brings obstacles to the maintenance work and is not conducive to the maintenance personnel to quickly eliminate the fault. Summary of the Invention

[0003] This application provides a hardware fault handling method and an electronic device. The technical solutions adopted in the embodiments of this application are as follows:

[0004] A hardware fault handling method includes:

[0005] In response to a hardware fault occurring in the electronic device and triggering the machine exception checking mechanism, obtaining the fault information generated by the machine exception detection mechanism for describing the hardware fault; wherein, the fault information includes first address information, and the first address information is used to identify the storage location of the data triggering the hardware fault in the memory space or the IO space;

[0006] Retrieving a pre-constructed relationship table; wherein, the relationship table includes the hardware information of each hardware of the electronic device, and the association relationship between each hardware information and second address information, the hardware information is used to uniquely identify the hardware, and the second address information is used to identify the storage space allocated to the hardware in the memory space or the IO space;

[0007] Based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information, obtaining the hardware information of the faulty hardware.

[0008] In some embodiments, the method further includes:

[0009] Performing an initialization operation on the electronic device through the BIOS or UEFI, and obtaining the hardware information and the second address information of each hardware;

[0010] Construct the relationship table through the BIOS or UEFI based on the association relationship between the hardware information and the second address information.

[0011] In some embodiments, the method further includes:

[0012] Obtain the hardware information of the first type of hardware, and the address range of the storage space allocated for the first type of hardware in the memory space or the IO space;

[0013] Construct a first relationship table based on the address range and the hardware information of the first type of hardware; and / or

[0014] Obtain the hardware information of the second type of hardware, and the allocation rule for allocating storage space for the second type of hardware in the memory space or the IO space;

[0015] Construct a second relationship table based on the allocation rule and the hardware information of the second type of hardware.

[0016] In some embodiments, obtaining the hardware information of the faulty hardware based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information includes:

[0017] Determine the type of the faulty hardware based on the first address information and the address space mapping table;

[0018] When the faulty hardware is the first type of hardware, determine the address range corresponding to the first address information in the first relationship table, and obtain the hardware information associated with the address range;

[0019] When the faulty hardware is the second type of hardware, obtain the hardware information of the second type of hardware based on the first address information and the allocation rule recorded in the second relationship table.

[0020] In some embodiments, the fault information further includes a first identifier for identifying the validity of the first address information;

[0021] The retrieving the pre-constructed relationship table includes:

[0022] When it is determined that the first address information is valid based on the first identifier, retrieve the pre-constructed relationship table.

[0023] In some embodiments, the method further includes:

[0024] Record an error log based on the hardware information of the faulty hardware.

[0025] An electronic device includes:

[0026] A first acquisition module, configured to, in response to a hardware failure occurring in an electronic device and triggering a machine anomaly inspection mechanism, acquire fault information generated by the machine anomaly detection mechanism for describing the hardware failure; wherein, the fault information includes first address information, and the first address information is used to identify the storage location of the data triggering the hardware failure in the memory space or the IO space;

[0027] An extraction module, configured to extract a pre-constructed relationship table; wherein, the relationship table includes hardware information of each hardware of the electronic device, and the association relationship between each piece of hardware information and second address information, the hardware information is used to uniquely identify the hardware, and the second address information is used to identify the storage space allocated for the hardware in the memory space or the IO space;

[0028] A determination module, configured to obtain the hardware information of the faulty hardware based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information.

[0029] In some embodiments, the electronic device further includes:

[0030] A second acquisition module, configured to perform an initialization operation on the electronic device through BIOS or UEFI, and acquire the hardware information and the second address information of each piece of hardware;

[0031] A first construction module, configured to construct the relationship table through BIOS or UEFI based on the association relationship between the hardware information and the second address information.

[0032] In some embodiments, the electronic device further includes:

[0033] A third acquisition module, configured to acquire the hardware information of a first type of hardware, and the address range of the storage space allocated for the first type of hardware in the memory space or the IO space;

[0034] A second construction module, configured to construct a first relationship table based on the address range and the hardware information of the first type of hardware; and / or

[0035] A fourth acquisition module, configured to acquire the hardware information of a second type of hardware, and the allocation rule for allocating storage space for the second type of hardware in the memory space or the IO space;

[0036] A third construction module, configured to construct a second relationship table based on the allocation rule and the hardware information of the second type of hardware.

[0037] In some embodiments, the determination module is specifically configured to:

[0038] Based on the first address information and the address space mapping table, determine the type of the faulty hardware;

[0039] When the faulty hardware is the first type of hardware, determine the address range corresponding to the first address information in the first relationship table, and obtain the hardware information associated with this address range;

[0040] When the faulty hardware is the second type of hardware, based on the first address information and the allocation rules recorded in the second relationship table, obtain the hardware information of this second type of hardware.

[0041] In the hardware fault handling method of the embodiments of the present application, a relationship table is pre - constructed. The relationship table contains the hardware information of each hardware of the electronic device, the second address information of each hardware, and the association relationship between the hardware information and the second address information. The hardware information can uniquely identify the hardware, and the second address information can identify the storage space allocated for the hardware in the memory space or the IO space. When a hardware fault occurs in the electronic device and triggers the machine check exception mechanism (MCE), obtain the fault information generated by the MCE mechanism and the relationship table. The fault information contains the first address information, and the first address information can identify the storage location of the data triggering the hardware fault in the memory space or the IO space. Based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information, the hardware information of the faulty hardware can be determined. In this way, the faulty hardware can be directly determined at the operating system level, and the maintenance personnel can quickly eliminate the hardware fault, which is beneficial to shortening the maintenance time. Description of the Drawings

[0042] Figure 1 It is a flowchart of an embodiment of the hardware fault handling method of the embodiments of the present application;

[0043] Figure 2 It is a flowchart of another embodiment of the hardware fault handling method of the embodiments of the present application;

[0044] Figure 3 It is a structural block diagram of an embodiment of the electronic device of the embodiments of the present application;

[0045] Figure 4 It is a structural block diagram of another embodiment of the electronic device of the embodiments of the present application. Detailed Embodiments

[0046] Reference is made herein to the various solutions and features of the present application with reference to the drawings.

[0047] It should be understood that various modifications can be made to the embodiments applied for herein. Therefore, the above description should not be construed as limiting, but merely as an exemplification of the embodiments. Those skilled in the art will envision other modifications within the scope and spirit of the present application.

[0048] The accompanying drawings, which are included in and form a part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0049] These and other features of the present application will become apparent from the following description of the preferred forms of the embodiments, given by way of non-limiting example with reference to the accompanying drawings.

[0050] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art can surely implement many other equivalent forms of the present application, which have the features as described in the claims and thus are all within the scope of protection defined thereby.

[0051] When taken in conjunction with the accompanying drawings, the above and other aspects, features, and advantages of the present application will become more apparent in view of the following detailed description.

[0052] Specific embodiments of the present application will be described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application and can be implemented in various ways. Well-known and / or repetitive functions and structures are not described in detail to avoid obscuring the present application with unnecessary or redundant details. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely as a basis and representative basis for the claims to teach those skilled in the art to use the present application in substantially any suitable detailed structure in a variety of ways.

[0053] This specification may use the phrases "in one embodiment", "in another embodiment", "in yet another embodiment", or "in other embodiments", which may each refer to one or more of the same or different embodiments according to the present application.

[0054] The embodiments of the present application provide a hardware fault handling method, which is executed at the operating system level of an electronic device and is used to process the fault information generated by a machine check error (MCE) mechanism to determine the faulty hardware, enabling maintenance personnel to quickly eliminate the hardware fault and thus shortening the repair time.

[0055] Figure 1 is a flowchart of the hardware fault handling method of the embodiments of the present application. See Figure 1 As shown, the hardware fault handling method of the embodiments of the present application may specifically include the following steps.

[0056] S110, in response to a hardware failure occurring in the electronic device and triggering the machine exception checking mechanism, obtains the failure information generated by the machine exception detection mechanism for describing the hardware failure. Wherein, the failure information includes first address information, and the first address information is used to identify the storage location of the data triggering the hardware failure in the memory space or the IO space.

[0057] When an error occurs in a certain instruction executed by the processor (CPU) of the electronic device, the processor will trigger the fault detection of the processor. If it is determined that the instruction execution error or operation execution error is caused by the hardware failure of the electronic device, the processor core will trigger the machine exception checking mechanism (Machine Check Error, MCE). The hardware failure is detected through the MCE mechanism, and the failure information for describing the hardware failure is generated. This failure information is usually stored in the Machine Check Architecture (MCA) register set. The MCA register set includes multiple special module (MSR) registers. For example, the IA32_MCG_CAP MSR register, the IA32_MCG_STATUS MSR register, the IA32_MCG_CTL MSR register, the IA32_MCG_EXT_CTL MSR register, the IA32_MCi_CTL MSR register, the IA32_MCi_STATUS MSR register, the IA32_MCi_ADDR MSR register, and so on.

[0058] The failure information includes this information stored in the MCA register set. The first address information, as a part of the failure information, is usually stored in the IA32_MCi_ADDR MSR register. The first address information points to the storage location of the data triggering the hardware failure in the memory space or the IO space, that is, the first address information points to the data that causes the processor to perform the fault detection. This data can be a certain instruction itself executed by the processor. At this time, the first address information points to the storage location of this instruction in the memory space or the IO space. This data can also be the target data to be operated on by a certain instruction. At this time, the first address information points to the storage location of this target data in the memory space or the IO space.

[0059] Optionally, after a hardware failure occurs in the electronic device and triggers the MCE mechanism, and the MCE mechanism detects the hardware failure and generates the failure information, the operating system level of the electronic device can, in response to this event, obtain all or part of the failure information from the MCA register set, but at least the first address information in the IA32_MCi_ADDR MSR register should be included.

[0060] S120, retrieve the pre-constructed relationship table. The relationship table includes the hardware information of each hardware component of the electronic device, as well as the association relationship between each piece of hardware information and the second address information. The hardware information is used to uniquely identify the hardware, and the second address information is used to identify the storage space allocated for the hardware in the memory space or the IO space.

[0061] Among them, the hardware of the electronic device includes but is not limited to memory, network card, sound card, graphics card (GPU), optical drive, or other hardware devices inside the electronic device, such as other hardware devices connected to the motherboard through the PCI interface or the PCI-e interface. During the initialization process of the electronic device, a memory address space or an IO address space will be allocated to each hardware component. The memory address space can include one or more address ranges, and the address range is used to identify the storage space allocated for the hardware in the memory space. The IO address space can also include one or more address ranges, and this address range is used to identify the storage space allocated for the hardware in the IO space.

[0062] On this basis, the second address information can include the memory address space or the IO address space of the hardware, or can include the address range used to identify the storage space allocated for the hardware in the memory space or the IO space. Or, the second address information can also include the rule for allocating the storage space for the hardware in the memory space or the IO space, etc., as long as the information included can determine the storage space allocated for the hardware in the memory space or the IO space.

[0063] During the operation of the electronic device, the processor and the hardware can interact and cooperate based on this storage space. For example, the data in the hardware can be retrieved to this storage space for the processor to read; or the data that the processor needs to send to the hardware can first be stored in this storage space and then sent to the hardware via this storage space; or the instructions for controlling the hardware are sent to this storage space, so that the driver of the hardware can retrieve the instructions from this storage space to execute the operation.

[0064] Among them, the hardware information is used to uniquely identify the hardware. Optionally, the hardware information can include the connection position information of the hardware on the motherboard, manufacturer information, field replaceable unit information (FRU info), etc. For example, the hardware information can include the location label of the hardware, part number, product serial number, manufacturer, model, etc. The location label is used to identify the connection position of the hardware on the motherboard.

[0065] Optionally, during the initialization process or after the operating system starts up, a relationship table can be pre-constructed by the BIOS, UEFI, or the operating system (OS) based on the hardware information and the second address information. In response to a hardware failure occurring in the electronic device and triggering the MCE mechanism, the failure information can be obtained and the relationship table can be retrieved. It should be noted that there is no clear sequence for the two steps of obtaining the failure information and retrieving the relationship table. The failure information can be obtained first, and then the relationship table can be retrieved. Or the relationship table can be retrieved first, and then the failure information can be obtained. Or the failure information and the relationship table can be retrieved synchronously.

[0066] S130. Based on the corresponding relationship between the first address information and the second address information, and the association relationship between the second address information and the hardware information, obtain the hardware information of the failed hardware.

[0067] When the first address information and the relationship table are obtained, it can be determined which hardware's storage space the data triggering the hardware failure is located in. Furthermore, it can be determined that the MCE mechanism is triggered due to the failure of this hardware, and this hardware is the failed hardware. The hardware information of the failed hardware can be obtained. For example, obtain the location label, part number, or serial number of the failed hardware, etc.

[0068] Optionally, when both the first address information and the second address information include address ranges, it can be directly determined which address range included in the first address information is within which address range included in the second address information. If the address range included in the first address information falls within the address range included in a second address information, it can be determined that the hardware corresponding to this second address information is the failed hardware.

[0069] Optionally, when the second address information includes the rule for allocating storage space for hardware in the memory space or the IO space, the memory address space or the IO address space of each hardware can be determined based on this rule. Furthermore, it can be determined which hardware's memory address space or IO address space the first address information is located in, and thus the failed hardware can be determined. Then, based on the association relationship recorded in the relationship table, the hardware information of the failed hardware can be obtained from the relationship table.

[0070] The hardware fault handling method according to the embodiment of the present application pre - constructs a relationship table, which includes the hardware information of each hardware of the electronic device, the second address information of each hardware, and the association relationship between the hardware information and the second address information. The hardware information can uniquely identify the hardware, and the second address information can identify the storage space allocated for the hardware in the memory space or the IO space. When a hardware fault occurs in the electronic device and triggers the Machine Check Exception (MCE) mechanism, the fault information generated by the MCE mechanism and the relationship table are obtained. The fault information includes the first address information, which can identify the storage location of the data triggering the hardware fault in the memory space or the IO space. Based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information, the hardware information of the faulty hardware can be determined. In this way, the faulty hardware can be directly determined at the operating system level, and maintenance personnel can quickly eliminate the hardware fault, which is beneficial to shortening the maintenance time.

[0071] In some embodiments, the fault information further includes a first identifier for identifying the validity of the first address information; Step S120 of retrieving the pre - constructed relationship table includes:

[0072] When it is determined that the first address information is valid based on the first identifier, the pre - constructed relationship table is retrieved.

[0073] Among them, the 58th bit (BIT58) of the IA32_MCi_STATUS MSR register is used as an identification bit for identifying the validity of the first address information. When the value in BIT58 is 1, it indicates that the first address information is valid; when the value in BIT58 is 0, it indicates that the first address information is invalid.

[0074] On this basis, before comparing the first address information with the relationship table, the value recorded in BIT58 of the IA32_MCi_STATUS MSR register can be obtained. If the value of BIT58 is 1, the first address information is compared with the relationship table; if the value of BIT58 is 0, the comparison of the first address information with the relationship table is abandoned, and other methods can be selected to obtain the hardware information of the faulty hardware to avoid detection errors or perform invalid data processing.

[0075] Cooperate with Figure 2 As shown, in some embodiments, the method further includes:

[0076] Perform an initialization operation on the electronic device through the BIOS or UEFI, and obtain the hardware information and the second address information of each hardware;

[0077] Construct the relationship table based on the association relationship between the hardware information and the second address information through BIOS or UEFI.

[0078] Optionally, after the electronic device is started, BIOS or UEFI can perform initialization operations on the electronic device. The initialization operations include two steps: hardware detection and resource allocation for the hardware. During the hardware detection process, BIOS or UEFI can obtain the hardware information of each hardware, such as the location label, manufacturer information, etc. of the hardware. After the hardware detection is completed, BIOS or UEFI allocates resources for each hardware, including allocating memory address space or IO address space for the hardware, that is, allocating storage space for the hardware in the memory space or IO space. Therefore, the hardware information of each hardware and the memory address space or IO address space of each hardware can be recorded through BIOS or UEFI, and a relationship table can be constructed based on the hardware information of each hardware and the memory address space or IO address space of each hardware. In this way, the convenience that BIOS or UEFI can obtain hardware information and the second address information during the initialization process is fully utilized, and the pre-construction of the relationship table is simply and easily realized. In the case of triggering the MCE mechanism, the operating system layer can directly retrieve this relationship table.

[0079] In some embodiments, the method further includes:

[0080] Obtain the hardware information of the first type of hardware and the address range of the storage space allocated for the first type of hardware in the memory space or IO space;

[0081] Construct a first relationship table based on the address range and the hardware information of the first type of hardware; and / or

[0082] Obtain the hardware information of the second type of hardware and the allocation rule for allocating storage space for the second type of hardware in the memory space or IO space;

[0083] Construct a second relationship table based on the allocation rule and the hardware information of the second type of hardware.

[0084] In specific implementation, since the rules for the electronic device to allocate memory address space or IO address space for various types of hardware are different, the storage space of some hardware (i.e., the first type of hardware) is relatively concentrated. The address space of this type of hardware contains a small number of address ranges. The hardware information and address range of the first type of hardware can be directly obtained, and a first relationship table can be constructed based on the address range and the hardware information of the first type of hardware. Optionally, the first type of hardware may include hardware devices such as network cards, sound cards, and graphics cards.

[0085] There may also be a situation where the storage space of another part of the hardware (i.e., the second type of hardware) is relatively scattered. The address space of this type of hardware contains a large number of address ranges. If each address range is recorded one by one, it will lead to a long construction time of the relationship table and a large amount of data in the relationship table. Therefore, for the second type of hardware, the hardware information of the second type of hardware and the allocation rules for allocating storage space to the second type of hardware in the memory space or the IO space can be obtained. Based on the hardware information and allocation rules of the second type of hardware, a second relationship table is constructed. Optionally, the second type of hardware may include, for example, a memory device. The hardware information such as the memory label and serial number of the memory device can be obtained, and the System Address Decode (SAD) or Target Address Decode (TAD) that contains the address space allocation rules of the memory device can be obtained. The hardware information such as the memory label and serial number, and the SAD or TAD are recorded in the second relationship table.

[0086] In some embodiments, step S130, obtaining the hardware information of the faulty hardware based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information, may include:

[0087] Based on the first address information and the address space mapping table, determine the type of the faulty hardware;

[0088] When the faulty hardware is the first type of hardware, determine the address range corresponding to the first address information in the first relationship table, and obtain the hardware information associated with this address range;

[0089] When the faulty hardware is the second type of hardware, based on the first address information and the allocation rules recorded in the second relationship table, obtain the hardware information of this second type of hardware.

[0090] Optionally, the electronic device can distinguish the types of hardware and allocate address spaces for various types of hardware. For example, the electronic device can pre-determine a first partition and a second partition in the memory space. Both the first partition and the second partition are a relatively large storage space. When determining that a hardware is the first type of hardware, select to allocate storage space for it in the first partition. When determining that a hardware is the second type of hardware, select to allocate storage space for it in the second partition. On this basis, an address space mapping table can be constructed based on the address range of the first partition and the address range of the second partition. The address space mapping table includes the correspondence between the address range of the first partition and the first type of hardware, and the correspondence between the address range of the second partition and the second type of hardware. However, the address space mapping table may not include the mapping relationship between a specific hardware and its specific address space.

[0091] On this basis, in response to the triggering of the MCE mechanism, the address space mapping table can be retrieved, and the first address information is compared with the address space mapping table to preliminarily determine whether the faulty hardware belongs to the first type of hardware or the second type of hardware. In the case where the faulty hardware is determined to be the first type of hardware, the first relationship table is retrieved, the address range corresponding to the first address information in the first relationship table is searched, and the hardware information associated with the address range is obtained. In the case where the faulty hardware is determined to be the second type of hardware, the second relationship table can be retrieved, the allocation rule is obtained from the second relationship table, the address ranges of each second type of hardware can be determined based on the allocation rule, and then the first address information is compared with the address ranges of each second type of hardware to determine which second type of hardware the faulty hardware is, and then the hardware information of the faulty hardware is obtained from the second relationship table.

[0092] It can be understood that in specific implementation, the first address information can also be first compared with the first relationship table to determine whether there is an address range corresponding to the first address information in the first relationship table. If there is an address range corresponding to the first address information, it can be determined that the faulty hardware is the first type of device, and the address information corresponding to the address range can be obtained. If there is no address range corresponding to the first address information in the first relationship table, it indicates that the faulty hardware does not belong to the first type of hardware. The second relationship table can be retrieved, the allocation rule is obtained, and the address ranges of each second type of hardware are determined based on the allocation rule. Then, the first address information is compared with the address ranges of each second type of hardware, and the hardware information of the faulty second type of hardware is obtained.

[0093] In some embodiments, the method further includes: recording an error log based on the hardware information of the faulty hardware. Optionally, after obtaining the hardware information of the faulty hardware, the hardware information of the faulty hardware can be recorded in the error log so that the maintenance personnel can directly retrieve the hardware information of the faulty hardware from the error log. Of course, other information related to the fault, such as fault information and fault time, can also be recorded in the error log.

[0094] See Figure 3 As shown, the embodiment of the present application further provides an electronic device, including:

[0095] A first acquisition module 201, configured to, in response to a hardware fault occurring in the electronic device and triggering a machine exception check mechanism, acquire fault information generated by the machine exception detection mechanism for describing the hardware fault; wherein, the fault information includes first address information, and the first address information is used to identify the storage location of the data triggering the hardware fault in the memory space or the IO space;

[0096] The retrieval module 202 is configured to retrieve a pre-constructed relationship table; wherein, the relationship table includes the hardware information of each hardware of the electronic device, and the association relationship between each piece of hardware information and the second address information, the hardware information is used to uniquely identify the hardware, and the second address information is used to identify the storage space allocated for the hardware in the memory space or the IO space;

[0097] The determination module 203 is configured to obtain the hardware information of the faulty hardware based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information.

[0098] In some embodiments, the electronic device further includes:

[0099] The second acquisition module is configured to perform an initialization operation on the electronic device through the BIOS or UEFI, and acquire the hardware information and the second address information of each piece of hardware;

[0100] The first construction module is configured to construct the relationship table based on the association relationship between the hardware information and the second address information through the BIOS or UEFI.

[0101] In some embodiments, the electronic device further includes:

[0102] The third acquisition module is configured to acquire the hardware information of the first type of hardware, and the address range of the storage space allocated for the first type of hardware in the memory space or the IO space;

[0103] The second construction module is configured to construct a first relationship table based on the address range and the hardware information of the first type of hardware; and / or

[0104] The fourth acquisition module is configured to acquire the hardware information of the second type of hardware, and the allocation rule for allocating storage space for the second type of hardware in the memory space or the IO space;

[0105] The third construction module is configured to construct a second relationship table based on the allocation rule and the hardware information of the second type of hardware.

[0106] In some embodiments, the determination module 203 is specifically configured to:

[0107] Determine the type of the faulty hardware based on the first address information and the address space mapping table;

[0108] In the case where the faulty hardware is the first type of hardware, determine the address range corresponding to the first address information in the first relationship table, and acquire the hardware information associated with the address range;

[0109] When the faulty hardware is the second type of hardware, based on the first address information and the allocation rules recorded in the second relationship table, obtain the hardware information of this second type of hardware.

[0110] In some embodiments, the fault information further includes a first identifier, and the first identifier is used to identify the validity of the first address information; the retrieval module 202 is specifically configured to:

[0111] When it is determined based on the first identifier that the first address information is valid, retrieve a pre-constructed relationship table.

[0112] In some embodiments, the electronic device further includes:

[0113] A recording module, configured to record an error log based on the hardware information of the faulty hardware.

[0114] See Figure 4 As shown, an embodiment of the present application further provides an electronic device, which at least includes a memory 301 and a processor 302. A program is stored on the memory 301, and when the processor 302 executes the program on the memory 301, the method described in any of the above embodiments is implemented.

[0115] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, an electronic device, a computer-readable storage medium, or a computer program product. Therefore, the present application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media that contain computer-usable program code. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0116] The above-mentioned processor can be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The above-mentioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The general-purpose processor can be a microprocessor or any conventional processor, etc.

[0117] The above-mentioned memory may include non-permanent memory in the form of computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0118] The above-mentioned readable storage medium may be a magnetic disk, an optical disk, a DVD, a USB, a read-only memory (ROM), a random access memory (RAM), etc. The present application does not limit the specific form of the storage medium.

[0119] The above embodiments are only exemplary embodiments of the present application and are not used to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art can make various modifications or equivalent replacements within the essence and protection scope of the present application, and such modifications or equivalent replacements should also be regarded as falling within the protection scope of the present application.

Claims

1. A method for handling hardware faults, comprising: In response to a hardware failure occurring in an electronic device and triggering a machine exception checking mechanism, obtain fault information generated by the machine exception detection mechanism for describing the hardware failure; wherein, the fault information includes first address information, and the first address information is used to identify the storage location of the data triggering the hardware failure in the memory space or the IO space; Retrieve a pre-constructed relationship table; wherein, the relationship table includes hardware information of each hardware of the electronic device, and the association relationship between each piece of hardware information and second address information, the hardware information is used to uniquely identify the hardware, and the second address information is used to identify the storage space allocated for the hardware in the memory space or the IO space; Based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information, obtain the hardware information of the faulty hardware; Obtain the hardware information of the first type of hardware, and the address range of the storage space allocated for the first type of hardware in the memory space or the IO space; Based on the address range and the hardware information of the first type of hardware, construct a first relationship table; and / or Obtain the hardware information of the second type of hardware, and the allocation rule for allocating storage space for the second type of hardware in the memory space or the IO space; Based on the allocation rule and the hardware information of the second type of hardware, construct a second relationship table.

2. The method according to claim 1, wherein, The method further includes: Perform an initialization operation on the electronic device through BIOS or UEFI, and obtain the hardware information and the second address information of each piece of hardware; Construct the relationship table through BIOS or UEFI based on the association relationship between the hardware information and the second address information.

3. The method according to claim 1, wherein, The obtaining the hardware information of the faulty hardware based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information includes: Based on the first address information and the address space mapping table, determine the type of the faulty hardware; When the faulty hardware is the first type of hardware, determine the address range corresponding to the first address information in the first relationship table, and obtain the hardware information associated with the address range; When the faulty hardware is the second type of hardware, based on the first address information and the allocation rule recorded in the second relationship table, obtain the hardware information of the second type of hardware.

4. The method according to claim 1, wherein, The fault information further includes a first identifier, and the first identifier is used to identify the validity of the first address information; The retrieving the pre-constructed relationship table includes: When it is determined that the first address information is valid based on the first identifier, retrieve the pre-constructed relationship table.

5. The method according to claim 1, wherein, The method further includes: Record an error log based on the hardware information of the faulty hardware.

6. An electronic device, comprising: A first obtaining module, configured to, in response to a hardware failure occurring in an electronic device and triggering a machine exception checking mechanism, obtain fault information generated by the machine exception detection mechanism for describing the hardware failure; wherein, the fault information includes first address information, and the first address information is used to identify the storage location of the data triggering the hardware failure in the memory space or the IO space; A retrieval module, configured to retrieve a pre-constructed relationship table; wherein, the relationship table includes hardware information of each hardware of the electronic device, and the association relationship between each piece of hardware information and the second address information, the hardware information is used to uniquely identify the hardware, and the second address information is used to identify the storage space allocated for the hardware in the memory space or the IO space; A determination module, configured to obtain the hardware information of the faulty hardware based on the correspondence between the first address information and the second address information, and the association relationship between the second address information and the hardware information; The electronic device further includes: A third acquisition module, configured to acquire the hardware information of the first type of hardware, and the address range of the storage space allocated for the first type of hardware in the memory space or the IO space; A second construction module, configured to construct a first relationship table based on the address range and the hardware information of the first type of hardware; and / or A fourth acquisition module, configured to acquire the hardware information of the second type of hardware, and the allocation rule for allocating a storage space for the second type of hardware in the memory space or the IO space; A third construction module, configured to construct a second relationship table based on the allocation rule and the hardware information of the second type of hardware.

7. The electronic device according to claim 6, wherein, The electronic device further includes: A second acquisition module, configured to perform an initialization operation on the electronic device through BIOS or UEFI, and acquire the hardware information and the second address information of each piece of hardware; A first construction module, configured to construct the relationship table through BIOS or UEFI based on the association relationship between the hardware information and the second address information.

8. The electronic device according to claim 6, wherein, The determination module is specifically configured to: Determine the type of the faulty hardware based on the first address information and the address space mapping table; When the faulty hardware is the first type of hardware, determine the address range corresponding to the first address information in the first relationship table, and acquire the hardware information associated with the address range; When the faulty hardware is the second type of hardware, acquire the hardware information of the second type of hardware based on the first address information and the allocation rule recorded in the second relationship table.

Citation Information

Patent Citations

  • Fault location method and server

    CN105589776A

  • Faulted hardware positioning method, device and system and readable storage medium

    CN108920314A