diff --git a/lib/event/reactor.c b/lib/event/reactor.c index dd367fdae..1dc025a11 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -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; diff --git a/test/unit/lib/event/reactor.c/reactor_ut.c b/test/unit/lib/event/reactor.c/reactor_ut.c index 8f4baf0e5..5447ab37a 100644 --- a/test/unit/lib/event/reactor.c/reactor_ut.c +++ b/test/unit/lib/event/reactor.c/reactor_ut.c @@ -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++) {