thread: ack msg_fd directly in intr_msg_proc

Although currently acking msg_fd inside function
msg_queue_run_batch() will also ack critical_msg's
notification, it is easier to understand the code
if moving acking msg_fd code into
thread_interrupt_msg_process().

Change-Id: I98267c5c28358334a2c1133e3dbc125788de77ab
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7265
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Liu Xiaodong 2021-04-07 10:29:49 -04:00 committed by Tomasz Zawadzki
parent 53429c7f44
commit 4e8032ab04

View File

@ -524,18 +524,6 @@ msg_queue_run_batch(struct spdk_thread *thread, uint32_t max_msgs)
} else {
max_msgs = SPDK_MSG_BATCH_SIZE;
}
if (spdk_unlikely(thread->in_interrupt)) {
assert(spdk_interrupt_mode_is_enabled());
/* There may be race between msg_acknowledge and another producer's msg_notify,
* so msg_acknowledge should be applied ahead. And then check for self's msg_notify.
* This can avoid msg notification missing.
*/
rc = read(thread->msg_fd, &notify, sizeof(notify));
if (rc < 0 && errno != EAGAIN) {
SPDK_ERRLOG("failed to acknowledge msg_queue: %s.\n", spdk_strerror(errno));
}
}
count = spdk_ring_dequeue(thread->messages, messages, max_msgs);
if (spdk_unlikely(thread->in_interrupt) &&
@ -1875,6 +1863,18 @@ thread_interrupt_msg_process(void *arg)
uint32_t msg_count;
spdk_msg_fn critical_msg;
int rc = 0;
uint64_t notify = 1;
assert(spdk_interrupt_mode_is_enabled());
/* There may be race between msg_acknowledge and another producer's msg_notify,
* so msg_acknowledge should be applied ahead. And then check for self's msg_notify.
* This can avoid msg notification missing.
*/
rc = read(thread->msg_fd, &notify, sizeof(notify));
if (rc < 0 && errno != EAGAIN) {
SPDK_ERRLOG("failed to acknowledge msg event: %s.\n", spdk_strerror(errno));
}
critical_msg = thread->critical_msg;
if (spdk_unlikely(critical_msg != NULL)) {