On 10/2/2018 9:34 PM, Ananyev, Konstantin wrote:
Hi Jeff,
Looks ok to me in general, just one thing I missed before:
+static void sigbus_handler(int signum, siginfo_t *info,
+ void *ctx __rte_unused)
+{
+ int ret;
+
+ RTE_LOG(INFO, EAL, "Thread[%d] catch SIGBUS, fault address:%p\n",
+ (int)pthread_self(), info->si_addr);
+
+ rte_spinlock_lock(&failure_handle_lock);
+ ret = rte_bus_sigbus_handler(info->si_addr);
+ rte_spinlock_unlock(&failure_handle_lock);
+ if (ret == -1) {
+ rte_exit(EXIT_FAILURE,
+ "Failed to handle SIGBUS for hot-unplug, "
+ "(rte_errno: %s)!", strerror(rte_errno));
+ } else if (ret == 1) {
+ if (sigbus_action_old.sa_handler)
+ (*(sigbus_action_old.sa_handler))(signum);
Shouldn't we check sigbus_action_old.sa_flags here,and based on that
invoke either sa_handler() or sa_sigaction()?
Konstantin
you are right here, konstantin.
We should not assume the old action should always be sa_handler. There
is a flags check missing here. Thanks.
+ else
+ rte_exit(EXIT_FAILURE,
+ "Failed to handle generic SIGBUS!");
+ }
+
+ RTE_LOG(INFO, EAL, "Success to handle SIGBUS for hot-unplug!\n");
+}