Skip to content

Commit ebef8ea

Browse files
jmberg-intelrichardweinberger
authored andcommitted
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: 88ce642 ("um: Implement time-travel=ext") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 730586f commit ebef8ea

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎arch/um/kernel/time.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,17 @@ static void time_travel_handle_message(struct um_timetravel_msg *msg,
7070
* read of the message and write of the ACK.
7171
*/
7272
if (mode != TTMH_READ) {
73+
bool disabled = irqs_disabled();
74+
75+
BUG_ON(mode == TTMH_IDLE && !disabled);
76+
77+
if (disabled)
78+
local_irq_enable();
7379
while (os_poll(1, &time_travel_ext_fd) != 0) {
74-
if (mode == TTMH_IDLE) {
75-
BUG_ON(!irqs_disabled());
76-
local_irq_enable();
77-
local_irq_disable();
78-
}
80+
/* nothing */
7981
}
82+
if (disabled)
83+
local_irq_disable();
8084
}
8185

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

0 commit comments

Comments
 (0)