Skip to contentSkip to conversation

um: time-travel=ext fixes

PATCH Superseded Johannes Berg 1 participant 3 messages Sep 10, 2020 User-mode Linux (UML)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/2 um: time-travel: fix IRQ handling in time_travel_handle_message()

From: Johannes Berg <[email protected]>

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 88ce64249233 ("um: Implement time-travel=ext")
Change-Id Ic74385f3d36466cc01cc8487fc54affe0fdf7f26
---
 arch/um/kernel/time.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
arch/um/kernel/time.c +9 -5
index 25eaa6a0c658..c07436e89e59 100644
@@ -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) {
+		bool disabled = irqs_disabled();
+
+		BUG_ON(mode == TTMH_IDLE && !disabled);
+
+		if (disabled)
+			local_irq_enable();
 		while (os_poll(1, &time_travel_ext_fd) != 0) {
-			if (mode == TTMH_IDLE) {
-				BUG_ON(!irqs_disabled());
-				local_irq_enable();
-				local_irq_disable();
-			}
+			/* nothing */
 		}
+		if (disabled)
+			local_irq_disable();
 	}
 
 	ret = os_read_file(time_travel_ext_fd, msg, sizeof(*msg));
Signature · 7 lines
2.26.2


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um
author maintainer
#2 lore raw

PATCH 2/2 um: time-travel: return the sequence number in ACK messages

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

For external time travel, the protocol says to return the incoming sequence number in the ACK message to aid debugging, so do that.

Change-Id Ib2bcca1371247b2f8643f35fb85ca5051addd8cc
---
 arch/um/kernel/time.c | 1 +
 1 file changed, 1 insertion(+)
arch/um/kernel/time.c +1 -0
index c07436e89e59..3d109ff3309b 100644
@@ -106,6 +106,7 @@ static void time_travel_handle_message(struct um_timetravel_msg *msg,
 		break;
 	}
 
+	resp.seq = msg->seq;
 	os_write_file(time_travel_ext_fd, &resp, sizeof(resp));
 }
 
Signature · 7 lines
2.26.2


_______________________________________________
linux-um mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-um