CN111240879B - SAS card firmware log collection method, system, device and storage medium - Google Patents
SAS card firmware log collection method, system, device and storage medium Download PDFInfo
- Publication number
- CN111240879B CN111240879B CN202010026621.2A CN202010026621A CN111240879B CN 111240879 B CN111240879 B CN 111240879B CN 202010026621 A CN202010026621 A CN 202010026621A CN 111240879 B CN111240879 B CN 111240879B
- Authority
- CN
- China
- Prior art keywords
- circular buffer
- memory
- sas card
- host
- card firmware
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0766—Error or fault reporting or storing
- G06F11/0787—Storage of error reports, e.g. persistent data storage, storage using memory protection
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
Description
技术领域technical field
本发明涉及计算机领域,特别涉及一种SAS卡固件日志收集方法、系统、装置及计算机可读存储介质。The invention relates to the field of computers, in particular to a method, system, device and computer-readable storage medium for collecting SAS card firmware logs.
背景技术Background technique
与硬盘和主机操作系统有较大的空间存自己内部的硬盘日志和系统日志不同,SAS卡(磁盘阵列卡)作为一种PCIE卡,由于嵌入式系统和硬件本身设计的局限,硬件内部存储日志的空间非常小。目前SAS卡利用卡内部的缓冲区来记录固件运行日志,缓冲区空间很小,一般只有KB到十几KB级别。Unlike the hard disk and the host operating system that have a large space to store their internal hard disk logs and system logs, the SAS card (disk array card) is a PCIE card. Due to the limitations of the embedded system and hardware design, the internal storage of logs The space is very small. At present, the SAS card uses the internal buffer of the card to record the firmware operation log, and the buffer space is very small, generally only at the level of KB to more than a dozen KB.
因此,目前SAS卡内部缓冲区采取循环记录固件日志的方式,这样缓冲区日志记录满后,由于日志存储空间太小很快会覆盖发生故障时的日志,如果抓取不及时,发生故障时的日志很容易被冲掉导致无法定位,无法分析故障,定位难度大,致使故障解决周期无限期拉长,导致用户体验降低。Therefore, at present, the internal buffer of the SAS card adopts the method of circularly recording the firmware log. After the buffer log is full, the log when the fault occurs will be overwritten soon because the log storage space is too small. If the capture is not timely, the log when the fault occurs Logs are easily flushed out, making it impossible to locate and analyze faults, making it difficult to locate faults, which prolongs the fault resolution cycle indefinitely and degrades user experience.
同时,目前抓取SAS卡缓冲区中的日志,只能通过SAS卡上的UART口用串口线连接笔记本电脑等终端设备导出,生产环境不具备可操作行性,没有能够及时抓取故障日志的前提条件。At the same time, at present, the logs in the SAS card buffer can only be captured through the UART port on the SAS card and exported to terminal devices such as laptops with serial cables. The production environment is not feasible, and there is no system that can capture fault logs in time. prerequisites.
为此,需要一种能够有效获取SAS卡固件日志的方法。For this reason, a method that can effectively obtain the firmware log of the SAS card is needed.
发明内容Contents of the invention
有鉴于此,本发明的目的在于提供一种SAS卡固件日志收集方法、系统、装置及计算机可读存储介质,能够便捷获取故障时的日志,提高SAS卡的维护效率,间接提高SAS卡的可靠性。其具体方案如下:In view of this, the object of the present invention is to provide a SAS card firmware log collection method, system, device and computer-readable storage medium, which can easily obtain the log when the failure occurs, improve the maintenance efficiency of the SAS card, and indirectly improve the reliability of the SAS card. sex. The specific plan is as follows:
一种SAS卡固件日志收集方法,包括:A kind of SAS card firmware log collection method, comprising:
发送内存申请请求至主机,得到所述主机的内存中的主机内存循环缓冲区;Sending a memory application request to the host to obtain a host memory circular buffer in the memory of the host;
生成并存储SAS卡的SAS卡固件日志至本地的循环缓冲区;Generate and store the SAS card firmware log of the SAS card to the local circular buffer;
判断所述循环缓冲区的剩余存储空间是否满足预设的第一存储阈值;judging whether the remaining storage space of the circular buffer meets a preset first storage threshold;
若是,则将所述循环缓冲区内的SAS卡固件日志全部转移到所述主机内存循环缓冲区中存储;If so, the SAS card firmware logs in the circular buffer are all transferred to the host memory circular buffer for storage;
其中,所述主机内存循环缓冲区为存储空间大于等于所述循环缓冲区,用于存储SAS卡固件日志的内存空间。Wherein, the host memory circular buffer is a memory space whose storage space is greater than or equal to the circular buffer and is used for storing SAS card firmware logs.
可选的,所述判断所述循环缓冲区的剩余存储空间是否满足预设的第一存储阈值之后,还包括:Optionally, after the judging whether the remaining storage space of the circular buffer meets the preset first storage threshold, the method further includes:
若否,则继续生成并存储SAS卡的SAS卡固件日志至所述循环缓冲区。If not, continue to generate and store the SAS card firmware log of the SAS card to the circular buffer.
可选的,所述将所述循环缓冲区内的SAS卡固件日志全部转移到主机的主机内存循环缓冲区中存储的过程,包括:Optionally, the process of transferring all the SAS card firmware logs in the circular buffer to the storage in the host memory circular buffer of the host includes:
当所述主机内存循环缓冲区存满SAS卡固件日志,则将所述循环缓冲区内的SAS卡固件日志全部转移到主机内存循环缓冲区中,覆盖生成时间最晚的SAS卡固件日志进行存储。When the host memory circular buffer is full of SAS card firmware logs, all the SAS card firmware logs in the circular buffer are transferred to the host memory circular buffer, and the SAS card firmware log with the latest generation time is overwritten for storage .
可选的,所述主机内存循环缓冲区为存储空间大于等于所述循环缓冲区,内存区域连续的用于存储SAS卡固件日志的内存空间。Optionally, the host memory circular buffer is a memory space where the storage space is greater than or equal to the circular buffer, and the memory area is continuous for storing SAS card firmware logs.
可选的,所述发送内存申请请求至主机,得到所述主机的内存中的主机内存循环缓冲区的过程,包括:Optionally, the process of sending a memory application request to the host to obtain the host memory circular buffer in the host's memory includes:
发送内存空间申请请求和内存锁定请求至所述主机,以使所述主机利用所述内存空间申请请求从所述内存中划分出所述主机内存循环缓冲区,得到所述主机内存循环缓冲区,以使所述主机利用所述内存锁定请求锁定所述主机内存循环缓冲区。sending a memory space application request and a memory lock request to the host, so that the host uses the memory space application request to divide the host memory circular buffer from the memory to obtain the host memory circular buffer, The host uses the memory lock request to lock the host memory circular buffer.
本发明还公开了一种SAS卡固件日志收集系统,包括:The invention also discloses a SAS card firmware log collection system, comprising:
请求发送模块,用于发送内存申请请求至主机,得到所述主机的内存中的主机内存循环缓冲区;The request sending module is used to send a memory application request to the host, and obtain the host memory circular buffer in the memory of the host;
日志生成模块,用于生成并存储SAS卡的SAS卡固件日志至本地的循环缓冲区;The log generation module is used to generate and store the SAS card firmware log of the SAS card to the local circular buffer;
存储空间判断模块,用于判断所述循环缓冲区的剩余存储空间是否满足预设的第一存储阈值;A storage space judging module, configured to judge whether the remaining storage space of the circular buffer satisfies a preset first storage threshold;
日志转移模块,用于若所述存储空间判断模块判定剩余存储空间满足所述第一存储阈值,则将所述循环缓冲区内的SAS卡固件日志全部转移到所述主机内存循环缓冲区中存储;The log transfer module is used to transfer all the SAS card firmware logs in the circular buffer to the host memory circular buffer for storage if the storage space judging module determines that the remaining storage space meets the first storage threshold ;
其中,所述主机内存循环缓冲区为存储空间大于等于所述循环缓冲区,用于存储SAS卡固件日志的内存空间。Wherein, the host memory circular buffer is a memory space whose storage space is greater than or equal to the circular buffer and is used for storing SAS card firmware logs.
可选的,还包括:Optionally, also include:
重复判断模块,用于若所述存储空间判断模块判定所述剩余存储空间不满足所述第一存储阈值,则继续调用所述日志生成模块生成并存储所述SAS卡固件日志至所述循环缓冲区。A repeat judging module, configured to continue calling the log generation module to generate and store the SAS card firmware log to the circular buffer if the storage space judging module judges that the remaining storage space does not meet the first storage threshold Area.
可选的,所述请求发送模块,具体用于发送内存空间申请请求和内存锁定请求至所述主机,以使所述主机利用所述内存空间申请请求从所述内存中划分出所述主机内存循环缓冲区,得到所述主机内存循环缓冲区,以使所述主机利用所述内存锁定请求锁定所述主机内存循环缓冲区。Optionally, the request sending module is specifically configured to send a memory space application request and a memory lock request to the host, so that the host uses the memory space application request to divide the host memory from the memory The circular buffer is obtained by obtaining the circular buffer of the host memory, so that the host locks the circular buffer of the host memory by using the memory lock request.
本发明还公开了一种SAS卡固件日志收集装置,包括:The invention also discloses a SAS card firmware log collection device, comprising:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行所述计算机程序以实现如前述的SAS卡固件日志收集方法。The processor is configured to execute the computer program to realize the aforementioned SAS card firmware log collection method.
本发明还公开了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如前述的SAS卡固件日志收集方法。The present invention also discloses a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the aforementioned SAS card firmware log collection method is realized.
本发明中,SAS卡固件日志收集方法,包括:发送内存申请请求至主机,得到主机的内存中的主机内存循环缓冲区;生成并存储SAS卡的SAS卡固件日志至本地的循环缓冲区;判断循环缓冲区的剩余存储空间是否满足预设的第一存储阈值;若是,则将循环缓冲区内的SAS卡固件日志全部转移到主机内存循环缓冲区中存储;其中,主机内存循环缓冲区为存储空间大于等于循环缓冲区,用于存储SAS卡固件日志的内存空间。In the present invention, the SAS card firmware log collection method includes: sending a memory application request to the host to obtain the host memory circular buffer in the memory of the host; generating and storing the SAS card firmware log of the SAS card to the local circular buffer; judging Whether the remaining storage space of the circular buffer meets the preset first storage threshold; if so, all the SAS card firmware logs in the circular buffer are transferred to the host memory circular buffer for storage; wherein, the host memory circular buffer is storage The space is greater than or equal to the circular buffer, which is used to store the memory space of the SAS card firmware log.
本发明在SAS卡原有的循环缓冲区基础上,向主机内存申请用于存储多出的SAS卡固件日志的主机内存循环缓冲区,当循环缓冲区中的剩余空间不足,满足第一存储阈值后,则转移循环缓冲区中全部的SAS卡固件日志至主机内存循环缓冲区,主机内存循环缓冲区中有足够的存储空间存储SAS卡运行期间的SAS卡固件日志,避免了SAS卡故障时的SAS卡固件日志快速丢失的情况,能够长时间保存SAS卡固件日志,同时为用户获取SAS卡固件日志留下了充足的获取时间,此外,用户可以通过主机直接从内存中获取SAS卡固件日志,而不用再通过串口接线通过串口调试的方式获取SAS卡固件日志,更为便捷,提高了SAS卡的维护效率,间接提高了SAS卡的可靠性。On the basis of the original circular buffer of the SAS card, the present invention applies to the host memory for storing the redundant SAS card firmware logs for the host memory circular buffer. When the remaining space in the circular buffer is insufficient, the first storage threshold is satisfied. Afterwards, all the SAS card firmware logs in the circular buffer are transferred to the host memory circular buffer. There is enough storage space in the host memory circular buffer to store the SAS card firmware logs during the operation of the SAS card, which avoids failures when the SAS card fails. If the SAS card firmware log is lost quickly, the SAS card firmware log can be saved for a long time, and at the same time, sufficient time is left for the user to obtain the SAS card firmware log. In addition, the user can directly obtain the SAS card firmware log from the memory through the host. It is more convenient to obtain the SAS card firmware log through serial port debugging instead of connecting through the serial port, which improves the maintenance efficiency of the SAS card and indirectly improves the reliability of the SAS card.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.
图1为本发明实施例公开的一种SAS卡固件日志收集方法流程示意图;Fig. 1 is a schematic flow chart of a method for collecting SAS card firmware logs disclosed by an embodiment of the present invention;
图2为本发明实施例公开的一种SAS卡固件日志收集系统结构示意图。Fig. 2 is a schematic structural diagram of a SAS card firmware log collection system disclosed in an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明实施例公开了一种SAS卡固件日志收集方法,参见图1所示,该方法包括:The embodiment of the present invention discloses a method for collecting SAS card firmware logs, as shown in Fig. 1, the method includes:
S11:发送内存申请请求至主机,得到主机的内存中的主机内存循环缓冲区。S11: Send a memory application request to the host, and obtain a host memory circular buffer in the memory of the host.
具体的,在SAS卡上电后,便可以自动发送内存申请请求至主机,以使主机利用内存申请请求从内存中划分出存储空间大于等于循环缓冲区,用于存储SAS卡固件日志的内存空间的主机内存循环缓冲区。Specifically, after the SAS card is powered on, it can automatically send a memory application request to the host, so that the host can use the memory application request to divide the storage space from the memory, which is greater than or equal to the circular buffer, and is used to store the memory space of the SAS card firmware log The host memory circular buffer.
具体的,预先向主机的内存申请一定大小的内存空间,用于存储SAS卡固件日志,为了避免循环缓冲区内的SAS卡固件日志被覆盖,需要将循环缓冲区的SAS卡固件日志全部转移到主机内存循环缓冲区中存储,因此,主机内存循环缓冲区的存储空间大小不能小于循环缓冲区的空间大小,若小于,还是会造成日志的丢失,失去了设立的意义,所以一般主机内存循环缓冲区的存储空间远大于循环缓冲区的空间大小,例如,循环缓冲区的空间大小可以为12KB,主机内存循环缓冲区的存储空间的大小可以为12MB,为循环缓冲区的空间大小的1024倍,以确保主机内存循环缓冲区中有足够的空间存储SAS卡固件日志。Specifically, apply for a certain amount of memory space in advance to the memory of the host for storing SAS card firmware logs. In order to prevent the SAS card firmware logs in the circular buffer from being overwritten, it is necessary to transfer all the SAS card firmware logs in the circular buffer to It is stored in the host memory circular buffer. Therefore, the storage space of the host memory circular buffer cannot be smaller than the space of the circular buffer. The storage space of the zone is much larger than the space size of the circular buffer. For example, the space size of the circular buffer can be 12KB, and the storage space of the host memory circular buffer can be 12MB, which is 1024 times the space size of the circular buffer. To ensure that there is enough space in the host memory circular buffer to store the SAS card firmware log.
其中,申请的主机内存循环缓冲区的大小可以与SAS卡运行期间可能产生的SAS卡固件日志对应,即确保SAS卡运行期间产生的SAS卡固件日志的大小不超过主机内存循环缓冲区的存储空间,以此确保SAS卡运行期间产生的SAS卡固件日志能够全部保留。Among them, the size of the requested host memory circular buffer can correspond to the SAS card firmware log that may be generated during the operation of the SAS card, that is, ensure that the size of the SAS card firmware log generated during the operation of the SAS card does not exceed the storage space of the host memory circular buffer , so as to ensure that all SAS card firmware logs generated during the operation of the SAS card can be retained.
S12:生成并存储SAS卡的SAS卡固件日志至本地的循环缓冲区。S12: Generate and store the SAS card firmware log of the SAS card to a local circular buffer.
具体的,根据SAS卡的运行信息生成SAS卡的SAS卡固件日志,并且将该SAS卡固件日志存储至本地即SAS卡的循环缓冲区中。Specifically, a SAS card firmware log of the SAS card is generated according to the running information of the SAS card, and the SAS card firmware log is stored locally, that is, in a circular buffer of the SAS card.
S13:判断循环缓冲区的剩余存储空间是否满足预设的第一存储阈值。S13: Determine whether the remaining storage space of the circular buffer satisfies a preset first storage threshold.
具体的,为了在循环缓冲区存满SAS卡固件日志后能够进行相应的动作,避免SAS卡固件日志被快速覆盖,判断循环缓冲区的剩余存储空间是否满足预设的第一存储阈值,例如,判断循环缓冲区的剩余存储空间是否小于10%,或循环缓冲区的剩余存储空间是否为0即循环缓冲区是否已经全部存满SAS卡固件日志。Specifically, in order to be able to perform corresponding actions after the circular buffer is full of SAS card firmware logs, and to prevent the SAS card firmware logs from being quickly overwritten, it is determined whether the remaining storage space of the circular buffer meets the preset first storage threshold, for example, Judging whether the remaining storage space of the circular buffer is less than 10%, or whether the remaining storage space of the circular buffer is 0, that is, whether the circular buffer has been completely filled with the SAS card firmware log.
S14:若是,则将循环缓冲区内的SAS卡固件日志全部转移到主机的主机内存循环缓冲区中存储。S14: If yes, all the SAS card firmware logs in the circular buffer are transferred to the host memory circular buffer of the host for storage.
具体的,在循环缓冲区的剩余存储空间满足预设的第一存储阈值后,便可以将循环缓冲区内的SAS卡固件日志全部转移到主机的主机内存循环缓冲区中存储,避免日志丢失,例如,预设的第一存储阈值为剩余存储空间为10%,则将循环缓冲区内占用了90%的存储空间的SAS卡固件日志全部转移到主机的主机内存循环缓冲区中存储,避免因循环缓冲区中的剩余空间不足,导致SAS卡固件日志迅速被覆盖,从而给提取SAS卡固件日志留有了足够的时间。Specifically, after the remaining storage space of the circular buffer meets the preset first storage threshold, all the SAS card firmware logs in the circular buffer can be transferred to the host memory circular buffer of the host for storage to avoid loss of logs. For example, if the preset first storage threshold is 10% of the remaining storage space, all the SAS card firmware logs that occupy 90% of the storage space in the circular buffer are transferred to the host memory circular buffer of the host for storage to avoid The remaining space in the circular buffer is insufficient, causing the SAS card firmware log to be overwritten quickly, leaving enough time for extracting the SAS card firmware log.
可以理解的是,由于SAS卡固件日志的写入过程是持续的,因此,转移的主机内存循环缓冲区中的SAS卡固件日志为判断满足第一存储阈值那一刻的当前循环缓冲区内的SAS卡固件日志,转移SAS卡固件日志时,循环缓冲区将会清空转移的SAS卡固件日志内容,以类似于剪切的形式转移SAS卡固件日志至主机内存循环缓冲区存储,其中,具体可以利用DMA技术(DMA,Direct Memory Access,直接内存存取)转移SAS卡固件日志至主机内存循环缓冲区。It can be understood that since the writing process of the SAS card firmware log is continuous, the SAS card firmware log in the transferred host memory circular buffer is the SAS card firmware log in the current circular buffer at the moment when the first storage threshold is judged to be satisfied. Card firmware log, when transferring the SAS card firmware log, the circular buffer will clear the content of the transferred SAS card firmware log, and transfer the SAS card firmware log to the host memory circular buffer in a form similar to cutting. DMA technology (DMA, Direct Memory Access, direct memory access) transfers the SAS card firmware log to the host memory circular buffer.
需要说明的是,SAS卡固件日志存储在了主机中的内存中,因此,用户可以直接通过主机获取内存中的SAS卡固件日志,而不用再利用串口调试技术与SAS卡直接连接获取SAS卡固件日志,日志获取方式更为便捷。It should be noted that the SAS card firmware log is stored in the memory of the host, therefore, the user can directly obtain the SAS card firmware log in the memory through the host, instead of using the serial port debugging technology to directly connect to the SAS card to obtain the SAS card firmware Logs, log acquisition is more convenient.
S15:若否,则继续生成并存储SAS卡的SAS卡固件日志至循环缓冲区。S15: If not, continue to generate and store the SAS card firmware log of the SAS card to the circular buffer.
具体的,在循环缓冲区的剩余存储空间满足第一存储阈值前,可以继续执行S12和S13持续存储SAS卡固件日志至循环缓冲区中,直至循环缓冲区的剩余存储空间满足第一存储阈值。Specifically, before the remaining storage space of the circular buffer meets the first storage threshold, S12 and S13 can be continued to store the SAS card firmware log in the circular buffer until the remaining storage space of the circular buffer meets the first storage threshold.
需要说明的是,SAS卡的SAS卡固件日志生成速度很快,其中,SAS卡将数据写入自身的循环缓冲区的写入速度最快,其次是SAS卡将数据写入主机内存循环缓冲区,所以为了避免数据写入完成前,新的数据覆盖了剩余没写入的数据导致数据丢失,因此,SAS卡首先将数据写入至自身的循环缓冲区,再利用第一存储阈值,将循环缓冲区中的SAS卡固件日志存储至主机内存循环缓冲区,保证了不会因写入速度导致数据丢失。It should be noted that the generation speed of the SAS card firmware log of the SAS card is very fast. Among them, the writing speed of the SAS card writing data into its own circular buffer is the fastest, followed by the writing speed of the SAS card writing data into the host memory circular buffer , so in order to avoid data loss caused by new data overwriting the remaining unwritten data before the data writing is completed, the SAS card first writes the data to its own circular buffer, and then uses the first storage threshold to cycle The SAS card firmware log in the buffer is stored in the host memory circular buffer, which ensures that data will not be lost due to the writing speed.
可以理解的是,主机可以为与SAS卡相连的用户终端,例如,电脑。It can be understood that the host may be a user terminal connected to the SAS card, for example, a computer.
可见,本发明实施例在SAS卡原有的循环缓冲区基础上,向主机内存申请用于存储多出的SAS卡固件日志的主机内存循环缓冲区,当循环缓冲区中的剩余空间不足,满足第一存储阈值后,则转移循环缓冲区中全部的SAS卡固件日志至主机内存循环缓冲区,主机内存循环缓冲区中有足够的存储空间存储SAS卡运行期间的SAS卡固件日志,避免了SAS卡故障时的SAS卡固件日志快速丢失的情况,能够长时间保存SAS卡固件日志,同时为用户获取SAS卡固件日志留下了充足的获取时间,此外,用户可以通过主机直接从内存中获取SAS卡固件日志,而不用再通过串口接线通过串口调试的方式获取SAS卡固件日志,更为便捷,提高了SAS卡的维护效率,间接提高了SAS卡的可靠性。It can be seen that, on the basis of the original circular buffer of the SAS card, the embodiment of the present invention applies to the host memory for storing the redundant SAS card firmware log for the host memory circular buffer. When the remaining space in the circular buffer is insufficient, the After the first storage threshold, all the SAS card firmware logs in the circular buffer are transferred to the host memory circular buffer. There is enough storage space in the host memory circular buffer to store the SAS card firmware logs during the operation of the SAS card, avoiding SAS When the SAS card firmware log is quickly lost when the card fails, the SAS card firmware log can be saved for a long time, and at the same time, sufficient acquisition time is left for the user to obtain the SAS card firmware log. In addition, the user can directly obtain the SAS card from the memory through the host Card firmware logs instead of getting SAS card firmware logs through serial port debugging, which is more convenient, improves the maintenance efficiency of SAS cards, and indirectly improves the reliability of SAS cards.
进一步的,上述S14中将循环缓冲区内的SAS卡固件日志全部转移到主机的主机内存循环缓冲区中存储的过程,可以具体为当主机内存循环缓冲区存满SAS卡固件日志,则将循环缓冲区内的SAS卡固件日志全部转移到主机内存循环缓冲区中,覆盖生成时间最晚的SAS卡固件日志进行存储。Further, the process of transferring all the SAS card firmware logs in the circular buffer to the storage in the host memory circular buffer of the host in the above S14 can be specifically as that when the host memory circular buffer is full of SAS card firmware logs, the circular All the SAS card firmware logs in the buffer are transferred to the host memory circular buffer, and the latest SAS card firmware log is overwritten for storage.
具体的,若主机内存循环缓冲区的存储空间仍不够,那么只能将生成时间最新的SAS卡固件日志覆盖生成时间最晚的SAS卡固件日志进行存储,由于主机内存循环缓冲区足够大,且SAS卡正产工作时间占绝大多数,所以即使进行了覆盖,也不会覆盖到SAS卡故障期间的SAS卡固件日志。Specifically, if the storage space of the host memory circular buffer is still insufficient, then the latest SAS card firmware log can only be overwritten with the latest SAS card firmware log for storage, because the host memory circular buffer is large enough and The working time of the SAS card is the vast majority, so even if it is overwritten, the SAS card firmware log during the SAS card failure will not be overwritten.
具体的,为了避免出现SAS卡固件日志还未完全转移,新生成的SAS卡固件日志就覆盖了未转移完全的SAS卡固件日志导致SAS卡固件日志丢失的情况,利用内存进行存储,保证写入速度足够快,由于引入了足够大的主机内存循环缓冲区,在主机内存循环缓冲区写满前有足够的时间可以进行数据转移,所以,当主机内存循环缓冲区的剩余空间满足第二存储阈值,则将主机内存循环缓冲区中的全部SAS卡固件日志转移到主机的硬盘中存储。Specifically, in order to avoid the situation that the SAS card firmware log has not been completely transferred, the newly generated SAS card firmware log will cover the incompletely transferred SAS card firmware log and cause the SAS card firmware log to be lost. The speed is fast enough. Due to the introduction of a large enough host memory circular buffer, there is enough time for data transfer before the host memory circular buffer is full. Therefore, when the remaining space of the host memory circular buffer meets the second storage threshold , transfer all the SAS card firmware logs in the host memory circular buffer to the host hard disk for storage.
具体的,在内存的基础上,还可以将SAS卡固件日志存储到存储空间更大的硬盘中,第二存储阈值可以设定为主机内存循环缓冲区的剩余空间小于50%时,此时,写满剩余主机内存循环缓冲区的存储空间所需的时间远大于主机内存循环缓冲区中的SAS卡固件日志写入到硬盘所需要的时间。Specifically, on the basis of memory, the SAS card firmware log can also be stored in a hard disk with larger storage space, and the second storage threshold can be set as when the remaining space of the host memory circular buffer is less than 50%. At this time, The time required to fill the storage space of the remaining host memory circular buffer is much longer than the time required to write the SAS card firmware log in the host memory circular buffer to the hard disk.
其中,第二存储阈值的设定可以根据日志写入硬盘的时间来定,只要确保剩余的存储空间能够确保在主机内存循环缓冲区写满前,SAS卡固件日志已经写入到硬盘便可。Wherein, the setting of the second storage threshold can be determined according to the time when the log is written to the hard disk, as long as the remaining storage space can ensure that the SAS card firmware log has been written to the hard disk before the host memory circular buffer is full.
具体的,上述主机内存循环缓冲区可以具体为存储空间大于等于循环缓冲区,内存区域连续的用于存储SAS卡固件日志的内存空间,连续的内存空间便于数据存储和管理,能够提高日志管理效率。Specifically, the above-mentioned host memory circular buffer can specifically be that the storage space is greater than or equal to the circular buffer, and the continuous memory area is used to store the memory space of the SAS card firmware log. The continuous memory space is convenient for data storage and management, and can improve log management efficiency. .
具体的,上述S11发送内存申请请求至主机,得到主机的内存中的主机内存循环缓冲区的过程,可以具体为发送内存空间申请请求和内存锁定请求至主机,以使主机利用内存空间申请请求从内存中划分出主机内存循环缓冲区,得到主机内存循环缓冲区,以使主机利用内存锁定请求锁定主机内存循环缓冲区。Specifically, the process of sending the memory application request to the host in the above S11 to obtain the host memory circular buffer in the memory of the host may specifically be sending a memory space application request and a memory lock request to the host, so that the host uses the memory space application request from The host memory circular buffer is divided in the memory to obtain the host memory circular buffer, so that the host uses a memory lock request to lock the host memory circular buffer.
具体的,在申请内存空间的同时,还发送内存锁定请求至主机,以使主机锁定主机内存循环缓冲区仅供发送请求的SAS卡使用,避免内存使用冲突。Specifically, while applying for memory space, a memory lock request is also sent to the host, so that the host locks the host memory circular buffer for use only by the SAS card sending the request, thereby avoiding memory usage conflicts.
相应的,本发明实施例还公开了一种SAS卡固件日志收集系统,参见图2所示,该系统包括:Correspondingly, the embodiment of the present invention also discloses a SAS card firmware log collection system, as shown in Figure 2, the system includes:
请求发送模块11,用于发送内存申请请求至主机,得到主机的内存中的主机内存循环缓冲区;The request sending module 11 is used to send a memory application request to the host to obtain the host memory circular buffer in the memory of the host;
日志生成模块12,用于生成并存储SAS卡的SAS卡固件日志至本地的循环缓冲区;The log generation module 12 is used to generate and store the SAS card firmware log of the SAS card to the local circular buffer;
存储空间判断模块13,用于判断循环缓冲区的剩余存储空间是否满足预设的第一存储阈值;A storage space judging module 13, configured to judge whether the remaining storage space of the circular buffer satisfies a preset first storage threshold;
日志转移模块14,用于若存储空间判断模块13判定剩余存储空间满足第一存储阈值,则将循环缓冲区内的SAS卡固件日志全部转移到主机内存循环缓冲区中存储;The log transfer module 14 is used to transfer all the SAS card firmware logs in the circular buffer to the host memory circular buffer for storage if the storage space judging module 13 judges that the remaining storage space meets the first storage threshold;
其中,主机内存循环缓冲区为存储空间大于等于循环缓冲区,用于存储SAS卡固件日志的内存空间。Wherein, the host memory circular buffer is a memory space whose storage space is greater than or equal to the circular buffer, and is used for storing SAS card firmware logs.
可见,本发明实施例在SAS卡原有的循环缓冲区基础上,向主机内存申请用于存储多出的SAS卡固件日志的主机内存循环缓冲区,当循环缓冲区中的剩余空间不足,满足第一存储阈值后,则转移循环缓冲区中全部的SAS卡固件日志至主机内存循环缓冲区,主机内存循环缓冲区中有足够的存储空间存储SAS卡运行期间的SAS卡固件日志,避免了SAS卡故障时的SAS卡固件日志快速丢失的情况,能够长时间保存SAS卡固件日志,同时为用户获取SAS卡固件日志留下了充足的获取时间,此外,用户可以通过主机直接从内存中获取SAS卡固件日志,而不用再通过串口接线通过串口调试的方式获取SAS卡固件日志,更为便捷,提高了SAS卡的维护效率,间接提高了SAS卡的可靠性。It can be seen that, on the basis of the original circular buffer of the SAS card, the embodiment of the present invention applies to the host memory for storing the redundant SAS card firmware log for the host memory circular buffer. When the remaining space in the circular buffer is insufficient, the After the first storage threshold, all the SAS card firmware logs in the circular buffer are transferred to the host memory circular buffer. There is enough storage space in the host memory circular buffer to store the SAS card firmware logs during the operation of the SAS card, avoiding SAS When the SAS card firmware log is quickly lost when the card fails, the SAS card firmware log can be saved for a long time, and at the same time, sufficient acquisition time is left for the user to obtain the SAS card firmware log. In addition, the user can directly obtain the SAS card from the memory through the host Card firmware logs instead of getting SAS card firmware logs through serial port debugging, which is more convenient, improves the maintenance efficiency of SAS cards, and indirectly improves the reliability of SAS cards.
具体的,还可以包括重复判断模块15;其中,Specifically, a
重复判断模块15,用于若存储空间判断模块13判定剩余存储空间不满足第一存储阈值,则继续调用日志生成模块12生成并存储SAS卡的SAS卡固件日志至循环缓冲区。The
具体的,上述日志转移模块14,可以具体用于若存储空间判断模块13判定剩余存储空间满足第一存储阈值,则当主机内存循环缓冲区存满SAS卡固件日志,则将循环缓冲区内的SAS卡固件日志全部转移到主机内存循环缓冲区中,覆盖生成时间最晚的SAS卡固件日志进行存储。Specifically, the above-mentioned log transfer module 14 can be specifically used for if the storage space judging module 13 judges that the remaining storage space meets the first storage threshold, then when the host memory circular buffer is full of SAS card firmware logs, the All SAS card firmware logs are transferred to the host memory circular buffer, and the latest SAS card firmware log is overwritten for storage.
具体的,还可以包括硬盘存储模块;其中,Specifically, it may also include a hard disk storage module; wherein,
硬盘存储模块,用于当主机内存循环缓冲区的剩余空间满足第二存储阈值,则将主机内存循环缓冲区中的全部SAS卡固件日志转移到主机的硬盘中存储。The hard disk storage module is configured to transfer all SAS card firmware logs in the host memory circular buffer to the host hard disk for storage when the remaining space of the host memory circular buffer satisfies the second storage threshold.
其中,主机内存循环缓冲区为存储空间大于等于循环缓冲区,内存区域连续的用于存储SAS卡固件日志的内存空间。Wherein, the host memory circular buffer is a memory space where the storage space is greater than or equal to the circular buffer, and the memory area is continuous for storing SAS card firmware logs.
具体的,上述请求发送模块11,可以具体用于发送内存空间申请请求和内存锁定请求至主机,以使主机利用内存空间申请请求从内存中划分出主机内存循环缓冲区,得到主机内存循环缓冲区,以使主机利用内存锁定请求锁定主机内存循环缓冲区。Specifically, the above-mentioned request sending module 11 can be specifically used to send a memory space application request and a memory lock request to the host, so that the host uses the memory space application request to divide the host memory circular buffer from the memory, and obtain the host memory circular buffer to have the host lock the host memory circular buffer with a memory lock request.
此外,本发明实施例还公开了一种SAS卡固件日志收集装置,包括:In addition, the embodiment of the present invention also discloses a SAS card firmware log collection device, including:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行计算机程序以实现如前述的SAS卡固件日志收集方法。The processor is used to execute the computer program to realize the aforementioned SAS card firmware log collection method.
另外,本发明实施例还公开了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如前述的SAS卡固件日志收集方法。In addition, the embodiment of the present invention also discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the aforementioned SAS card firmware log collection method is implemented.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the possible For interchangeability, in the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
以上对本发明所提供的技术内容进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The technical content provided by the present invention has been introduced in detail above, and the principle and implementation of the present invention have been explained by using specific examples in this paper. The description of the above embodiments is only used to help understand the method and core idea of the present invention; At the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and application scope. In summary, the content of this specification should not be construed as limiting the present invention.
Claims (8)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010026621.2A CN111240879B (en) | 2020-01-10 | 2020-01-10 | SAS card firmware log collection method, system, device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010026621.2A CN111240879B (en) | 2020-01-10 | 2020-01-10 | SAS card firmware log collection method, system, device and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111240879A CN111240879A (en) | 2020-06-05 |
| CN111240879B true CN111240879B (en) | 2022-11-25 |
Family
ID=70874415
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010026621.2A Active CN111240879B (en) | 2020-01-10 | 2020-01-10 | SAS card firmware log collection method, system, device and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111240879B (en) |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112347059B (en) * | 2020-09-04 | 2023-12-22 | 北京浪潮数据技术有限公司 | Storage system data reduction service log management method and related components |
| CN112905415B (en) * | 2021-02-19 | 2022-06-07 | 浪潮电子信息产业股份有限公司 | A serial port log file acquisition method, device and related components |
| CN113296704B (en) * | 2021-05-27 | 2022-12-02 | 济南浪潮数据技术有限公司 | Online parallel collection method, device and equipment for firmware logs of SAS HBA (Serial attached SCSI) card |
| CN116610648A (en) * | 2022-02-08 | 2023-08-18 | 哲库科技(上海)有限公司 | Log storage method and device, electronic equipment and storage medium |
| CN119473170A (en) * | 2025-01-15 | 2025-02-18 | 山东云海国创云计算装备产业创新中心有限公司 | Method and system for constructing circular buffer area, storage medium and electronic device |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103309767A (en) * | 2012-03-08 | 2013-09-18 | 阿里巴巴集团控股有限公司 | Method and device for processing client log |
| CN105468502A (en) * | 2015-11-30 | 2016-04-06 | 北京奇艺世纪科技有限公司 | Log collection method, device and system |
| CN110362450A (en) * | 2019-07-16 | 2019-10-22 | 深圳市网心科技有限公司 | A kind of log data acquisition method, device and computer readable storage medium |
-
2020
- 2020-01-10 CN CN202010026621.2A patent/CN111240879B/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103309767A (en) * | 2012-03-08 | 2013-09-18 | 阿里巴巴集团控股有限公司 | Method and device for processing client log |
| CN105468502A (en) * | 2015-11-30 | 2016-04-06 | 北京奇艺世纪科技有限公司 | Log collection method, device and system |
| CN110362450A (en) * | 2019-07-16 | 2019-10-22 | 深圳市网心科技有限公司 | A kind of log data acquisition method, device and computer readable storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111240879A (en) | 2020-06-05 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111240879B (en) | SAS card firmware log collection method, system, device and storage medium | |
| CN106471478B (en) | Device controller and method for performing multiple write transactions atomically within a non-volatile data storage device | |
| CN103765373B (en) | Data storage method, data storage device and storage device | |
| CN115576505B (en) | A data storage method, device, equipment and readable storage medium | |
| CN110727597B (en) | A method for troubleshooting invalid code completion use cases based on logs | |
| CN101286130A (en) | A method for implementing reset fault location of embedded devices | |
| WO2019090493A1 (en) | Memory block recovery method and device | |
| CN103049224A (en) | Method, device and system for importing data into physical tape | |
| CN106406750A (en) | Data operation method and system | |
| CN111124258B (en) | Data storage method, device and equipment of full flash memory array and readable storage medium | |
| CN115629714B (en) | Writing method of RAID card, writing system of RAID card and relative device | |
| CN113626253A (en) | Data recovery method, device, equipment and medium for failed solid-state memory | |
| CN102662799A (en) | Data backup method, server and hot backup system | |
| WO2024113685A1 (en) | Data recovery method for raid array and related apparatus | |
| CN116501259A (en) | Disk group dual-activity synchronization method and device, computer equipment and storage medium | |
| CN105068760B (en) | Date storage method, data storage device and storage device | |
| CN118535098A (en) | Data recovery method, device, computer equipment and storage medium | |
| CN107329699A (en) | One kind, which is entangled, deletes rewrite method and system | |
| CN115309591B (en) | Recovery method and related device of full flash memory system | |
| CN112578993A (en) | Method for processing programming error of multi-plane NVM and storage device | |
| CN102073655B (en) | A kind of method and apparatus preserving data | |
| CN105718357A (en) | Memory monitoring method | |
| CN111142792B (en) | Power-down protection method of storage device | |
| CN113568559B (en) | Method, device, equipment and medium for processing hard disk write errors | |
| CN115617479A (en) | BIOS log storage method and computing device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address |
Address after: Building 9, No.1, guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Wuzhong District, Suzhou City, Jiangsu Province Patentee after: Suzhou Yuannao Intelligent Technology Co.,Ltd. Country or region after: China Address before: Building 9, No.1, guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Wuzhong District, Suzhou City, Jiangsu Province Patentee before: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd. Country or region before: China |