lib/event: do not set interrupt mode when eventfd is not supported

spdk_reactor_set_interrupt_mode() writes/reads from fds created during
reactor_interrupt_init(). Since spdk_fd_group_create() depends
on eventfd, this will not work for systems that do not have it.

reactor_interrupt_init() handled lack of support for eventfd correctly,
while spdk_reactor_set_interrupt_mode() did not check for it.

Reported-by: Nick Connolly <nick.connolly@mayadata.io>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I5181d436636c55cca3a06b1947e944502a9204ce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9131
Reviewed-by: Nick Connolly <nick.connolly@mayadata.io>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Tomasz Zawadzki 2021-08-09 11:12:04 -04:00
parent 4f99de088e
commit a7b15178c2
2 changed files with 11 additions and 2 deletions

View File

@ -429,6 +429,11 @@ spdk_reactor_set_interrupt_mode(uint32_t lcore, bool new_in_interrupt,
return -EINVAL;
}
/* Eventfd has to be supported in order to use interrupt functionality. */
if (target->fgrp == NULL) {
return -ENOTSUP;
}
if (spdk_get_thread() != _spdk_get_app_thread()) {
SPDK_ERRLOG("It is only permitted within spdk application thread.\n");
return -EPERM;

View File

@ -883,7 +883,9 @@ test_governor(void)
MOCK_SET(spdk_env_get_current_core, 0);
_reactors_scheduler_gather_metrics(NULL, NULL);
CU_ASSERT(_run_events_till_completion(2) == 6);
i = _run_events_till_completion(2);
/* Six runs when interrupt mode is supported, two if not. */
CU_ASSERT(i == 6 || i == 2);
MOCK_SET(spdk_env_get_current_core, 0);
/* Main core should be busy more than 50% time now - frequency should be raised */
@ -906,7 +908,9 @@ test_governor(void)
MOCK_SET(spdk_env_get_current_core, 0);
_reactors_scheduler_gather_metrics(NULL, NULL);
CU_ASSERT(_run_events_till_completion(2) == 6);
i = _run_events_till_completion(2);
/* Six runs when interrupt mode is supported, two if not. */
CU_ASSERT(i == 6 || i == 2);
MOCK_SET(spdk_env_get_current_core, 0);
for (i = 0; i < 2; i++) {