Hardware equipment anomaly detection method and device, equipment and storage medium
By receiving switching scripts, determining multiple operating modes of hardware devices, acquiring and analyzing configuration space data, and generating detailed exception reports, solving the design blind spot problem caused by single scenario analysis in the prior art, and achieving comprehensive abnormality detection of hardware devices.
Patent Information
- Application Number
- CN202510459822.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-08-15
AI Technical Summary
In the prior art, abnormal analysis of controllable deep sleep state is only suitable for a single scenario, which can easily cause a blind spot in the design of hardware devices.
By receiving the switching script sent by the user, multiple operating modes of the hardware device are determined, and configuration space data is obtained after switching to the target operating mode, determining whether there is any abnormal information, generating an exception report, and traversing other operating modes to generate detailed exception reports.
By conducting abnormal analysis of multiple operating modes of hardware equipment, we deeply explore hardware equipment design defects in various scenarios, avoid design blind spots, and improve the comprehensiveness and accuracy of abnormal detection.
Smart Images

Figure CN120491797A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of device detection technology, and in particular to a method, apparatus, device, and storage medium for detecting anomalies in hardware devices. Background Art
[0002] A device power state describes the power state of a hardware device in a computer, independent of other devices in the computer. A device power state has multiple substates. For example, deep sleep can be further divided into two substates: controlled deep sleep and completely powered off. Controlled deep sleep allows software to control the device or the entire link to enter a low-power state.
[0003] Related technologies often analyze hardware device energy consumption and anomaly conditions during controlled deep sleep. During this state, hardware device operating data is collected to determine energy consumption and anomalies. However, this analysis of anomalies in controlled deep sleep is limited to a single scenario, potentially creating blind spots in hardware device design. Summary of the Invention
[0004] The present application provides a method, apparatus, device and storage medium for detecting anomalies in a hardware device, so as to at least solve the problem in the related art that abnormal analysis of a controllable deep sleep state is only applicable to a single scenario and easily causes a design blind spot in the hardware device.
[0005] This application provides a method for detecting anomalies in a hardware device, including:
[0006] Receive the switching script sent by the user end;
[0007] determining a target operating mode from multiple operating modes of the initialized hardware device according to a switching script;
[0008] Switch the hardware device to the target operating mode;
[0009] After determining that the hardware device has completed the switch of the target operating mode, obtaining the configuration space data of the hardware device;
[0010] Determine whether there is abnormal information in the configuration space data;
[0011] If there is abnormal information in the configuration space data, an abnormal report of the hardware device is generated based on the abnormal information;
[0012] Traverse other operating modes of hardware devices according to the switching script and generate corresponding exception reports;
[0013] Output various abnormal reports of hardware devices to the user end.
[0014] This application also provides a hardware device anomaly detection device, comprising:
[0015] A receiving module, used for receiving the switching script sent by the user terminal;
[0016] a determination module, configured to determine a target operating mode from a plurality of operating modes of the initialized hardware device according to a switching script;
[0017] A switching module is used to switch the hardware device to the target operating mode;
[0018] An acquisition module, configured to acquire configuration space data of the hardware device after determining that the hardware device has completed switching to the target operating mode;
[0019] The first judgment module is used to judge whether there is abnormal information in the configuration space data;
[0020] A first generating module is configured to generate an abnormality report of the hardware device according to the abnormality information if there is abnormality information in the configuration space data;
[0021] The second generating module is used to traverse other operating modes of the hardware device according to the switching script and generate corresponding abnormality reports;
[0022] The output module is used to output various abnormal reports of hardware devices to the user end.
[0023] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned methods for detecting anomalies in a hardware device when executing the computer program.
[0024] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned hardware device anomaly detection methods are implemented.
[0025] The hardware device anomaly detection method, apparatus, device and storage medium provided by the embodiments of the present application receive a switching script sent by a user terminal; determine a target operating mode from multiple operating modes of the initialized hardware device according to the switching script; switch the hardware device to the target operating mode; after determining that the hardware device has completed the switching of the target operating mode, obtain the configuration space data of the hardware device; determine whether there is abnormal information in the configuration space data; if there is abnormal information in the configuration space data, generate an abnormality report for the hardware device according to the abnormal information; traverse other operating modes of the hardware device according to the switching script, and generate corresponding abnormality reports; output each abnormality report of the hardware device to the user terminal. By analyzing the abnormalities of multiple operating modes of the hardware device, it is possible to deeply explore the defects of the hardware device design in various scenarios and avoid the design blind spots of the hardware device. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0027] Figure 1 A schematic diagram of an application scenario of the method for detecting anomalies in hardware devices provided in an embodiment of the present application;
[0028] Figure 2 Schematic diagram of the process of the hardware device anomaly detection method provided in the embodiment of the application Figure 1 ;
[0029] Figure 3 Schematic diagram of the process of the hardware device anomaly detection method provided in the embodiment of the application Figure 2 ;
[0030] Figure 4 Schematic diagram of the process of the hardware device anomaly detection method provided in the embodiment of the application Figure 3 ;
[0031] Figure 5 Schematic diagram of the process of the hardware device anomaly detection method provided in the embodiment of the application Figure 4 ;
[0032] Figure 6 A schematic diagram of the structure of an abnormality detection device for a hardware device provided in an embodiment of the present application;
[0033] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0035] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0036] The device power state describes the power state of the hardware device in the computer, which is independent of other devices in the computer. The device power state has multiple sub-states. Taking the deep sleep state as an example, it can be further divided into two sub-states: a controllable deep sleep state and a completely power-off state. The controllable deep sleep state can control the device or the entire link to enter a low-power state through software. In the related art, the energy consumption and abnormality analysis of hardware devices mainly focuses on the controllable deep sleep state. In the controllable deep sleep state, the operating data of the hardware device is obtained to determine the energy consumption and abnormal conditions of the hardware device. However, in the related art, the abnormality analysis of the sub-state of the controllable deep sleep state or any other device power state is only applicable to a single scenario, which can easily cause blind spots in the design of hardware devices.
[0037] In order to solve the above technical problems, the embodiments of the present application propose the following technical ideas: the inventor considers the multiple operating modes of the collected hardware devices, determines the target operating mode based on the switching script sent by the user terminal, uses the target operating mode to obtain the configuration space data of the hardware device, and after determining that there is abnormal information in the configuration space data, generates a corresponding abnormality report, traverses other operating modes of the hardware device, and generates corresponding abnormality reports, and outputs each abnormality report to the user terminal. Through the abnormal analysis of multiple operating modes of the hardware device, it is possible to deeply explore the defects of the hardware device design in each scenario and avoid the design blind spots of the hardware device.
[0038] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0039] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the hardware device anomaly detection method depends, the specific application environment architecture or specific hardware architecture is described here. Figure 1 , Figure 1 Schematic diagram of an application scenario of an anomaly detection method for hardware devices.
[0040] like Figure 1 As shown, the scenario includes: an electronic device 10 and a user terminal 20.
[0041] The electronic device 10 may be a computer device or other devices.
[0042] The user terminal 20 may be a display terminal or other user terminal.
[0043] The user terminal 20 transmits the switching script to the electronic device 10 via the wireless network. The electronic device 10 determines a target operating mode from multiple operating modes of the initialized hardware device according to the switching script; switches the hardware device to the target operating mode; after determining that the hardware device has completed switching to the target operating mode, obtains configuration space data of the hardware device; determines whether the configuration space data contains abnormal information; if the configuration space data contains abnormal information, generates an abnormality report for the hardware device based on the abnormal information; traverses other operating modes of the hardware device according to the switching script and generates corresponding abnormality reports; and outputs each abnormality report of the hardware device to the user terminal 20.
[0044] Figure 2 Schematic diagram of the process of the hardware device anomaly detection method provided in the embodiment of the application Figure 1 ,like Figure 2 As shown, the embodiment of the present application provides a method for detecting anomalies of a hardware device, and the method is described in detail as follows:
[0045] S201: Receive a switching script sent by a user terminal.
[0046] S202: Determine a target operating mode from multiple operating modes of the initialized hardware device according to the switching script.
[0047] In this embodiment, the hardware device may be a PCIe device or other devices.
[0048] PCIe devices are hardware devices that use the PCIe interface. PCIe is a high-speed serial computer expansion bus standard. PCIe devices are widely used to connect various components within a computer, such as graphics cards, network cards, and sound cards.
[0049] Exemplarily, the PCIe device is 0000:11:00.0.
[0050] In this embodiment, the multiple operating modes include at least a controllable deep sleep state, a random switching mode between the controllable deep sleep state and the full active state, and a full active state and a switching mode between the full active state and the idle state.
[0051] In this embodiment, the initialization process of the hardware device specifically includes steps a to f:
[0052] Step a: In response to a startup operation of the user terminal, the operating system is initialized and a corresponding virtual file is generated.
[0053] In this embodiment, the virtual file may be a / proc / cmdline file or other files.
[0054] Additionally, when the operating system boots, the boot loader reads a set of kernel parameters from a virtual file and passes them to the kernel.
[0055] Step b: Determine whether the operating system has enabled a memory management unit according to the virtual file.
[0056] Specifically, step b is as follows: obtaining all parameters of the virtual file; determining whether all parameters contain an enable parameter; and if so, determining whether the operating system has enabled the memory management unit.
[0057] The enable parameter can be iommu=pt intel_iommu=on quiet.
[0058] The memory management unit may be an input / output memory management unit or another memory management unit.
[0059] Step c: After determining that the memory management unit is enabled, the default driver is loaded according to the default loading instruction.
[0060] In this embodiment, the preset loading instruction may be a modprobe instruction or other instructions.
[0061] The modprobe command is a Linux command used to manage and operate kernel modules. It can intelligently load or unload modules and handle dependencies between modules.
[0062] In this embodiment, the preset driver may be a vfio-pci driver or other drivers.
[0063] Among them, the vfio-pci driver is a technology that directly transmits hardware devices to virtual machines, allowing virtual machines to directly access the configuration space and registers of these devices.
[0064] Step d: Bind the hardware device to the default driver.
[0065] Specifically, the driverctl tool is used to bind the hardware device to the preset driver.
[0066] Among them, the driverctl tool is a tool for managing device drivers on the upper layer of the device manager. It manages the loading and unloading of device drivers through an overwriting mechanism.
[0067] Step e: Determine whether the hardware device is bound to the preset driver.
[0068] Specifically, a preset viewing command is used to determine whether the hardware device is bound to the preset driver.
[0069] The preset viewing command may be the lspci command or other commands.
[0070] The lspci command is used to enable users to quickly understand the hardware configuration status in the operating system.
[0071] Step f: If it is determined that the hardware device is bound to the preset driver, the hardware device is initialized.
[0072] Specifically, if it is determined that the current kernel is using a preset driver to manage a hardware device, it is determined that the hardware device is bound to the preset driver to complete the initialization of the hardware device.
[0073] Exemplarily, the target operating mode is the first operating mode; accordingly, step S202 is specifically: determining the first operating mode from multiple operating modes of the initialized hardware device according to the switching script, wherein the first operating mode corresponds to a controllable deep sleep state.
[0074] The controllable deep sleep state is the D3hot state, which is used to instruct the hardware device to enter deep sleep.
[0075] D3hot is a substate of the device power state, a higher-power substate within the D3 off state. In D3hot, most hardware devices are shut down, but not completely powered off, and the bus controller can still detect the presence of devices.
[0076] S203: Switch the hardware device to the target operating mode.
[0077] Exemplarily, the hardware device is switched to the first operating mode.
[0078] S204: After determining that the hardware device has completed the switching of the target operation mode, obtaining configuration space data of the hardware device.
[0079] Exemplarily, after determining that the hardware device completes switching to the first operating mode, configuration space data of the hardware device within a first preset time is acquired through a switching script, wherein the configuration space data is configured with the switching script.
[0080] Among them, determining whether the hardware device has completed the switching of the first operating mode is specifically: reading the configuration space data of the hardware device through a preset viewing command, and if the first operating mode information exists in the configuration space data, determining that the hardware device has completed the switching of the first operating mode.
[0081] The first preset time may be any one of 1 hour, 2 hours or 3 hours, or other time.
[0082] In the above process, the virtual machine is not enabled.
[0083] S205: Determine whether there is abnormal information in the configuration space data.
[0084] In this embodiment, the abnormal information includes hardware device link abnormal information and / or power supply unit abnormal information, the hardware device link abnormal information includes one or more error flags, and the power supply unit abnormal information includes abnormal information of one or more power supplies; accordingly, step S205 specifically includes:
[0085] S2051: Acquire hardware device operation data in the configuration space data, where the hardware device operation data includes device link operation data and power supply unit operation data.
[0086] Specifically, the hardware device operation data in the configuration space data is obtained through a preset viewing command.
[0087] S2052: Determine whether the device link operation data contains device link abnormality information, and determine whether the power supply unit operation data contains power supply unit abnormality information.
[0088] In this embodiment, determining whether the device link operation data contains device link abnormality information in step S2052 specifically includes determining whether the device link operation data contains an error flag, where the error flag may also correspond to a register.
[0089] The error flags may be RxErr+, BadDLLP+, Timeout+, and NonFatalErr+.
[0090] Among them, RxErr+ can be described as: the receiving end detects a data packet error, such as a CRC check failure, which can reduce link stability; BadDLLP+ can be described as: the data link layer protocol packet format error or check failure, which can cause link layer communication abnormalities; Timeout+ can be described as: the retransmission timer timeout, such as TLP not receiving ACK / NAK within the expected time, which can increase data transmission delay; NonFatalErr+ can be described as: non-fatal errors, such as Advisory Non-FatalError, which need to be handled but will not cause a system crash. Therefore, it requires attention but can be temporarily run.
[0091] In addition, you can also use a protocol analyzer to perform deep link diagnosis by capturing device link packets.
[0092] In addition, RxErr+, BadDLLP+, Timeout+, and NonFatalErr+ errors are correctable errors and are recorded in the recoverable error status register of the hardware device.
[0093] In this embodiment, the power supply unit operation data includes one or more power supply operation data; accordingly, determining whether the power supply unit operation data contains power supply unit abnormality information in step S2052 specifically includes:
[0094] S20521: Acquire one or more power supply operation data, where each power supply operation data corresponds to voltage operation data and current operation data.
[0095] In this embodiment, the one or more power supplies may be PVCCL, P1V0_GR1, P0V8_GR1, P1V8_GR2, P1V2_GR3, P3V3, P5V, and PVPP_P2V5.
[0096] S20522: Determine whether the fluctuation value of each voltage operation data and / or current operation data exceeds a preset threshold.
[0097] In this embodiment, the fluctuation value may be the fluctuation frequency and the fluctuation amplitude.
[0098] In this embodiment, the preset threshold may be any value among 5%, 10% or 15%, or other values.
[0099] S20523: If the fluctuation value of any voltage operation data and / or current operation data exceeds a preset threshold, it is determined that the power supply unit operation data contains power supply unit abnormality information.
[0100] For example, if the fluctuation value of any voltage operation data and / or current operation data exceeds 5% for three consecutive times, it is determined that the power supply unit operation data contains power supply unit abnormality information.
[0101] S20524: If the fluctuation value of each voltage operation data and / or current operation data does not exceed the preset threshold, it is determined that there is no power supply unit abnormality information in the power supply unit operation data.
[0102] S206: If there is abnormal information in the configuration space data, an abnormality report of the hardware device is generated according to the abnormal information.
[0103] In this embodiment, step S206 specifically includes:
[0104] S2061: If the device link operation data contains device link abnormality information, and / or the power supply unit operation data contains power supply unit abnormality information, then obtain one or more error flags in the device link abnormality information, and / or abnormality information of one or more power supplies in the power supply unit abnormality information.
[0105] S2062: Generate an exception report for the hardware device according to the one or more error flags and / or the abnormal information of one or more power supplies.
[0106] S207: Traverse other operating modes of the hardware device according to the switching script and generate a corresponding exception report.
[0107] Exemplarily, based on S202, the random switching mode between the controllable deep sleep state and the full active state, the switching mode between the full active state and the full active state and the idle state are sequentially traversed according to the switching script, and a corresponding abnormality report is generated.
[0108] Among them, when traversing the full active state and switching modes between the full active state and the idle state, it is necessary to uninstall the preset driver to prevent the controllable deep sleep state D3hot from participating.
[0109] S208: Outputting each abnormality report of the hardware device to the user end.
[0110] Exemplarily, each abnormality report of the hardware device is output to the user end, so that the user end adjusts the selection of the filter capacitor according to each abnormality report.
[0111] In summary, the hardware device anomaly detection method provided in this embodiment receives a switching script sent by a user terminal; determines a target operating mode from multiple operating modes of the initialized hardware device according to the switching script; switches the hardware device to the target operating mode; after determining that the hardware device has completed the switching of the target operating mode, obtains the configuration space data of the hardware device; determines whether there is abnormal information in the configuration space data; if there is abnormal information in the configuration space data, generates an abnormality report for the hardware device according to the abnormal information; traverses other operating modes of the hardware device according to the switching script, and generates corresponding abnormality reports; outputs each abnormality report of the hardware device to the user terminal. By analyzing the abnormalities of multiple operating modes of the hardware device, it is possible to deeply explore the design defects of the hardware device in various scenarios and avoid the design blind spots of the hardware device.
[0112] In addition, the hardware device anomaly detection method provided in this embodiment makes hardware device anomaly detection more efficient by analyzing device link errors and voltage and current fluctuations.
[0113] Figure 3 Schematic diagram of the process of the hardware device anomaly detection method provided in the embodiment of the application Figure 2 In the embodiment of the present application, Figure 2 Based on the embodiment provided, the specific implementation method when the target operating mode is the second operating mode is described in detail. Figure 3 As shown, the method includes:
[0114] S301: Receive a switching script sent by a user terminal.
[0115] S302: Determine a second operating mode from a plurality of operating modes of the initialized hardware device according to a switching script, wherein the second operating mode is a random switching mode of the hardware device between a controllable deep sleep state and a fully active state.
[0116] In this embodiment, the discussion on the hardware device and multiple operating modes has been described in detail in step S202 and will not be repeated here.
[0117] In this embodiment, the fully active state is the D0 state, in which the configuration file of the hardware device can be read, so the hardware device can be controlled to switch randomly and frequently between the controllable deep sleep state and the fully active state.
[0118] Among them, the D0 state means that the hardware device is in full-function operation mode, with the highest power consumption and no power saving measures.
[0119] S303: Switch the hardware device to the second operating mode.
[0120] S304: After determining that the hardware device has completed switching to the second operating mode, obtaining configuration space data of the hardware device within a second preset time through the switching script, wherein the configuration space data is configured with the switching script.
[0121] In this embodiment, the second preset time may be any one of 1 hour, 2 hours, or 3 hours, or other time.
[0122] S305: Determine whether there is abnormal information in the configuration space data.
[0123] In this embodiment, the discussion on abnormal information has been described in detail in step S205 and will not be repeated here.
[0124] S306: If there is abnormal information in the configuration space data, an abnormal report of the hardware device is generated according to the abnormal information.
[0125] In this embodiment, the discussion on the generation process of the abnormality report has been described in detail in step S206 and will not be repeated here.
[0126] S307: Traverse other operating modes of the hardware device according to the switching script and generate a corresponding exception report.
[0127] In this embodiment, the controllable deep sleep state, the full active state, and the switching mode between the full active state and the idle state are randomly traversed according to the switching script, and a corresponding abnormality report is generated.
[0128] S308: Outputting each abnormality report of the hardware device to the user end.
[0129] Exemplarily, each abnormality report of the hardware device is output to the user end, so that the user end adjusts the selection of the filter capacitor according to each abnormality report.
[0130] In summary, the hardware device anomaly detection method provided in this embodiment determines the second operating mode from multiple operating modes of the initialized hardware device according to the switching script, wherein the second operating mode is a random switching mode of the hardware device between a controllable deep sleep state and a fully active state; switches the hardware device to the second operating mode; after determining that the hardware device has completed the switching of the second operating mode, obtains the configuration space data of the hardware device within a second preset time through the switching script, and through the anomaly detection of the hardware device in the random switching mode between the controllable deep sleep state and the fully active state, it is possible to accurately discover the defects in the design of the hardware device in this scenario.
[0131] In addition, the hardware device anomaly detection method provided in this embodiment can deeply explore the defects of hardware device design in various scenarios by analyzing anomalies in multiple operating modes of the hardware device, thereby avoiding blind spots in the design of the hardware device.
[0132] Figure 4 Schematic diagram of the process of the hardware device anomaly detection method provided in the embodiment of the application Figure 3 In the embodiment of the present application, Figure 2 Based on the embodiment provided, the specific implementation method when the target operating mode is the third operating mode is described in detail. Figure 4 As shown, the method includes:
[0133] S401: Receive a switching script sent by a user terminal.
[0134] S402: Determine a third operating mode from a plurality of operating modes of the initialized hardware device according to a switching script, wherein the third operating mode corresponds to a fully active state, and the hardware device is configured with a preset driver.
[0135] In this embodiment, the discussion on the hardware device and multiple operating modes has been described in detail in step S202 and will not be repeated here.
[0136] In this embodiment, the discussion on the fully active state has been described in detail in step S302 and will not be repeated here.
[0137] S403: Switch the hardware device to the third operating mode and uninstall the preset driver.
[0138] In this embodiment, since the preset driver is in the D3hot state, the preset driver needs to be uninstalled to keep the hardware device in the D0 state.
[0139] S404: After determining that the hardware device completes switching to the third operating mode and uninstalling the preset driver, obtaining configuration space data of the hardware device within a third preset time through the switching script, wherein the configuration space data is configured with the switching script.
[0140] In this embodiment, the third preset time may be any one of 1 hour, 2 hours, or 3 hours, or other time.
[0141] S405: Determine whether there is any abnormal information in the configuration space data.
[0142] In this embodiment, the discussion on abnormal information has been described in detail in step S205 and will not be repeated here.
[0143] S406: If there is abnormal information in the configuration space data, an abnormal report of the hardware device is generated according to the abnormal information.
[0144] In this embodiment, the discussion on the generation process of the abnormality report has been described in detail in step S206 and will not be repeated here.
[0145] S407: Traverse other operating modes of the hardware device according to the switching script and generate a corresponding exception report.
[0146] In this embodiment, the controllable deep sleep state, the random switching mode between the controllable deep sleep state and the full active state, and the switching mode between the full active state and the idle state are randomly traversed according to the switching script, and a corresponding abnormality report is generated.
[0147] In addition, if a controlled deep sleep state is detected, you need to continue installing the preset driver.
[0148] S408: Outputting each abnormality report of the hardware device to the user end.
[0149] Exemplarily, each abnormality report of the hardware device is output to the user end, so that the user end adjusts the selection of the filter capacitor according to each abnormality report.
[0150] In summary, the hardware device anomaly detection method provided in this embodiment determines the third operating mode from multiple operating modes of the initialized hardware device according to the switching script, wherein the third operating mode corresponds to the fully active state, and the hardware device is configured with a preset driver; switches the hardware device to the third operating mode, and uninstalls the preset driver; after determining that the hardware device has completed the switching of the third operating mode and uninstalled the preset driver, obtains the configuration space data of the hardware device within the third preset time through the switching script, and through the anomaly detection of the hardware device in the fully active state, it is possible to accurately discover the defects in the design of the hardware device in this scenario.
[0151] In addition, the hardware device anomaly detection method provided in this embodiment can deeply explore the defects of hardware device design in various scenarios by analyzing anomalies in multiple operating modes of the hardware device, thereby avoiding blind spots in the design of the hardware device.
[0152] Figure 5 Schematic diagram of the process of the hardware device anomaly detection method provided in the embodiment of the application Figure 4 In the embodiment of the present application, Figure 2 Based on the embodiment provided, the specific implementation method when the target operating mode is the fourth operating mode is described in detail. Figure 5 As shown, the method includes:
[0153] S501: Receive a switching script sent by a user terminal.
[0154] S502: Determine a fourth operating mode from multiple operating modes of the initialized hardware device according to a switching script, wherein the fourth operating mode is a mode in which the hardware device switches between a fully active state and an idle state at a preset time interval, and the hardware device is configured with a preset driver.
[0155] In this embodiment, the discussion on the hardware device and multiple operating modes has been described in detail in step S202 and will not be repeated here.
[0156] In this embodiment, the preset time interval may be any time interval among 5 minutes, 10 minutes, or 15 minutes, or other time intervals.
[0157] S503: Switch the hardware device to the fourth operating mode and uninstall the preset driver.
[0158] In this embodiment, the discussion on uninstalling the preset driver has been described in detail in step S403 and will not be repeated here.
[0159] S504: After determining that the hardware device completes switching to the fourth operating mode and uninstalling the preset driver, obtaining configuration space data of the hardware device within a fourth preset time through the switching script, wherein the configuration space data is configured with the switching script.
[0160] In this embodiment, the fourth preset time may be any one of 3 hours, 4 hours, or 5 hours, or other time.
[0161] S505: Determine whether there is abnormal information in the configuration space data.
[0162] In this embodiment, the discussion on abnormal information has been described in detail in step S205 and will not be repeated here.
[0163] S506: If there is abnormal information in the configuration space data, generate an abnormality report of the hardware device according to the abnormal information.
[0164] In this embodiment, the discussion on the generation process of the abnormality report has been described in detail in step S206 and will not be repeated here.
[0165] S507: Traverse other operating modes of the hardware device according to the switching script and generate a corresponding exception report.
[0166] In this embodiment, the controllable deep sleep state, the random switching mode between the controllable deep sleep state and the full active state, and the full active state are randomly traversed according to the switching script, and a corresponding abnormality report is generated.
[0167] In addition, if a controlled deep sleep state is detected, you need to continue installing the preset driver.
[0168] S508: Output each abnormality report of the hardware device to the user end.
[0169] Exemplarily, each abnormality report of the hardware device is output to the user end, so that the user end adjusts the selection of the filter capacitor according to each abnormality report.
[0170] In summary, the hardware device anomaly detection method provided in this embodiment determines the fourth operating mode from multiple operating modes of the initialized hardware device according to a switching script, wherein the fourth operating mode is a mode in which the hardware device switches between a fully active state and an idle state at a preset time interval, and the hardware device is configured with a preset driver; the hardware device is switched to the fourth operating mode, and the preset driver is uninstalled; after determining that the hardware device has completed the switching of the fourth operating mode and uninstalled the preset driver, the configuration space data of the hardware device within the fourth preset time is obtained through the switching script, and by detecting the anomaly of the switching mode of the hardware device between the fully active state and the idle state, the defects of the hardware device design in this scenario can be accurately discovered.
[0171] In addition, the hardware device anomaly detection method provided in this embodiment can deeply explore the defects of hardware device design in various scenarios by analyzing anomalies in multiple operating modes of the hardware device, thereby avoiding blind spots in the design of the hardware device.
[0172] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0173] Figure 6 This is a schematic diagram of the structure of the abnormality detection device of the hardware device provided in the embodiment of the present application. Figure 6 As shown, an embodiment of the present application also provides an anomaly detection device for a hardware device, including: a receiving module 601, a determination module 602, a switching module 603, an acquisition module 604, a first judgment module 605, a first generation module 606, a second generation module 607 and an output module 608.
[0174] Receiving module 601, used for receiving the switching script sent by the user terminal;
[0175] A determination module 602 is configured to determine a target operating mode from a plurality of operating modes of the initialized hardware device according to a switching script;
[0176] The switching module 603 is used to switch the hardware device to the target operation mode;
[0177] An acquisition module 604 is configured to acquire configuration space data of the hardware device after determining that the hardware device has completed switching to the target operating mode;
[0178] The first judgment module 605 is used to judge whether there is abnormal information in the configuration space data;
[0179] A first generating module 606 is configured to generate an abnormality report of the hardware device according to the abnormality information if there is abnormality information in the configuration space data;
[0180] The second generating module 607 is used to traverse other operating modes of the hardware device according to the switching script and generate corresponding abnormality reports;
[0181] The output module 608 is used to output various abnormality reports of the hardware device to the user end.
[0182] In one possible implementation, the target operating mode is the first operating mode; accordingly, the determination module 602 is specifically used to: determine the first operating mode from multiple operating modes of the initialized hardware device according to the switching script, wherein the first operating mode corresponds to a controllable deep sleep state; accordingly, the switching module 603 is specifically used to: switch the hardware device to the first operating mode; accordingly, the acquisition module 604 is specifically used to: after determining that the hardware device completes the switching of the first operating mode, obtain the configuration space data of the hardware device within the first preset time through the switching script, wherein the configuration space data is configured with the switching script.
[0183] In one possible implementation, the target operating mode is the second operating mode; accordingly, the determination module 602 is specifically used to: determine the second operating mode from multiple operating modes of the initialized hardware device according to the switching script, wherein the second operating mode is a random switching mode of the hardware device between a controllable deep sleep state and a fully active state; accordingly, the switching module 603 is specifically used to: switch the hardware device to the second operating mode; accordingly, the acquisition module 604 is specifically used to: after determining that the hardware device has completed the switching of the second operating mode, obtain the configuration space data of the hardware device within the second preset time through the switching script, wherein the configuration space data is configured with the switching script.
[0184] In one possible implementation, the target operating mode is the third operating mode; accordingly, the determination module 602 is specifically used to: determine the third operating mode from multiple operating modes of the initialized hardware device according to the switching script, wherein the third operating mode corresponds to the fully active state, and the hardware device is configured with a preset driver; accordingly, the switching module 603 is specifically used to: switch the hardware device to the third operating mode and uninstall the preset driver; accordingly, the acquisition module 604 is specifically used to: after determining that the hardware device completes the switching of the third operating mode and uninstalls the preset driver, obtain the configuration space data of the hardware device within the third preset time through the switching script, wherein the configuration space data is configured with the switching script.
[0185] In one possible implementation, the target operating mode is the fourth operating mode; accordingly, the determination module 602 is specifically used to: determine the fourth operating mode from multiple operating modes of the initialized hardware device according to the switching script, wherein the fourth operating mode is a mode in which the hardware device switches between the fully active state and the idle state according to a preset time interval, and the hardware device is configured with a preset driver; accordingly, the switching module 603 is specifically used to: switch the hardware device to the fourth operating mode and uninstall the preset driver; accordingly, the acquisition module 604 is specifically used to: after determining that the hardware device completes the switching of the fourth operating mode and uninstalls the preset driver, obtain the configuration space data of the hardware device within the fourth preset time through the switching script, wherein the configuration space data is configured with the switching script.
[0186] In a possible implementation, the abnormality information includes hardware device link abnormality information and / or power supply unit abnormality information, the hardware device link abnormality information includes one or more error flags, and the power supply unit abnormality information includes abnormality information of one or more power supplies;
[0187] Accordingly, the judgment module 605 specifically includes:
[0188] An acquisition unit, configured to acquire hardware device operation data from the configuration space data, wherein the hardware device operation data includes device link operation data and power supply unit operation data;
[0189] a judgment unit, configured to judge whether the device link operation data contains device link abnormality information, and to judge whether the power supply unit operation data contains power supply unit abnormality information;
[0190] Accordingly, the first generating module 606 includes:
[0191] an acquiring unit, configured to acquire, if the device link operation data contains device link abnormality information and / or the power supply unit operation data contains power supply unit abnormality information, one or more error flags in the device link abnormality information and / or abnormality information of one or more power supplies in the power supply unit abnormality information;
[0192] The generating unit is configured to generate an abnormality report of the hardware device according to one or more error flags and / or abnormality information of one or more power supplies.
[0193] In a possible implementation, the apparatus further includes:
[0194] An initialization module, configured to initialize the operating system and generate corresponding virtual files in response to a startup operation of the user terminal;
[0195] A second judgment module is used to judge whether the operating system has enabled the memory management unit according to the virtual file;
[0196] A loading module, configured to load a preset driver according to a preset loading instruction after determining that the memory management unit is enabled;
[0197] Binding module, used to bind hardware devices to preset drivers;
[0198] The third judgment module is used to judge whether the hardware device is bound to the preset driver;
[0199] The determination module is configured to complete the initialization of the hardware device if it is determined that the hardware device is bound to the preset driver.
[0200] For the description of the features in the embodiment corresponding to the abnormality detection device of the hardware device, please refer to the relevant description of the embodiment corresponding to the abnormality detection method of the hardware device, and will not be repeated here.
[0201] Figure 7 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 7 As shown, the electronic device provided by this embodiment includes: at least one processor 701 and a memory 702. Optionally, the electronic device further includes a communication component 703. The processor 701, the memory 702 and the communication component 703 are connected via a bus.
[0202] During the specific implementation process, at least one processor 701 executes the computer-executable instructions stored in the memory 702, so that the at least one processor 701 executes the above-mentioned embodiment of the method for detecting anomalies in a hardware device.
[0203] The specific implementation process of the processor 701 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.
[0204] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the application may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.
[0205] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
[0206] A bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0207] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned hardware device anomaly detection method embodiments when running.
[0208] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0209] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned hardware device anomaly detection method embodiments are implemented.
[0210] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned hardware device anomaly detection method embodiments.
[0211] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0212] The above is a detailed introduction to the anomaly detection method, device, equipment and storage medium for a hardware device provided by this application. This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
Claims
1. A method for detecting anomalies in hardware equipment, characterized in that: include: Receive the switching script sent by the user end; Determining a target operating mode from a plurality of operating modes of the initialized hardware device according to the switching script; Switching the hardware device to a target operating mode; After determining that the hardware device has completed switching to the target operating mode, obtaining configuration space data of the hardware device; Determining whether there is abnormal information in the configuration space data; If there is abnormal information in the configuration space data, generating an abnormality report of the hardware device according to the abnormal information; Traversing other operating modes of the hardware device according to the switching script and generating corresponding exception reports; Outputting each abnormality report of the hardware device to the user terminal.
2. The method for detecting anomalies in hardware devices according to claim 1, wherein: wherein the target operating mode is the first operating mode; Accordingly, determining the target operating mode from multiple operating modes of the initialized hardware device according to the switching script includes: determining a first operating mode from a plurality of operating modes of the initialized hardware device according to the switching script, wherein the first operating mode corresponds to a controllable deep sleep state; Accordingly, switching the hardware device to the target operating mode includes: Switching the hardware device to a first operating mode; Accordingly, after determining that the hardware device has completed the switching of the target operating mode, obtaining the configuration space data of the hardware device includes: After determining that the hardware device completes switching to the first operating mode, the configuration space data of the hardware device within a first preset time is acquired through a switching script, wherein the configuration space data is configured with the switching script.
3. The method for detecting anomalies in hardware devices according to claim 1, wherein: wherein the target operating mode is the second operating mode; Accordingly, determining the target operating mode from multiple operating modes of the initialized hardware device according to the switching script includes: determining a second operating mode from a plurality of operating modes of the initialized hardware device according to the switching script, wherein the second operating mode is a random switching mode of the hardware device between a controllable deep sleep state and a fully active state; Accordingly, switching the hardware device to the target operating mode includes: Switching the hardware device to a second operating mode; Accordingly, after determining that the hardware device has completed the switching of the target operating mode, obtaining the configuration space data of the hardware device includes: After determining that the hardware device completes switching to the second operating mode, the configuration space data of the hardware device within a second preset time is acquired through a switching script, wherein the configuration space data is configured with the switching script.
4. The method for detecting anomalies in hardware devices according to claim 1, wherein: wherein the target operating mode is the third operating mode; Accordingly, determining the target operating mode from multiple operating modes of the initialized hardware device according to the switching script includes: determining a third operating mode from a plurality of operating modes of the initialized hardware device according to the switching script, wherein the third operating mode corresponds to a fully active state, and the hardware device is configured with a preset driver; Accordingly, switching the hardware device to the target operating mode includes: Switching the hardware device to a third operating mode and uninstalling the preset driver; Accordingly, after determining that the hardware device has completed the switching of the target operating mode, obtaining the configuration space data of the hardware device includes: After determining that the hardware device completes switching to the third operating mode and uninstalling the preset driver, the configuration space data of the hardware device within a third preset time is obtained through a switching script, wherein the configuration space data is configured with the switching script.
5. The method for detecting anomalies in hardware devices according to claim 1, wherein: wherein the target operating mode is the fourth operating mode; Accordingly, determining the target operating mode from multiple operating modes of the initialized hardware device according to the switching script includes: determining a fourth operating mode from a plurality of operating modes of the initialized hardware device according to the switching script, wherein the fourth operating mode is a mode in which the hardware device switches between a fully active state and an idle state at a preset time interval, and the hardware device is configured with a preset driver; Accordingly, switching the hardware device to the target operating mode includes: Switching the hardware device to a fourth operating mode and uninstalling the preset driver; Accordingly, after determining that the hardware device has completed the switching of the target operating mode, obtaining the configuration space data of the hardware device includes: After determining that the hardware device completes switching to the fourth operating mode and uninstalling the preset driver, the configuration space data of the hardware device within a fourth preset time is obtained through a switching script, wherein the configuration space data is configured with the switching script.
6. The method for detecting anomalies in hardware devices according to claim 1, wherein: The abnormal information includes hardware device link abnormal information and / or power supply unit abnormal information, wherein the hardware device link abnormal information includes one or more error flags, and the power supply unit abnormal information includes abnormal information of one or more power supplies; Accordingly, the determining whether the configuration space data contains abnormal information includes: Acquire hardware device operation data in the configuration space data, wherein the hardware device operation data includes device link operation data and the power supply unit operation data; Determining whether the device link operation data contains device link abnormality information, and determining whether the power supply unit operation data contains power supply unit abnormality information; Correspondingly, if there is abnormal information in the configuration space data, generating an abnormality report of the hardware device according to the abnormal information includes: If the device link operation data contains device link abnormality information, and / or the power supply unit operation data contains power supply unit abnormality information, obtaining one or more error flags in the device link abnormality information, and / or abnormality information of one or more power supplies in the power supply unit abnormality information; Generate an exception report of the hardware device according to the one or more error flags and / or the abnormal information of one or more power supplies.
7. The method for detecting anomalies in hardware devices according to any one of claims 1 to 6, characterized in that: The initialization process of the hardware device includes: In response to a startup operation of the user terminal, the operating system is initialized and a corresponding virtual file is generated; Determining whether the memory management unit of the operating system is enabled according to the virtual file; After determining to enable the memory management unit, loading the preset driver according to the preset loading instruction; Binding the hardware device to the preset driver; Determine whether the hardware device is bound to the preset driver; If it is determined that the hardware device is bound to the preset driver, the initialization of the hardware device is completed.
8. A hardware device anomaly detection device, characterized in that: include: A receiving module, used for receiving the switching script sent by the user terminal; a determination module, configured to determine a target operating mode from a plurality of operating modes of the initialized hardware device according to the switching script; A switching module, configured to switch the hardware device to a target operating mode; an acquisition module, configured to acquire configuration space data of the hardware device after determining that the hardware device has completed switching to the target operation mode; A first judgment module is used to judge whether there is abnormal information in the configuration space data; A first generating module is configured to generate an abnormality report of the hardware device according to abnormality information if abnormality information exists in the configuration space data; A second generating module, configured to traverse other operating modes of the hardware device according to the switching script and generate corresponding exception reports; The output module is used to output each abnormality report of the hardware device to the user terminal.
9. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method for detecting anomaly of a hardware device according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method for detecting anomaly of a hardware device according to any one of claims 1 to 7 are implemented.