Commit ebef8ea2 authored by Johannes Berg's avatar Johannes Berg Committed by Richard Weinberger
Browse files

um: time-travel: Fix IRQ handling in time_travel_handle_message()



As the comment here indicates, we need to do the polling in the
idle loop without blocking interrupts, since interrupts can be
vhost-user messages that we must process even while in our idle
loop.

I don't know why I explained one thing and implemented another,
but we have indeed observed random hangs due to this, depending
on the timing of the messages.

Fixes: 88ce6424 ("um: Implement time-travel=ext")
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Acked-By: default avatarAnton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 730586ff
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -70,13 +70,17 @@ static void time_travel_handle_message(struct um_timetravel_msg *msg,
	 * read of the message and write of the ACK.
	 */
	if (mode != TTMH_READ) {
		while (os_poll(1, &time_travel_ext_fd) != 0) {
			if (mode == TTMH_IDLE) {
				BUG_ON(!irqs_disabled());
		bool disabled = irqs_disabled();

		BUG_ON(mode == TTMH_IDLE && !disabled);

		if (disabled)
			local_irq_enable();
				local_irq_disable();
			}
		while (os_poll(1, &time_travel_ext_fd) != 0) {
			/* nothing */
		}
		if (disabled)
			local_irq_disable();
	}

	ret = os_read_file(time_travel_ext_fd, msg, sizeof(*msg));