Event notification method and device, equipment, medium and product

By allocating the event configuration area in the base address register space of the storage device, the storage device actively reports interrupt notifications and obtains event information when a target event occurs, solving the problems of untimely event reporting and excessive resource consumption in the prior art, realizing timely event reporting and effective utilization of resources.

CN119847792AActive Publication Date: 2025-04-18SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510344830.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-04-18
Estimated Expiration
2045-03-24

AI Technical Summary

Technical Problem

In the prior art, storage devices may not be able to report events to the host in time when an event occurs, resulting in event loss or excessive resource consumption.

Method used

By allocating the event configuration area in the base address register space of the storage device, the storage device actively reports an interrupt notification when a target event occurs, and reads the target offset from the event configuration area to obtain the latest event information.

Benefits of technology

It realizes timely reporting of events, avoids event loss, reduces resource consumption, and improves system reliability and responsiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847792A_ABST
    Figure CN119847792A_ABST
Patent Text Reader

Abstract

The invention provides an event notification method and device, equipment, a medium and a product, which are applied to the technical field of storage, and the event notification method comprises the following steps: acquiring an interrupt notification reported by storage equipment, the interrupt notification being reported when a target event occurs in the storage equipment, and the storage equipment being based on a nonvolatile memory host controller interface specification; reading a target offset from an event configuration area based on the interrupt notification, the target offset being an offset of a target event record in the event configuration area, the target event record being an event record corresponding to a newly occurring target event, and the target event record being an event record corresponding to the newly occurring target event; the event configuration area is an area allocated in a base address register space of the storage equipment; and reading the target event record based on the target offset to obtain event information corresponding to the latest target event. In this way, events can be reported in time, event loss is avoided, and resource consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage technology, and in particular to an event notification method, device, equipment, medium and product. Background Art

[0002] At present, in the prior art, after the host completes initialization, it will send an AER (Asynchronous Event Request) control command to the NVMe (Non Volatile Memory Express, based on the non-volatile memory host controller interface specification) storage device. After receiving the AER request, the storage device detects whether there is an event to be reported in the event buffer pool. If there is an event to be reported, it will send an AER event message to the host. If there is no event, it will wait for the event to occur before sending the AER message to the host. After receiving the AER message, the host will process it and send the AER request to the storage device again in order to receive the AER message from the storage device again. In this way, the event is not reported to the host in a timely manner, and the event may be lost due to the failure to send the AER request or the insufficient event buffer pool, and the control command queue is occupied, causing resource pressure.

[0003] Therefore, how to ensure timely reporting of events, avoid event loss, and reduce resource consumption is a problem that technical personnel in this field need to solve. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide an event notification method, device, equipment, medium and product, which can ensure timely reporting of events, avoid event loss and reduce resource consumption. The specific scheme is as follows:

[0005] In a first aspect, the present invention provides an event notification method, applied to a host, comprising:

[0006] Obtaining an interrupt notification reported by a storage device, wherein the interrupt notification is reported when a target event occurs in the storage device, and the storage device is based on a non-volatile memory host controller interface specification;

[0007] Reading a target offset from an event configuration area based on the interrupt notification, wherein the target offset is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a latest target event, and the event configuration area is an area allocated in a base address register space of the storage device;

[0008] The target event record is read based on the target offset to obtain event information corresponding to the latest target event.

[0009] In a second aspect, the present invention provides an event notification method, which is applied to a storage device, wherein the storage device is based on a non-volatile memory host controller interface specification, and the method comprises:

[0010] In the event of a target event, adding a target offset to an event configuration area, wherein the target offset recorded in the event configuration area is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a latest target event, and the event configuration area is an area allocated in a base address register space of the storage device;

[0011] An interrupt notification is reported to the host so that the host reads the target event record based on the target offset to obtain event information corresponding to the latest target event.

[0012] In a third aspect, the present invention provides an event notification device, applied to a host, comprising:

[0013] An interrupt notification acquisition module, used to acquire an interrupt notification reported by a storage device, wherein the interrupt notification is reported when a target event occurs in the storage device, and the storage device is based on a non-volatile memory host controller interface specification;

[0014] a target offset reading module, configured to read a target offset from an event configuration area based on the interrupt notification, wherein the target offset is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a latest target event, and the event configuration area is an area allocated in a base address register space of the storage device;

[0015] The event information reading module is used to read the target event record based on the target offset to obtain event information corresponding to the latest target event.

[0016] In a fourth aspect, the present invention provides an event notification device, which is applied to a storage device, wherein the storage device is based on a non-volatile memory host controller interface specification, and comprises:

[0017] A target offset adding module, used for adding a target offset to an event configuration area when a target event occurs, wherein the target offset recorded in the event configuration area is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a target event that has occurred most recently, and the event configuration area is an area allocated in a base address register space of the storage device;

[0018] The interrupt notification reporting module is used to report the interrupt notification to the host so that the host reads the target event record based on the target offset to obtain event information corresponding to the latest target event.

[0019] In a fifth aspect, the present invention provides an electronic device, comprising:

[0020] Memory for storing computer programs;

[0021] A processor is used to execute the computer program to implement the steps of the aforementioned event notification method.

[0022] In a sixth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and the computer program, when executed by a processor, implements the steps of the aforementioned event notification method.

[0023] In a seventh aspect, the present invention discloses a computer program product, including a computer program / instruction, which implements the steps of the aforementioned event notification method when executed by a processor.

[0024] It can be seen from the above scheme that the present invention provides an event notification method, which is applied to a host, including: obtaining an interrupt notification reported by a storage device, wherein the interrupt notification is reported when a target event occurs in the storage device, and the storage device is based on a non-volatile memory host controller interface specification; reading a target offset from an event configuration area based on the interrupt notification, wherein the target offset is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a latest target event, and the event configuration area is an area allocated in a base address register space of the storage device; reading the target event record based on the target offset to obtain event information corresponding to the latest target event.

[0025] It can be seen that the beneficial effects of the present invention are: an area is allocated in the base address register space of a storage device based on the non-volatile memory host controller interface specification as an event configuration area. When a target event occurs in the storage device, the storage device actively reports an interrupt notification to the host, reads the target offset from the event configuration area, and then obtains the event record corresponding to the latest target event to obtain event information. In this way, when an event occurs, the storage device actively reports it through an interrupt, and transmits the event information based on the event configuration area allocated in the base address register space of the storage device. There is no need to wait for requests and occupy queue resources, which can ensure timely reporting of events, avoid event loss and reduce resource consumption.

[0026] Correspondingly, the event notification device, equipment, medium and product provided by the present invention also have the above-mentioned technical effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0028] Figure 1 A flow chart of an event notification method provided by an embodiment of the present invention;

[0029] Figure 2 A flow chart of another event notification method provided by an embodiment of the present invention;

[0030] Figure 3 A schematic diagram of an NVMe storage device AER event notification interaction provided by an embodiment of the present invention;

[0031] Figure 4 A schematic diagram of a host-side processing flow provided for an example of the present invention;

[0032] Figure 5 A storage device end processing flow chart provided for an embodiment of the present invention;

[0033] Figure 6 A schematic diagram of an event configuration area provided by an embodiment of the present invention;

[0034] Figure 7 A flowchart of interaction between a host and a storage device provided by an embodiment of the present invention;

[0035] Figure 8 A schematic diagram of the structure of an event notification device disclosed in an embodiment of the present invention;

[0036] Fig. 9 The present invention is a structural diagram of an electronic device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.

[0039] First, the terms involved in the present invention are explained:

[0040] IO: Input / Output, input and output.

[0041] NVMe: Non Volatile Memory Express, NVMe storage protocol, based on the non-volatile memory host controller interface specification.

[0042] SQ: Submission Queue, NVMe protocol instruction submission queue.

[0043] CQ: Completion Queue, NVMe protocol instruction completion queue.

[0044] ASQ: Admin Submission Queue, controls the instruction submission queue.

[0045] ACQ: Admin Completion Queue, controls the instruction completion queue.

[0046] AER: Asynchronous Event Request, asynchronous event request, initiated by the host.

[0047] AEN: Asynchronous Event Notify, asynchronous event notification, issued by the device.

[0048] BAR: Base Address Register, base address register space, configuration space of NVMe device, host and device can interact through this area, similar to shared memory.

[0049] Doorbell: A register in the BAR space of the NVMe device, used by the host to notify the NVMe device to read the SQE (Submission Queue Entry).

[0050] PCIe: peripheral component interconnect express, high-speed serial computer expansion bus standard.

[0051] MSIX: Message Signaled Interrupts eXtended, message-based PCIe interrupts.

[0052] At present, the communication between the host and the storage device based on the NVMe protocol must be completed through the instruction queue located in the host memory. The host needs to put the instructions executed by the storage device into the SQ queue, and then write the device's SQ Doorbell register to notify the storage device to read the instructions. The controller inside the storage device reads the instructions from the SQ queue in the host memory through the PCIe message, and executes the instructions inside the storage device. Finally, the executed instruction results are placed in the corresponding CQ queue through the PCIe message, and the CQ Doorbell register is updated to complete an IO interaction. The number of NVMe queues supports up to 64K, and the SQ command submission queue and the CQ command completion queue are one-to-one or many-to-one. The NVMe protocol defines two types of instructions, one is control instructions and the other is IO instructions. Control instructions are mainly used to configure storage devices, and IO instructions are mainly used to read and write data in the Flash (i.e. flash memory) media in storage devices. At the same time, two types of queues are also defined, namely control queues and IO queues. Control instructions can only be submitted to control queues, and IO instructions can only be submitted to IO queues. The control queue has only one set of SQ / CQ, and the IO queue can have multiple sets of SQ / CQ. All instructions are sent to the storage device through the PCIe link.

[0053] NVMe instructions interact based on the synchronous method of request and response. Each request command corresponds to a response command. The request command is placed in the submission queue SQ by the host, and the response command is placed in the completion queue CQ by the controller of the storage device. All instructions in the NVMe device are initiated by the host, and the storage device responds to the request. The event reporting AER message of the storage device is also based on this method. The AER message reporting interaction process between the host and the storage device includes: after the host is initialized, it will send an AER request control command to the storage device. After receiving the AER request, the storage device detects whether there is an event to be reported in the event buffer pool. If there is an event to be reported, it sends an AER event message to the host. If there is no event in the storage device event buffer pool, it waits for the event to occur before sending an AER message to the host. After receiving the AER message, the host processes it. After processing the AER message, in order to receive the device's AER message again, the host will send an AER request to the storage device again, and so on.

[0054] The above method has the following problems: when the storage device has an event to report to the host, it first needs to receive an AER request from the host. If the AER request from the host is not received, the device event will be temporarily stored in the device's event buffer pool. This results in the device event not being reported to the host in a timely manner. Since the storage device reports the AER message to the host using the ACQ queue of the control command, if there are too many control command completion instructions in the ACQ queue, the host will not process the AER message in a timely manner. In order to receive the AER messages reported by all devices, the host needs to send a request command for each AER message. The command has no parameters. This operation will occupy the queue of the control command and consume PCIe link resources and device controller resources under high IO throughput. If the host does not send an AER request, the storage device will never report the AER event to the host. If the host does not send an AER request for a long time, or the storage device generates too many events for a period of time, exceeding the threshold of the device event buffer pool, there may be a risk of losing important events. It takes 5 interactions with the device to obtain an event, which consumes a total of 92 bytes, but in fact, there is less valid data, which wastes the link bandwidth.

[0055] To this end, the present invention provides an event notification method, which can ensure timely reporting of events, avoid event loss and reduce resource consumption.

[0056] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0057] Next, an event notification method provided by an embodiment of the present invention is described in detail. Figure 1 A flow chart of an event notification method provided by an embodiment of the present invention, the event notification method comprising:

[0058] Step S11: obtaining an interrupt notification reported by a storage device, wherein the interrupt notification is reported when a target event occurs in the storage device, and the storage device is based on a non-volatile memory host controller interface specification.

[0059] The target event is an AER event, an event corresponding to an asynchronous event request. In the embodiment of the present invention, the host does not need to send an AER request, and the storage device actively reports an interrupt notification when the target event occurs. The target event is an event of a preset type, which may include a hard disk error event, a hard disk health event, a hard disk notification event, and a storage block specific event, that is, the event type may be a hard disk error event, a hard disk health event, a hard disk notification event, and a storage block specific event.

[0060] In an optional implementation manner, when any target event occurs, the storage device may report an interrupt notification.

[0061] Step S12: Read the target offset from the event configuration area based on the interrupt notification, wherein the target offset is the offset of the target event record in the event configuration area, the target event record is the event record corresponding to the most recently occurred target event, and the event configuration area is an area allocated in the base address register space of the storage device.

[0062] Among them, the event configuration area is an area allocated in the base address register space of the storage device for transmitting event information. The embodiment of the present invention selects a fixed offset address in the base address register space of the storage device, and starts with the fixed offset address to allocate a certain area as the event configuration area. The event configuration area may include event records corresponding to each event type. Different event types correspond to different event records. In this way, each event record has its own corresponding offset, and event information of different event types can be stored in different sub-areas in the event configuration area.

[0063] In addition, the event configuration area also saves the target offset, that is, sets the corresponding position to save the target offset, that is, saves the offset address of the target event record in the event configuration area, and the target event record can be located through the target offset and the fixed offset address. Every time a target event occurs, the target offset in the event configuration area is modified to the offset corresponding to the target event, so that the target offset in the event configuration area remains the offset of the event record corresponding to the latest target event.

[0064] Step S13: Read the target event record based on the target offset to obtain event information corresponding to the latest target event.

[0065] In an optional implementation, the number of event statistics in the target event record can be read based on the target offset to obtain a first number of event statistics; if the first number of event statistics is greater than the second number of event statistics, it is determined that a target event of the event type corresponding to the target event record has occurred, and event information is read from the target event record to obtain event information corresponding to the latest target event; wherein the second number of event statistics is the number of event statistics of the event type corresponding to the target event record recorded by the host at a first storage location, and the first storage location is a storage location outside the event configuration area.

[0066] In the embodiment of the present invention, any event record may include event statistics and event information. When a target event occurs, the storage device adds 1 to the event statistics in the event record of the corresponding event type, and updates the target offset to the offset of the event record. The initial values ​​of the first event statistics and the second event statistics are 0.

[0067] In addition, the host also records the event statistics to compare with the time statistics in the event record in the event storage area to determine whether a new target event has occurred. In the case of a new target event, the time information in the record is read. The first storage location can be an area that stores the event statistics of each event type. After the host obtains the event information of the event record each time, it can update the event statistics in the event record to the first storage location.

[0068] In an optional implementation, the event information is the information required to determine the cause of the event, and may include the event type of the target event, event description information, and event log identifier. The event description information may be a description of the target event, or may be an event subdivision type, and the event log identifier is an identifier of the log of the target event, which can locate the log of the target event.

[0069] Among them, the event description information of the hard disk error event may include the host write storage device register error, the host write storage device register value error, the diagnostic error, the internal permanent error, the internal temporary error and the firmware load error; the event description information of the hard disk health event may include the storage block reliability event, the temperature exceeds the threshold event and the capacity is lower than the threshold event; the event description information of the hard disk notification event may include the ns (namespace) attribute change notification, the hard disk firmware upgrade notification, the hard disk log notification and the asymmetric access notification; the event description information of the storage block specific event may include the storage block clear operation completion event and the scheduled log notification event.

[0070] Furthermore, different event types correspond to different event log identifiers. For example, the event log identifier of a hard disk error event can be 0x1; the event description information of a hard disk health event can be 0x2; the event log identifier of an ns attribute change notification can be 0x4, the event log identifier of a hard disk firmware upgrade notification can be 0x3, the event log identifier of a hard disk log notification can be 0x7, the event log identifier of an asymmetric access notification can be 0xc, the event log identifier of a storage block clear operation completion event can be 0x81, and the event log identifier of a scheduled log notification event can be 0x80.

[0071] In an optional implementation, after reading the target event record based on the target offset to obtain the event information corresponding to the latest target event, the method further includes: searching for the event log corresponding to the latest target event based on the event log identifier in the event information corresponding to the latest target event; and determining the cause of the event based on the event type, event description information, and the event log. In an embodiment of the present invention, the cause of the event can be perceived through the event type, event description information, and event log.

[0072] In an optional implementation, it is determined based on the event configuration area whether there are any unprocessed target events occurring on the storage device; if there are any unprocessed target events occurring on the storage device, the event record of the target event is read to obtain event information of the target event.

[0073] The target event that has not been processed and occurred in the storage device is an event whose event information has not been read and the cause of the event has not been located.

[0074] In an optional implementation, the total number of event statistics in the event configuration area can be read to obtain a first total number of event statistics, wherein the total number of event statistics is the total number of event statistics of target events of each event type; if the first total number of event statistics is greater than the second total number of event statistics, and the difference between the first total number of event statistics and the second total number of event statistics is greater than or equal to 2, it is determined that there are still unprocessed target events occurring in the storage device; wherein the second total number of event statistics is the total number of event statistics of target events of each event type recorded by the host in a second storage location, and the second storage location is a storage location outside the event configuration area.

[0075] Furthermore, if there are still unprocessed target events occurring in the storage device, the event statistical quantities of the event records of each event type in the event configuration area are traversed and compared with the event statistical quantities corresponding to each event type in the first storage location, and the event records with inconsistent event statistical quantities are read to obtain the event information in the event records.

[0076] That is, the event configuration area also records the total number of event statistics, the initial value of which is 0. When a target event occurs, the total number of event statistics in the event configuration area is increased by 1. After reading the event information of any event record, the host can update the second total number of event statistics according to the event statistics of the event record.

[0077] It should be pointed out that if an event is not reported as an interrupt due to a switch or other reasons, the event configuration area will also be modified. The host can handle each event through the information in the event configuration area to avoid missing events.

[0078] In an optional implementation, after the storage device initializes the event configuration area, the event configuration area is mapped from the base address register space of the storage device to the memory space of the host.

[0079] In this way, by mapping the base address register space to the host's memory space, the base address register space can be accessed through memory read and write, and event information can be read through memory read, which can improve the efficiency of event information transmission.

[0080] Among them, initialization can include filling in the event information in each event record based on the event type supported by the storage device itself, that is, adding the event type, event description information and event log identifier to the corresponding position in each event record. In addition, the event configuration area also records the number of event types supported by the storage device itself. During the initialization phase, the storage device adds the number of event types supported by itself to the event configuration area. In addition, in an optional implementation, the event configuration area also includes an event reporting master switch, and each event record has an event reporting switch, which is initialized to a closed state during the storage device initialization phase.

[0081] Furthermore, the embodiment of the present invention can also obtain the fixed offset address of the event configuration area in the base address register space of the storage device. Accordingly, reading the target event record based on the target offset can include: reading the target event record based on the fixed offset address and the target offset. That is, the fixed offset address plus the target offset is the position of the target event record.

[0082] In an optional implementation, the event reporting master switch in the event configuration area may be turned on, so that when a target event occurs and the storage device detects that the event reporting master switch is turned on, it reports an interrupt notification to the host.

[0083] That is, the event configuration area may include an event reporting master switch, which is used to control whether to report a host interrupt notification when a target event of all event types occurs. When the event reporting master switch is a first preset value, it can represent a closed state, and when the event reporting master switch is a second preset value, it can represent an open state. After an event occurs, the storage device checks the event reporting master switch in the event configuration area, and reports an interrupt notification to the host when the event reporting master switch is in the open state.

[0084] In an optional implementation, the event reporting switch in one or more event records in the event configuration area can be turned on as needed, so that when a target event occurs and the storage device detects that the event reporting main switch and the event reporting switch corresponding to the target event are turned on, it reports the interrupt notification corresponding to the target event to the host.

[0085] That is, each event record in the event configuration area may also include an event reporting switch, which is used to control whether to report a host interrupt notification when a target event of the event type corresponding to the event record occurs. When the event reporting switch is a first preset value, it can represent a closed state, and when the event reporting switch is a second preset value, it can represent an open state. After an event occurs, the storage device checks the event reporting master switch in the event configuration area, and when the event reporting master switch is in the open state, checks the event reporting switch in the corresponding event record, and when the event reporting switch in the corresponding event record is turned on, reports an interrupt notification to the host. For example, the first preset value is 1, and the second preset value is 0.

[0086] In an optional implementation, the event reporting switch in one or more event records in the event configuration area can be turned on as needed, including: obtaining the number of event types supported by the storage device from the event configuration area; based on the fixed offset address, the number of event types, and the address range occupied by each event record, turning on the event reporting switch in one or more event records in the event configuration area as needed.

[0087] Among them, the address range occupied by each event record, that is, the size of the space occupied, the size of the space corresponding to each event record can be consistent. The host can locate the space corresponding to the event record according to the number of event types supported by the storage device, the fixed offset address of the event configuration area, and the address range occupied by each event record, and then turn on the event reporting switch in one or more event records in the event configuration area as needed.

[0088] In an optional implementation, after mapping the event configuration area from the base address register space of the storage device to the memory space of the host, the event configuration area can be read to obtain event information in the target event record based on the target offset, and event information of other event records can be obtained based on the total number of event statistics and the number of event statistics in each event record, wherein the event configuration area is modified by the storage device based on the occurrence of an event after the storage device initializes the event configuration area, and after the host maps the base address register space, event information of events occurring during the initialization phase is obtained.

[0089] In this way, after the device is initialized, the host can immediately know whether the device is a target event after mapping the base address register space, so that the internal state of the storage device can be understood more quickly and respond in time.

[0090] It can be seen that the embodiment of the present invention allocates an area in the base address register space of the storage device based on the non-volatile memory host controller interface specification as an event configuration area. When a target event occurs in the storage device, it actively reports an interrupt notification to the host, reads the target offset from the event configuration area, and then obtains the event record corresponding to the latest target event to obtain event information. In this way, when an event occurs, the storage device actively reports it through an interrupt, and transmits the event information based on the event configuration area allocated in the base address register space of the storage device. There is no need to wait for requests and occupy queue resources, which can ensure timely reporting of events, avoid event loss and reduce resource consumption.

[0091] For further information, see Figure 2 As shown, an embodiment of the present invention discloses an event notification method, which is applied to a storage device, wherein the storage device is based on a non-volatile memory host controller interface specification, and the method includes:

[0092] Step S21: when a target event occurs, adding a target offset to an event configuration area, wherein the target offset recorded in the event configuration area is the offset of the target event record in the event configuration area, the target event record is the event record corresponding to the latest target event, and the event configuration area is an area allocated in the base address register space of the storage device;

[0093] Step S22: reporting an interrupt notification to the host so that the host reads the target event record based on the target offset to obtain event information corresponding to the latest target event.

[0094] In an optional implementation, before reporting an interrupt notification to the host, the event statistics number in the target event record is increased by one so that the host reads the event statistics number in the target event record based on the target offset to obtain a first event statistics number; when the first event statistics number is greater than the second event statistics number, it is determined that a target event of the event type corresponding to the target event record has occurred, and event information is read from the target event record to obtain event information corresponding to the latest target event; wherein the second event statistics number is the event statistics number of the event type corresponding to the target event record recorded by the host at a first storage location, and the first storage location is a storage location outside the event configuration area.

[0095] The above event notification method applied to the storage device can be referenced with the above embodiments.

[0096] It can be seen that the embodiment of the present invention allocates an area in the base address register space of the storage device based on the non-volatile memory host controller interface specification as an event configuration area. When a target event occurs in the storage device, it actively reports an interrupt notification to the host, reads the target offset from the event configuration area, and then obtains the event record corresponding to the latest target event to obtain event information. In this way, when an event occurs, the storage device actively reports it through an interrupt, and transmits the event information based on the event configuration area allocated in the base address register space of the storage device. There is no need to wait for requests and occupy queue resources, which can ensure timely reporting of events, avoid event loss and reduce resource consumption.

[0097] For further information, see Figure 3 As shown, Figure 3 A schematic diagram of an NVMe storage device AER event notification interaction provided by an embodiment of the present invention, wherein the controller is a storage device controller, and does not occupy the control command submission queue, control command completion queue, IO command submission queue, and IO completion queue of the data plane and the control plane. The AER event originates from the inside of the storage device, and is actively sent to the host in real time through an interruption in the embodiment of the present invention. The storage device uses the register of the NVMe Bar space to report the event to the host. When an event occurs in the storage device, the event configuration area is modified, and the host is notified of the event through an interruption. The host will immediately perceive that an event has occurred in the device through an interruption, and obtain the event information by directly reading the Bar space, i.e., the event configuration area. Because this method of using the NVMe Bar space register has a higher priority than the processing of the SQ queue, and the operation method is simple and direct, the host will process the event of the storage device as soon as possible, preventing the loss caused by the failure to process the AER message in time, improving the system reliability and responsiveness, avoiding the consumption of the control command queue, PCIe link, and storage device controller resources by the host sending the AER request, and reducing unnecessary message interactions on the PCIe link, reducing the complexity of the host and storage device controller implementation. There are only two interactions in event reporting, and only 4 bytes of data are accessed each time.

[0098] For further information, see Figure 4 As shown, Figure 4 A schematic diagram of a host-side processing flow provided by an example of the present invention. It may include host initialization, mapping base address register space, reading event configuration area, turning on event reporting switch, including event reporting master switch and event reporting switch in corresponding event record; waiting for event reporting. Figure 5 As shown, Figure 5A storage device end processing flow chart provided for an embodiment of the present invention. It may include device initialization; turning off the event reporting switch, including the event reporting master switch and the event reporting switch in each event record; setting event information, the embodiment of the present invention uses the event information as an event identifier, and the event information includes the event type, event description information, and event log identifier; clearing event statistical data, including the event statistical quantity and the total event statistical quantity.

[0099] Among them, the host maps the register address space of NVMe Bar (i.e. base address register space) to the host's memory space during the initialization phase, so that the NVMe Bar space can be accessed through memory read and write. The host reads the fixed offset address of the NVMe Bar register address space during the initialization phase. Here is the NVMe AER event configuration area. Its layout in memory can be found in Figure 6 As shown, Figure 6 A schematic diagram of an event configuration area provided for an embodiment of the present invention, wherein the support number (support num) indicates how many types of AER events the storage device supports, i.e., the number of event types supported by the aforementioned storage device, the total number of event statistics (total aer num) indicates how many AER events the storage device has generated in total, the event reporting total switch (top mask) indicates the total switch for AER event reporting, and the target offset (last aer offset, i.e., the most recent event offset) indicates the offset of the latest AER event in the AER event configuration area. Each event type of AER event is controlled by an AER entry (event record). During the initialization phase, the host sets the top mask of the AER event configuration area in the NVMe Bar space to 0, indicating that the total switch for AER event reporting is turned on. During the initialization phase, the host obtains how many types of AER events the device supports in total according to the support num in the AER event configuration area, and sets the mask (event reporting switch) of different types of AER events to 0 in turn, indicating that the corresponding AER event notification is turned on.

[0100] When the NVMe storage device is initialized, it is necessary to initialize the support num to the total number of AER events supported by it, and initialize the top mask and the mask of all AER entries (event reporting switch, represented by m in the figure) to 1, indicating that the AER event is not reported. At the same time, fill in all supported AER id (i.e. event identifier, event information is used as event identifier in the present invention) fields. When an event occurs in the storage device, the device finds the entry (event record) of the AER in the AER event configuration area according to the id of the AER event, and adds one to the event statistics field. The storage device checks whether the mask in the top mask and the entry of the AER event is 0 at the same time. If both are 0, it means that the host has turned on the interrupt notification function. At this time, the storage device notifies the host through the MSIX interrupt. The host receives the interrupt, reads the target offset of the event from the last aer offset in the AER event configuration area, and then reads the corresponding event record through the target offset, and perceives the cause of the event through the event information.

[0101] That is, the present invention adds an AER event configuration area for the storage device in the NVMe Bar space. The NVMe storage device controller needs to configure the initial value to the AER event configuration area during initialization, and the host turns on or off the AER event reporting as needed during initialization. Avoid the cumbersome request / response mechanism of the AER event reporting mechanism, overcome the shortcomings of the AER event reporting mechanism that is not reported in a timely manner and has the potential for lost events. At the same time, the present invention will also improve the utilization rate of the PCIe link, especially in high IO throughput scenarios.

[0102] For further information, see Figure 7 As shown, an embodiment of the present invention provides an interaction flow chart of a host and a storage device. The storage device initializes the event configuration area, the host maps the base address register space, reads the event configuration area, turns on the event reporting switch, and when the storage device generates an event, an interrupt is reported. The host device receives the interrupt, reads the event configuration area and processes it. Both interrupt reporting and reading the event configuration area involve access to 4 bytes.

[0103] In this way, an AER event configuration area is created for the NVMe storage device in the NVMe Bar memory, and the memory mapping method is used to interact with the device, with a priority higher than all SQ / CQ queues. When the storage device has an event to report, it interacts with the host through the AER event configuration area, reducing the event interaction process and link load, improving the timeliness of NVMe storage device event reporting and system reliability, and significantly improving efficiency. It reduces the consumption of PCIe links by NVMe storage devices. This method consumes only 8 bytes of links, reducing the occupation of ASQ control command queue resources and controller resources by NVMe storage devices. The host can use interrupts or polling to handle AER events, which greatly broadens the business scenarios on the host.

[0104] See also Figure 8 As shown, an embodiment of the present invention provides an event notification device, which is applied to a host and includes:

[0105] An interrupt notification acquisition module 81, used for acquiring an interrupt notification reported by a storage device, wherein the interrupt notification is reported when a target event occurs in the storage device, and the storage device is based on a non-volatile memory host controller interface specification;

[0106] A target offset reading module 82, configured to read a target offset from an event configuration area based on the interrupt notification, wherein the target offset is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a latest target event, and the event configuration area is an area allocated in a base address register space of the storage device;

[0107] The event information reading module 83 is used to read the target event record based on the target offset to obtain event information corresponding to the latest target event.

[0108] In an optional implementation, the event information reading module 83 includes:

[0109] Reading a statistical number of events in the target event record based on the target offset to obtain a first statistical number of events;

[0110] If the first event statistical number is greater than the second event statistical number, determining that a target event of the event type corresponding to the target event record has occurred, reading event information from the target event record, and obtaining event information corresponding to the latest target event;

[0111] The second event statistics are the event statistics of the event type corresponding to the target event record recorded by the host in the first storage location, and the first storage location is a storage location outside the event configuration area.

[0112] In an optional embodiment, the device further comprises:

[0113] The unprocessed event determination module is used to read the target event record based on the target offset, obtain event information corresponding to the latest target event, and then determine whether there are any unprocessed target events occurring in the storage device based on the event configuration area.

[0114] The event processing module is used to read the event record of the target event if there is still an unprocessed target event occurring in the storage device, and obtain the event information of the target event.

[0115] The event unprocessed judgment module is specifically used to read the total number of event statistics in the event configuration area to obtain the first total number of event statistics, wherein the total number of event statistics is the total number of event statistics of target events of each event type;

[0116] If the total number of the first event statistics is greater than the total number of the second event statistics, and the difference between the total number of the first event statistics and the total number of the second event statistics is greater than or equal to 2, it is determined that there are still unprocessed target events occurring on the storage device;

[0117] The second total event statistics is the total number of event statistics of target events of each event type recorded by the host in the second storage location, and the second storage location is a storage location outside the event configuration area.

[0118] Correspondingly, the event processing module is specifically used to traverse the event statistical quantity of the event records of each event type in the event configuration area, compare them with the event statistical quantity corresponding to each event type in the first storage location, read the event records with inconsistent event statistical quantities, and obtain the event information in the event records if there are still unprocessed target events occurring in the storage device.

[0119] In an optional implementation, the event information includes the event type of the target event, event description information, and an event log identifier.

[0120] Furthermore, the device also includes:

[0121] An event log search module, configured to read the target event record based on the target offset to obtain event information corresponding to the latest target event, and then search for an event log corresponding to the latest target event based on an event log identifier in the event information corresponding to the latest target event;

[0122] The event cause determination module is used to determine the event cause based on the event type, event description information and the event log.

[0123] Furthermore, the apparatus further comprises an address mapping module, which is used to map the event configuration area from the base address register space of the storage device to the memory space of the host after the storage device initializes the event configuration area.

[0124] Furthermore, the device further comprises a fixed offset address acquisition module for acquiring the fixed offset address of the event configuration area in the base address register space of the storage device. Correspondingly, the event information reading module 83 is used to read the target event record based on the fixed offset address and the target offset.

[0125] In an optional embodiment, the device further comprises:

[0126] The event reporting master switch activation module is used to activate the event reporting master switch in the event configuration area, so that when a target event occurs and the storage device detects that the event reporting master switch is activated, it reports an interrupt notification to the host.

[0127] In an optional embodiment, the device further comprises:

[0128] An event reporting switch enabling module is used to enable the event reporting switch in one or more event records in the event configuration area as required, so that when a target event occurs and the storage device detects that the event reporting main switch and the event reporting switch corresponding to the target event are turned on, it reports the interrupt notification corresponding to the target event to the host.

[0129] In an optional implementation manner, the event reporting switch enabling module may be specifically used for:

[0130] Acquire the number of event types supported by the storage device from the event configuration area;

[0131] Based on the fixed offset address, the number of event types and the address range occupied by each event record, the event reporting switch in one or more event records in the event configuration area is turned on as required.

[0132] It can be seen that the embodiment of the present invention allocates an area in the base address register space of the storage device based on the non-volatile memory host controller interface specification as an event configuration area. When a target event occurs in the storage device, it actively reports an interrupt notification to the host, reads the target offset from the event configuration area, and then obtains the event record corresponding to the latest target event to obtain event information. In this way, when an event occurs, the storage device actively reports it through an interrupt, and transmits the event information based on the event configuration area allocated in the base address register space of the storage device. There is no need to wait for requests and occupy queue resources, which can ensure timely reporting of events, avoid event loss and reduce resource consumption.

[0133] Figure 8 The description of the features in the corresponding embodiments can be found in Figure 1 The relevant descriptions of the corresponding embodiments will not be repeated here one by one.

[0134] Furthermore, an embodiment of the present invention discloses an event notification device, which is applied to a storage device, wherein the storage device is based on a non-volatile memory host controller interface specification, and the method includes:

[0135] A target offset adding module, used for adding a target offset to an event configuration area when a target event occurs, wherein the target offset recorded in the event configuration area is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a target event that has occurred most recently, and the event configuration area is an area allocated in a base address register space of the storage device;

[0136] The interrupt notification reporting module is used to report the interrupt notification to the host so that the host reads the target event record based on the target offset to obtain event information corresponding to the latest target event.

[0137] It can be seen that the embodiment of the present invention allocates an area in the base address register space of the storage device based on the non-volatile memory host controller interface specification as an event configuration area. When a target event occurs in the storage device, it actively reports an interrupt notification to the host, reads the target offset from the event configuration area, and then obtains the event record corresponding to the latest target event to obtain event information. In this way, when an event occurs, the storage device actively reports it through an interrupt, and transmits the event information based on the event configuration area allocated in the base address register space of the storage device. There is no need to wait for requests and occupy queue resources, which can ensure timely reporting of events, avoid event loss and reduce resource consumption.

[0138] Fig. 9 A structural diagram of an electronic device provided by an embodiment of the present invention, such as Fig. 9 As shown, the electronic device includes: a memory 90 for storing a computer program;

[0139] The processor 91 is used to implement the steps of the event notification method in the above embodiment when executing a computer program.

[0140] Among them, the processor 91 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 91 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 91 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 91 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 91 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0141] The memory 90 may include one or more computer-readable storage media, which may be non-transitory. The memory 90 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 90 is at least used to store the following computer program 901, wherein, after the computer program is loaded and executed by the processor 91, it can implement the relevant steps of the event notification method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 90 may also include an operating system 902 and data 903, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 902 may include Windows, Unix, Linux, etc. Data 903 may include but is not limited to event data, etc.

[0142] In some embodiments, the electronic device may further include a display screen 92 , an input / output interface 93 , a communication interface 94 , a power supply 95 , and a communication bus 96 .

[0143] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure.

[0144] It is understandable that if the event notification method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the current technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk or optical disk and other media that can store program codes.

[0145] Based on this, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above event notification method are implemented.

[0146] A computer program product provided by an embodiment of the present invention is introduced below. The computer program product described below can be referenced to other embodiments described in this document.

[0147] A computer program product comprises a computer program / instruction, which implements the steps of the aforementioned disclosed event notification method when executed by a processor.

[0148] The above is a detailed introduction to the event notification method, device, equipment, medium and product provided in the embodiments of the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0149] 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 composition and steps of each example have been generally described in the above description according to function. 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 to be beyond the scope of the present invention.

[0150] The event notification method, device, equipment, medium and product provided by the present invention are introduced in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.

Claims

1. An event notification method, characterized in that: Applied to the host, including: Obtaining an interrupt notification reported by a storage device, wherein the interrupt notification is reported when a target event occurs in the storage device, and the storage device is based on a non-volatile memory host controller interface specification; Reading a target offset from an event configuration area based on the interrupt notification, wherein the target offset is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a latest target event, and the event configuration area is an area allocated in a base address register space of the storage device; The target event record is read based on the target offset to obtain event information corresponding to the latest target event.

2. The event notification method according to claim 1, characterized in that: Reading the target event record based on the target offset to obtain event information corresponding to the latest target event, including: Reading a statistical number of events in the target event record based on the target offset to obtain a first statistical number of events; If the first event statistical number is greater than the second event statistical number, determining that a target event of the event type corresponding to the target event record has occurred, reading event information from the target event record, and obtaining event information corresponding to the latest target event; The second event statistics are the event statistics of the event type corresponding to the target event record recorded by the host in the first storage location, and the first storage location is a storage location outside the event configuration area.

3. The event notification method according to claim 2, characterized in that: After reading the target event record based on the target offset to obtain event information corresponding to the latest target event, the method further includes: Determining whether there are any unprocessed target events occurring in the storage device based on the event configuration area; If there is still an unprocessed target event occurring in the storage device, the event record of the target event is read to obtain event information of the target event.

4. The event notification method according to claim 3, characterized in that: Determining whether there is any unprocessed target event occurring on the storage device based on the event configuration area includes: Reading the total number of event statistics in the event configuration area to obtain a first total number of event statistics, wherein the total number of event statistics is the total number of event statistics of target events of each event type; If the total number of the first event statistics is greater than the total number of the second event statistics, and the difference between the total number of the first event statistics and the total number of the second event statistics is greater than or equal to 2, it is determined that there are still unprocessed target events occurring on the storage device; The second total event statistics is the total number of event statistics of target events of each event type recorded by the host in the second storage location, and the second storage location is a storage location outside the event configuration area.

5. The event notification method according to claim 4, characterized in that: If there is still an unprocessed target event occurring in the storage device, then the event record of the target event is read to obtain event information of the target event, including: If there are still unprocessed target events occurring in the storage device, the event statistical quantities of the event records of each event type in the event configuration area are traversed, and compared with the event statistical quantities corresponding to each event type in the first storage location, and the event records with inconsistent event statistical quantities are read to obtain the event information in the event records.

6. The event notification method according to claim 1, characterized in that: The event information includes the event type of the target event, event description information, and event log identifier.

7. The event notification method according to claim 6, characterized in that: After reading the target event record based on the target offset to obtain event information corresponding to the latest target event, the method further includes: Find the event log corresponding to the latest target event based on the event log identifier in the event information corresponding to the latest target event; The cause of the event is determined based on the event type, event description information and the event log.

8. The event notification method according to claim 1, characterized in that: Also includes: After the storage device initializes the event configuration area, the event configuration area is mapped from the base address register space of the storage device to the memory space of the host.

9. The event notification method according to claim 8, characterized in that: Also includes: Obtain a fixed offset address of the event configuration area in the base address register space of the storage device.

10. The event notification method according to claim 9, characterized in that: Reading the target event record based on the target offset includes: The target event record is read based on the fixed offset address and the target offset.

11. The event notification method according to claim 9, characterized in that: Also includes: The event reporting master switch in the event configuration area is turned on, so that when a target event occurs and the storage device detects that the event reporting master switch is turned on, it reports an interrupt notification to the host.

12. The event notification method according to claim 11, characterized in that: Also includes: Turn on the event reporting switch in one or more event records in the event configuration area as required, so that when a target event occurs and the storage device detects that the event reporting main switch and the event reporting switch corresponding to the target event are turned on, it reports the interrupt notification corresponding to the target event to the host.

13. The event notification method according to claim 12, characterized in that: Turning on the event reporting switch in one or more event records in the event configuration area as required includes: Acquire the number of event types supported by the storage device from the event configuration area; Based on the fixed offset address, the number of event types and the address range occupied by each event record, the event reporting switch in one or more event records in the event configuration area is turned on as required.

14. An event notification method, characterized in that: Applied to a storage device, the storage device is based on a non-volatile memory host controller interface specification, the method comprising: In the event of a target event, adding a target offset to an event configuration area, wherein the target offset recorded in the event configuration area is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a latest target event, and the event configuration area is an area allocated in a base address register space of the storage device; An interrupt notification is reported to the host so that the host reads the target event record based on the target offset to obtain event information corresponding to the latest target event.

15. The event notification method according to claim 14, characterized in that: Also includes: Before reporting the interrupt notification to the host, the event statistics in the target event record are incremented by one, so that the host reads the event statistics in the target event record based on the target offset to obtain a first event statistics, and when the first event statistics is greater than the second event statistics, it is determined that a target event of the event type corresponding to the target event record has occurred, and event information is read from the target event record to obtain event information corresponding to the latest target event; The second event statistics are the event statistics of the event type corresponding to the target event record recorded by the host in the first storage location, and the first storage location is a storage location outside the event configuration area.

16. An event notification device, characterized in that: Applied to the host, including: An interrupt notification acquisition module, used to acquire an interrupt notification reported by a storage device, wherein the interrupt notification is reported when a target event occurs in the storage device, and the storage device is based on a non-volatile memory host controller interface specification; a target offset reading module, configured to read a target offset from an event configuration area based on the interrupt notification, wherein the target offset is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a latest target event, and the event configuration area is an area allocated in a base address register space of the storage device; The event information reading module is used to read the target event record based on the target offset to obtain event information corresponding to the latest target event.

17. An event notification device, characterized in that: Applied to a storage device, the storage device is based on a non-volatile memory host controller interface specification, including: A target offset adding module, used for adding a target offset to an event configuration area when a target event occurs, wherein the target offset recorded in the event configuration area is an offset of a target event record in the event configuration area, the target event record is an event record corresponding to a target event that has occurred most recently, and the event configuration area is an area allocated in a base address register space of the storage device; The interrupt notification reporting module is used to report the interrupt notification to the host so that the host reads the target event record based on the target offset to obtain event information corresponding to the latest target event.

18. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the event notification method according to any one of claims 1 to 15.

19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the event notification method according to any one of claims 1 to 15 are implemented.

20. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the event notification method according to any one of claims 1 to 15 are implemented.

Citation Information

Patent Citations

  • Storage device and an element management method of the storage device

    CN109840232A

  • Interrupt processing method and device, electronic equipment and computer readable storage medium

    CN114546911A

  • Node abnormal event processing method, network card and storage cluster

    CN118118321A

  • Message order-preserving transmission method, chip and electronic equipment

    CN118316888A

  • Disk access method and device, electronic equipment and storage medium

    CN118778910A