Flash memory controller and related control method

By introducing an interrupt aggregation mechanism and timer into the flash memory controller, delaying the sending of interrupt signals and calculating the command queue depth, the problem of inability to optimize performance in the existing technology is solved, and accurate measurement of the command queue depth and performance improvement are achieved. .

CN118796731APending Publication Date: 2024-10-18SILICON MOTION INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311524173.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-04-14
Filing Date
2023-11-15
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

Existing flash memory controllers cannot accurately calculate the command queue depth on the master device side, resulting in inability to optimize performance.

Method used

By introducing an interrupt aggregation mechanism and a timer in the flash memory controller, the interrupt signal is delayed, and the difference between the end of the submission queue and the head of the completion queue is calculated to determine the command queue depth.

Benefits of technology

Accurate calculation of command queue depth is implemented for performance optimization, improving the performance of flash memory controllers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796731A_ABST
    Figure CN118796731A_ABST
Patent Text Reader

Abstract

The invention discloses a flash memory controller and a related control method, and the method comprises the following steps: setting a waiting time in an interrupt aggregation mechanism, and setting a timer, and a timeout value of the timer is equal to the waiting time; the method comprises the following steps: receiving a plurality of commands from a submission queue in a main device, processing the plurality of commands, respectively generating a plurality of command responses, and writing the plurality of command responses into a completion queue in the main device; receiving a submission queue tail and a completion queue head from the main device; when the timer reaches the timeout value, the completion queue head is subtracted from the submission queue tail to obtain a queue length of a command queue inside the main device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a flash memory controller. Background Art

[0002] In current electronic devices including flash memory, when a host device needs to transmit multiple commands temporarily stored in a command queue, such as read commands, write commands or management commands, to a flash memory controller for execution, the host device first writes these commands into a commit queue and notifies the flash memory controller that there are commands to be executed in the commit queue, and the flash memory controller then reads the commands from the commit queue to perform related operations. However, since the command queue is a memory set at the host device end, the flash memory controller cannot know the queue depth of the command queue, and therefore cannot determine the behavior of the host device in sending commands, and cannot take corresponding measures to optimize the overall performance. Summary of the invention

[0003] Therefore, one of the objectives of the present invention is to provide a flash memory controller that can accurately calculate the queue depth of the commit queue at the host device end for performing relevant settings for performance optimization to solve the problems described in the prior art.

[0004] In one embodiment of the present invention, a flash memory controller is disclosed, wherein the flash memory controller is used to access a flash memory module, and the flash memory controller includes a read-only memory and a microprocessor. The read-only memory is used to store a program code, and the microprocessor is used to execute the program code to control access to the flash memory module. The microprocessor is used to perform the following steps: setting a waiting time in an interrupt aggregation mechanism and setting a timer, wherein a timeout value of the timer is equal to the waiting time; receiving multiple commands from a submission queue in a master device, generating multiple command responses after processing the multiple commands, and writing the multiple command responses into a completion queue in the master device; receiving a submission queue tail and a completion queue head from the master device, wherein the submission queue tail indicates how many commands the master device has sent, and the completion queue head indicates how many command responses the master device has read from the completion queue; when the timer reaches the timeout value, subtracting the completion queue head from the submission queue tail to obtain a queue length of a command queue inside the master device; and when the timer reaches the timeout value, sending an interrupt signal to the master device, wherein the interrupt signal is used to trigger the master device to read the multiple command responses from the completion queue.

[0005] In one embodiment of the present invention, a control method for a flash memory controller is disclosed, which includes the following steps: setting a waiting time in an interrupt aggregation mechanism and setting a timer, wherein a timeout value of the timer is equal to the waiting time; receiving multiple commands from a submission queue in a master device, generating multiple command responses after processing the multiple commands respectively, and writing the multiple command responses to a completion queue in the master device; receiving a submission queue tail and a completion queue head from the master device, wherein the submission queue tail indicates how many commands the master device has sent, and the completion queue head indicates how many command responses the master device has read from the completion queue; when the timer reaches the timeout value, subtracting the completion queue head from the submission queue tail to obtain a queue length of a command queue inside the master device; and when the timer reaches the timeout value, sending an interrupt signal to the master device, wherein the interrupt signal is used to trigger the master device to read the multiple command responses from the completion queue. BRIEF DESCRIPTION OF THE DRAWINGS

[0006] Figure 1 FIG. 4 is a schematic diagram of a memory device according to an embodiment of the present invention.

[0007] Figure 2 Schematic diagram of an SQ tail, an SQ head, a CQ tail, a CQ head and corresponding command queues.

[0008] Figure 3 FIG. 4 is a schematic diagram showing the operation of a main device and a memory device according to an embodiment of the present invention.

[0009] Figure 4 FIG. 4 is a schematic diagram showing the operation of a main device and a memory device according to an embodiment of the present invention.

[0010] Figure 5 FIG. 4 is a flow chart of a control method of a flash memory controller according to an embodiment of the present invention.

[0011] Figure 6 FIG. 4 is a schematic diagram of a queue depth calculation circuit according to an embodiment of the present invention.

[0012] Figure 7 A schematic diagram of a master device including a plurality of command queues and a corresponding plurality of submission queues and a plurality of completion queues.

[0013] Figure 8 FIG. 4 is a schematic diagram of a queue depth calculation circuit according to an embodiment of the present invention.

[0014]

Explanation of symbols

[0015] 100: Memory Device

[0016] 110: Flash memory controller

[0017] 112: Microprocessor

[0018] 112M: Read-only memory

[0019] 112C: Program code

[0020] 114: Control Logic

[0021] 116: Buffer memory

[0022] 118: Interface Logic

[0023] 120: Flash memory module

[0024] 130: Main device

[0025] 132: Encoder

[0026] 134:Decoder

[0027] 191: Command Queue

[0028] 192: Submit Queue

[0029] 194:Complete queue

[0030] 500~510: Steps

[0031] 600: queue depth calculation circuit

[0032] 610: Subtractor

[0033] 791_1~791_N: Command Queue

[0034] 792_1~792_N: Submission Queue

[0035] 794_1~794_N: Complete the queue

[0036] 800: queue depth calculation circuit

[0037] 810_1~810_N: Subtractor

[0038] 820: Adder

[0039] QD#1~QD#N: queue depth

[0040] t0~t18: time DETAILED DESCRIPTION

[0041] Figure 11 is a schematic diagram of a memory device 100 according to an embodiment of the present invention. The memory device 100 includes a flash memory module 120 and a flash memory controller 110, and the flash memory controller 110 is used to access the flash memory module 120. According to this embodiment, the flash memory controller 110 includes a microprocessor 112, a read only memory (ROM) 112M, a control logic 114, a buffer memory 116, and an interface logic 118. The ROM 112M is used to store a program code 112C, and the microprocessor 112 is used to execute the program code 112C to control the access to the flash memory module 120. The control logic 114 includes an encoder 132 and a decoder 134, wherein the encoder 132 is used to encode the data written into the flash memory module 120 to generate a corresponding check code (or error correction code (ECC)), and the decoder 134 is used to decode the data read from the flash memory module 120.

[0042] In a typical case, the flash memory module 120 includes a plurality of flash memory chips, and each flash memory chip includes a plurality of blocks. The flash memory controller 110 performs operations such as copying, erasing, and merging data on the flash memory module 120 in units of blocks. In addition, a block includes a specific number of data pages, and the flash memory controller 110 performs operations such as writing data to the flash memory module 120 in units of data pages. In other words, a block is a minimum erase unit in the flash memory module 120, and a data page is a minimum write unit in the flash memory module 120.

[0043] In practice, the flash memory controller 110, which executes the program code 112C through the microprocessor 112, can use its own internal components to perform various control operations, such as using the control logic 114 to control the access operation of the flash memory module 120 (especially the access operation to at least one block or at least one data page), using the buffer memory 116 to perform the required buffer processing, and using the interface logic 118 to communicate with a host device 130.

[0044] In one embodiment, the memory device 100 may be a portable memory device (e.g., a memory card that complies with SD / MMC, CF, MS, or XD standards), and the host device 130 is an electronic device that can be connected to the memory device, such as a mobile phone, a notebook computer, a desktop computer, etc. In another embodiment, the memory device 100 may be a solid state drive or an embedded storage device that complies with Universal Flash Storage (UFS) or Embedded Multi Media Card (EMMC) specifications, and is disposed in an electronic device, such as a mobile phone, a watch, a portable medical detection device (e.g., a medical bracelet), a notebook computer, or a desktop computer, and the host device 130 may be a processor of the electronic device.

[0045] In this embodiment, the host device 130 includes a command queue 191, a submission queue (SQ) 192, and a completion queue (CQ), wherein the command queue 191 is used to temporarily store commands that need to be transmitted to the memory device 100, such as read commands, write commands, or some management commands that comply with the Non-Volatile Memory Express (NVMe) specification, etc.; the submission queue 192 is used for the host device 130 to write the content of the command queue 192 for the memory device 100 to read; and the completion queue 194 is used for the memory device 100 to reply the command execution status to the host device 130. Through the submission queue 192 and the completion queue 194, the host device 130 can complete the access and management of the memory device 100. Specifically, in the process of using the submit queue 192 and the completion queue 194, the host device 130 and the memory device 100 will describe the processing status and the completion status of the command by setting four parameters. Figure 2The four parameters are a submission queue tail (SQ tail) (hereinafter referred to as SQ tail), a submission queue head (SQ head) (hereinafter referred to as SQ head), a completion queue tail (CQ tail) (hereinafter referred to as CQ tail) and a completion queue head (CQ tail). head) (hereinafter referred to as CQ head), wherein the SQ tail is used to indicate how many commands the master device 130 sends, that is, if the master device 130 writes a command to the submission queue 192, the value of the SQ tail is added with "1"; the SQ head is used to indicate how many commands the memory device 100 reads from the submission queue 192, that is, if the memory device 100 reads a command from the submission queue 192, the value of the SQ head is added with "1"; the CQ tail is used to indicate how many commands the memory device 100 completes and how many command responses are written to the completion queue 194, that is, if the memory device 100 writes a command response to the completion queue 194, the value of the CQ tail is added with "1"; the CQ header is used to indicate how many command responses the master device 130 reads from the completion queue 194, that is, if the master device 130 reads a command response from the completion queue 194, the value of the CQ header is added with "1". It should be noted that the values ​​of the SQ tail, SQ head, CQ tail and CQ head can be reset at an appropriate time.

[0046] Taking the process of the host device 130 sending a command to the memory device 100 as an example, first, the host device 130 writes the command into the commit queue 192. At this time, the host device 130 adds "1" to the tail of the internal SQ and synchronizes the tail of the SQ to the memory device 100 through a doorbell mechanism. Then, the memory device 100 can know through the tail of the SQ that there is an unexecuted command in the current commit queue 192, so the flash memory controller 110 in the memory device 100 reads the command from the commit queue 192 and adds "1" to the SQ header. Then, the flash memory controller 110 executes the command and generates a command response after the command is executed. Then, the command response is written to the completion queue 194 and "1" is added to the tail of the CQ. Finally, after receiving an interrupt signal from the memory device 100, the host device 130 reads the command response from the completion queue 194. At this time, the host device 130 adds "1" to the internal CQ header and synchronizes the CQ header to the memory device 100 through a doorbell mechanism.

[0047] The values ​​of the SQ tail, SQ head, CQ tail and CQ head can be used to indicate the command number pointed to, and the current command processing status can be known through the SQ tail, SQ head, CQ tail and CQ head. Figure 2, the area A between the SQ tail and the SQ header is used to indicate the number of commands that the master device 130 has issued but the memory device 100 has not yet read from the submission queue 192; the area B between the SQ header and the CQ tail indicates the number of commands that the memory device 100 has received but has not yet generated a command response; and the area C between the CQ tail and the CQ header indicates the number of command responses that the memory device 100 has completed but the master device 130 has not yet read from the completion queue 194.

[0048] As described in the prior art, since the flash memory controller 110 does not know the queue depth of the command queue 191, it is unable to perform related performance optimization. Figure 2 As shown, in theory, the queue depth of the command queue 191 can be obtained by subtracting the CQ head from the SQ tail. However, since the values ​​of the SQ head, CQ tail, and CQ head will change rapidly during the command processing, the microprocessor 112 or other related circuits cannot accurately obtain the queue depth of the command queue 191 based on the SQ tail and CQ head. For example, in the prior art, since the flash memory controller 110 will immediately send an interrupt signal to the master device 130 after writing a command response to the completion queue 194, and the master device 130 will immediately read the command response from the completion queue 194 after receiving the interrupt signal, the CQ head will quickly catch up with the CQ tail, that is, the values ​​of the CQ head and the CQ tail will be the same most of the time, resulting in Figure 2 The number of commands corresponding to the area C shown cannot be accurately obtained. As mentioned above, since Figure 2 The number of commands corresponding to the area C shown cannot be accurately obtained, which means that the queue depth of the command queue 191 cannot be accurately obtained by subtracting the CQ head from the SQ tail.

[0049] Therefore, in one embodiment of the present invention, a control method of the flash memory controller 110 is proposed, which can delay the time point of sending the command response by the flash memory controller 110 through an interrupt coalescing mechanism, so that the CQ head will not quickly catch up with the CQ tail. Therefore, the microprocessor 112 or other related circuits can obtain the queue depth of the command queue 191 by subtracting the CQ head from the SQ tail.

[0050] Specifically, the microprocessor 112 can set a waiting time and / or a critical value by setting an interrupt aggregation mechanism, wherein the waiting time is the time difference between two interrupt signals sent by the flash memory controller 110, that is, after the flash memory controller 110 sends an interrupt signal, it must calculate the waiting time through a timer before sending the next interrupt signal; and when the number of commands executed by the flash memory controller 110 is higher than the critical value, the flash memory controller 110 will also send an interrupt signal.

[0051] In one embodiment, the waiting time is greater than the time it takes for the microprocessor 112 to complete executing multiple commands. For example, the microprocessor 112 can set the waiting time so that the waiting time is greater than the time it takes for the microprocessor 112 to complete 4 or 5 read / write commands.

[0052] refer to Figure 3 The operation diagram of the host device 130 and the memory device 100 shown in the figure, at time t0, it is assumed that the current SQ tail, SQ head, CQ tail and CQ head are all "0". At time t1, the host device 130 writes 8 commands in the command queue 191 to the commit queue 192, and at this time the host device 130 updates the value of the SQ tail to "8", and synchronizes the updated SQ tail to a register in the flash memory controller 110. At time t2, the flash memory controller 110 reads 8 commands from the commit queue 192, and at this time the flash memory controller 110 updates the value of the SQ head to "8". Then, at time t3-t6, the microprocessor 112 in the flash memory controller 110 executes the four commands in sequence and generates corresponding command responses to the completion queue 194, and the value of the CQ tail is also updated accordingly. At time t7, since the time from t0 to t7 has reached the waiting time in the interrupt aggregation mechanism, the microprocessor 112 starts to calculate the queue depth of the command queue 191 according to the SQ header and the CQ tail, that is, the microprocessor 112 subtracts the CQ header from the SQ tail to obtain the queue depth of the command queue 191 as "8". Then, at time t8, the microprocessor 112 sends an interrupt signal to the master device 130 to inform the completion queue 194 that there is a new command response. At time t9, the master device 130 reads 4 command responses from the completion queue 194 and updates the CQ header to "4".

[0053] Next, refer to Figure 4At time t10, since the queue depth of command queue 191 is "8", and there are still 4 commands that have not been executed among the 8 commands at time t1, the master device 130 will only write the remaining 4 commands in command queue 191 to commit queue 192, and at this time the master device 130 updates the value of SQ tail to "12", and synchronizes the updated SQ tail to a register in flash memory controller 110. At time t11, flash memory controller 110 reads 4 commands from commit queue 192, and at this time the flash memory controller 110 updates the value of SQ header to "12". Then, at time t12-t15, the microprocessor 112 in flash memory controller 110 executes the four commands in sequence and generates corresponding command responses to completion queue 194, and the value of CQ tail is also updated accordingly. At time t16, since the time from t9 to t16 has reached the waiting time in the interrupt aggregation mechanism, the microprocessor 112 starts to calculate the queue depth of the command queue 191 according to the SQ header and the CQ tail, that is, the microprocessor 112 subtracts the CQ header from the SQ tail to obtain the queue depth of the command queue 191 as "8". Then, at time t17, the microprocessor 112 sends an interrupt signal to the master device 130 to inform the completion queue 194 that there is a new command response. At time t18, the master device 130 reads 4 command responses from the completion queue 194 and updates the CQ header to "8".

[0054] As described above, when the host device 130 continuously sends commands to the memory device 100, the method described in the above embodiment can obtain the same value "8" each time the queue depth calculation of the command queue 191 is performed, so the queue depth can be calculated effectively and accurately.

[0055] After determining the queue depth of the command queue 191 of the host device 130, the microprocessor 112 can optimize the internal control according to the queue depth of the command queue 191. For example, after determining the queue depth of the command queue 191 of the host device 130, the microprocessor 112 can stop the interrupt aggregation mechanism, and if the command queue 191 of the host device 130 has a smaller queue depth, such as the queue depth is less than a critical value, the microprocessor 112 in the flash memory controller 100 can shorten the time of sending an interrupt signal to the host device 130 after completing the command, that is, the microprocessor 112 will immediately send an interrupt signal to the host device 130 after writing the command response to the completion queue 194, so as to speed up the command processing of the host device 130. In addition, if the command queue 191 of the host device 130 has a larger queue depth, for example, the queue depth is greater than another critical value, the microprocessor 112 in the flash memory controller 100 can increase the time to send an interrupt signal to the host device 130 after completing the command, that is, the microprocessor 112 will delay for a period of time before sending the interrupt signal to the host device 130 after writing the command response to the completion queue 194.

[0056] The step of calculating the queue depth of the command queue 191 described in the embodiments of FIGS. 2 to 4 above can be completed by the microprocessor 112 executing the program code 112C. Figure 5 is a flow chart of a control method of the flash memory controller 100 according to an embodiment of the present invention, and the steps are as follows.

[0057] Step 500: The process starts.

[0058] Step 502: Set a waiting time in the interrupt aggregation mechanism, and set a timer inside the flash memory controller 100, wherein the timeout value of the timer is equal to the waiting time.

[0059] Step 504: Continue to receive and process commands from the master device 130, and update the values ​​of the SQ tail, SQ head, CQ tail, and CQ head.

[0060] Step 506: Determine whether the timer has expired. If so, the process proceeds to step 508; if not, the process returns to step 504.

[0061] Step 508 : Calculate the queue depth of a command queue of the master device 130 according to the SQ tail and the CQ head, and send an interrupt signal to the master device 130 .

[0062] Step 510: Reset the timer and the process returns to step 504.

[0063] It should be noted that Figure 5The process shown can be enabled / disabled by a setting. For example, when the memory device 100 is powered on, the flash memory controller 100 can execute Figure 5 The process shown is used to calculate the queue depth of a command queue of the host device 130, and then this function can be turned off to reduce power consumption.

[0064] In another embodiment, the step of calculating the queue depth of the command queue 191 described in the embodiments of FIGS. 2 to 4 above can be accomplished by setting a queue depth calculation circuit in the interface logic 118. Specifically, refer to Figure 6 FIG. 6 is a schematic diagram of a queue depth calculation circuit 600 according to an embodiment of the present invention. Figure 6 As shown, the queue depth calculation circuit 600 includes a subtractor 610, wherein the subtractor 610 subtracts the CQ head from the SQ tail to obtain the queue depth of the command queue 191 according to a trigger signal, wherein the trigger signal is generated when a timer reaches a timeout value, and the timeout value is equal to a waiting time of an interrupt aggregation mechanism.

[0065] In another embodiment of the present invention, Figure 7 As shown, the master device 130 may include a plurality of command queues 791_1-791_N and a corresponding plurality of submit queues 792_1-792_N and a plurality of completion queues 794_1-794_N, wherein each set of submit queues and completion queues has a corresponding SQ tail, SQ head, CQ tail, and CQ head. For example, the submit queue 792_1 and the completion queue 794_1 have a corresponding SQ tail #1, SQ head #1, CQ tail #1, and CQ head #1, the submit queue 792_2 and the completion queue 794_2 have a corresponding SQ tail #2, SQ head #2, CQ tail #2, and CQ head #2, and the submit queue 792_N and the completion queue 794_N have a corresponding SQ tail #N, SQ head #N, CQ tail #N, and CQ head #N. In one embodiment, the microprocessor 112 may calculate the queue depth of each command queue 791_1 - 791_N according to the embodiments of FIGS. 2 to 6 above.

[0066] In one embodiment, the microprocessor 112 may calculate the sum of the queue depths of the plurality of command queues 791_1 ˜ 791_N for subsequent management, or calculate the sum of the queue depths of the plurality of command queues 791_1 ˜ 791_N by configuring a queue depth calculation circuit in the interface logic 118 . Figure 8 FIG. 8 is a schematic diagram of a queue depth calculation circuit 800 according to an embodiment of the present invention. Figure 6As shown, the queue depth calculation circuit 600 includes a plurality of subtractors 810_1-810_N and an adder 820, wherein the subtractor 810_1 is used to subtract the CQ head #1 from the SQ tail #1 according to a trigger signal to obtain the queue depth QD#1 of the command queue 791_1, the subtractor 810_2 is used to subtract the CQ head #2 from the SQ tail #2 to obtain the queue depth QD#2 of the command queue 791_2, and the subtractor 810_N is used to subtract the CQ head #N from the SQ tail #N to obtain the queue depth QD#N of the command queue 791_N. In one embodiment, the trigger signal is generated when a timer reaches a timeout value, and the timeout value is equal to a waiting time of an interrupt aggregation mechanism. The adder 820 is used to sum the queue depths QD#1-QD#N of the command queues 791_1-791_N to obtain the sum of the queue depths of the command queues 791_1-791_N.

[0067] To briefly summarize the present invention, in the control method of the flash memory controller of the present invention, by setting an interrupt aggregation mechanism to extend the time of sending an interrupt signal to the main device, the flash memory controller can accurately calculate the queue depth of the command queue inside the main device according to the SQ tail and the CQ head, so as to provide relevant settings for performance optimization.

[0068] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.

Claims

1. A flash memory controller, wherein the flash memory controller is used to access a flash memory module, and the flash memory controller comprises: A read-only memory for storing a program code; a microprocessor, used to execute the program code to control access to the flash memory module; The microprocessor is used to perform the following steps: Setting a waiting time in an interrupt aggregation mechanism and setting a timer, wherein a timeout value of the timer is equal to the waiting time; receiving a plurality of commands from a submission queue in a master device, generating a plurality of command responses after processing the plurality of commands, and writing the plurality of command responses to a completion queue in the master device; receiving a submission queue tail and a completion queue head from the master device, wherein the submission queue tail indicates how many commands the master device has sent, and the completion queue head indicates how many command responses the master device has read from the completion queue; When the timer reaches the timeout value, subtracting the completion queue head from the submission queue tail to obtain a queue length of a command queue within the master device; and When the timer reaches the timeout value, an interrupt signal is sent to the master device, wherein the interrupt signal is used to trigger the master device to read the plurality of command responses from the completion queue.

2. The flash memory controller according to claim 1, wherein: The waiting time in the interrupt aggregation mechanism is greater than the time length for the microprocessor to complete executing multiple read commands or multiple write commands.

3. The flash memory controller according to claim 1, wherein: When the timer reaches the timeout value, the step of sending the interrupt signal to the master device comprises: When the timer reaches the timeout value, the interrupt signal is sent to the master device, wherein before the timer reaches the timeout value, no interrupt signal is sent to the master device.

4. The flash memory controller according to claim 1, wherein: When the timer reaches the timeout value, the step of subtracting the completion queue head from the submission queue tail to obtain the queue length of the command queue inside the master device comprises: When the timer reaches the timeout value, a queue depth calculation circuit is controlled to subtract the completion queue head from the submission queue tail to obtain the queue length of the command queue inside the master device.

5. The flash memory controller according to claim 1, wherein: The microprocessor is further configured to perform the following steps: The time for the microprocessor to send the interrupt signal to the main device when processing subsequent commands is controlled according to the calculated queue length of the command queue.

6. A control method of a flash memory controller, comprising: Setting a waiting time in an interrupt aggregation mechanism and setting a timer, wherein a timeout value of the timer is equal to the waiting time; receiving a plurality of commands from a submission queue in a master device, generating a plurality of command responses after processing the plurality of commands, and writing the plurality of command responses to a completion queue in the master device; receiving a submission queue tail and a completion queue head from the master device, wherein the submission queue tail indicates how many commands the master device has sent, and the completion queue head indicates how many command responses the master device has read from the completion queue; When the timer reaches the timeout value, subtracting the completion queue head from the submission queue tail to obtain a queue length of a command queue within the master device; and When the timer reaches the timeout value, an interrupt signal is sent to the master device, wherein the interrupt signal is used to trigger the master device to read the plurality of command responses from the completion queue.

7. The control method according to claim 6, characterized in that: The waiting time in the interrupt aggregation mechanism is greater than the time length for the flash memory controller to complete executing a plurality of read commands or a plurality of write commands.

8. The control method according to claim 6, characterized in that: When the timer reaches the timeout value, the step of sending the interrupt signal to the master device comprises: When the timer reaches the timeout value, the interrupt signal is sent to the master device, wherein before the timer reaches the timeout value, no interrupt signal is sent to the master device.

9. The control method according to claim 6, characterized in that: When the timer reaches the timeout value, the step of subtracting the completion queue head from the submission queue tail to obtain the queue length of the command queue inside the master device comprises: When the timer reaches the timeout value, a queue depth calculation circuit is controlled to subtract the completion queue head from the submission queue tail to obtain the queue length of the command queue inside the master device.

10. The control method according to claim 6, characterized in that: Also included: The time for the flash memory controller to send the interrupt signal to the host device when processing subsequent commands is controlled according to the calculated queue length of the command queue.