Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add mailbox_res_record to mailbox_channel. Maybe it will be good that res record can also do some statistics work for helping debugging/analyzing, etc.. So, this is a good move.
Move mailbox_rx_worker to before mailbox_irq_handler better readability
In mailbox_irq_handler(), we aware that the clear iohub might race with set iohub from FW side. So that the iohub register is not able to trigger MSI-X interrupt. This leads to the application hangs.
The idea is to fix this in host. In mailbox_irq_handler(), after clear iohub and launch worker, it keeps reading iohub for up to 4 times.
If all these read are 0, this means there is no race during this period. Then the handler can exit safely.
If any of the read is 1, this means FW want to trigger interrupt. The handler will clear iohub again and enqueue another work. This is not the perfect solution in theory. But based on the fact that handler is running very fast, and the FW to trigger next interrupt is slower. This change looks like very promising.
In my stress test, which disabled TDR in the driver, it can run overnight without issue. Without this change, my test will hang in less than half hour.