CN117667802A - Method, device, equipment and medium for processing equipment hot plug event - Google Patents
Method, device, equipment and medium for processing equipment hot plug event Download PDFInfo
- Publication number
- CN117667802A CN117667802A CN202311606258.1A CN202311606258A CN117667802A CN 117667802 A CN117667802 A CN 117667802A CN 202311606258 A CN202311606258 A CN 202311606258A CN 117667802 A CN117667802 A CN 117667802A
- Authority
- CN
- China
- Prior art keywords
- event
- slot
- equipment
- list
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012545 processing Methods 0.000 title claims abstract description 46
- 238000000034 method Methods 0.000 title claims description 43
- 238000012544 monitoring process Methods 0.000 claims abstract description 11
- 238000003780 insertion Methods 0.000 claims description 23
- 230000037431 insertion Effects 0.000 claims description 23
- 238000004590 computer program Methods 0.000 claims description 15
- 238000003860 storage Methods 0.000 claims description 13
- 238000000605 extraction Methods 0.000 claims description 6
- 238000003672 processing method Methods 0.000 abstract 1
- 208000012788 shakes Diseases 0.000 description 21
- 230000006870 function Effects 0.000 description 10
- 230000008569 process Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 9
- 238000005304 joining Methods 0.000 description 5
- 238000012986 modification Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000750 progressive effect Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 238000005070 sampling Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000026676 system process Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Landscapes
- Stored Programmes (AREA)
Abstract
The embodiment of the invention provides a processing method, a device, equipment and a medium for a hot plug event of equipment, which are used for monitoring an inserting slot event or a pulling slot event of target equipment by acquiring an event list and initializing, adding the inserting slot event into the event list if the target equipment is not newly added equipment when the inserting slot event is monitored, unloading a driver corresponding to the target equipment to complete the pulling slot event if the inserting slot event does not exist in the event list when the pulling slot event is monitored, detecting the event list according to a preset time interval, adding the driver corresponding to the target equipment to complete the inserting slot event if the inserting slot event exists in the event list and a preset condition is met, avoiding the problems of system processing confusion, memory leakage and the like caused by the conditions of frequent inserting and pulling, repeated on-off and the like of PCIe equipment, and improving the stability and high availability of a system when the equipment generates the hot plug event.
Description
Technical Field
The present invention relates to the field of computer hardware devices, and in particular, to a method, an apparatus, a device, and a medium for processing a device hot plug event.
Background
A large data center is generally composed of a server, a switch, a storage device and the like, and the data communication of the whole data center is not separated from an important component: PCIe devices. PCIe (Eripheral Component Interconnect express) is a standard for expansion bus of a high-speed serial computer, and PCIe devices are devices using this standard, such as a high-speed network card, a solid state hard disk for storing data, a graphics card for computing, etc., and these components are typically plugged into slots of a server or a storage device. In some cases, hot plug is required to these devices (i.e. plug or unplug the devices without powering off or stopping the system application), such as a scenario where a device failure needs to be replaced, etc., to ensure that the system is permanently providing service online.
In the process of hot-plugging a PCIe device, the following situations may occur: 1. the equipment is frequently and quickly plugged and unplugged; 2. a plurality of devices are plugged and unplugged at the same time; 3. the equipment is repeatedly electrified and powered off, at the moment, the system can frequently and repeatedly receive a large number of signals for inserting and extracting the equipment, and when the system processes the signals, confusion can occur, so that serious problems such as resource leakage, system blocking and even downtime can be caused.
Disclosure of Invention
In view of the foregoing, it is proposed to provide a method, apparatus, device and storage medium for processing a device hot plug event that overcomes or at least partially solves the foregoing, comprising:
acquiring an event list and initializing;
monitoring an inserting slot event or a pulling slot event of the target device;
when the event of inserting the slot is monitored, if the target equipment is not newly added equipment, adding the event of inserting the slot into the event list;
when the event of pulling out the slot is monitored, if the event list does not have the event of inserting the slot, unloading the driver corresponding to the target equipment so as to complete the event of pulling out the slot;
detecting the event list according to a preset time interval, and if the event list has the slot insertion event and meets a preset condition, adding a driver corresponding to the target device to complete the slot insertion event.
Optionally, the preset condition includes:
after the target device is inserted into the slot, the driver needs to be added for a preset time length, and the time difference between the current time and the occurrence time of the event inserted into the slot exceeds the preset time length.
Optionally, before the step of acquiring the event list and initializing, the method includes:
and acquiring the equipment information of all the online equipment, and storing the equipment information in an equipment information list.
Optionally, when the event of inserting the slot is monitored, if the target device is not a new joining device, the step of adding the event of inserting the slot to the event list includes:
when the event of inserting the slot is monitored, judging whether the target equipment is newly added equipment according to the equipment information list;
and if the target equipment is not the newly added equipment, adding the event inserted into the slot into the event list.
Optionally, after the step of inserting the slot event or extracting the slot event of the monitor target device, the method further includes:
and when the event of inserting the slot is monitored, if the target equipment is newly added equipment, adding a driver corresponding to the target equipment to complete the event of inserting the slot.
Optionally, after the step of inserting the slot event or extracting the slot event of the monitor target device, the method further includes:
and when the event of pulling out the slot is monitored, if the event list has the event of inserting the slot, removing the event of inserting the slot so as to complete the event of pulling out the slot.
Optionally, the device information includes:
device identifier, time of device insertion into slot, statistics of device insertion into slot.
An apparatus for handling a device hot plug event, the apparatus comprising:
the event list acquisition module is used for acquiring an event list and initializing the event list;
the event monitoring module is used for monitoring an inserting slot event or an extracting slot event of the target equipment;
the inserting event processing module is used for adding the inserting event into the event list if the target equipment is not newly added equipment when the inserting event is monitored;
the extraction event processing module is used for unloading the driver corresponding to the target equipment to finish the extraction slot event if the event list does not have the insertion slot event when the extraction slot event is monitored;
the event list processing module is used for detecting the event list according to a preset time interval, and if the event list has the event of inserting the slot and meets a preset condition, adding a driver corresponding to the target device so as to complete the event of inserting the slot.
An electronic device for device hot plug events, comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, which when executed by the processor, implements the steps of a method for processing device hot plug events as described above.
A computer readable storage medium for a device hot plug event, wherein the computer readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of a method for handling a device hot plug event as described above.
According to the embodiment of the invention, through acquiring and initializing the event list, monitoring the inserting slot event or the extracting slot event of the target device, when the inserting slot event is monitored, if the target device is not a new joining device, the inserting slot event is added into the event list, when the extracting slot event is monitored, if the inserting slot event does not exist in the event list, the driving corresponding to the target device is unloaded to complete the extracting slot event, the event list is detected according to a preset time interval, and if the inserting slot event exists in the event list and a preset condition is met, the driving corresponding to the target device is added to complete the inserting slot event, so that the problems of system processing confusion, memory leakage and the like caused by the conditions of frequent inserting and extracting of PCIe devices are avoided, and the stability and the high availability of the system when the device generates the hot inserting slot event are improved.
Drawings
In order to more clearly illustrate the technical solutions of the present invention, the drawings that are needed in the description of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort to a person skilled in the art.
FIG. 1 is a flowchart illustrating a method for handling a device hot plug event according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an implementation position of an anti-shake policy according to an embodiment of the invention;
FIG. 3 is a flowchart illustrating implementation of an anti-shake policy according to an embodiment of the present invention;
fig. 4 is a block diagram of a device for handling a hot plug event according to an embodiment of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description. It will be apparent that the described embodiments are some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
When a hot plug event occurs in a PCIe device, the problems of processing confusion, memory leakage, and the like caused to the system may be collectively referred to as system jitter, and a policy adopted to avoid or reduce such jitter as much as possible may be referred to as an anti-jitter policy for short. In the prior art, although protection measures for reducing system jitter are provided on the hardware or operating system level, no anti-jitter function is provided on respective driving applications of PCIe devices.
As shown in fig. 2, the memory space of the operating system is divided according to the access rights of the user operation instructions, and is divided into a kernel space of the protected memory space and a user space outside the protected memory space. For example, the size of the memory space is 4GB, the upper 1GB address space (0 xFFFFFFFF-0xC 0000000) is the protected space, which is defined as the kernel space, and the lower 3GB address space (0 xC0000000-0x 00000000) is divided into the user space.
The kernel space can be directly communicated with the hardware equipment to perform bottom-layer operations such as system interface calling, memory management, hardware drive management and the like. Although the hardware equipment can not be directly accessed in the user space, the information interaction can be carried out through the user mode driver and the kernel mode driver in the kernel space, and the running state and other information of the equipment are fed back to an application program at a higher layer for processing so as to realize corresponding business logic.
When PCIe devices such as an optical fiber network card and an Ethernet card are hot plugged, the system captures a hot plug event of hardware through a PCIe hot plug driver in a kernel space, processes a basic event (for example, receives a signal for plugging or unplugging the device to respond), and then transmits hot plug information to the kernel mode driver to perform relevant driving processing (for example, adding or uninstalling the driver).
The embodiment of the invention mainly sets an anti-shake strategy (an anti-shake position shown in figure 2) in the process of information interaction between the PCIe hot plug driver and the kernel mode driver, and when the hot plug information is transmitted to the kernel mode driver, the anti-shake strategy is adopted to perform anti-shake treatment and then related driving treatment is performed.
The core concept of the embodiment of the invention is that after the equipment is inserted into the slot, the corresponding adding driving operation is not performed immediately in response to the signal of equipment insertion, but a camouflage preprocessing method is adopted, namely, the callback result of event processing completion of inserting the slot is immediately returned to the system kernel in response to the signal of equipment insertion, the event of inserting the slot is not actually processed by adding driving, but is put into an event list to wait for processing, if the equipment accords with the preset condition, the adding driving processing is performed on the equipment after waiting for the preset time, and the processing mode of delaying the adding of equipment driving is the anti-shake strategy adopted in the embodiment of the invention.
Referring to fig. 1, a step flowchart of a method for processing a device hot plug event according to an embodiment of the present invention may specifically include the following steps:
step 101, acquiring an event list and initializing;
in the embodiment of the invention, the event List can be a data type of a linked List (List), and the device information of the device and the event information of the corresponding inserting or extracting slot are saved. In order to prevent the event list from leaving a history of events that have not been processed due to system processing exceptions, it is necessary to initialize the event list flush.
Step 102, monitoring an inserting slot event or an extracting slot event of the target device;
in the embodiment of the present invention, the target device may be a PCIe device, for example, an ethernet card, an optical fiber network card, a sound card, a video card, a disk array, a memory bank, and the like. When the device is plugged into or pulled out of a specific slot, the plugged or pulled out signal is reported to the system kernel, and the system receives the signal and performs relevant processing.
Step 103, when the event of inserting the slot is monitored, if the target device is not a newly added device, adding the event of inserting the slot into the event list;
in some embodiments, prior to step 101, further comprising:
in step 1001, device information of all online devices is acquired, and the device information is stored in a device information list.
The master device is powered on and the system traverses all device information of all PCIe device components connected to the master device that are online and saves all device information in a device list. As shown in fig. 3, dev0, dev1, dev2, etc. in the device list represent the saved device information corresponding to each PCIe device.
Wherein the device information may include: device identifier, time of device insertion into slot, statistics of device insertion into slot.
The Device identifier may be a BDF (Bus-Device-Function) identifier of the PCIe Device, where the identifier includes three parts including a Bus Number (Bus Number), a Device Number (Device Number), and a Function Number (Function Number), and in the BDF, the Bus Number occupies 8 bits, the Device Number occupies 5 bits, and the Function Number occupies 3 bits. The functions represented by the function numbers may include a hard disk interface, a display controller, an ethernet controller, a USB controller, and the like. The BDF identifier may be used as a unique identifier for the PCIe device to find corresponding device information from the BDF identifier in the device list.
The time of inserting the device into the slot can be recorded when the system receives the insertion signal reported by the device, and only the latest time of inserting the device into the slot is recorded.
The statistics times of the device inserting into the slot, namely, each time the inserting signal reported by the device is received, the statistics times are counted once, and the statistics times are updated.
Step 103, including:
a substep 131, when the event of inserting the slot is monitored, determining whether the target device is a newly added device according to the device information list;
in a substep 132, if the target device is not a newly added device, the insert slot event is added to the event list.
As shown in fig. 3, an event of inserting a slot into a PCIe device is monitored, the device is found in a device list according to a BDF identifier of the device, if corresponding device information can be found, which indicates that the device is not a newly added device, it is primarily determined that the device may need to perform anti-shake processing, the slot inserting time is added to the event list, and the event processor waits for processing. And updating the latest slot inserting time and slot inserting statistics times.
In some embodiments, after step 102, comprising:
and step 1021, when the event of inserting the slot is monitored, if the target device is a newly added device, adding a driver corresponding to the target device to complete the event of inserting the slot.
As shown in fig. 3, if the device information corresponding to the device is not matched in the device list, the device is inserted into the slot for the first time, that is, the newly added device adds the driver for the first time, which generally does not conflict with the driver processing of the existing device, so that the anti-shake processing is not required, the event is not required to be added into the event list, and the driver corresponding to the device is directly added to complete the slot insertion event.
104, when the event of pulling out the slot is monitored, if the event list does not have the event of inserting the slot, unloading the driver corresponding to the target device so as to complete the event of pulling out the slot;
in the embodiment of the invention, as shown in fig. 3, a slot pulling event of a PCIe device is monitored, whether an slot inserting event corresponding to the device exists in an event list is first searched, if not, it is indicated that the slot inserting event of the device is finished in advance and is not in an intermediate state to be processed, and a conflict of drive processing is not caused, then a drive corresponding to the device is directly unloaded, and an event of pulling out a slot of the device is completed.
In some embodiments, after step 102, further comprising:
step 1022, when the unplugged slot event is monitored, if the event list includes the plugged slot event, removing the plugged slot event to complete the unplugged slot event.
As shown in fig. 3, when the event of pulling out the slot is monitored, if the event of inserting the slot corresponding to the target device is found in the event list, it is indicated that the event of inserting the slot of the device is in a waiting state at this time and is not processed, and the event of inserting the slot is removed from the event list, without entering a step of adding a device driver subsequently. Because the addition of the device driver is not completed, the device driver does not need to be unloaded, and the slot event is directly pulled out after the slot event is removed.
And 105, detecting the event list according to a preset time interval, and if the event list has the event of inserting the slot and meets a preset condition, adding a driver corresponding to the target device to complete the event of inserting the slot.
The preset conditions comprise:
after the target device is inserted into the slot, the driver needs to be added for a preset time length, and the time difference between the current time and the occurrence time of the event inserted into the slot exceeds the preset time length.
In the embodiment of the invention, based on the principles of time delay sampling and multiple sampling, an event processor detects an event List (for example, once every 1 s) according to a preset time interval, traverses the event List (List) to judge whether an event which needs to be processed is inserted into a slot, and if the event which needs to be processed is detected, firstly judges whether target equipment corresponding to the event needs to adopt an anti-shake strategy, namely, the target equipment needs to wait for a preset time period to add a drive after being inserted into the slot.
In practical applications, whether an anti-shake policy needs to be adopted may be determined based on the type of PCIe device inserted into the slot. For example, the speed of processing data by the equipment is low, the initialization work of the system after adding the drive of the equipment is also low, and the system can not process in time, so that the PCIe equipment needs to adopt an anti-shake strategy. For another example, because the fiber network card (FC card) has high performance, the data processing speed of the device is high, and the PCIe device of the type does not need to adopt an anti-shake policy, and can directly add a driver. The system can improve the processing efficiency of the system to the hot plug event by carrying out differential customization of the anti-shake strategy on different types of equipment, and meets the performance requirement while guaranteeing the stability of the system.
If the target device is judged to adopt the anti-shake strategy, whether the time difference between the current time and the occurrence time of the slot insertion event exceeds the preset time length defined in the anti-shake strategy is further judged, if the time difference exceeds the preset time length, device driving is added, slot insertion event is completed, and the event is removed from the event list. If the preset time length is not exceeded, the event is ignored, and the next round of traversal of the event list is entered.
In practical application, the type of equipment requiring the anti-shake strategy and the preset duration in the anti-shake strategy can be subjected to parameter configuration through the configuration file. The configuration file can adjust anti-shake strategies according to the characteristics and service requirements of different devices, conduct differentiated configuration, and conduct preloading after an event list is obtained and a device list is obtained.
In some embodiments, the hot plug process of the whole device may be recorded in a log, and the anti-shake process is checked by debugging the log, so as to test and verify the anti-shake effect in a fast plug manner.
According to the embodiment of the invention, through acquiring and initializing the event list, monitoring the inserting slot event or the extracting slot event of the target device, when the inserting slot event is monitored, if the target device is not a new joining device, the inserting slot event is added into the event list, when the extracting slot event is monitored, if the inserting slot event does not exist in the event list, the driving corresponding to the target device is unloaded to complete the extracting slot event, the event list is detected according to a preset time interval, and if the inserting slot event exists in the event list and a preset condition is met, the driving corresponding to the target device is added to complete the inserting slot event, so that the problems of system processing confusion, memory leakage and the like caused by the conditions of frequent inserting and extracting of PCIe devices are avoided, and the stability and the high availability of the system when the device generates the hot inserting slot event are improved.
Referring to fig. 4, a block diagram of a device hot plug event processing apparatus according to an embodiment of the present invention may specifically include the following modules:
an event list acquisition module 401, configured to acquire an event list and initialize the event list;
an event monitoring module 402, configured to monitor an insert slot event or an extract slot event of a target device;
an insert event processing module 403, configured to add the insert event to the event list if the target device is not a new add device when the insert event is monitored;
a unplugged event processing module 404, configured to, when the unplugged slot event is detected, uninstall a driver corresponding to the target device to complete the unplugged slot event if the event list does not have the plugged slot event;
the event list processing module 405 is configured to detect the event list at a preset time interval, and if the event list has the insert slot event and meets a preset condition, add a driver corresponding to the target device to complete the insert slot event.
In an embodiment of the present invention, the preset condition includes:
after the target device is inserted into the slot, the driver needs to be added for a preset time length, and the time difference between the current time and the occurrence time of the event inserted into the slot exceeds the preset time length.
In an embodiment of the invention, the apparatus further comprises:
and the device list generation module is used for acquiring the device information of all the online devices and storing the device information in a device information list.
In one embodiment of the present invention, the insertion event processing module 403 includes:
the newly added equipment judging submodule is used for judging whether the target equipment is newly added equipment according to the equipment information list when the event of inserting the slot is monitored;
and the event processing sub-module is used for adding the event of the insertion slot into the event list if the target equipment is not newly added equipment.
In an embodiment of the invention, the apparatus further comprises:
and the new joining device driver adding module is used for adding a driver corresponding to the target device if the target device is the new joining device when the event of inserting the slot is monitored, so as to complete the event of inserting the slot.
In an embodiment of the invention, the apparatus further comprises:
and the event removing module is used for removing the event inserted into the slot if the event list has the event inserted into the slot when the event extracted from the slot is monitored, so as to complete the event extracted from the slot.
In an embodiment of the present invention, the device information includes:
device identifier, time of device insertion into slot, statistics of device insertion into slot.
An embodiment of the present invention further provides an electronic device, which may include a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program when executed by the processor implements a method for processing a hot plug event of a device as described above.
An embodiment of the present invention further provides a computer readable storage medium, where a computer program is stored, where the computer program when executed by a processor implements a method for processing a hot plug event of a device as described above.
The readable storage medium may include: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region, and provide corresponding operation entries for the user to select authorization or rejection.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It is to be understood that the invention is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the invention is limited only by the appended claims
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and scope of the invention are intended to be included within the scope of the invention.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The above method and apparatus for synchronizing data, electronic device, and storage medium are described in detail, and specific examples are applied to illustrate the principles and embodiments of the present invention, and the above examples are only used to help understand the method and core idea of the present invention; meanwhile, as those skilled in the art will vary in the specific embodiments and application scope according to the idea of the present invention, the present disclosure should not be construed as limiting the present invention in summary.
Claims (10)
1. A method for processing a device hot plug event, the method comprising:
acquiring an event list and initializing;
monitoring an inserting slot event or a pulling slot event of the target device;
when the event of inserting the slot is monitored, if the target equipment is not newly added equipment, adding the event of inserting the slot into the event list;
when the event of pulling out the slot is monitored, if the event list does not have the event of inserting the slot, unloading the driver corresponding to the target equipment so as to complete the event of pulling out the slot;
detecting the event list according to a preset time interval, and if the event list has the slot insertion event and meets a preset condition, adding a driver corresponding to the target device to complete the slot insertion event.
2. The method of claim 1, wherein the preset conditions include:
after the target device is inserted into the slot, the driver needs to be added for a preset time length, and the time difference between the current time and the occurrence time of the event inserted into the slot exceeds the preset time length.
3. The method of claim 1, comprising, prior to the step of obtaining and initializing the event list:
and acquiring the equipment information of all the online equipment, and storing the equipment information in an equipment information list.
4. The method of claim 3, wherein the step of adding the insert slot event to the event list when the insert slot event is detected if the target device is not a newly added device comprises:
when the event of inserting the slot is monitored, judging whether the target equipment is newly added equipment according to the equipment information list;
and if the target equipment is not the newly added equipment, adding the event inserted into the slot into the event list.
5. The method according to claim 1 or 4, further comprising, after the step of listening for a slot insertion event or a slot withdrawal event of the target device:
and when the event of inserting the slot is monitored, if the target equipment is newly added equipment, adding a driver corresponding to the target equipment to complete the event of inserting the slot.
6. The method of claim 1, further comprising, after the step of listening for a slot-in event or a slot-out event of a target device:
and when the event of pulling out the slot is monitored, if the event list has the event of inserting the slot, removing the event of inserting the slot so as to complete the event of pulling out the slot.
7. A method according to claim 3, wherein the device information comprises:
device identifier, time of device insertion into slot, statistics of device insertion into slot.
8. A device hot plug event handling apparatus, the apparatus comprising:
the event list acquisition module is used for acquiring an event list and initializing the event list;
the event monitoring module is used for monitoring an inserting slot event or an extracting slot event of the target equipment;
the inserting event processing module is used for adding the inserting event into the event list if the target equipment is not newly added equipment when the inserting event is monitored;
the extraction event processing module is used for unloading the driver corresponding to the target equipment to finish the extraction slot event if the event list does not have the insertion slot event when the extraction slot event is monitored;
the event list processing module is used for detecting the event list according to a preset time interval, and if the event list has the event of inserting the slot and meets a preset condition, adding a driver corresponding to the target device so as to complete the event of inserting the slot.
9. An electronic device comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, which when executed by the processor implements a method of handling device hot plug events according to any of claims 1 to 7.
10. A computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, which when executed by a processor implements the method of handling device hot plug events according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311606258.1A CN117667802A (en) | 2023-11-28 | 2023-11-28 | Method, device, equipment and medium for processing equipment hot plug event |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311606258.1A CN117667802A (en) | 2023-11-28 | 2023-11-28 | Method, device, equipment and medium for processing equipment hot plug event |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117667802A true CN117667802A (en) | 2024-03-08 |
Family
ID=90072595
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311606258.1A Pending CN117667802A (en) | 2023-11-28 | 2023-11-28 | Method, device, equipment and medium for processing equipment hot plug event |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117667802A (en) |
-
2023
- 2023-11-28 CN CN202311606258.1A patent/CN117667802A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109743315B (en) | Behavior identification method, behavior identification device, behavior identification equipment and readable storage medium for website | |
CN110096314B (en) | Interface initialization method, device, equipment and computer readable storage medium | |
CN111209151A (en) | Linux-based NVME SSD hot plug test method, system, terminal and storage medium | |
CN109614045B (en) | Metadata dropping method and device and related equipment | |
EP3373162A1 (en) | Data persistence method and system in stream computing | |
CN115407116A (en) | Method and device for determining charging current | |
CN110399168B (en) | System starting method, device and equipment for multiple data disk storage servers | |
CN103020510B (en) | A kind of method and device of the illegal write identified in movable storage device | |
CN108667515B (en) | Port configuration method and communication equipment | |
CN113177063A (en) | Thermal reset method and related device of PCI bus equipment | |
US10503430B2 (en) | Method and device for clearing data and electronic device | |
CN117648133A (en) | Hot plug management method, device, equipment and machine-readable storage medium | |
CN117667802A (en) | Method, device, equipment and medium for processing equipment hot plug event | |
CN107341255B (en) | Key value data processing method and device and electronic equipment | |
CN113010885B (en) | Method and device for detecting kernel thread disguised with start address | |
CN102841836B (en) | Testing method and programmable processor | |
CN106933578B (en) | USB drive loading method of QNX system | |
CN113765504B (en) | Universal dynamic delay jitter elimination method, device, terminal and storage medium | |
CN102111446B (en) | Device connection handling method, combination equipment and host equipment | |
CN113297149A (en) | Method and device for monitoring data processing request | |
CN113542398A (en) | Control method, device, medium and equipment of distributed cluster system | |
CN109800567B (en) | Method and device for monitoring foreground application starting and terminal equipment | |
CN111371818B (en) | Data request verification method, device and equipment | |
CN108388797B (en) | Intrusion detection method and device and electronic equipment | |
CN112214394A (en) | Memory leak detection method, device and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |